hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.Instrument.Swap

Synopsis

Types

Swap hierarchy

type GenSwap s = GenInstrument (AnyOf CSwap' s) Source #

type Swap = GenSwap CSwap Source #

An Instrument; see the hierarchy under GenInstrument.

type GenFixedVsFloatingSwap f = GenSwap (AnyOf CFixedVsFloatingSwap' f) Source #

type FixedVsFloatingSwap = GenFixedVsFloatingSwap CFixedVsFloatingSwap Source #

A Swap; see the hierarchy under GenInstrument.

type VanillaSwap = GenFixedVsFloatingSwap CVanillaSwap Source #

A FixedVsFloatingSwap; see the hierarchy under GenInstrument.

type NonstandardSwap = GenSwap CNonstandardSwap Source #

A Swap; see the hierarchy under GenInstrument.

type IrregularSwap = GenSwap CIrregularSwap Source #

A Swap; see the hierarchy under GenInstrument.

type FloatFloatSwap = GenSwap CFloatFloatSwap Source #

A Swap; see the hierarchy under GenInstrument.

type AssetSwap = GenSwap CAssetSwap Source #

A Swap; see the hierarchy under GenInstrument.

type OvernightIndexedSwap = GenSwap COvernightIndexedSwap Source #

A Swap; see the hierarchy under GenInstrument.

type BMASwap = GenSwap CBMASwap Source #

A Swap; see the hierarchy under GenInstrument.

type ZeroCouponInflationSwap = GenSwap CZeroCouponInflationSwap Source #

A Swap; see the hierarchy under GenInstrument.

type YearOnYearInflationSwap = GenSwap CYearOnYearInflationSwap Source #

A Swap; see the hierarchy under GenInstrument.

type CPISwap = GenSwap CCPISwap Source #

A Swap; see the hierarchy under GenInstrument.

type ZeroCouponSwap = GenSwap CZeroCouponSwap Source #

A Swap; see the hierarchy under GenInstrument.

type EquityTotalReturnSwap = GenSwap CEquityTotalReturnSwap Source #

A Swap; see the hierarchy under GenInstrument.

type VarianceSwap = GenInstrument CVarianceSwap Source #

An Instrument; see the hierarchy under GenInstrument.

type GenConstNotionalCrossCurrencySwap x = GenSwap (AnyOf CConstNotionalCrossCurrencySwap' x) Source #

type ConstNotionalCrossCurrencySwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencySwap Source #

A Swap; see the hierarchy under GenInstrument.

type ConstNotionalCrossCurrencyFixedVsFloatingSwap = GenConstNotionalCrossCurrencySwap CConstNotionalCrossCurrencyFixedVsFloatingSwap Source #

A ConstNotionalCrossCurrencySwap; see the hierarchy under GenInstrument.

Swaptions and variance options

type Swaption = GenOption CSwaption Source #

An Option; see the hierarchy under GenInstrument.

type IrregularSwaption = GenOption CIrregularSwaption Source #

An Option; see the hierarchy under GenInstrument.

type NonstandardSwaption = GenOption CNonstandardSwaption Source #

An Option; see the hierarchy under GenInstrument.

type FloatFloatSwaption = GenOption CFloatFloatSwaption Source #

An Option; see the hierarchy under GenInstrument.

type VarianceOption = GenInstrument CVarianceOption Source #

An Instrument; see the hierarchy under GenInstrument.

Configuration

data IrregularSettlementType Source #

data CPIInterpolationType Source #

Constructors

CPIFlat 
CPILinear 

Instances

Instances details
Bounded CPIInterpolationType Source # 
Instance details

Defined in QuantLib.Internal.Common

Enum CPIInterpolationType Source #

How an overnight leg observes its index fixings. Shared by every overnight-leg producer: the swap constructors, the OIS rate helpers, and the cross-currency swaps. lookbackDays is Nothing for upstream's Null default, meaning the index's own fixing days.

Declared here rather than in a topical module because its producers span QuantLib.Instrument.Swap and QuantLib.TermStructure.Yield, whose build order cannot accommodate one importing the other.

Instance details

Defined in QuantLib.Internal.Common

Read CPIInterpolationType Source # 
Instance details

Defined in QuantLib.Internal.Common

Show CPIInterpolationType Source # 
Instance details

Defined in QuantLib.Internal.Common

Eq CPIInterpolationType Source # 
Instance details

Defined in QuantLib.Internal.Common

data CalibrationBasketType Source #

Instances

Instances details
Bounded CalibrationBasketType Source # 
Instance details

Defined in QuantLib.Internal.Common

Enum CalibrationBasketType Source # 
Instance details

Defined in QuantLib.Internal.Common

Read CalibrationBasketType Source # 
Instance details

Defined in QuantLib.Internal.Common

Show CalibrationBasketType Source # 
Instance details

Defined in QuantLib.Internal.Common

Eq CalibrationBasketType Source # 
Instance details

Defined in QuantLib.Internal.Common

defaultOvernightObservation :: OvernightObservation Source #

Upstream's own defaults: index fixing days, no lockout, no observation shift.

Constructors

Hierarchy conversion

Swaps

swapFromLegs Source #

Arguments

:: [(Leg, Bool)]

(legs, payer)

-> IO Swap 

Multi leg constructor.

swap :: GenLeg l1 -> GenLeg l2 -> IO Swap Source #

The cash flows belonging to the first leg are paid; the ones belonging to the second leg are received.

bmaSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule

liborSchedule

-> Double

liborFraction

-> Double

liborSpread

-> GenIborIndex ibor 
-> DayCounter

liborDayCount

-> Schedule

bmaSchedule

-> BMAIndex 
-> DayCounter

bmaDayCount

-> IO BMASwap 

Swap paying Libor against BMA coupons

vanillaSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule

fixedSchedule

-> Double

fixedRate

-> DayCounter

fixedDayCount

-> Schedule

floatSchedule

-> GenIborIndex ibor 
-> Double

spread

-> DayCounter

floatingDayCount

-> Maybe BusinessDayConvention

paymentConvention

-> Maybe Bool

useIndexedCoupons

-> IO VanillaSwap 

Fixed-rate vs floating-rate (Ibor) swap; if no payment convention is given, the floating leg's is used.

nonstandardSwapFromVanilla :: GenFixedVsFloatingSwap f -> IO NonstandardSwap Source #

Converts an existing FixedVsFloatingSwap (e.g. a VanillaSwap) into a NonstandardSwap (upstream's own conversion constructor, NonstandardSwap(const FixedVsFloatingSwap&)).

nonstandardSwap Source #

Arguments

:: SwapType 
-> [Double]

fixedNominal

-> [Double]

floatingNominal

-> Schedule

fixedSchedule

-> [Double]

fixedRate

-> DayCounter

fixedDayCount

-> Schedule

floatingSchedule

-> GenIborIndex ibor 
-> Double

gearing

-> Double

spread

-> DayCounter

floatingDayCount

-> Bool

intermediateCapitalExchange

-> Bool

finalCapitalExchange

-> Maybe BusinessDayConvention

paymentConvention

-> IO NonstandardSwap 

VanillaSwap generalized to per-period fixed/floating nominals and fixed rates, plus optional intermediate/final notional exchange -- a single Double gearing/spread shared across all floating periods. See nonstandardSwapFromGearingsAndSpreads for per-period gearing/spread.

nonstandardSwapFromGearingsAndSpreads Source #

Arguments

:: SwapType 
-> [Double]

fixedNominal

-> [Double]

floatingNominal

-> Schedule

fixedSchedule

-> [Double]

fixedRate

-> DayCounter

fixedDayCount

-> Schedule

floatingSchedule

-> GenIborIndex ibor 
-> [Double]

gearing

-> [Double]

spread

-> DayCounter

floatingDayCount

-> Bool

intermediateCapitalExchange

-> Bool

finalCapitalExchange

-> Maybe BusinessDayConvention

paymentConvention

-> IO NonstandardSwap 

As nonstandardSwap, but with a per-period gearing and spread instead of one shared value.

floatFloatSwap :: SwapType -> Double -> Double -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapOpts -> IO FloatFloatSwap Source #

Swap exchanging capped/floored Libor or CMS coupons with a single flat nominal on each leg. FloatFloatSwapOpts bundles every trailing param the C++ constructor defaults (gearing/ spread/cap/floor per leg, capital exchange, payment conventions); override only what's needed via record-update syntax on defaultFloatFloatSwapOpts. See floatFloatSwapFromNominals for the per-period-nominal overload.

floatFloatSwapFromNominals :: SwapType -> [Double] -> [Double] -> Schedule -> GenInterestRateIndex ridx1 -> DayCounter -> Schedule -> GenInterestRateIndex ridx2 -> DayCounter -> FloatFloatSwapVaryingOpts -> IO FloatFloatSwap Source #

As floatFloatSwap, but with per-period nominals on each leg. FloatFloatSwapVaryingOpts also supplies the per-period gearings, spreads, caps, and floors for both legs.

makeVanillaSwap Source #

Arguments

:: (Word, TimeUnit)

swapTenor

-> GenIborIndex ibor 
-> Double

fixedRate

-> (Int, TimeUnit)

forwardStart

-> Maybe Int

settlementDays

-> (Word, TimeUnit)

fixedLegTenor

-> DayCounter

fixedLegDayCount

-> Maybe BusinessDayConvention

fixedLegConvention

-> Maybe BusinessDayConvention

fixedLegTerminationDateConvention

-> Maybe Calendar

fixedLegCalendar

-> Maybe Calendar

floatingLegCalendar

-> Maybe Double

nominal

-> Maybe SwapType 
-> IO VanillaSwap 

Haskell equivalent of QuantLib's fluent MakeVanillaSwap builder -- a single function with Maybe-wrapped optional parameters instead of chained .with* calls, covering the subset of makevanillaswap.hpp's fields named in the parameters below. Not covered at all (no parameter): explicit effective/termination date overrides, a settlement calendar distinct from the floating-leg one, floating-leg tenor/convention/ termination convention/day count overrides (always taken from the index, matching upstream's own defaults), withRule variants (always DateGeneration::Backward), end-of-month/first-date/next-to-last-date overrides, a floating-leg spread other than 0, a discounting term structure or custom pricing engine (use setPricingEngine on the result instead), indexed/at-par coupon overrides, and payment convention (always the floating leg's, matching upstream's own default when unset). fixedLegTenor/fixedLegDayCount are required arguments here rather than optional with upstream's currency-based inference. A Nothing settlementDays behaves as Just 0, rather than replicating upstream's index-valueDate-based spot-date convention.

makeCms Source #

Arguments

:: (Word, TimeUnit)

swapTenor

-> GenSwapIndex sidx

cms index

-> GenIborIndex ibor

floating-leg index

-> Double

floating-leg spread

-> (Int, TimeUnit)

forwardStart

-> Maybe Int

settlementDays

-> (Word, TimeUnit)

cmsLegTenor

-> DayCounter

cmsLegDayCount

-> Maybe Calendar

cmsLegCalendar

-> Maybe Calendar

floatingLegCalendar

-> Maybe Double

nominal

-> Maybe SwapType

Payer pays the CMS leg (receives floating); Receiver the reverse

-> IO Swap 

Haskell equivalent of QuantLib's fluent MakeCms builder, in the style of makeVanillaSwap above -- not a binding of the MakeCms C++ class at all, but a plain function composing already-bound primitives (schedule, cmsLeg, iborLeg, swapFromLegs). The result is a plain Swap (a CMS swap has no calc/getter of its own beyond generic Swap's), with no FloatingRateCouponPricer attached -- attach one to the CMS leg afterwards via setCouponPricer =<< leg result 0 (swapFromLegs is used instead of swap precisely so the CMS leg is always leg 0, regardless of SwapType) and setCouponPricer before pricing.

Unlike MakeCms, cmsLegTenor/cmsLegDayCount are required arguments here rather than defaulted (upstream hardcodes 3 Months/Actual360); pass those literals to reproduce MakeCms's own defaults. Not covered at all (no parameter): an explicit effective date override, CMS-leg/floating-leg termination-date-convention/rule/end-of-month/ first-date/next-to-last-date overrides (always ModifiedFollowing/Backward/False/ unset, matching MakeCms's own defaults for the CMS leg), CMS coupon gearing/caps/floors (use cmsLegWithOptions and swap directly for those), an ATM-spread lookup, a discounting term structure or custom pricing engine (use setPricingEngine on the result instead). A Nothing settlementDays behaves as Just 0, rather than replicating upstream's index-valueDate-based spot-date convention (matching makeVanillaSwap's own choice here).

zeroCouponInflationSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Day

startDate

-> Day

maturity

-> Calendar 
-> BusinessDayConvention

paymentConvention

-> DayCounter 
-> Double

fixedRate

-> ZeroInflationIndex 
-> (Word, TimeUnit)

observationLag

-> CPIInterpolationType

observationInterpolation

-> Bool

adjustInfObsDates

-> Calendar

infCalendar

-> BusinessDayConvention

infConvention

-> IO ZeroCouponInflationSwap 

A zero-coupon inflation-indexed swap (ZCIIS): a single fixed-vs-CPI-ratio exchange at maturity. Per-leg NPV/BPS use the generic leg/legNpv/legBps (leg 0 = fixed, leg 1 = inflation).

yearOnYearInflationSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule

fixedSchedule

-> Double

fixedRate

-> DayCounter

fixedDayCount

-> Schedule

yoySchedule

-> YoYInflationIndex 
-> (Word, TimeUnit)

observationLag

-> CPIInterpolationType

interpolation

-> Double

spread

-> DayCounter

yoyDayCount

-> Calendar

paymentCalendar

-> BusinessDayConvention

paymentConvention

-> IO YearOnYearInflationSwap 

A year-on-year inflation-indexed swap: fixed leg vs a YoY-inflation-linked leg. Per-leg NPV/BPS use the generic leg/legNpv/legBps (leg 0 = fixed, leg 1 = YoY).

cpiSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Bool

subtractInflationNominal

-> Double

spread

-> DayCounter

floatDayCount

-> Schedule

floatSchedule

-> BusinessDayConvention

floatRoll

-> Word

fixingDays

-> GenIborIndex ibor

floatIndex

-> Double

fixedRate

-> Double

baseCPI

-> DayCounter

fixedDayCount

-> Schedule

fixedSchedule

-> BusinessDayConvention

fixedRoll

-> (Word, TimeUnit)

observationLag

-> ZeroInflationIndex

fixedIndex

-> CPIInterpolationType

observationInterpolation

-> Maybe Double

inflationNominal

-> IO CPISwap 

A fixed-x-CPI-ratio leg (subtracting the inflation notional if subtractInflationNominal) vs a float+spread leg -- QuantLib's general-purpose inflation swap, also usable to replicate a single-cashflow ZCIIS (see zeroCouponInflationSwap). Per-leg NPV/BPS use the generic leg/legNpv/legBps (leg 0 = CPI, leg 1 = float).

zeroCouponSwap Source #

Arguments

:: SwapType 
-> Double

baseNominal

-> Day

startDate

-> Day

maturityDate

-> Double

fixedPayment

-> GenIborIndex ibor 
-> Calendar

paymentCalendar

-> BusinessDayConvention

paymentConvention

-> Word

paymentDelay

-> IO ZeroCouponSwap 

Zero-coupon swap quoted in terms of a known fixed cash flow. "payer"/"receiver" refer to the fixed leg. Per-leg NPV uses the generic leg/legNpv (leg 0 = fixed, leg 1 = floating).

zeroCouponSwapFromRate Source #

Arguments

:: SwapType 
-> Double

baseNominal

-> Day

startDate

-> Day

maturityDate

-> Double

fixedRate

-> DayCounter

fixedDayCounter

-> GenIborIndex ibor 
-> Calendar

paymentCalendar

-> BusinessDayConvention

paymentConvention

-> Word

paymentDelay

-> IO ZeroCouponSwap 

Zero-coupon swap quoted in terms of a fixed rate.

equityTotalReturnSwapIbor Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule 
-> EquityIndex 
-> GenIborIndex ibor

interestRateIndex

-> DayCounter 
-> Double

margin

-> Double

gearing

-> Calendar

paymentCalendar

-> BusinessDayConvention

paymentConvention

-> Word

paymentDelay

-> IO EquityTotalReturnSwap 

Exchanges the total return of an EquityIndex for a set of floating cash flows linked to an IborIndex. type (payer/receiver) refers to the equity leg.

equityTotalReturnSwapOvernight Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule 
-> EquityIndex 
-> OvernightIborIndex

interestRateIndex

-> DayCounter 
-> Double

margin

-> Double

gearing

-> Calendar

paymentCalendar

-> BusinessDayConvention

paymentConvention

-> Word

paymentDelay

-> IO EquityTotalReturnSwap 

As equityTotalReturnSwapIbor, but with the floating leg linked to an overnight index instead -- fixings are compounded over the accrual period.

varianceSwap Source #

Arguments

:: PositionType 
-> Double

strike

-> Double

notional

-> Day

startDate

-> Day

maturityDate

-> IO VarianceSwap 

Variance swap: pays off the difference between realized and strike variance, scaled by notional. This class does not manage seasoned variance swaps.

varianceOption Source #

Arguments

:: Payoff 
-> Double

notional

-> Day

startDate

-> Day

maturityDate

-> IO VarianceOption 

Variance option: an option on realized variance, priced (e.g. via integralHestonVarianceOptionEngine) against a payoff on the variance level rather than the underlying price. This class does not manage seasoned variance options.

Cross-currency swaps

constNotionalCrossCurrencySwap Source #

Arguments

:: GenLeg l1 
-> Currency

firstLegCcy

-> GenLeg l2 
-> Currency

secondLegCcy

-> IO ConstNotionalCrossCurrencySwap 

Constructs a cross-currency swap from two legs and their currencies; the first leg is paid, the second received.

constNotionalCrossCurrencySwapFromLegs Source #

Arguments

:: [(Leg, Bool)]

(legs, payer)

-> [Currency] 
-> IO ConstNotionalCrossCurrencySwap 

Multi-leg constructor.

constNotionalCrossCurrencyBasisSwap :: Double -> Currency -> Schedule -> GenIborIndex ibor1 -> Double -> Double -> Double -> Currency -> Schedule -> GenIborIndex ibor2 -> Double -> Double -> ConstNotionalCrossCurrencyBasisSwapOpts -> IO ConstNotionalCrossCurrencyBasisSwap Source #

Cross-currency basis swap: pay-currency cashflows on leg 0, receive-currency on leg 1. ConstNotionalCrossCurrencyBasisSwapOpts bundles every trailing param the C++ constructor defaults (all OIS-only -- payment lag, compound-spread, lookback, observation shift, lockout, averaging method per leg, plus a shared telescopic-value-dates flag; ignored for a plain Ibor payIndex/recIndex, since upstream itself only consults them when the index is an overnight index); override only what's needed via record-update syntax on defaultConstNotionalCrossCurrencyBasisSwapOpts.

constNotionalCrossCurrencyFixedVsFloatingSwap Source #

Arguments

:: SwapType 
-> Double

fixedNominal

-> Currency

fixedCurrency

-> Schedule

fixedSchedule

-> Double

fixedRate

-> DayCounter

fixedDayCount

-> BusinessDayConvention

fixedPaymentBdc

-> Word

fixedPaymentLag

-> Calendar

fixedPaymentCalendar

-> Double

floatNominal

-> Currency

floatCurrency

-> Schedule

floatSchedule

-> GenIborIndex ibor

floatIndex

-> Double

floatSpread

-> BusinessDayConvention

floatPaymentBdc

-> Word

floatPaymentLag

-> Calendar

floatPaymentCalendar

-> Bool

telescopicValueDates

-> Bool

floatCompoundSpread

-> OvernightObservation

floatObservation

-> RateAveragingType

floatAveragingMethod

-> IO ConstNotionalCrossCurrencyFixedVsFloatingSwap 

Cross-currency fixed-vs-floating swap: Payer pays the fixed leg (leg 0) and receives the floating leg (leg 1); Receiver the reverse. Every trailing defaulted param of the upstream constructor is a required argument here (only 4 trailing defaults, under the options-record threshold -- see ConstNotionalCrossCurrencyBasisSwapOpts above) -- pass False/False/ defaultOvernightObservation/AveragingCompound to reproduce upstream's own defaults; the OIS-only ones are ignored for a plain Ibor floatIndex.

Upstream declares the three observation parameters as floatLookbackDays, floatObservationShift, floatLockoutDays, inverting the order every other overnight-leg producer uses; OvernightObservation hides that.

Overnight-indexed and asset swaps

overnightIndexedSwap Source #

Arguments

:: SwapType 
-> Double

nominal

-> Schedule 
-> Double

fixedRate

-> DayCounter

fixedDC

-> OvernightIborIndex 
-> Double

spread

-> Int

paymentLag

-> BusinessDayConvention

paymentAdjustment

-> Calendar

paymentCalendar

-> Bool

telescopicValueDates

-> RateAveragingType

averagingMethod

-> OvernightObservation 
-> IO OvernightIndexedSwap 

Fixed vs compounded-overnight-rate swap, with a single flat nominal for both legs.

overnightIndexedSwapFromNominals Source #

Arguments

:: SwapType 
-> [Double]

nominals

-> Schedule 
-> Double

fixedRate

-> DayCounter

fixedDC

-> OvernightIborIndex 
-> Double

spread

-> Int

paymentLag

-> BusinessDayConvention

paymentAdjustment

-> Calendar

paymentCalendar

-> Bool

telescopicValueDates

-> RateAveragingType

averagingMethod

-> OvernightObservation 
-> IO OvernightIndexedSwap 

As overnightIndexedSwap, but with a per-period nominal schedule instead of a single flat nominal.

assetSwap Source #

Arguments

:: Bool

payBondCoupon

-> Bond 
-> Double

bondCleanPrice

-> GenIborIndex ibor 
-> Double 
-> Schedule

floatSchedule

-> DayCounter

floatingDayCount

-> Bool

parAssetSwap

-> Double

gearing

-> Maybe Double

nonParRepayment

-> Maybe Day

dealMaturity

-> IO AssetSwap 

Bullet bond vs Libor swap (par or market asset swap, per parAssetSwap).

Swaptions

irregularSwaption :: IrregularSwap -> Exercise -> IrregularSettlementType -> IO IrregularSwaption Source #

A priceable option on an IrregularSwap. Use haganIrregularSwaptionEngine as its pricing engine; QuantLib has no corresponding stock IrregularSwap engine.

nonstandardSwaptionFromSwaption :: Swaption -> IO NonstandardSwaption Source #

Converts an existing Swaption into a NonstandardSwaption (upstream's own conversion constructor).

Inspectors

Common swap inspectors

class HasInstrumentUnderlying a where Source #

Options that hold the swap they are written on. CdsOption is constructed in QuantLib.Instrument.Credit; import this module as well to reach its underlying swap.

Associated Types

type InstrumentUnderlying a Source #

Instances

Instances details
HasInstrumentUnderlying CdsOption Source # 
Instance details

Defined in QuantLib.Instrument.Swap

HasInstrumentUnderlying FloatFloatSwaption Source # 
Instance details

Defined in QuantLib.Instrument.Swap

HasInstrumentUnderlying IrregularSwaption Source # 
Instance details

Defined in QuantLib.Instrument.Swap

HasInstrumentUnderlying NonstandardSwaption Source # 
Instance details

Defined in QuantLib.Instrument.Swap

HasInstrumentUnderlying Swaption Source # 
Instance details

Defined in QuantLib.Instrument.Swap

impliedVolatility Source #

Arguments

:: Swaption 
-> Double

price

-> GenYieldTermStructure y 
-> Double

guess

-> Double

accuracy

-> Word

maxEvaluations

-> Double

minVol

-> Double

maxVol

-> VolatilityType

type

-> Double

displacement

-> SwaptionPriceType

priceType

-> IO Double 

implied volatility

endDiscounts :: GenSwap s -> Word -> IO Double Source #

Discount factor at leg j's end date.

leg :: GenSwap s -> Word -> IO Leg Source #

The j-th leg's cash flows.

numberOfLegs :: GenSwap s -> IO Word Source #

How many legs this swap has; leg indexes run from 0 to one less than this.

legBps :: GenSwap s -> Word -> IO Double Source #

Basis-point sensitivity of leg j.

legNpv :: GenSwap s -> Word -> IO Double Source #

NPV of leg j.

maturityDate :: GenSwap s -> IO (Maybe Day) Source #

The swap's maturity date, or Nothing if the swap has no legs.

npvDateDiscount :: GenSwap s -> IO Double Source #

Discount factor at the instrument's NPV date.

startDate :: GenSwap s -> IO (Maybe Day) Source #

The swap's start date, or Nothing if the swap has no legs.

startDiscounts :: GenSwap s -> Word -> IO Double Source #

Discount factor at leg j's start date.

nonstandardSwapFixedRate :: NonstandardSwap -> IO [Double] Source #

Per-period fixed rate, one entry per fixed-leg accrual period. For a swap built via nonstandardSwap/nonstandardSwapFromGearingsAndSpreads, this simply echoes the constructor's fixedRate; for one built via nonstandardSwapFromVanilla it is derived from the underlying vanilla swap's fixed leg coupons.

Cross-currency swaps

inCcyLegBps :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #

Basis-point sensitivity of leg j, expressed in the leg's own currency (contrast legBps, in the swap's NPV currency).

inCcyLegNpv :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #

NPV of leg j, expressed in the leg's own currency (contrast legNpv, in the swap's NPV currency).

npvDateDiscounts :: GenConstNotionalCrossCurrencySwap x -> Word -> IO Double Source #

Discount factor at the instrument's NPV date, for leg j.

fairPaySpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double Source #

The pay-leg spread that would make the swap's NPV zero.

fairRecSpread :: ConstNotionalCrossCurrencyBasisSwap -> IO Double Source #

The receive-leg spread that would make the swap's NPV zero.

BMA swaps

bmaLeg :: BMASwap -> IO Leg Source #

The BMA leg's cash flows.

bmaLegBps :: BMASwap -> IO Double Source #

Basis-point sensitivity of the BMA leg.

bmaLegNpv :: BMASwap -> IO Double Source #

NPV of the BMA leg.

fairLiborFraction :: BMASwap -> IO Double Source #

The Libor fraction that would make the swap's NPV zero.

fairLiborSpread :: BMASwap -> IO Double Source #

The Libor spread that would make the swap's NPV zero.

liborFraction :: BMASwap -> IO Double Source #

The fraction of the Libor rate paid on the Libor leg.

liborLeg :: BMASwap -> IO Leg Source #

The Libor leg's cash flows.

liborLegBps :: BMASwap -> IO Double Source #

Basis-point sensitivity of the Libor leg.

liborLegNpv :: BMASwap -> IO Double Source #

NPV of the Libor leg.

Swaption calibration baskets

calibrationBasket Source #

Arguments

:: NonstandardSwaption 
-> GenSwapIndex sidx

standardSwapBase

-> GenSwaptionVolatilityStructure sv

swaptionVolatility

-> CalibrationBasketType 
-> IO [BlackCalibrationHelper] 

Auto-generates a basket of plain Swaptions used to calibrate a model to price a NonstandardSwaption -- either ATM swaptions adapted to the exercise dates (Naive) or swaptions whose maturity/strike/nominal match the underlying's NPV, delta and gamma at each exercise date (MaturityStrikeByDeltaGamma).

Asset swaps

bondLeg :: AssetSwap -> IO Leg Source #

The underlying bond's cash flows.

cleanPrice :: AssetSwap -> IO Double Source #

The bond's clean price, as passed to the constructor.

fairCleanPrice :: AssetSwap -> IO Double Source #

The clean price that would make the swap's NPV zero.

fairNonParRepayment :: AssetSwap -> IO Double Source #

The non-par repayment that would make the swap's NPV zero.

nonParRepayment :: AssetSwap -> IO Double Source #

The non-par repayment, as passed to the constructor.

parSwap :: AssetSwap -> IO Bool Source #

Whether this is a par asset swap.

payBondCoupon :: AssetSwap -> IO Bool Source #

Whether the bond coupon is paid (rather than netted against the floating leg).

Float-float swaps

firstLegFairSpread :: FloatFloatSwap -> IO Double Source #

The spread on leg 1 that would make the swap's NPV zero.

secondLegFairSpread :: FloatFloatSwap -> IO Double Source #

The spread on leg 2 that would make the swap's NPV zero.

Zero-coupon, equity and variance swaps

fairFixedPayment :: ZeroCouponSwap -> IO Double Source #

The fixed payment that would make the swap's NPV zero.

fairFixedRate :: ZeroCouponSwap -> DayCounter -> IO Double Source #

The fixed rate, under the given day counter, that would make the swap's NPV zero.

equityLegNpv :: EquityTotalReturnSwap -> IO Double Source #

NPV of the equity total-return leg.

interestRateLegNpv :: EquityTotalReturnSwap -> IO Double Source #

NPV of the interest-rate leg.

fairMargin :: EquityTotalReturnSwap -> IO Double Source #

The margin that would make the swap's NPV zero.

variance :: VarianceSwap -> IO Double Source #

Realized variance -- requires a pricing engine to be set first

Overnight-indexed swaps

overnightLeg :: OvernightIndexedSwap -> IO Leg Source #

The overnight leg's cash flows.

overnightLegBps :: OvernightIndexedSwap -> IO Double Source #

Basis-point sensitivity of the overnight leg.

overnightLegNpv :: OvernightIndexedSwap -> IO Double Source #

NPV of the overnight leg.