Module ContingentClaims.Core.Internal.Claim¶
Data Types¶
data Claim t x a o
Core data type used to model cashflows of instruments. Check out the Daml Finance documentation(https://digital-asset.github.io/daml-finance/concepts/contingent-claims.html) for a detailed explanation. In the reference paper from Peyton-Jones this is called ‘Contract’. We renamed it to avoid ambiguity.
t
andx
respectively correspond to theObservation
input type and the resulting output type. An observation is a function fromt
tox
. A common choice is to useTime
andDecimal
, respectively.a
is the representation of an asset, e.g. aText
ISIN code.o
is the representation of an observable, e.g. aText
.You should build the
Claim
using the smart constructors (e.g.zero
,and
) instead of using the data constructors directly (Zero
,And
).Represents an absence of claims. MonoidAnd
identity.One a
The bearer acquires one unit ofa
immediately.The obligations of the bearer and issuer are reversed.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 Multiplies the
claim
byk
(which can be non-deterministic).
Field Type Description k Observation t x o claim Claim t x a o Defers the acquisition of
claim
until the first instant thatpredicate
is true.
Field Type Description predicate Inequality t x o claim Claim t x a o Like
When
, but valid any time the predicate is true (not just infinium).
Field Type Description predicate Inequality t x o claim Claim t x a o 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)
data Inequality t x o
Data type for boolean predicates supported by the library. A boolean predicate is a generic function with signature
t -> x -> Bool
. However, a lmited set of predicates is currently supported.TimeGte t
True
whentime ≥ t
,False
otherwise.TimeLte t
True
whentime ≤ t
,False
otherwise.Lte (Observation t x o, Observation t x o)
True
wheno(t, x) ≤ o'(t, x)
,False
otherwise for a pair of observationso
,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)