hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.CashFlow

Synopsis

Types

Cash-flow hierarchy

data GenCashFlow cf Source #

CashFlow
  Coupon
    FixedRateCoupon
    FloatingRateCoupon
      AverageBMACoupon
      CmsCoupon
      DigitalCoupon
        DigitalCmsCoupon
        DigitalCmsSpreadCoupon
      IborCoupon
      MultipleResetsCoupon
      OvernightIndexedCoupon
      RangeAccrualFloatersCoupon
      StrippedCappedFlooredCoupon
    CPICoupon
    YoYInflationCoupon
  IndexedCashFlow
    CPICashFlow
    EquityCashFlow
    ZeroInflationCashFlow
  CommodityCashFlow

type CashFlow = GenCashFlow CCashFlow Source #

The root of the hierarchy shown under GenCashFlow.

type GenCoupon c = GenCashFlow (AnyOf CCoupon' c) Source #

Shared base of every accruing cash flow: a nominal, an accrual period, and a rate. See the hierarchy under GenCashFlow.

type Coupon = GenCoupon CCoupon Source #

A CashFlow; see the hierarchy under GenCashFlow.

type GenFloatingRateCoupon frc = GenCoupon (AnyOf CFloatingRateCoupon' frc) Source #

A FloatingRateCoupon or one of its leaves; see the hierarchy under GenCashFlow.

type FloatingRateCoupon = GenFloatingRateCoupon CFloatingRateCoupon Source #

A Coupon; see the hierarchy under GenCashFlow.

type GenDigitalCoupon dc = GenFloatingRateCoupon (AnyOf CDigitalCoupon' dc) Source #

A DigitalCoupon or one of its leaves; see the hierarchy under GenCashFlow.

type DigitalCoupon = GenDigitalCoupon CDigitalCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type GenIndexedCashFlow icf = GenCashFlow (AnyOf CIndexedCashFlow' icf) Source #

An IndexedCashFlow or one of its leaves; see the hierarchy under GenCashFlow.

type IndexedCashFlow = GenIndexedCashFlow CIndexedCashFlow Source #

A CashFlow; see the hierarchy under GenCashFlow.

type FixedRateCoupon = GenCoupon CFixedRateCoupon Source #

A Coupon; see the hierarchy under GenCashFlow.

type IborCoupon = GenFloatingRateCoupon CIborCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type AverageBMACoupon = GenFloatingRateCoupon CAverageBMACoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type StrippedCappedFlooredCoupon = GenFloatingRateCoupon CStrippedCappedFlooredCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type CmsCoupon = GenFloatingRateCoupon CCmsCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type DigitalCmsCoupon = GenDigitalCoupon CDigitalCmsCoupon Source #

A DigitalCoupon; see the hierarchy under GenCashFlow.

type DigitalCmsSpreadCoupon = GenDigitalCoupon CDigitalCmsSpreadCoupon Source #

A DigitalCoupon; see the hierarchy under GenCashFlow.

type MultipleResetsCoupon = GenFloatingRateCoupon CMultipleResetsCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type OvernightIndexedCoupon = GenFloatingRateCoupon COvernightIndexedCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type RangeAccrualFloatersCoupon = GenFloatingRateCoupon CRangeAccrualFloatersCoupon Source #

A FloatingRateCoupon; see the hierarchy under GenCashFlow.

type CPICoupon = GenCoupon CCPICoupon Source #

A Coupon; see the hierarchy under GenCashFlow.

type YoYInflationCoupon = GenCoupon CYoYInflationCoupon Source #

A Coupon; see the hierarchy under GenCashFlow.

type ZeroInflationCashFlow = GenIndexedCashFlow CZeroInflationCashFlow Source #

An IndexedCashFlow; see the hierarchy under GenCashFlow.

type CPICashFlow = GenIndexedCashFlow CCPICashFlow Source #

An IndexedCashFlow; see the hierarchy under GenCashFlow.

type EquityCashFlow = GenIndexedCashFlow CEquityCashFlow Source #

An IndexedCashFlow; see the hierarchy under GenCashFlow.

Legs

data GenLeg l Source #

Leg
  CouponLeg

type Leg = GenLeg CLeg Source #

The root of the hierarchy shown under GenLeg.

type CouponLeg = GenLeg CCouponLeg Source #

A Leg; see the hierarchy under GenLeg.

Coupon pricers

data GenFloatingRateCouponPricer frcp Source #

FloatingRateCouponPricer
  CmsCouponPricer

type FloatingRateCouponPricer = GenFloatingRateCouponPricer CFloatingRateCouponPricer Source #

The root of the hierarchy shown under GenFloatingRateCouponPricer.

data YoYInflationCouponPricer Source #

Pricer for capped/floored yoyInflationLeg coupons. All 3 concrete upstream pricers (Black/UnitDisplacedBlack/Bachelier) share one ctor shape and are bound as constructors of this single type, mirroring FloatingRateCouponPricer/EquityCashFlowPricer (a standalone pricer type, not part of any GenX hierarchy).

Configuration

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 Discounting y Source #

Where discount factors come from.

data BpsDiscounting y Source #

Discounting restricted to the cases bps supports: upstream has no Z-spreaded bps.

data LinearTsrPricerStrategy Source #

The strategy LinearTsrPricer uses to pick the integration cut-off strike bounds; each carries the strategy-specific parameter upstream's corresponding Settings::withX takes (LinearTsrRateBound has none). Pass explicit bounds via LinearTsrPricerSettings' ltsrBounds rather than baking upstream's own default bounds in here, since upstream's no-explicit-bounds overloads aren't just sugar for those same numbers -- they also flip Settings::defaultBounds_, which under a normal-vol swaption surface adjusts the lower bound to min(-upperBound, lowerBound) (see qlcashflowslineartsrpricer.cpp). Passing Nothing reaches that adjustment; passing explicit bounds via Just does not.

data LinearTsrPricerSettings Source #

ltsrBounds of Nothing uses upstream's own default lower/upper rate bounds (and, for a normal-vol surface, its default-bounds strike adjustment -- see LinearTsrPricerStrategy); Just (lower, upper) pins explicit bounds instead.

Constructors

Hierarchy conversion

toCouponLeg :: GenLeg l -> IO CouponLeg Source #

try to downcast leg to a coupon leg

Cash flows and coupons

leg Source #

Arguments

:: [(Day, Double)]

amounts and dates

-> IO Leg 

cashFlowLeg Source #

Arguments

:: [GenCashFlow cf]

cashFlows

-> IO Leg 

Build a Leg from a homogeneous cash-flow subtype, or from explicitly erased CashFlow values when the elements are heterogeneous. The leg takes shared ownership of each flow, so it remains valid when the individual values are no longer retained.

simpleCashFlow Source #

Arguments

:: Double

amount

-> Day

payment date

-> IO CashFlow 

A predetermined payment, suitable for mixing with other cash-flow kinds in cashFlowLeg. For a leg made entirely of such payments, leg is a more concise API.

indexedCashFlow Source #

Arguments

:: Double

notional

-> GenIndex idx

index

-> Day

base date

-> Day

fixing date

-> Day

payment date

-> Bool

growthOnly

-> IO IndexedCashFlow 

A payment of notional * i(fixingDate) / i(baseDate), or the same ratio minus one when growthOnly is true. QuantLib does no date adjustment here; callers supply the already adjusted fixing and payment dates. This is the generic building block behind the specialized CPI and equity cash flows, and accepts any bound GenIndex.

redemption Source #

Arguments

:: Double

amount

-> Day

date

-> IO CashFlow 

A single redemption payment.

amortizingPayment Source #

Arguments

:: Double

amount

-> Day

date

-> IO CashFlow 

An amortizing principal payment.

fixedRateCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Double

rate

-> DayCounter

dayCounter

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> Maybe Day

exCouponDate

-> IO FixedRateCoupon 

A fixed coupon with explicitly supplied payment, accrual, reference-period, and ex-coupon dates. Nothing for a reference or ex-coupon date passes QuantLib's empty Date(). A homogeneous list of fixed coupons can be passed directly to cashFlowLeg; use asCashFlow only when mixing it with other cash-flow types.

floatingRateCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> GenInterestRateIndex ridx

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO FloatingRateCoupon 

A generic floating-rate coupon. Attach a FloatingRateCouponPricer to the resulting leg with setCouponPricer before evaluating a coupon whose rate requires one. Nothing dates pass QuantLib's empty Date(); all other constructor parameters are explicit.

iborCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> GenIborIndex ibor

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO IborCoupon 

An Ibor-specific floating coupon. Prefer this to floatingRateCoupon when the index is Ibor: QuantLib then uses IborCoupon's fixing value/maturity-date logic rather than the base floating-coupon implementation. Date and pricer handling are as in floatingRateCoupon.

averageBmaCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> BMAIndex

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> IO AverageBMACoupon 

A BMA-index coupon with explicitly supplied accrual and reference dates.

cappedFlooredCoupon Source #

Arguments

:: GenFloatingRateCoupon frc

underlying

-> Maybe Double

cap

-> Maybe Double

floor

-> IO FloatingRateCoupon 

Wrap a floating-rate coupon with optional cap and floor rates.

strippedCappedFlooredCoupon Source #

Arguments

:: GenFloatingRateCoupon frc

underlying

-> Maybe Double

cap

-> Maybe Double

floor

-> IO StrippedCappedFlooredCoupon 

Strip the embedded cap/floor option out of a capped/floored coupon: builds a CappedFlooredCoupon from underlying, cap and floor (as cappedFlooredCoupon does), then wraps it so the option's rate, cap and floor are separately readable.

cappedFlooredIborCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> GenIborIndex ibor

index

-> Double

gearing

-> Double

spread

-> Maybe Double

cap

-> Maybe Double

floor

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO FloatingRateCoupon 

Ibor coupon with optional cap and floor rates.

digitalIborCoupon Source #

Arguments

:: IborCoupon

underlying

-> Maybe Double

callStrike

-> PositionType

callPosition

-> Bool

callATM

-> Maybe Double

callDigitalPayoff

-> Maybe Double

putStrike

-> PositionType

putPosition

-> Bool

putATM

-> Maybe Double

putDigitalPayoff

-> Maybe DigitalReplication

replication

-> Bool

nakedOption

-> IO DigitalCoupon 

Ibor coupon with embedded digital call and put options.

digitalCoupon Source #

A floating coupon with replicated digital call and put payoffs. Optional strikes/payoffs use Nothing for QuantLib's null-rate sentinel.

multipleResetsCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Schedule

fixingSchedule

-> Word

fixingDays

-> GenIborIndex ibor

index

-> Double

gearing

-> Double

couponSpread

-> Double

rateSpread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Maybe Day

exCouponDate

-> IO MultipleResetsCoupon 

Ibor coupon whose rate averages multiple reset dates in each accrual period.

rangeAccrualFloatersCoupon :: Day -> Double -> GenIborIndex ibor -> Day -> Day -> Word -> DayCounter -> Double -> Double -> Maybe Day -> Maybe Day -> Schedule -> Double -> Double -> IO RangeAccrualFloatersCoupon Source #

A range-accrual coupon. Attach the existing range-accrual pricer before asking for its rate; priceWithoutOptionality needs only a discount curve.

overnightIndexedCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> OvernightIborIndex

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

telescopicValueDates

-> RateAveragingType

averagingMethod

-> Word

lookbackDays

-> Word

lockoutDays

-> Bool

applyObservationShift

-> Bool

includeSpread

-> Maybe Day

rateComputationStartDate

-> Maybe Day

rateComputationEndDate

-> Maybe Day

exCouponDate

-> Maybe Int

rounding

-> IO OvernightIndexedCoupon 

Overnight-index coupon with explicit observation and accrual conventions.

cappedFlooredOvernightIndexedCoupon Source #

Arguments

:: OvernightIndexedCoupon

underlying

-> Maybe Double

cap

-> Maybe Double

floor

-> Bool

nakedOption

-> Bool

includeSpread

-> IO FloatingRateCoupon 

Capped/floored overnight-index coupon.

cpiCoupon Source #

Arguments

:: Double

baseCPI

-> Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> GenZeroInflationIndex zidx

index

-> (Int, TimeUnit)

observationLag

-> CPIInterpolationType

observationInterpolation

-> DayCounter

dayCounter

-> Double

fixedRate

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> Maybe Day

exCouponDate

-> IO CPICoupon 

CPI-linked coupon whose base fixing is supplied directly.

cpiCouponFromBaseDate Source #

Arguments

:: Day

baseDate

-> Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> GenZeroInflationIndex zidx

index

-> (Int, TimeUnit)

observationLag

-> CPIInterpolationType

observationInterpolation

-> DayCounter

dayCounter

-> Double

fixedRate

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> Maybe Day

exCouponDate

-> IO CPICoupon 

CPI-linked coupon whose base fixing is determined by a base date.

cpiCouponWithBaseDate Source #

Arguments

:: Double

baseCPI

-> Day

baseDate

-> Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> GenZeroInflationIndex zidx

index

-> (Int, TimeUnit)

observationLag

-> CPIInterpolationType

observationInterpolation

-> DayCounter

dayCounter

-> Double

fixedRate

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> Maybe Day

exCouponDate

-> IO CPICoupon 

CPI-linked coupon with both an explicit base CPI and base date.

yoyInflationCoupon :: Day -> Double -> Day -> Day -> Word -> YoYInflationIndex -> (Int, TimeUnit) -> CPIInterpolationType -> DayCounter -> Double -> Double -> Maybe Day -> Maybe Day -> IO YoYInflationCoupon Source #

A year-on-year inflation coupon. As for yoyInflationLeg, attach a YoY inflation coupon pricer before evaluating the coupon rate.

zeroInflationCashFlow Source #

Arguments

:: Double

notional

-> ZeroInflationIndex 
-> CPIInterpolationType

observationInterpolation

-> Day

startDate

-> Day

endDate

-> (Word, TimeUnit)

observationLag

-> Day

paymentDate

-> Bool

growthOnly

-> IO ZeroInflationCashFlow 

Cash flow dependent on a ZeroInflationIndex ratio (not a coupon -- no accruals). The ratio is taken between fixings observed at startDate and endDate minus observationLag.

cpiCashFlow Source #

Arguments

:: Double

notional

-> ZeroInflationIndex 
-> Maybe Day

baseDate

-> Maybe Double

baseFixing

-> Day

observationDate

-> (Word, TimeUnit)

observationLag

-> CPIInterpolationType

interpolation

-> Day

paymentDate

-> Bool

growthOnly

-> IO CPICashFlow 

CPI-linked cash flow (not a coupon -- no accruals), with an optional explicit baseFixing (pass Nothing to derive it from baseDate instead).

equityCashFlow Source #

Arguments

:: Double

notional

-> EquityIndex 
-> Day

baseDate

-> Day

fixingDate

-> Day

paymentDate

-> Bool

growthOnly

-> IO EquityCashFlow 

Cash flow dependent on the total return of an EquityIndex (not a coupon -- no accruals): index(fixingDate)/index(baseDate), or that ratio minus one if growthOnly. If no EquityCashFlowPricer is attached via setEquityCashFlowPricer, amount computes this ratio directly from the index; a pricer (e.g. equityQuantoCashFlowPricer) is only needed to price a quanto-adjusted variant.

CMS coupons and digital replication

cmsCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> GenSwapIndex sidx

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO CmsCoupon 

Constant-maturity-swap (CMS) coupon.

The start and end dates are used as supplied: QuantLib performs no business-day adjustment when constructing this coupon, so callers must supply already adjusted dates. Attach a CMS pricer before asking for its rate or amount.

cappedFlooredCmsCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> GenSwapIndex sidx

index

-> Double

gearing

-> Double

spread

-> Maybe Double

cap

-> Maybe Double

floor

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO FloatingRateCoupon 

CMS coupon with optional cap and floor. This is QuantLib's CappedFlooredCmsCoupon: it wraps a CmsCoupon in a capped/floored coupon and returns it at the useful FloatingRateCoupon level. Nothing means no cap or floor.

cmsSpreadCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> SwapSpreadIndex

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO FloatingRateCoupon 

Constant-maturity-swap-spread coupon. Its index is the geared difference of two swap rates. QuantLib does no date adjustment at construction, so callers must provide business dates.

cappedFlooredCmsSpreadCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> SwapSpreadIndex

index

-> Double

gearing

-> Double

spread

-> Maybe Double

cap

-> Maybe Double

floor

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> IO FloatingRateCoupon 

Capped/floored CMS-spread coupon, returned at the useful FloatingRateCoupon level. Nothing represents QuantLib's absent cap or floor.

digitalReplication Source #

Arguments

:: ReplicationType

replicationType

-> Double

gap

-> IO DigitalReplication 

Digital-option replication strategy. It specifies the sub, central, or super replication used to price the embedded digital option in a digital coupon; gap is the call/put-spread width used by that replication.

digitalCmsCoupon Source #

Arguments

:: CmsCoupon

underlying

-> Maybe Double

callStrike

-> PositionType

callPosition

-> Bool

callATM

-> Maybe Double

callDigitalPayoff

-> Maybe Double

putStrike

-> PositionType

putPosition

-> Bool

putATM

-> Maybe Double

putDigitalPayoff

-> Maybe DigitalReplication

replication

-> Bool

nakedOption

-> IO DigitalCmsCoupon 

CMS-rate coupon with embedded digital call and put options.

QuantLib evaluates the digital options by call/put-spread replication. A supplied digital payoff produces a cash-or-nothing option; without one the option is asset-or-nothing. When nakedOption is true, the underlying coupon rate is excluded from the payoff. Optional strikes and payoffs use Nothing for QuantLib's null-rate sentinel.

digitalCmsSpreadCoupon Source #

Arguments

:: Day

paymentDate

-> Double

nominal

-> Day

accrualStartDate

-> Day

accrualEndDate

-> Word

fixingDays

-> SwapSpreadIndex

index

-> Double

gearing

-> Double

spread

-> Maybe Day

referencePeriodStart

-> Maybe Day

referencePeriodEnd

-> DayCounter

dayCounter

-> Bool

inArrears

-> Maybe Day

exCouponDate

-> BusinessDayConvention

fixingConvention

-> Maybe Double

callStrike

-> PositionType

callPosition

-> Bool

callATM

-> Maybe Double

callDigitalPayoff

-> Maybe Double

putStrike

-> PositionType

putPosition

-> Bool

putATM

-> Maybe Double

putDigitalPayoff

-> Maybe DigitalReplication

replication

-> Bool

nakedOption

-> IO DigitalCmsSpreadCoupon 

CMS-spread-rate coupon with embedded digital call and put options. Builds its own underlying CmsSpreadCoupon from paymentDate through fixingConvention (as cmsSpreadCoupon does), then wraps it exactly as digitalCmsCoupon wraps a CmsCoupon. QuantLib does no date adjustment at construction, so callers must provide business dates. Optional strikes and payoffs use Nothing for QuantLib's null-rate sentinel.

Dividends

fixedDividend Source #

Arguments

:: Double

amount

-> Day

date

-> IO Dividend 

Predetermined cash flow paying a fixed amount at date.

fractionalDividendWithNominal Source #

Arguments

:: Double

rate

-> Double

nominal

-> Day

date

-> IO Dividend 

Predetermined cash flow paying rate times nominal at date.

fractionalDividend Source #

Arguments

:: Double

rate

-> Day

date

-> IO Dividend 

Predetermined cash flow paying a fractional rate of the underlying's price at date.

Coupon legs

averageBmaLeg Source #

Arguments

:: Schedule 
-> BMAIndex 
-> NonEmpty Double

notionals

-> DayCounter 
-> BusinessDayConvention 
-> [Double]

gearings

-> [Double]

spreads

-> IO Leg 

Build a leg of average-BMA coupons.

iborLeg :: Schedule -> GenIborIndex ibor -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> [Double] -> [Double] -> Bool -> Bool -> IO Leg Source #

iborLeg keeps its original 12-arg signature -- existing callers are unaffected -- but now delegates to iborLeg_, the raw binding widened to IborLeg's full builder surface, hardcoding upstream's own defaults for the params iborLeg doesn't expose. Use iborLegWithOptions to reach those (payment lag/calendar, ex-coupon period, fixing convention, indexed/at-par coupons) via IborLegOpts.

iborLegWithOptions :: Schedule -> GenIborIndex ibor -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> [Double] -> [Double] -> Bool -> Bool -> IborLegOpts -> IO Leg Source #

iborLeg widened to every IborLeg builder-method param via IborLegOpts.

cmsLeg :: Schedule -> GenSwapIndex sidx -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> [Double] -> [Double] -> Bool -> Bool -> IO Leg Source #

CMS leg builder (analog of iborLeg), 12-arg core shape -- same defaults-hardcoding pattern as iborLeg for the params not in this signature. Use cmsLegWithOptions to reach them (CmsLegOpts).

cmsLegWithOptions :: Schedule -> GenSwapIndex sidx -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> [Double] -> [Double] -> Bool -> Bool -> CmsLegOpts -> IO Leg Source #

cmsLeg widened to every CmsLeg builder-method param via CmsLegOpts.

cmsSpreadLeg Source #

Arguments

:: Schedule 
-> SwapSpreadIndex

swapSpreadIndex

-> NonEmpty Double

notionals

-> DayCounter 
-> BusinessDayConvention

paymentAdjustment

-> [Word]

fixingDays

-> [Double]

gearings

-> [Double]

spreads

-> [Double]

caps

-> [Double]

floors

-> Bool

inArrears

-> Bool

zeroPayments

-> IO Leg 

CMS-spread leg builder. Unlike CmsLeg, upstream's CmsSpreadLeg has no ex-coupon-period/fixing-convention builder methods, so this binds its full builder surface directly with no accompanying options record.

digitalCmsLeg :: Schedule -> GenSwapIndex sidx -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> Bool -> DigitalCmsLegOpts -> IO Leg Source #

Build a sequence of digital CMS-rate coupons. The options record covers all digital call/put and replication choices.

digitalCmsSpreadLeg :: Schedule -> SwapSpreadIndex -> NonEmpty Double -> DayCounter -> BusinessDayConvention -> [Word] -> [Double] -> [Double] -> Bool -> DigitalCmsSpreadLegOpts -> IO Leg Source #

Build a sequence of digital CMS-spread-rate coupons. The options record covers all digital call/put and replication choices, exactly as digitalCmsLeg does for the plain CMS index case.

overnightLeg Source #

Arguments

:: Schedule 
-> OvernightIborIndex 
-> NonEmpty Double

notionals'

-> DayCounter 
-> BusinessDayConvention 
-> [Double]

gearings

-> [Double]

spreads

-> IO Leg 

Build a leg of overnight-index coupons.

rangeAccrualLeg Source #

Arguments

:: Schedule 
-> GenIborIndex ibor 
-> NonEmpty Double

notionals

-> DayCounter 
-> BusinessDayConvention 
-> [Word]

fixingDays

-> [Double]

gearings

-> [Double]

spreads

-> [Double]

lowerTriggers

-> [Double]

upperTriggers

-> (Int, TimeUnit)

observationTenor

-> BusinessDayConvention 
-> IO Leg 

Build a leg of range-accrual floating-rate coupons.

cpiLeg Source #

Arguments

:: Schedule 
-> ZeroInflationIndex 
-> Double

baseCPI

-> (Word, TimeUnit)

observationLag

-> NonEmpty Double

notionals

-> NonEmpty Double

fixedRates

-> DayCounter

paymentDayCounter

-> BusinessDayConvention

paymentAdjustment

-> Calendar

paymentCalendar

-> CPIInterpolationType

observationInterpolation

-> Bool

subtractInflationNominal

-> IO Leg 

Fixed-rate coupons scaled by the ratio of a ZeroInflationIndex fixing to baseCPI (a CPICoupon leg -- no capped/floored variant, unlike yoyInflationLeg: QL 1.43 has no CappedFlooredCPICoupon class to build one from, see README.md's TODO).

yoyInflationLeg Source #

Arguments

:: Schedule 
-> Calendar 
-> YoYInflationIndex 
-> (Word, TimeUnit)

observationLag

-> CPIInterpolationType

interpolation

-> NonEmpty Double

notionals

-> DayCounter

paymentDayCounter

-> BusinessDayConvention

paymentAdjustment

-> [Word]

fixingDays

-> [Double]

gearings

-> [Double]

spreads

-> [Double]

caps

-> [Double]

floors

-> IO Leg 

Year-on-year inflation-linked coupons (a YoYInflationCoupon leg). Non-empty caps/floors build CappedFlooredYoYInflationCoupons instead of plain ones -- but any resulting coupon (capped or not) still needs a pricer set via setYoyInflationCouponPricer before its 'QuantLib.CashFlow.npvWithZSpread/amount can be computed: upstream's InflationCoupon::rate() requires pricer_ unconditionally, not just for the capped/floored case (confirmed by reading inflationcoupon.cpp). CPI-leg (cpiLeg) caps/floors have no equivalent in QL 1.43 (no CappedFlooredCPICoupon class exists upstream, see README.md's TODO) -- this is a QuantLib-version limitation, not an unbound feature.

Coupon pricers

blackIborCouponPricer Source #

Arguments

:: GenOptionletVolatilityStructure ov 
-> TimingAdjustment 
-> Maybe (GenQuote q)

correlation

-> Maybe Bool

useIndexedCoupon

-> IO FloatingRateCouponPricer 

Black-formula pricer for capped/floored Ibor coupons

blackIborQuantoCouponPricer Source #

Arguments

:: GenBlackVolTermStructure bv

fxVolatility

-> GenQuote q

underlyingFxCorrelation

-> GenOptionletVolatilityStructure ov

capletVolatility

-> IO FloatingRateCouponPricer 

Experimental quanto-adjusted Black-formula pricer for capped/floored Ibor coupons. The FX Black volatility and underlying/FX correlation determine the quanto adjustment; the caplet volatility supplies the ordinary Ibor optionlet pricing inputs. The three handles are retained by QuantLib, so relinking their underlying quotes or term structures updates the pricer in the usual way.

analyticHaganPricer Source #

CMS-coupon pricer via static replication (Hagan's "Conundrums..."), using an analytic closed-form approximation of the replication integrals.

numericHaganPricer Source #

Arguments

:: GenSwaptionVolatilityStructure sv 
-> YieldCurveModel 
-> GenQuote q

meanReversion

-> Double

lowerLimit

-> Double

upperLimit

-> Double

precision

-> Double

hardUpperLimit

-> IO CmsCouponPricer 

CMS-coupon pricer via static replication (Hagan's "Conundrums..."), evaluating the replication integrals by numerical integration over vanilla swaption prices.

linearTsrPricer :: GenSwaptionVolatilityStructure sv -> GenQuote q -> Maybe (GenYieldTermStructure y) -> LinearTsrPricerSettings -> IO CmsCouponPricer Source #

CMS-coupon pricer using a linear terminal swap rate model (Andersen/Piterbarg 16.3.2). couponDiscountCurve of Nothing uses the coupon's own discount curve, matching upstream's default empty Handle. The upstream constructor's trailing integrator parameter (an advanced numerical-integration override) is not exposed; upstream's own default (ext::shared_ptr<Integrator>()) is always used.

lognormalCmsSpreadPricer :: CmsCouponPricer -> GenQuote q -> Maybe (GenYieldTermStructure y) -> Word -> Maybe VolatilityType -> Maybe Double -> Maybe Double -> IO FloatingRateCouponPricer Source #

CMS-spread pricer using the Brigo--Mercurio bivariate model, with extensions for shifted lognormal and normal dynamics. volatilityType of Nothing inherits the type and shifts from the component swaption volatility structures; in that case both shifts must be Nothing.

rangeAccrualPricerByBgm Source #

Arguments

:: Double

correlation

-> SmileSection

smilesOnExpiry

-> SmileSection

smilesOnPayment

-> Bool

withSmile

-> Bool

byCallSpread

-> IO FloatingRateCouponPricer 

averagingMultipleResetsPricer :: IO FloatingRateCouponPricer Source #

Pricer that arithmetically averages multiple Ibor resets.

compoundingMultipleResetsPricer :: IO FloatingRateCouponPricer Source #

Pricer that compounds multiple Ibor resets.

compoundingOvernightIndexedCouponPricer Source #

Arguments

:: Maybe OptionletVolatilityStructure

capletVolatility

-> Bool

byApprox

-> IO FloatingRateCouponPricer 

Compounding overnight-index coupon pricer.

arithmeticAveragedOvernightIndexedCouponPricer Source #

Arguments

:: Double

meanReversion

-> Double

volatility

-> Bool

byApprox

-> Maybe OptionletVolatilityStructure

capletVolatility

-> Bool

effective

-> IO FloatingRateCouponPricer 

Arithmetic-average overnight-index coupon pricer.

blackCompoundingOvernightIndexedCouponPricer Source #

Arguments

:: Maybe OptionletVolatilityStructure

capletVolatility

-> Bool

effective

-> IO FloatingRateCouponPricer 

Black-formula compounding overnight-index coupon pricer.

blackAveragingOvernightIndexedCouponPricer Source #

Arguments

:: Maybe OptionletVolatilityStructure

capletVolatility

-> Bool

effective

-> IO FloatingRateCouponPricer 

Black-formula arithmetic-average overnight-index coupon pricer.

cpiCouponPricer Source #

Arguments

:: Maybe YieldTermStructure

nominalTermStructure

-> IO CPICouponPricer 

CPI coupon pricer using an optional nominal yield curve.

cpiCouponPricerWithVol Source #

Arguments

:: CPIVolatilitySurface

volatilitySurface

-> Maybe YieldTermStructure

nominalTermStructure

-> IO CPICouponPricer 

CPI coupon pricer using a CPI volatility surface and optional nominal yield curve.

blackYoyInflationCouponPricer Source #

Black-formula pricer for capped/floored yoyInflationLeg coupons.

unitDisplacedBlackYoyInflationCouponPricer Source #

Unit-Displaced-Black-formula pricer for capped/floored yoyInflationLeg coupons.

bachelierYoyInflationCouponPricer Source #

Bachelier-formula pricer for capped/floored yoyInflationLeg coupons.

equityQuantoCashFlowPricer Source #

Arguments

:: GenYieldTermStructure y

quantoCurrencyTermStructure

-> GenBlackVolTermStructure bv1

equityVolatility

-> GenBlackVolTermStructure bv2

fxVolatility

-> GenQuote q

correlation

-> IO EquityCashFlowPricer 

Quanto-adjusted pricer for an EquityCashFlow whose equity leg is denominated in a currency other than the swap's payment currency.

Mutators

setCpiCouponPricer Source #

Arguments

:: CPICoupon

coupon

-> CPICouponPricer

pricer

-> IO () 

Attach a CPI coupon pricer to a CPI coupon.

setFloatingRateCouponPricer Source #

Arguments

:: GenFloatingRateCoupon frc

coupon

-> GenFloatingRateCouponPricer frcp

pricer

-> IO () 

Set the coupon pricer used to calculate a floating-rate coupon's rate.

setYoyInflationCouponPricer :: GenLeg l -> YoYInflationCouponPricer -> IO () Source #

Set the pricer of every YoYInflationCapFloor-ready YoYInflationCoupon/CappedFlooredYoYInflationCoupon in leg. Required before pricing (via 'QuantLib.CashFlow.npvWithZSpread or an setPricingEngined instrument built on the leg) any yoyInflationLeg built with non-empty caps/floors -- yoyInflationLeg auto-attaches a default (non-vol) pricer only when caps and floors are both empty.

setEquityCashFlowPricer :: EquityCashFlow -> EquityCashFlowPricer -> IO () Source #

Attach a pricer (e.g. from equityQuantoCashFlowPricer) to a single EquityCashFlow; see setEquityLegPricer to attach one to every EquityCashFlow in a leg instead.

setCouponPricer :: GenLeg l -> GenFloatingRateCouponPricer frcp -> IO () Source #

Set the pricer of every floating-rate coupon in leg.

setCouponPricers :: GenLeg l -> [GenFloatingRateCouponPricer frcp] -> IO () Source #

Set the pricer of every floating-rate coupon in leg, picking each coupon's pricer from pricers by matching coupon type.

setEquityLegPricer :: GenLeg l -> EquityCashFlowPricer -> IO () Source #

Attach a pricer to every EquityCashFlow found in leg (non-EquityCashFlow entries are left untouched); see setEquityCashFlowPricer to attach one to a single cash flow instead.

Inspectors

Coupon fixings

class HasFixingDates coupon where Source #

Methods

fixingDates :: coupon -> IO [Day] Source #

fixingDependencies :: GenLeg l -> IO [(String, Day)] Source #

Coupon types that expose the dates of their component index fixings. |Every fixing the cash flows of this leg need, as (index name, fixing date) pairs in leg order. QuantLib has no requiredFixings query, so this walks the leg itself, unwrapping decorating coupons (capped/floored, stripped, digital) and asking each coupon for its own fixing dates: one for an Ibor, CMS or CMS-spread coupon, one per averaged date for an overnight, BMA or multiple-resets coupon, and the fixing and base dates for an inflation coupon or an index-linked payment. A CMS-spread coupon reports its two underlying swap indexes rather than the spread index, because that is where the fixings are stored. Names are name, the key QuantLib's process-global fixing store uses. A cash flow that needs no fixing -- a redemption, a fixed-rate coupon -- contributes nothing. Duplicates are not removed: two coupons may fix the same index on the same date.

class HasIndexFixings coupon where Source #

Coupon types that expose their component index fixings.

Methods

indexFixings :: coupon -> IO [Double] Source #

baseFixing :: GenIndexedCashFlow icf -> IO Double Source #

The fixing used as the base of an indexed cash flow's return ratio.

indexFixing :: GenIndexedCashFlow icf -> IO Double Source #

The fixing used as the numerator of an indexed cash flow's return ratio.

Leg analytics

amount Source #

Arguments

:: GenCashFlow cf

cashFlow

-> IO Double 

The undiscounted amount paid by a cash flow on its payment date.

date Source #

Arguments

:: GenCashFlow cf

cashFlow

-> Day 

The payment date of a cash flow.

duration Source #

Arguments

:: GenLeg l 
-> InterestRate

yield

-> DurationType 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

Cash-flow duration. The simple duration of a string of cash flows is defined as \[ D_{\mathrm{simple}} = \frac{\sum t_i c_i B(t_i)}{\sum c_i B(t_i)} \] where $ c_i $ is the amount of the $ i $-th cash flow, $ t_i $ is its payment time, and $ B(t_i) $ is the corresponding discount according to the passed yield.The modified duration is defined as \[ D_{\mathrm{modified}} = -\frac{1}{P} \frac{\partial P}{\partial y} \] where $ P $ is the present value of the cash flows according to the given IRR $ y $.The Macaulay duration is defined for a compounded IRR as \[ D_{\mathrm{Macaulay}} = \left( 1 + \frac{y}{N} \right) D_{\mathrm{modified}} \] where $ y $ is the IRR and $ N $ is the number of cash flows per year.

accrualDays Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Int 

Number of days in the accrual period of the coupon paying on settlementDate.

accrualEndDate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

End of the accrual period of the coupon paying on settlementDate.

accrualPeriod Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Length, in years, of the accrual period of the coupon paying on settlementDate.

accrualStartDate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

Start of the accrual period of the coupon paying on settlementDate.

accruedAmount Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Accrued amount of the coupon paying on settlementDate.

accruedDays Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Int 

Number of days accrued so far on the coupon paying on settlementDate.

accruedPeriod Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Fraction of the accrual period elapsed, as of settlementDate, for the coupon paying then.

atmRate Source #

Arguments

:: GenLeg l 
-> GenYieldTermStructure y 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> Double

npv

-> IO Double 

At-the-money rate of the cash flows. The result is the fixed rate for which a fixed rate cash flow vector, equivalent to the input vector, has the required NPV according to the given term structure. If the required NPV is not given, the input cash flow vector's NPV is used instead.

basisPointValue Source #

Arguments

:: GenLeg l 
-> InterestRate 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

Basis-point value. Obtained by setting dy = 0.0001 in the 2nd-order Taylor series expansion.

bps :: GenLeg l -> BpsDiscounting y -> Bool -> Maybe Day -> Maybe Day -> IO Double Source #

Basis-point sensitivity of the cash flows under the given discounting.

convexity Source #

Arguments

:: GenLeg l 
-> InterestRate 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

Cash-flow convexity. The convexity of a string of cash flows is defined as \[ C = \frac{1}{P} \frac{\partial^2 P}{\partial y^2} \] where $ P $ is the present value of the cash flows according to the given IRR $ y $.

isExpired Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Bool 

Whether every cash flow in the leg has occurred as of settlementDate.

maturityDate :: GenLeg l -> IO Day Source #

Date of the leg's last cash flow.

startDate :: GenLeg l -> IO Day Source #

Returns the start (i.e. first accrual) date for the given Leg

cashFlows Source #

Arguments

:: GenLeg l 
-> Maybe Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO [(Day, Double, Bool)]

date, amount, hasOccurred

return cash flows together with an indicator whether they occurred as of settlementDate

nextCashFlows Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Leg 

return cashflows that will occur after settlementDate

nextCashFlowAmount Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Amount of the first cash flow paying after settlementDate.

nextCashFlowDate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

Date of the first cash flow paying after settlementDate.

nextCouponRate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Coupon rate of the next cash flow paying after settlementDate.

previousCashFlows Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Leg 

return cashflows that occurred before settlementDate

previousCashFlowAmount Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Amount of the last cash flow that paid before or at settlementDate.

previousCashFlowDate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

Date of the last cash flow that paid before or at settlementDate.

previousCouponRate Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Coupon rate of the last cash flow that paid before or at settlementDate.

nominal Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

Nominal of the coupon paying on settlementDate.

npv :: GenLeg l -> Discounting y -> Bool -> Maybe Day -> Maybe Day -> IO Double Source #

NPV of the cash flows under the given discounting.

npvBps Source #

Arguments

:: GenLeg l 
-> GenYieldTermStructure y 
-> Bool

includeSettlementDateFlows

-> Day

settlementDate

-> Day

npvDate

-> IO (Double, Double) 

NPV and BPS of the cash flows. The NPV and BPS of the cash flows calculated together for performance reason

referencePeriodEnd Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

End of the reference period of the coupon paying on settlementDate.

referencePeriodStart Source #

Arguments

:: GenLeg l 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

Start of the reference period of the coupon paying on settlementDate.

yield Source #

Arguments

:: GenLeg l 
-> Double

npv

-> DayCounter 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> Double

accuracy

-> Word

maxIterations

-> Double

guess

-> IO Double 

Implied internal rate of return. The function verifies the theoretical existance of an IRR and numerically establishes the IRR to the desired precision.

yieldValueBasisPoint Source #

Arguments

:: GenLeg l 
-> InterestRate

yield

-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

Yield value of a basis point. The yield value of a one basis point change in price is the derivative of the yield with respect to the price multiplied by 0.01

zSpread Source #

Arguments

:: GenLeg l 
-> Double

npv

-> GenYieldTermStructure y 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> Double

accuracy

-> Word

maxIterations

-> Double

guess

-> IO Double 

implied Z-spread.

Coupon rates and prices

coupons Source #

Arguments

:: CouponLeg

leg

-> IO [Coupon] 

The individual coupons of a coupon leg, e.g. to ask each one its own rate or couponAccruedAmount. Pair with toCouponLeg to get here from a Leg.

couponAccrualStartDates :: CouponLeg -> IO [Day] Source #

start of the accrual periods for a coupon leg

couponAccruedAmount Source #

Arguments

:: GenCoupon c

coupon

-> Day

date

-> IO Double 

Interest accrued on a single coupon up to the given date -- nominal times rate times the accrued fraction of the accrual period. Named apart from the leg-level accruedAmount, which sums a whole Leg and takes settlement-date arguments this does not.

rate Source #

Arguments

:: GenCoupon c

coupon

-> IO Double 

The coupon rate, at the Coupon level every accruing cash flow shares. How it is obtained is the subtype's business: a FixedRateCoupon returns its own rate, a CPICoupon its fixed rate times the index ratio, and a FloatingRateCoupon requires an attached FloatingRateCouponPricer and throws without one (see setFloatingRateCouponPricer).

price Source #

Arguments

:: GenFloatingRateCoupon frc

coupon

-> Maybe (GenYieldTermStructure y)

discountingCurve

-> IO Double 

Net present value of the coupon, i.e. the coupon amount discounted off the given curve. Nothing uses the coupon's own default discounting (an empty Handle<YieldTermStructure>).

interestRate :: FixedRateCoupon -> IO InterestRate Source #

The coupon's own fixed rate, as an InterestRate (rate value plus day countercompounding frequency) rather than a bare rate -- distinct from rate, which returns a bare Double for the (possibly index-derived) accrual rate.

indexRatio Source #

Arguments

:: CPICoupon

coupon

-> Day

d

-> IO Double 

The ratio of the (possibly interpolated) index value on d to the coupon's base index value, i.e. the inflation-adjustment factor applied to the coupon's fixed rate.

convexityAdjustment Source #

Arguments

:: GenFloatingRateCoupon frc

coupon

-> IO Double 

The adjustment (e.g. for coupons that fix in arrears) applied to the plain index fixing to get the effective, convexity-adjusted fixing used in rate.

swapletRate :: GenFloatingRateCouponPricer frcp -> IO Double Source #

Rate for a fully-determined coupon period, with no cap/floor.

swapletPrice :: GenFloatingRateCouponPricer frcp -> IO Double Source #

Price (NPV contribution) for a fully-determined coupon period, with no cap/floor. Not every pricer supports this: e.g. CompoundingOvernightIndexedCouponPricer throws.

capletPrice Source #

Arguments

:: GenFloatingRateCouponPricer frcp 
-> Double

effectiveCap

-> IO Double 

Price of the caplet with the given effective cap rate. Not every pricer supports this.

capletRate Source #

Arguments

:: GenFloatingRateCouponPricer frcp 
-> Double

effectiveCap

-> IO Double 

Rate of the caplet with the given effective cap rate. Not every pricer supports this.

floorletPrice Source #

Arguments

:: GenFloatingRateCouponPricer frcp 
-> Double

effectiveFloor

-> IO Double 

Price of the floorlet with the given effective floor rate. Not every pricer supports this.

floorletRate Source #

Arguments

:: GenFloatingRateCouponPricer frcp 
-> Double

effectiveFloor

-> IO Double 

Rate of the floorlet with the given effective floor rate. Not every pricer supports this.

gap Source #

Arguments

:: DigitalReplication

replication

-> Double 

Capped and floored coupons

capRate Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Double 

The cap actually in effect for this coupon, accounting for the sign of gearing; QuantLib's null-rate sentinel means no cap applies.

floorRate Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Double 

The floor actually in effect for this coupon, accounting for the sign of gearing; QuantLib's null-rate sentinel means no floor applies.

effectiveCap Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Double 

The cap rate translated back to the underlying index rate (before gearing/spread); QuantLib's null-rate sentinel means the coupon is not capped.

effectiveFloor Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Double 

The floor rate translated back to the underlying index rate (before gearing/spread); QuantLib's null-rate sentinel means the coupon is not floored.

isCap Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Bool 

Whether this coupon has a cap in effect.

isFloor Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Bool 

Whether this coupon has a floor in effect.

isCollar Source #

Arguments

:: StrippedCappedFlooredCoupon

coupon

-> Bool 

Whether this coupon is both capped and floored (a collar).