hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.Quote

Synopsis

Types

Quote hierarchy

data GenQuote q Source #

Quote
  SimpleQuote
  DeltaVolQuote
  FuturesConvAdjustmentQuote
  RelinkableQuote

type Quote = GenQuote CQuote Source #

The root of the hierarchy shown under GenQuote.

type SimpleQuote = GenQuote CSimpleQuote Source #

A Quote; see the hierarchy under GenQuote.

type DeltaVolQuote = GenQuote CDeltaVolQuote Source #

A Quote; see the hierarchy under GenQuote.

type FuturesConvAdjustmentQuote = GenQuote CFuturesConvAdjustmentQuote Source #

A Quote; see the hierarchy under GenQuote.

type RelinkableQuote = GenQuote CRelinkableQuote Source #

A Quote; see the hierarchy under GenQuote.

Configuration

data IntervalPriceType Source #

Operation used by derivedQuote or compositeQuote. The former applies quote `op` operand; the latter applies quote1 `op` quote2. Use withDerivedQuote for reversed unary operations such as FX inversion.

data QuoteOp Source #

Instances

Instances details
Bounded QuoteOp Source # 
Instance details

Defined in QuantLib.Quote

Enum QuoteOp Source # 
Instance details

Defined in QuantLib.Quote

Read QuoteOp Source # 
Instance details

Defined in QuantLib.Quote

Show QuoteOp Source # 
Instance details

Defined in QuantLib.Quote

Eq QuoteOp Source # 
Instance details

Defined in QuantLib.Quote

Methods

(==) :: QuoteOp -> QuoteOp -> Bool #

(/=) :: QuoteOp -> QuoteOp -> Bool #

Constructors

Basic quotes and conversions

simpleQuote :: Double -> IO SimpleQuote Source #

market element returning a stored value

deltaVolQuote Source #

Arguments

:: Double

delta

-> GenQuote q

vol

-> Double

maturity

-> DeltaType 
-> IO DeltaVolQuote 

quotation of an FX delta vs vol, e.g. a 25-delta risk-reversal/butterfly point

atmVolQuote Source #

Arguments

:: GenQuote q

vol

-> DeltaType 
-> Double

maturity

-> AtmType 
-> IO DeltaVolQuote 

quotation of an FX at-the-money vol point (e.g. ATM straddle)

eurodollarFuturesImpliedStdDevQuote Source #

Arguments

:: GenQuote q1

forward

-> GenQuote q2

callPrice

-> GenQuote q3

putPrice

-> Double

strike

-> Double

guess

-> Double

accuracy

-> Word

maxIter

-> IO Quote 

implied standard deviation of a Eurodollar future's underlying, solved from its call/put prices

forwardSwapQuote Source #

Arguments

:: GenSwapIndex sidx 
-> GenQuote q

spread

-> (Int, TimeUnit)

fwdStart

-> IO Quote 

implied rate of a forward-starting swap on the given swap index, offset by a spread quote

forwardValueQuote :: GenIndex idx -> Day -> IO Quote Source #

forward value of an index as of a given fixing date

fxCashSpotQuote Source #

Arguments

:: GenQuote q

settlementSpot: S_V, domestic currency per unit of foreign, for settlement on V

-> GenYieldTermStructure y1

domesticTS: discounting in the domestic (quote) currency

-> GenYieldTermStructure y2

foreignTS: discounting in the foreign (base) currency

-> Calendar

settlementCalendar: business days that set V

-> Word

settlementDays: spot lag in business days from the evaluation date

-> IO Quote 

The cash value, at the evaluation date d, of an FX spot quoted for settlement on V = advance calendar d settlementDays Days (business days; with zero days, d adjusted Following). Its value is

S_d = S_V * (P_dom(V) / P_dom(d)) / (P_for(V) / P_for(d))

with P each curve's discount factor, so a forward built from it, S_d * (P_for(T) / P_for(d)) / (P_dom(T) / P_dom(d)), equals S_V at T = V. Use it as a Garman-Kohlhagen process's spot when the market quotes spot for settlement rather than cash.

This class is defined by hasquant, not QuantLib (which has no quote observing yield curves); QuantExt's FxRateQuote is the prior art. It is live: it notifies its observers when the settlement spot, either curve (including a relink) or the evaluation date changes, and recomputes V and every discount factor on each read. A read throws when a curve cannot discount to d, for instance when its reference date is after the evaluation date.

