hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.Currency

Synopsis

Types

Currencies

data Currency Source #

Instances

Instances details
Show Currency Source # 
Instance details

Defined in QuantLib.Internal.Type

Eq Currency Source # 
Instance details

Defined in QuantLib.Internal.Type

data Ccy Source #

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 

Instances

Instances details
Bounded Ccy Source # 
Instance details

Defined in QuantLib.Currency

Methods

minBound :: Ccy #

maxBound :: Ccy #

Enum Ccy Source # 
Instance details

Defined in QuantLib.Currency

Methods

succ :: Ccy -> Ccy #

pred :: Ccy -> Ccy #

toEnum :: Int -> Ccy #

fromEnum :: Ccy -> Int #

enumFrom :: Ccy -> [Ccy] #

enumFromThen :: Ccy -> Ccy -> [Ccy] #

enumFromTo :: Ccy -> Ccy -> [Ccy] #

enumFromThenTo :: Ccy -> Ccy -> Ccy -> [Ccy] #

Read Ccy Source # 
Instance details

Defined in QuantLib.Currency

Show Ccy Source # 
Instance details

Defined in QuantLib.Currency

Methods

showsPrec :: Int -> Ccy -> ShowS #

show :: Ccy -> String #

showList :: [Ccy] -> ShowS #

Eq Ccy Source # 
Instance details

Defined in QuantLib.Currency

Methods

(==) :: Ccy -> Ccy -> Bool #

(/=) :: Ccy -> Ccy -> Bool #

Exchange rates and money

Constructors

Currencies

currency :: Ccy -> IO Currency Source #

Look up one of the built-in ISO 4217 currencies by its enum tag.

customCurrency Source #

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

exchangeRate Source #

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 #

Register an exchange rate with the global exchange-rate repository, valid between the given dates (inclusive). Use minDate/maxDate for an always-valid rate.

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

exchange Source #

Arguments

:: ExchangeRate 
-> (Double, Currency)

amount

-> IO (Double, Currency) 

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 #

Arguments

:: (Double, Currency)

amount

-> IO (Double, Currency) 

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

code :: Currency -> String Source #

The currency's ISO 4217 three-letter code, e.g. "USD".

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.

symbol :: Currency -> String Source #

The currency's symbol, e.g. "$".

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.