Options
All
  • Public
  • Public/Protected
  • All
Menu

cashflow-analysis functions

todo

add tests

Hierarchy

  • CashFlows

Index

Methods

Static accrualDays

  • accrualDays(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Integer
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Integer

Static accrualEndDate

  • accrualEndDate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static accrualPeriod

  • accrualPeriod(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Time
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Time

Static accrualStartDate

  • accrualStartDate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static accruedAmount

  • accruedAmount(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Real
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Real

Static accruedDays

  • accruedDays(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Integer
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Integer

Static accruedPeriod

  • accruedPeriod(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Time
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Time

Static atmRate

  • atmRate(leg: Leg, discountCurve: YieldTermStructure, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date, targetNpv?: Real): Rate
  • 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.

    Parameters

    • leg: Leg
    • discountCurve: YieldTermStructure
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null
    • Default value targetNpv: Real = QL_NULL_REAL

    Returns Rate

Static basisPointValue1

  • basisPointValue1(leg: Leg, y: InterestRate, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): number
  • Basis-point value Obtained by setting dy = 0.0001 in the 2nd-order Taylor series expansion.

    Parameters

    • leg: Leg
    • y: InterestRate
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns number

Static basisPointValue2

  • Parameters

    Returns number

Static bps1

  • bps1(leg: Leg, discountCurve: YieldTermStructure, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): Real
  • 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.

    Parameters

    • leg: Leg
    • discountCurve: YieldTermStructure
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns Real

Static bps2

  • bps2(leg: Leg, y: InterestRate, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): Real
  • Parameters

    • leg: Leg
    • y: InterestRate
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns Real

Static bps3

  • Parameters

    Returns Real

Static convexity1

  • convexity1(leg: Leg, y: InterestRate, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): number
  • 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 $.

    Parameters

    • leg: Leg
    • y: InterestRate
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns number

Static convexity2

  • Parameters

    Returns number

Static duration1

  • duration1(leg: Leg, rate: InterestRate, type: Type, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): Time
  • 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.

    Parameters

    • leg: Leg
    • rate: InterestRate
    • type: Type
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns Time

Static duration2

  • Parameters

    Returns Time

Static isExpired

  • isExpired(leg: Leg, includeSettlementDateFlows: boolean, settlementDate: Date): boolean
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • settlementDate: Date

    Returns boolean

Static maturityDate

  • maturityDate(leg: Leg): Date
  • Parameters

    Returns Date

Static nextCashFlow1

  • nextCashFlow1(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): CashFlow
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns CashFlow

Static nextCashFlow2

  • nextCashFlow2(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Size
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Size

Static nextCashFlowAmount

  • nextCashFlowAmount(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Real
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Real

Static nextCashFlowDate

  • nextCashFlowDate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static nextCouponRate

  • nextCouponRate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Rate
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Rate

Static nominal

  • nominal(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Real
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Real

Static npv1

  • npv1(leg: Leg, discountCurve: YieldTermStructure, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): number
  • NPV of the cash flows. The NPV is the sum of the cash flows, each discounted according to the given term structure.

    Parameters

    • leg: Leg
    • discountCurve: YieldTermStructure
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns number

Static npv2

  • npv2(leg: Leg, y: InterestRate, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): Real
  • Parameters

    • leg: Leg
    • y: InterestRate
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns Real

Static npv3

  • Parameters

    Returns Real

Static npv4

  • Parameters

    Returns number

Static npvbps

  • npvbps(leg: Leg, discountCurve: YieldTermStructure, includeSettlementDateFlows: boolean, settlementDate: Date, npvDate: Date, ref: byRef): void
  • NPV and BPS of the cash flows.

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

    Parameters

    Returns void

Static previousCashFlow1

  • previousCashFlow1(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): CashFlow
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns CashFlow

Static previousCashFlow2

  • previousCashFlow2(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Size
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Size

Static previousCashFlowAmount

  • previousCashFlowAmount(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Real
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Real

Static previousCashFlowDate

  • previousCashFlowDate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static previousCouponRate

  • previousCouponRate(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Rate
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Rate

Static referencePeriodEnd

  • referencePeriodEnd(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static referencePeriodStart

  • referencePeriodStart(leg: Leg, includeSettlementDateFlows: boolean, settlementDate?: Date): Date
  • Parameters

    • leg: Leg
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null

    Returns Date

Static startDate

  • startDate(leg: Leg): Date
  • Parameters

    Returns Date

Static yield1

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

    Parameters

    • leg: Leg
    • npv: Real
    • dc: DayCounter
    • comp: Compounding
    • freq: Frequency
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null
    • Default value accuracy: Real = 1e-10
    • Default value maxIterations: Size = 100
    • Default value guess: Rate = 0.05

    Returns Rate

Static yield2

  • Parameters

    • solver: ISolver1D
    • leg: Leg
    • npv: Real
    • dc: DayCounter
    • comp: Compounding
    • freq: Frequency
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null
    • Default value accuracy: Real = 1e-10
    • Default value maxIterations: Size = 100
    • Default value guess: Rate = 0.05

    Returns Rate

Static yieldValueBasisPoint1

  • yieldValueBasisPoint1(leg: Leg, y: InterestRate, includeSettlementDateFlows: boolean, settlementDate?: Date, npvDate?: Date): number
  • 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

    Parameters

    • leg: Leg
    • y: InterestRate
    • includeSettlementDateFlows: boolean
    • Default value settlementDate: Date = null
    • Default value npvDate: Date = null

    Returns number

Static yieldValueBasisPoint2

  • Parameters

    Returns number

Static zSpread1

Static zSpread2

  • Parameters

    Returns Spread