futuresConvAdjustmentQuoteFromImmCode Source #

Arguments

:: GenIborIndex ibor 
-> String

immCode

-> GenQuote q1

futuresQuote

-> GenQuote q2

volatility

-> GenQuote q3

meanReversion

-> IO FuturesConvAdjustmentQuote 

futures-convexity adjustment for an Ibor future identified by its IMM code

futuresConvAdjustmentQuote Source #

Arguments

:: GenIborIndex ibor 
-> Day

futuresDate

-> GenQuote q1

futuresQuote

-> GenQuote q2

volatility

-> GenQuote q3

meanReversion

-> IO FuturesConvAdjustmentQuote 

futures-convexity adjustment for an Ibor future identified by its futures (IMM) date

impliedStdDevQuote Source #

Arguments

:: OptionType 
-> GenQuote q1

forward

-> GenQuote q2

price

-> Double

strike

-> Double

guess

-> Double

accuracy

-> Word

maxIter

-> IO Quote 

implied standard deviation of an underlying, solved from its option price at a given strike

lastFixingQuote :: GenIndex idx -> IO Quote Source #

last available fixing of the given index, updating whenever a new fixing is added

relinkableQuote :: Maybe (GenQuote q) -> IO RelinkableQuote Source #

A relinkable quote handle. Objects built from it follow later linkTo calls. Nothing creates an empty handle; reading it throws until linked.

Composite quotes

derivedQuote Source #

Arguments

:: QuoteOp 
-> GenQuote q 
-> Double

operand

-> IO Quote 

A quote derived from another by applying quote `op` operand, live: it recomputes whenever the underlying quote moves, and notifies everything built on it.

derivedQuote QuoteAdd base 0.0005 is the "base plus 5bp" spread quote for a rate helper. For anything outside the QuoteOp catalogue -- 1/x, a cap, a nonlinear transform -- use withDerivedQuote.

compositeQuote :: QuoteOp -> GenQuote q1 -> GenQuote q2 -> IO Quote Source #

A quote combining two others as quote1 `op` quote2, live in both: it recomputes whenever either moves. Use withCompositeQuote for an operation outside the QuoteOp catalogue.

multiCompositeQuote :: MultiQuoteOp -> [GenQuote q] -> IO Quote Source #

A quote folding any number of others, live in all of them. An empty list is accepted and gives the fold's identity (0 for QuoteSum and QuoteNorm2, 1 for QuoteProduct) -- upstream imposes no non-empty requirement. Use withMultiCompositeQuote for a fold outside the MultiQuoteOp catalogue.

withDerivedQuote Source #

Arguments

:: (Double -> Double)

f(value)

-> GenQuote q 
-> (Quote -> IO b) 
-> IO b 

As derivedQuote, with an arbitrary Haskell function.

The quote and its native dependents retain the callback after the continuation returns. Callback exceptions are rethrown by the enclosing Haskell call.

withCompositeQuote Source #

Arguments

:: (Double -> Double -> Double)

f(value1, value2)

-> GenQuote q1 
-> GenQuote q2 
-> (Quote -> IO b) 
-> IO b 

As compositeQuote, but combining the two quotes with an arbitrary Haskell function. Same ownership and exception rules as withDerivedQuote.

withMultiCompositeQuote Source #

Arguments

:: ([Double] -> Double)

f(values)

-> [GenQuote q] 
-> (Quote -> IO b) 
-> IO b 

As multiCompositeQuote, but folding with an arbitrary Haskell function. The whole element vector is passed per evaluation, so this crosses into Haskell once per value, not once per element. Same ownership and exception rules as withDerivedQuote.

Mutators

setValue :: SimpleQuote -> Double -> IO () Source #

Set the quote's value. The change propagates to all users of the quote.

linkTo :: RelinkableQuote -> GenQuote q -> IO () Source #

Point a relinkable handle at another quote. Existing dependents reprice without reconstruction. Use setValue for a value bump; this swaps the quote object.

Inspectors

value :: GenQuote q -> IO Double Source #

Returns the current value of the given Quote object

isValid :: GenQuote q -> IO Bool Source #

returns true if the Quote holds a valid value

futuresValue :: FuturesConvAdjustmentQuote -> IO Double Source #

The futures-vs-forward-rate value implied by the futures quote alone (futuresQuote_->value()).