hasquant
Safe HaskellNone
LanguageHaskell2010

QuantLib.CashFlow

Synopsis

Documentation

type Leg = GenLeg CLeg #

type CouponLeg = GenLeg CCouponLeg #

asLeg :: GenLeg a -> IO Leg #

data Dividend #

data GenLeg a #

leg #

Arguments

:: [(Day, Double)]

amounts and dates

-> IO Leg 

startDate :: GenLeg a -> IO Day #

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

return cashflows that will occur after settlementDate

nextCashFlows #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Leg 

return cashflows that occurred before settlementDate

previousCashFlows #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Leg 

cashFlows #

Arguments

:: Leg 
-> 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

duration #

Arguments

:: GenLeg a 
-> 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 #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Int 

accrualEndDate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

accrualPeriod #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

accrualStartDate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

accruedAmount #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

accruedDays #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Int 

accruedPeriod #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

atmRate #

Arguments

:: GenLeg a 
-> GenYieldTermStructure b 
-> 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.

Basis-point sensitivity of the cash flows. The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given term structure.

basisPointValue' #

Arguments

:: GenLeg a 
-> 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.

basisPointValue #

Arguments

:: GenLeg a 
-> Double 
-> DayCounter 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

bpsFromYield #

Arguments

:: GenLeg a 
-> Double 
-> DayCounter 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

bpsFromYield' #

Arguments

:: GenLeg a 
-> InterestRate 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

Basis-point sensitivity of the cash flows. The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.

bps #

Arguments

:: GenLeg a 
-> GenYieldTermStructure b 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

NPV of the cash flows. For details on z-spread refer to: "Credit Spreads Explained", Lehman Brothers European Fixed Income Research - March 2004, D. O'KaneThe NPV is the sum of the cash flows, each discounted according to the z-spreaded term structure. The result is affected by the choice of the z-spread compounding and the relative frequency and day counter.

convexity' #

Arguments

:: GenLeg a 
-> 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 $.

convexity #

Arguments

:: GenLeg a 
-> Double 
-> DayCounter 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

duration' #

Arguments

:: GenLeg a 
-> Double 
-> DayCounter 
-> Compounding 
-> Frequency 
-> DurationType 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

isExpired #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Bool 

nextCashFlowAmount #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

nextCashFlowDate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

nextCouponRate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

nominal #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

NPV of the cash flows. The IRR is the interest rate at which the NPV of the cash flows equals the dirty price.The NPV is the sum of the cash flows, each discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.

npvFromYield #

Arguments

:: GenLeg a 
-> Double 
-> DayCounter 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

npvFromYield' #

Arguments

:: GenLeg a 
-> InterestRate 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

npv' #

Arguments

:: GenLeg a 
-> GenYieldTermStructure b 
-> Double

zSpread

-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

NPV of the cash flows. The NPV is the sum of the cash flows, each discounted according to the given term structure.

npv #

Arguments

:: GenLeg a 
-> GenYieldTermStructure b 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

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

npvbps #

Arguments

:: GenLeg a 
-> GenYieldTermStructure b 
-> Bool

includeSettlementDateFlows

-> Day

settlementDate

-> Day

npvDate

-> IO (Double, Double) 

implied Z-spread.

previousCashFlowAmount #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

previousCashFlowDate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

previousCouponRate #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO Double 

referencePeriodEnd #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

referencePeriodStart #

Arguments

:: GenLeg a 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> IO (Maybe Day) 

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

yield #

Arguments

:: GenLeg a 
-> Double

npv

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

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> Double

accuracy

-> Word

maxIterations

-> Double

guess

-> IO Double 

yieldValueBasisPoint' #

Arguments

:: GenLeg a 
-> InterestRate

yield

-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> IO Double 

start of the accrual periods for a coupon leg

yieldValueBasisPoint #

Arguments

:: GenLeg a 
-> Double

yield

-> DayCounter 
-> Compounding 
-> Frequency 
-> 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 #

Arguments

:: GenLeg a 
-> Double

npv

-> GenYieldTermStructure b 
-> Compounding 
-> Frequency 
-> Bool

includeSettlementDateFlows

-> Maybe Day

settlementDate

-> Maybe Day

npvDate

-> Double

accuracy

-> Word

maxIterations

-> Double

guess

-> IO Double 

fixedDividend #

Arguments

:: Double

amount

-> Day

date

-> IO Dividend 

fractionalDividend' #

Arguments

:: Double

rate

-> Double

nominal

-> Day

date

-> IO Dividend 

fractionalDividend #

Arguments

:: Double

rate

-> Day

date

-> IO Dividend 

averageBMALeg #

Arguments

:: Schedule 
-> BMAIndex 
-> [Double]

notionals

-> DayCounter 
-> BusinessDayConvention 
-> [Double]

gearings

-> [Double]

spreads

-> IO Leg 

fixedRateLeg #

Arguments

:: Schedule 
-> [Double]

notionals

-> [InterestRate]

couponRates

-> BusinessDayConvention

paymentAdjustment

-> DayCounter

firstPeriodDayCounter

-> Calendar

paymentCalendar

-> IO Leg 

iborLeg #

Arguments

:: Schedule 
-> GenIborIndex a 
-> [Double]

notionals

-> DayCounter 
-> BusinessDayConvention

paymentAdjustment

-> [Word]

fixingDays

-> [Double]

gearings

-> [Double]

spreads

-> [Double]

caps

-> [Double]

floors

-> Bool

inArrears

-> Bool

zeroPayments

-> IO Leg 

overnightLeg #

Arguments

:: Schedule 
-> OvernightIborIndex 
-> [Double]

notionals'

-> DayCounter 
-> BusinessDayConvention 
-> [Double]

gearings

-> [Double]

spreads

-> IO Leg 

rangeAccrualLeg #

Arguments

:: Schedule 
-> GenIborIndex a 
-> [Double]

notionals

-> DayCounter 
-> BusinessDayConvention 
-> [Word]

fixingDays

-> [Double]

gearings

-> [Double]

spreads

-> [Double]

lowerTriggers

-> [Double]

upperTriggers

-> (Int, TimeUnit)

observationTenor

-> BusinessDayConvention 
-> IO Leg 

try to downcast leg to a coupon leg don't blame me, it's how QuantLib works

blackIborCouponPricer :: OptionletVolatilityStructure -> IO FloatingRateCouponPricer #

Black-formula pricer for capped/floored Ibor coupons

numericHaganPricer #

Arguments

:: SwaptionVolatilityStructure 
-> YieldCurveModel 
-> GenQuote a

meanReversion

-> Double

lowerLimit

-> Double

upperLimit

-> Double

precision

-> IO FloatingRateCouponPricer