| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
QuantLib.Currency
Synopsis
- data Currency
- data Ccy
- = ARS
- | ATS
- | AUD
- | BCH
- | BDT
- | BEF
- | BGL
- | BRL
- | BTC
- | BYR
- | CAD
- | CHF
- | CLP
- | CNY
- | COP
- | CYP
- | CZK
- | DASH
- | DEM
- | DKK
- | EEK
- | ESP
- | ETC
- | ETH
- | EUR
- | FIM
- | FRF
- | GBP
- | GRD
- | HKD
- | HUF
- | IDR
- | IEP
- | ILS
- | INR
- | IQD
- | IRR
- | ISK
- | ITL
- | JPY
- | KRW
- | KWD
- | KZT
- | LTC
- | LTL
- | LUF
- | LVL
- | MTL
- | MXN
- | MYR
- | NGN
- | NLG
- | NOK
- | NPR
- | NZD
- | PEH
- | PEI
- | PEN
- | PKR
- | PLN
- | PTE
- | ROL
- | RON
- | RUB
- | SAR
- | SEK
- | SGD
- | SIT
- | SKK
- | THB
- | TRL
- | TRY
- | TTD
- | TWD
- | UAH
- | USD
- | VEB
- | VND
- | XRP
- | ZAR
- | ZEC
- | AED
- | AOA
- | BGN
- | BHD
- | BWP
- | CLF
- | CNH
- | COU
- | EGP
- | ETB
- | GEL
- | GHS
- | HRK
- | JOD
- | KES
- | LKR
- | MAD
- | MKD
- | MUR
- | MXV
- | OMR
- | PHP
- | QAR
- | RSD
- | TND
- | UGX
- | UYU
- | UZS
- | XOF
- | ZMW
- data ExchangeRate
- data ExchangeRateType
- data MoneyConversionType
- currency :: Ccy -> IO Currency
- customCurrency :: String -> String -> Int -> String -> String -> Int -> Maybe Rounding -> Maybe Currency -> IO Currency
- exchangeRate :: Currency -> Currency -> Double -> IO ExchangeRate
- chainExchangeRate :: ExchangeRate -> ExchangeRate -> IO ExchangeRate
- addExchangeRate :: ExchangeRate -> Day -> Day -> IO ()
- clearExchangeRates :: IO ()
- setMoneyConversionType :: MoneyConversionType -> IO ()
- setMoneyBaseCurrency :: Currency -> IO ()
- exchange :: ExchangeRate -> (Double, Currency) -> IO (Double, Currency)
- convertToBaseCurrency :: (Double, Currency) -> IO (Double, Currency)
- code :: Currency -> String
- fractionsPerUnit :: Currency -> Int
- fractionSymbol :: Currency -> String
- numericCode :: Currency -> Int
- symbol :: Currency -> String
- rate :: ExchangeRate -> IO Double
- exchangeRateType :: ExchangeRate -> IO ExchangeRateType
- lookupExchangeRate :: Currency -> Currency -> Maybe Day -> ExchangeRateType -> IO ExchangeRate
- moneyConversionType :: IO MoneyConversionType
- moneyBaseCurrency :: IO (Maybe Currency)
Types
Currencies
Constructors
| ARS | |
| ATS | |
| AUD | |
| BCH | |
| BDT | |
| BEF | |
| BGL | |
| BRL | |
| BTC | |
| BYR | |
| CAD | |
| CHF | |
| CLP | |
| CNY | |
| COP | |
| CYP | |
| CZK | |
| DASH | |
| DEM | |
| DKK | |
| EEK | |
| ESP | |
| ETC | |
| ETH | |
| EUR | |
| FIM | |
| FRF | |
| GBP | |
| GRD | |
| HKD | |
| HUF | |
| IDR | |
| IEP | |
| ILS | |
| INR | |
| IQD | |
| IRR | |
| ISK | |
| ITL | |
| JPY | |
| KRW | |
| KWD | |
| KZT | |
| LTC | |
| LTL | |
| LUF | |
| LVL | |
| MTL | |
| MXN | |
| MYR | |
| NGN | |
| NLG | |
| NOK | |
| NPR | |
| NZD | |
| PEH | |
| PEI | |
| PEN | |
| PKR | |
| PLN | |
| PTE | |
| ROL | |
| RON | |
| RUB | |
| SAR | |
| SEK | |
| SGD | |
| SIT | |
| SKK | |
| THB | |
| TRL | |
| TRY | |
| TTD | |
| TWD | |
| UAH | |
| USD | |
| VEB | |
| VND | |
| XRP | |
| ZAR | |
| ZEC | |
| AED | |
| AOA | |
| BGN | |
| BHD | |
| BWP | |
| CLF | |
| CNH | |
| COU | |
| EGP | |
| ETB | |
| GEL | |
| GHS | |
| HRK | |
| JOD | |
| KES | |
| LKR | |
| MAD | |
| MKD | |
| MUR | |
| MXV | |
| OMR | |
| PHP | |
| QAR | |
| RSD | |
| TND | |
| UGX | |
| UYU | |
| UZS | |
| XOF | |
| ZMW |
Exchange rates and money
data ExchangeRate Source #
data ExchangeRateType Source #
Instances
data MoneyConversionType Source #
Constructors
| NoConversion | |
| BaseCurrencyConversion | |
| AutomatedConversion |
Instances
Constructors
Currencies
currency :: Ccy -> IO Currency Source #
Look up one of the built-in ISO 4217 currencies by its enum tag.
Arguments
| :: String | name |
| -> String | code |
| -> Int | numericCode |
| -> String | symbol |
| -> String | fractionSymbol |
| -> Int | fractionsPerUnit |
| -> Maybe Rounding | |
| -> Maybe Currency | triangulationCurrency |
| -> IO Currency |
Construct a custom currency from its name, codes, symbols, rounding convention and an optional triangulation currency used for indirect exchange.
Exchange rates
Arguments
| :: Currency | source |
| -> Currency | target |
| -> Double | rate |
| -> IO ExchangeRate |
Construct a Direct exchange rate: a unit of source is worth rate units of target.
chainExchangeRate :: ExchangeRate -> ExchangeRate -> IO ExchangeRate Source #
Combine two exchange rates sharing a common currency into a derived rate between their other two currencies. Throws if the rates don't share a common currency.
Mutators
addExchangeRate :: ExchangeRate -> Day -> Day -> IO () Source #
clearExchangeRates :: IO () Source #
Reset the exchange-rate repository back to its built-in set of known historical rates,
discarding anything added via addExchangeRate.
setMoneyConversionType :: MoneyConversionType -> IO () Source #
Set the global Money arithmetic conversion setting.
setMoneyBaseCurrency :: Currency -> IO () Source #
Set the global base currency used by MoneyConversionType base-currency conversion.
Inspectors
Currency conversion
Apply an exchange rate to a cash amount (a (Double, Currency) pair, standing in for
QuantLib's Money), returning the converted amount as a pair in the other currency of the
rate. Throws if the given currency is on neither side of the rate.
convertToBaseCurrency Source #
Convert a cash amount to the configured base currency (via setMoneyBaseCurrency), using
lookupExchangeRate and rounding the result per the target currency's convention. Throws if
no base currency is set or no rate path exists.
Currencies
fractionsPerUnit :: Currency -> Int Source #
The number of fractional units (e.g. cents) in one unit of the currency.
fractionSymbol :: Currency -> String Source #
The currency's fractional-unit symbol, e.g. "¢".
numericCode :: Currency -> Int Source #
The currency's ISO 4217 numeric code, e.g. 840 for USD.
Exchange rates and settings
rate :: ExchangeRate -> IO Double Source #
The rate itself: a unit of the source currency is worth this many units of the target.
exchangeRateType :: ExchangeRate -> IO ExchangeRateType Source #
Whether the rate was given directly or derived by chaining two other rates.
lookupExchangeRate :: Currency -> Currency -> Maybe Day -> ExchangeRateType -> IO ExchangeRate Source #
Look up a (possibly derived) exchange rate between two currencies at a given date (or the
current evaluation date if Nothing). Throws if no rate can be found. Pre-populated with a
set of known historical rates even before any addExchangeRate call.
moneyConversionType :: IO MoneyConversionType Source #
The global Money arithmetic setting controlling how amounts in different currencies are
combined (no conversion, convert to the base currency, or convert automatically).
moneyBaseCurrency :: IO (Maybe Currency) Source #
The global base currency used by MoneyConversionType base-currency conversion, if set.