Module ContingentClaims.Valuation.Stochastic

Typeclasses

class IsIdentifier t where

localVar

: Int -> t

Produce a local identifier of type t, subindexed by i.

Data Types

data Expr t

Represents an expression of t-adapted stochastic processes.

Const Decimal

Ident t

Proc

Field Type Description
name Text  
process Process t  
filtration t  

Sup

Field Type Description
lowerBound t  
tau t  
rv Expr t  

Sum [Expr t]

Neg (Expr t)

Mul (Expr t, Expr t)

Pow (Expr t, Expr t)

I (Expr t, Expr t)

E

Field Type Description
rv Expr t  
filtration t  

instance ToXml t => ToXml (Expr t)

instance Corecursive (Expr t) (ExprF t)

instance Recursive (Expr t) (ExprF t)

instance Eq t => Eq (Expr t)

instance Show t => Show (Expr t)

data ExprF t x

Base functor for Expr. Note that this is ADT is re-used in a couple of places, e.g., Process, where however not every choice is legal and will lead to a partial evaluator.

ConstF Decimal

IdentF t

ProcF

Field Type Description
name Text  
process Process t  
filtration t  

SupF

Field Type Description
lowerBound t  
tau t  
rv x  

SumF [x]

NegF x

MulF

Field Type Description
lhs x  
rhs x  

PowF

Field Type Description
lhs x  
rhs x  

I_F

Field Type Description
lhs x  
rhs x  

E_F

Field Type Description
rv x  
filtration t  

instance Corecursive (Expr t) (ExprF t)

instance Recursive (Expr t) (ExprF t)

instance Functor (ExprF t)

instance Foldable (ExprF t)

instance Traversable (ExprF t)

data Process t

A stochastic processes. Currently this represents a Geometric Browniam Motion, i.e., dX / X = α dt + β dW. Eventually, we wish to support other processes such as Levy.

Process

Field Type Description
dt Expr t  
dW Expr t  

instance Eq t => Eq (Process t)

instance Show t => Show (Process t)

Functions

riskless

: t -> Process t

Helper function to create a riskless process dS = r dt.

gbm

: t -> t -> Process t

Helper function to create a geometric BM dS = μ dt + σ dW.

fapf

: (Eq a, Show a, Show o, IsIdentifier t) => a -> (a -> Process t) -> (a -> a -> Process t) -> (o -> Process t) -> t -> Claim t Decimal a o -> Expr t

Converts a Claim into the Fundamental Asset Pricing Formula. The ϵ expressions are defined as E1-E10 in the Eber/Peyton-Jones paper. This is still an experimental feature.

simplify

: Expr t -> Expr t

This is meant to be a function that algebraically simplifies the FAPF by

  1. using simple identities and ring laws
  2. change of numeraire technique. This is still an experimental feature.