QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
exchange rate between two currencies More...
#include <exchangerate.hpp>
Public Types | |
enum | Type { Direct , Derived } |
Public Member Functions | |
Constructors | |
ExchangeRate () | |
ExchangeRate (Currency source, Currency target, Decimal rate) | |
Inspectors | |
const Currency & | source () const |
the source currency. More... | |
const Currency & | target () const |
the target currency. More... | |
Type | type () const |
the type More... | |
Decimal | rate () const |
the exchange rate (when available) More... | |
Utility methods | |
Currency | source_ |
Currency | target_ |
Decimal | rate_ |
Type | type_ |
std::pair< ext::shared_ptr< ExchangeRate >, ext::shared_ptr< ExchangeRate > > | rateChain_ |
Money | exchange (const Money &amount) const |
apply the exchange rate to a cash amount More... | |
static ExchangeRate | chain (const ExchangeRate &r1, const ExchangeRate &r2) |
chain two exchange rates More... | |
exchange rate between two currencies
Definition at line 38 of file exchangerate.hpp.
enum Type |
Enumerator | |
---|---|
Direct | given directly by the user |
Derived | derived from exchange rates between other currencies |
Definition at line 40 of file exchangerate.hpp.
ExchangeRate | ( | ) |
Definition at line 84 of file exchangerate.hpp.
ExchangeRate | ( | Currency | source, |
Currency | target, | ||
Decimal | rate | ||
) |
the rate \( r \) is given with the convention that a unit of the source is worth \( r \) units of the target.
Definition at line 86 of file exchangerate.hpp.
const Currency & source | ( | ) | const |
the source currency.
Definition at line 89 of file exchangerate.hpp.
const Currency & target | ( | ) | const |
the target currency.
Definition at line 93 of file exchangerate.hpp.
ExchangeRate::Type type | ( | ) | const |
the type
Definition at line 97 of file exchangerate.hpp.
Decimal rate | ( | ) | const |
the exchange rate (when available)
Definition at line 101 of file exchangerate.hpp.
apply the exchange rate to a cash amount
Definition at line 25 of file exchangerate.cpp.
|
static |
chain two exchange rates
Definition at line 50 of file exchangerate.cpp.
|
private |
Definition at line 74 of file exchangerate.hpp.
|
private |
Definition at line 74 of file exchangerate.hpp.
|
private |
Definition at line 75 of file exchangerate.hpp.
|
private |
Definition at line 76 of file exchangerate.hpp.
|
private |
Definition at line 78 of file exchangerate.hpp.