Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides base data definitions and functions for Haspara
library.
Synopsis
- data FXQuote (s :: Nat)
- fxQuoteDate :: FXQuote s -> Date
- fxQuotePair :: FXQuote s -> CurrencyPair
- fxQuoteRate :: FXQuote s -> Refined Positive (Quantity s)
- fxquote :: (KnownNat s, MonadError String m) => Date -> Currency -> Currency -> Scientific -> m (FXQuote s)
- fxquoteFail :: (KnownNat s, MonadFail m) => Date -> Currency -> Currency -> Scientific -> m (FXQuote s)
- type FXQuoteDatabase (n :: Nat) = HashMap CurrencyPair (FXQuotePairDatabase n)
- data FXQuotePairDatabase (n :: Nat) = FXQuotePairDatabase {}
- findFXQuote :: KnownNat n => FXQuoteDatabase n -> CurrencyPair -> Date -> Maybe (FXQuote n)
FX Quote
Data Definition
data FXQuote (s :: Nat) Source #
Type encoding for FX rates.
Instances
Eq (FXQuote s) Source # | |
Ord (FXQuote s) Source # | |
Defined in Haspara.Internal.FXQuote | |
KnownNat s => Show (FXQuote s) Source # | |
KnownNat s => ToJSON (FXQuote s) Source # |
|
Defined in Haspara.Internal.FXQuote | |
KnownNat s => FromJSON (FXQuote s) Source # |
|
fxQuoteDate :: FXQuote s -> Date Source #
Actual date of the FX rate.
fxQuotePair :: FXQuote s -> CurrencyPair Source #
Currency pair of the FX rate.
Constructors
:: (KnownNat s, MonadError String m) | |
=> Date | Date of the FX rate. |
-> Currency | First currency (from) of the FX rate. |
-> Currency | Second currency (to) of the FX rate. |
-> Scientific | FX rate value. |
-> m (FXQuote s) |
Smart constructor for FXQuote
values within MonadError
context.
FX Quote Database
fxquoteDatabase
type FXQuoteDatabase (n :: Nat) = HashMap CurrencyPair (FXQuotePairDatabase n) Source #
data FXQuotePairDatabase (n :: Nat) Source #
findFXQuote :: KnownNat n => FXQuoteDatabase n -> CurrencyPair -> Date -> Maybe (FXQuote n) Source #