quantfin-0.1.0.1: Quant finance library in pure Haskell.

Safe HaskellNone
LanguageHaskell2010

Quant.ContingentClaim

Contents

Synopsis

Types for modeling contingent claims.

type ContingentClaim = [ContingentClaim'] Source

ContingentClaim is just a list of the underlying ContingentClaim's.

data ContingentClaim' Source

ContingentClaim' is the underlying type of contingent claims.

Constructors

ContingentClaim' 

Fields

payoutTime :: Double

Payout time for cash flow

collector :: [Vector Double] -> Vector Double
 
observations :: [(Double, Observables -> Vector Double, Double -> Double)]

List containing: Time of observation Function to access specific observable. Function to collect observations and transform them into a cash flow

data Observables Source

Observables are the observables available in a Monte Carlo simulation. Most basic MCs will have one observables (Black-Scholes) whereas more complex ones will have multiple (i.e. Heston-Hull-White).

Constructors

Observables [Vector Double] 

data ContingentClaimBasket Source

Used to compile claims for the Monte Carlo engine.

data OptionType Source

ADT for Put or Calls

Constructors

Put 
Call 

Options and option combinators

vanillaOption :: OptionType -> Double -> Double -> ContingentClaim Source

Takes an OptionType, a strike, and a time to maturity and generates a vanilla option.

binaryOption :: OptionType -> Double -> Double -> Double -> ContingentClaim Source

Takes an OptionType, a strike, a payout amount and a time to maturity and generates a vanilla option.

straddle :: Double -> Double -> ContingentClaim Source

A straddle is a put and a call with the same time to maturity / strike.

arithmeticAsianOption :: OptionType -> Double -> [Double] -> Double -> ContingentClaim Source

Takes an OptionType, a strike, observation times, time to maturity and generates an arithmetic Asian option.

geometricAsianOption :: OptionType -> Double -> [Double] -> Double -> ContingentClaim Source

Takes an OptionType, a strike, observation times, time to maturity and generates a geometric Asian option.

callSpread :: Double -> Double -> Double -> ContingentClaim Source

A call spread is a long position in a low-strike call and a short position in a high strike call.

putSpread :: Double -> Double -> Double -> ContingentClaim Source

A put spread is a long position in a high strike put and a short position in a low strike put.

forwardContract :: Double -> ContingentClaim Source

Takes a time to maturity and generates a forward contract.

fixed :: Double -> Double -> ContingentClaim Source

Takes an amount and a time and generates a fixed cash flow.

multiplier :: Double -> ContingentClaim -> ContingentClaim Source

Scales up a contingent claim by a multiplier.

short :: ContingentClaim -> ContingentClaim Source

Flips the signs in a contingent claim to make it a short position.

combine :: ContingentClaim -> ContingentClaim -> ContingentClaim Source

Just combines two contingent claims into one.

terminalOnly :: Double -> (Double -> Double) -> ContingentClaim Source

Takes a maturity time and a function and generates a ContingentClaim dependent only on the terminal value of the observable.

changeObservableFct :: ContingentClaim -> (Observables -> Vector Double) -> ContingentClaim Source

Offers the ability to change the function on the observable an option is based on. All options default to being based on the first observable.

Utility functions

obsNum :: ContingentClaim -> Int -> ContingentClaim Source

Utility function for when the observable function is just !!

obsHead :: Observables -> Vector Double Source

Utility function to pull the head of a basket of observables.