Options
All
  • Public
  • Public/Protected
  • All
Menu

zero-coupon bond

test

calculations are tested by checking results against cached values.

Hierarchy

  • Bond
    • ZeroCouponBond

Implements

Index

Constructors

constructor

  • Parameters

    • settlementDays: Natural
    • calendar: Calendar
    • faceAmount: Real
    • maturityDate: Date
    • Default value paymentConvention: BusinessDayConvention = BusinessDayConvention.Following
    • Default value redemption: Real = 100
    • Default value issueDate: Date = null

    Returns ZeroCouponBond

Properties

Protected _NPV

_NPV: Real

Protected _additionalResults

_additionalResults: Map<string, any> = new Map<string, any>()

_alwaysForward

_alwaysForward: boolean = false

_calculated

_calculated: boolean = false

Protected _calendar

_calendar: Calendar = new Calendar()

Protected _cashflows

_cashflows: Leg = []

_engine

_engine: PricingEngine

Protected _errorEstimate

_errorEstimate: Real

_frozen

_frozen: boolean = false

_isDisposed

_isDisposed: boolean = false

Protected _issueDate

_issueDate: Date

Protected _maturityDate

_maturityDate: Date

Protected _notionalSchedule

_notionalSchedule: Date[] = []

Protected _notionals

_notionals: Real[] = []

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

Protected _redemptions

_redemptions: Leg = []

Protected _settlementDays

_settlementDays: Natural

Protected _settlementValue

_settlementValue: Real

Protected _valuationDate

_valuationDate: Date

dispose

dispose: () => void

Type declaration

    • (): void
    • Returns void

isDisposed

isDisposed: boolean

notifyObservers

notifyObservers: () => void

Type declaration

    • (): void
    • Returns void

registerObserver

registerObserver: (o: Observer) => void

Type declaration

registerWith

registerWith: (h: Observable) => void

Type declaration

registerWithObservables

registerWithObservables: (o: Observer) => void

Type declaration

unregisterObserver

unregisterObserver: (o: Observer) => void

Type declaration

unregisterWith

unregisterWith: (h: Observable) => Size

Type declaration

unregisterWithAll

unregisterWithAll: () => void

Type declaration

    • (): void
    • Returns void

Methods

NPV

  • returns the net present value of the instrument.

    Returns Real

accruedAmount

  • accruedAmount(settlement?: Date): Real
  • accrued amount at a given date The default bond settlement is used if no date is given.

    Parameters

    • Default value settlement: Date = null

    Returns Real

Protected addRedemptionsToCashflows

  • addRedemptionsToCashflows(redemptions?: Real[]): void
  • This method can be called by derived classes in order to build redemption payments from the existing cash flows. It must be called after setting up the _cashflows vector and will fill the _notionalSchedule, _notionals, and _redemptions data members.

    If given, the elements of the redemptions vector will multiply the amount of the redemption cash flow. The elements will be taken in base 100, i.e., a redemption equal to 100 does not modify the amount.

    The _cashflows vector must contain at least one coupon and must be sorted by date.

    Parameters

    • Default value redemptions: Real[] = []

    Returns void

additionalResults

  • additionalResults(): Map<string, any>
  • returns all additional result returned by the pricing engine.

    Returns Map<string, any>

alwaysForwardNotifications

  • alwaysForwardNotifications(): void
  • This method causes the object to forward all notifications, even when not calculated. The default behavior is to forward the first notification received, and discard the others until recalculated; the rationale is that observers were already notified, and don't need further notification until they recalculate, at which point this object would be recalculated too. After recalculation, this object would again forward the first notification received.

    warning Forwarding all notifications will cause a performance hit, and should be used only when discarding notifications cause an incorrect behavior.

    Returns void

calculate

  • calculate(): void

Protected calculateNotionalsFromCashflows

  • calculateNotionalsFromCashflows(): void
  • used internally to collect notional information from the coupons. It should not be called by derived classes, unless they already provide redemption cash flows (in which case they must set up the _redemptions data member independently). It will fill the _notionalSchedule and _notionals data members.

    Returns void

calendar

cashflows

  • cashflows(): Leg
  • note returns all the cashflows, including the redemptions.

    Returns Leg

cleanPrice1

  • cleanPrice1(): Real
  • theoretical clean price

    The default bond settlement is used for calculation.

    warning the theoretical price calculated from a flat term structure might differ slightly from the price calculated from the corresponding yield by means of the other overload of this function. If the price from a constant yield is desired, it is advisable to use such other overload.

    Returns Real

cleanPrice2

  • clean price given a yield and settlement date The default bond settlement is used if no date is given.

    Parameters

    Returns Real

deepUpdate

  • deepUpdate(): void

dirtyPrice1

  • dirtyPrice1(): Real
  • theoretical dirty price

    The default bond settlement is used for calculation.

    warning the theoretical price calculated from a flat term structure might differ slightly from the price calculated from the corresponding yield by means of the other overload of this function. If the price from a constant yield is desired, it is advisable to use such other overload.

    Returns Real

