ContingentClaims.Core.Internal.Claim

Data Types

data Claim t x a o

Core data type used to model cashflows of instruments. In the reference paper from Peyton-Jones this is called ‘Contract’. We renamed it to avoid ambiguity.

  • t corresponds to the time parameter.
  • x corresponds to the Observation output type. An observation is a function from t to x. A common choice is to use Time and Decimal, respectively.
  • a is the representation of a deliverable asset, e.g. a Text ISIN code or an InstrumentKey.
  • o is the representation of an observable, e.g. a Text.

You should build the Claim using the smart constructors (e.g. zero, and) instead of using the data constructors directly (Zero, And).

Zero

Represents an absence of claims. Monoid And identity.

One a

The bearer acquires one unit of a immediately.

Give (Claim t x a o)

The obligations of the bearer and the counterparty are reversed.

And

Used to combine multiple rights together.

Field Type Description
a1 Claim t x a o  
a2 Claim t x a o  
as [Claim t x a o]  

Or

Gives the bearer the right to choose between several claims.

Field Type Description
or1 Electable t x a o  
or2 Electable t x a o  
ors [Electable t x a o]  

Cond

Gives the bearer the right to the first claim if predicate is true, else the second claim.

Field Type Description
predicate Inequality t x o  
success Claim t x a o  
failure Claim t x a o  

Scale

Multiplies the claim by k (which can be non-deterministic).

Field Type Description
k Observation t x o  
claim Claim t x a o  

When

Defers the acquisition of claim until the first instant that predicate is true.

Field Type Description
predicate Inequality t x o  
claim Claim t x a o  

Anytime

Gives the bearer the right to enter a claim at any time the predicate is true.

Field Type Description
predicate Inequality t x o  
electable Electable t x a o  

Until

Expires said claim on the first instant that predicate is true.

Field Type Description
predicate Inequality t x o  
claim Claim t x a o  

instance Corecursive (Claim t x a o) (ClaimF t x a o)

instance Recursive (Claim t x a o) (ClaimF t x a o)

instance (Eq a, Eq x, Eq o, Eq t) => Eq (Claim t x a o)

instance (Show t, Show x, Show a, Show o) => Show (Claim t x a o)

instance Monoid (Claim t x a o)

instance Semigroup (Claim t x a o)

type Electable t x a o

= (Text, Claim t x a o)

Type synonym for sub-trees that can be elected in an Or or Anytime node. The textual tag is used to identify each sub-tree when an election is made.

data Inequality t x o

Data type for boolean predicates supported by the library. A boolean predicate is a generic function with signature t -> Bool. However, a limited set of predicates is currently supported.

TimeGte t

True when time t, False otherwise.

TimeLte t

True when time t, False otherwise.

Lte (Observation t x o, Observation t x o)

True when o(t) o'(t), False otherwise, for a pair of observations o, o'.

instance (Eq t, Eq x, Eq o) => Eq (Inequality t x o)

instance (Show t, Show x, Show o) => Show (Inequality t x o)