ContingentClaims.Core.Observation¶
Data Types¶
data Observation t x o
Implementation of market observables. Conceptually it is helpful to think of this as the type
t -> x
, ort -> Update x
.A numerical constant, e.g.
10.0
.
Field Type Description value x A named parameter, e.g. "LIBOR 3M".
Field Type Description key o A named parameter, e.g. "LIBOR 3M", observed at an explicit point in time.
Field Type Description key o t t Add (Observation t x o, Observation t x o)
Sum of two observations.Neg (Observation t x o)
Opposite of an observation.Mul (Observation t x o, Observation t x o)
Product of two observations.Div (Observation t x o, Observation t x o)
Division of two observations.instance Corecursive (Observation t x o) (ObservationF t x o)
instance Recursive (Observation t x o) (ObservationF t x o)
instance Functor (Observation t x)
instance (Eq x, Eq o, Eq t) => Eq (Observation t x o)
instance Additive x => Additive (Observation t x o)
instance Multiplicative x => Divisible (Observation t x o)
instance Multiplicative x => Multiplicative (Observation t x o)
instance (Additive x, Multiplicative x) => Number (Observation t x o)
instance (Show t, Show x, Show o) => Show (Observation t x o)
Functions¶
- pure
: x -> Observation t x o
Smart constructor for
Const
. Lifts a constant to an observation.
- observe
: o -> Observation t x o
Smart constructor for
Observe
. Looks up the value ofo
.
- eval
: (Ord t, Number x, Divisible x, CanAbort m) => (o -> t -> m x) -> Observation t x o -> t -> m x
Reify the
Observation
into an observation function. This function is used to convert an abstract observation, e.g.LIBOR 3M + 0.005
to the actual observation functiont -> m x
.
- mapParams
: (i -> t) -> (o -> o’) -> (x -> x’) -> Observation i x o -> Observation t x’ o’
The functor map operation and also map any parameters to keys. For example, could map the param "spot" to an ISIN code "GB123456789". Also contra-maps time parameter, i.e. from relative time values to absolute ones.
@ mapParams identity = bimap