dirtyPrice2

  • dirty price given a yield and settlement date The default bond settlement is used if no date is given.

    Parameters

    Returns Real

errorEstimate

  • errorEstimate(): Real
  • returns the error estimate on the NPV when available.

    Returns Real

fetchResults

freeze

  • freeze(): void
  • This method constrains the object to return the presently cached results on successive invocations, even if arguments upon which they depend should change.

    Returns void

init

init1

  • Parameters

    • settlementDays: Natural
    • calendar: Calendar
    • Default value issueDate: Date = null
    • Default value coupons: Leg = []

    Returns Bond

init2

  • init2(settlementDays: Natural, calendar: Calendar, faceAmount: Real, maturityDate: Date, issueDate?: Date, cashflows?: Leg): Bond
  • warning

    The last passed cash flow must be the bond redemption. No other cash flow can have a date later than the redemption date.

    Parameters

    • settlementDays: Natural
    • calendar: Calendar
    • faceAmount: Real
    • maturityDate: Date
    • Default value issueDate: Date = null
    • Default value cashflows: Leg = []

    Returns Bond

isExpired

  • isExpired(): boolean

isTradable

  • isTradable(d?: Date): boolean
  • Parameters

    • Default value d: Date = null

    Returns boolean

issueDate

  • issueDate(): Date
  • Returns Date

maturityDate

  • maturityDate(): Date
  • Returns Date

nextCashFlowDate

  • nextCashFlowDate(settlement?: Date): Date
  • Parameters

    • Default value settlement: Date = null

    Returns Date

nextCouponRate

  • nextCouponRate(settlement?: Date): Rate
  • Expected next coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the already-fixed not-yet-paid one.

    The current bond settlement is used if no date is given.

    Parameters

    • Default value settlement: Date = null

    Returns Rate

notional

  • notional(d?: Date): Real
  • Parameters

    • Default value d: Date = null

    Returns Real

notionals

  • notionals(): Real[]

performCalculations

  • performCalculations(): void

previousCashFlowDate

  • previousCashFlowDate(settlement?: Date): Date
  • Parameters

    • Default value settlement: Date = null

    Returns Date

previousCouponRate

  • previousCouponRate(settlement?: Date): Rate
  • Previous coupon already paid at a given date

    Expected previous coupon: depending on (the bond and) the given date the coupon can be historic, deterministic or expected in a stochastic sense. When the bond settlement date is used the coupon is the last paid one.

    The current bond settlement is used if no date is given.

    Parameters

    • Default value settlement: Date = null

    Returns Rate

recalculate

  • recalculate(): void
  • This method force the recalculation of any results which would otherwise be cached. It is not declared as const since it needs to call the non-const notifyObservers method.

    note Explicit invocation of this method is not necessary if the object registered itself as observer with the structures on which such results depend. It is strongly advised to follow this policy when possible.

    Returns void

redemption

  • returns the redemption, if only one is defined

    Returns CashFlow

redemptions

  • redemptions(): Leg
  • returns just the redemption flows (not interest payments)

    Returns Leg

result

  • result(tag: string): any
  • returns any additional result returned by the pricing engine.

    Parameters

    • tag: string

    Returns any

setPricingEngine

  • set the pricing engine to be used.

    warning calling this method will have no effects in case the performCalculation method was overridden in a derived class.

    Parameters

    Returns void

Protected setSingleRedemption1

  • setSingleRedemption1(notional: Real, redemption: Real, date: Date): void
  • This method can be called by derived classes in order to build a bond with a single redemption payment. It will fill the _notionalSchedule, _notionals, and _redemptions data members.

    Parameters

    • notional: Real
    • redemption: Real
    • date: Date

    Returns void

Protected setSingleRedemption2

  • setSingleRedemption2(notional: Real, redemption: CashFlow): void
  • This method can be called by derived classes in order to build a bond with a single redemption payment. It will fill the _notionalSchedule, _notionals, and _redemptions data members.

    Parameters

    Returns void

settlementDate

  • settlementDate(d?: Date): Date
  • Parameters

    • Default value d: Date = null

    Returns Date

settlementDays

settlementValue1

  • settlementValue1(): Real
  • theoretical settlement value

    The default bond settlement date is used for calculation.

    Returns Real

settlementValue2

  • settlementValue2(cleanPrice: Real): Real
  • settlement value as a function of the clean price The default bond settlement date is used for calculation.

    Parameters

    Returns Real

setupArguments

setupExpired

  • setupExpired(): void

startDate

  • startDate(): Date
  • Returns Date

unfreeze

  • unfreeze(): void
  • This method reverts the effect of the freeze method, thus re-enabling recalculations.

    Returns void

update

  • update(): void

valuationDate

  • valuationDate(): Date
  • returns the date the net present value refers to.

    Returns Date

yield1

  • theoretical bond yield

    The default bond settlement and theoretical price are used for calculation.

    Parameters

    Returns Rate

yield2

  • yield given a (clean) price and settlement date The default bond settlement is used if no date is given.

    Parameters

    Returns Rate