org.jquantlib.currencies
Class ExchangeRate
- java.lang.Object
-
- org.jquantlib.currencies.ExchangeRate
-
public class ExchangeRate extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classExchangeRate.Type
-
Field Summary
Fields Modifier and Type Field and Description Pair<ExchangeRate,ExchangeRate>rateChain_The pair of chained ExchangeRates.
-
Constructor Summary
Constructors Constructor and Description ExchangeRate()Creates a new ExchangeRate instance.ExchangeRate(Currency source, Currency target, double rate)Creates a new ExchangeRate instanceExchangeRate(ExchangeRate toCopy)Creates clone of an existing ExchangeRate instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static ExchangeRatechain(ExchangeRate r1, ExchangeRate r2)Returns a new ExchangeRate with a initialized ratechain.Moneyexchange(Money amount)Apply this ExchangeRate an amount of cash.doublerate()Currencysource()Currencytarget()ExchangeRate.Typetype()
-
-
-
Field Detail
-
rateChain_
public Pair<ExchangeRate,ExchangeRate> rateChain_
The pair of chained ExchangeRates.
-
-
Constructor Detail
-
ExchangeRate
public ExchangeRate()
Creates a new ExchangeRate instance.
-
ExchangeRate
public ExchangeRate(ExchangeRate toCopy)
Creates clone of an existing ExchangeRate instance.- Parameters:
toCopy- the ExchangeRate to be cloned.
-
-
Method Detail
-
source
public Currency source()
-
target
public Currency target()
-
type
public ExchangeRate.Type type()
-
rate
public double rate()
-
exchange
public Money exchange(Money amount)
Apply this ExchangeRate an amount of cash. A new money instance will be returned. The input remains unchanged.- Parameters:
amount- The money instance the exchange rate should be applied to. Money- Returns:
- A new money instance where this ExchangeRate has been applied to. Money
-
chain
public static ExchangeRate chain(ExchangeRate r1, ExchangeRate r2)
Returns a new ExchangeRate with a initialized ratechain. The ratechain will be initialized by copies of r1 and r1.- Parameters:
r1- The first ExchangeRate to be used in the ratechain ExchangeRater2- The second ExchangeRate to be used inthe ratechain ExchangeRate- Returns:
- A new ExchangeRate
-
-
DataMelt 3.0 © DataMelt by jWork.ORG