Constructor and Description |
---|
FxRateImpl(CurrencyPair currencyPair,
String crossCcy,
boolean marketConvention,
BigDecimal bid,
BigDecimal ask,
CurrencyProvider currencyProvider) |
Modifier and Type | Method and Description |
---|---|
CurrencyAmount |
convertAmountUsingBidOrAsk(CurrencyAmount originalAmount)
Given a monetary amount in the original currency, calculate the resulting amount in the other currency, using BID or ASK
depending on the originalAmount.currency.
|
CurrencyAmount |
convertAmountUsingMid(CurrencyAmount originalAmount)
Given a monetary amount in the original currency, calculate the resulting amount in the other currency, using MID rate.
|
FxRate |
createInverse()
Create the FX Rate for ccy2 / ccy1, return a new FxRate; the inverse of bid / ask are swapped around.
|
FxRate |
createInverse(int precision)
Create the FX Rate for ccy2 / ccy1, return a new FxRate with given precision; the inverse of bid / ask are swapped around.
|
BigDecimal |
getAsk()
The price at which the 'quoter' is willing to buy ccy1 and sell ccy2.
|
BigDecimal |
getAskInMarketConvention()
Useful for human readable display, returns the same value as Ask if FxRate is in market convention otherwise 1/bid.
|
BigDecimal |
getBid()
The price at which the 'quoter' is willing to sell ccy1 and buy ccy2.
|
BigDecimal |
getBidInMarketConvention()
Useful for human readable display, returns the same value as Bid if FxRate is in market convention otherwise 1/ask.
|
Optional<String> |
getCrossCcy()
This FxRate might come from a combination of 2 rates through a cross currency, if it is the case,
return the cross currency.
|
CurrencyPair |
getCurrencyPair()
The CurrencyPair as in Ccy1/Ccy2 where the Bid will be the price for selling ccy1 and buying ccy2.
|
String |
getDescription()
Nice human readable description of the FX Rate, useful reminder.
|
BigDecimal |
getMid()
Mid = (bid + ask) / 2
|
BigDecimal |
getMidInMarketConvention()
Mid = (bid + ask) / 2
|
CurrencyAmount |
getPaymentAmountForBuying(CurrencyAmount amountToBuy)
Calculates the amount to pay given an amount to buy, e.g.
|
CurrencyAmount |
getReceiptAmountForSelling(CurrencyAmount amountToSell)
Calculates the amount the seller would receive given an amount to sell, e.g.
|
boolean |
isMarketConvention()
true if the CurrencyPair follows market convention, e.g.
|
String |
toString() |
public FxRateImpl(CurrencyPair currencyPair, String crossCcy, boolean marketConvention, BigDecimal bid, BigDecimal ask, CurrencyProvider currencyProvider)
public String getDescription()
CAD.SGD Mkt Convention:true Quoter buys CAD and sells SGD at 1.1279 Quoter sells CAD and buys SGD at 1.1289
getDescription
in interface FxRate
public FxRate createInverse()
FxRate
createInverse
in interface FxRate
public FxRate createInverse(int precision)
FxRate
createInverse
in interface FxRate
public BigDecimal getBid()
FxRate
public BigDecimal getAsk()
FxRate
public CurrencyPair getCurrencyPair()
FxRate
getCurrencyPair
in interface FxRate
public Optional<String> getCrossCcy()
FxRate
getCrossCcy
in interface FxRate
public boolean isMarketConvention()
FxRate
isMarketConvention
in interface FxRate
public BigDecimal getMid()
FxRate
public BigDecimal getBidInMarketConvention()
FxRate
getBidInMarketConvention
in interface FxRate
public BigDecimal getMidInMarketConvention()
FxRate
getMidInMarketConvention
in interface FxRate
public BigDecimal getAskInMarketConvention()
FxRate
getAskInMarketConvention
in interface FxRate
public CurrencyAmount convertAmountUsingMid(CurrencyAmount originalAmount)
FxRate
convertAmountUsingMid
in interface FxRate
originalAmount
- the monetary amount (currency + amount)public CurrencyAmount convertAmountUsingBidOrAsk(CurrencyAmount originalAmount)
FxRate
convertAmountUsingBidOrAsk
in interface FxRate
originalAmount
- the monetary amount (currency + amount)public CurrencyAmount getPaymentAmountForBuying(CurrencyAmount amountToBuy)
getPaymentAmountForBuying
in interface FxRate
amountToBuy
- amount you want to buy.public CurrencyAmount getReceiptAmountForSelling(CurrencyAmount amountToSell)
getReceiptAmountForSelling
in interface FxRate
amountToSell
- amount you want to sell.Copyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.