Module ContingentClaims.Core.Observation

Data Types

data Observation t x o

Concrete implementation of Observable, which can be serialized. Conceptually it is helpful to think of this as the type t -> x, or t -> Update x.

Const

A numerical constant, e.g. 10.0.

Field Type Description
value x  

Observe

A named parameter, e.g. "LIBOR 3M".

Field Type Description
key o  

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 (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)

type T

= Observation

Type synonym for Observation.

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 of o.

eval

: (Number x, Divisible x, Action 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 function t -> m x. The function is only total when the first argument is too (typically it will fail on t > today).

mapParams

: (t -> i) -> (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