Options
All
  • Public
  • Public/Protected
  • All
Menu

Discount curve fitted to a set of fixed-coupon bonds

This class fits a discount function $ d(t) $ over a set of bonds, using a user defined fitting method. The discount function is fit in such a way so that all cashflows of all input bonds, when discounted using $ d(t) $, will reproduce the set of input bond prices in an optimized sense. Minimized price errors are weighted by the inverse of their respective bond duration.

The FittedBondDiscountCurve class acts as a generic wrapper, while its inner class FittingMethod provides the implementation details. Developers thus need only derive new fitting methods from the latter.

warning

The method can be slow if there are many bonds to fit. Speed also depends on the particular choice of fitting method chosen and its convergence properties under optimization. See also todo list for BondDiscountCurveFittingMethod.

todo

refactor the bond helper class so that it is pure virtual and returns a generic bond or its cash flows. Derived classes would include helpers for fixed-rate and zero-coupon bonds. In this way, both bonds and bills can be used to fit a discount curve using the exact same machinery. At present, only fixed-coupon bonds are supported. An even better way to move forward might be to get rate helpers to return cashflows, in which case this class could be used to fit any set of cash flows, not just bonds.

todo

add more fitting diagnostics: smoothness, standard deviation, student-t test, etc. Generic smoothness method may be useful for smoothing splines fitting. See Fisher, M., D. Nychka and D. Zervos: "Fitting the term structure of interest rates with smoothing splines." Board of Governors of the Federal Reserve System, Federal Resere Board Working Paper, 95-1.

todo

add extrapolation routines

Hierarchy

Implements

Index

Properties

_accuracy

_accuracy: Real

_alwaysForward

_alwaysForward: boolean = false

_bondHelpers

_bondHelpers: BondHelper[]

_calculated

_calculated: boolean = false

_calendar

_calendar: Calendar

_dayCounter

_dayCounter: DayCounter

_extrapolate

_extrapolate: boolean

Private _fittingMethod

_fittingMethod: FittingMethod

_frozen

_frozen: boolean = false

_guessSolution

_guessSolution: Real[]

_isDisposed

_isDisposed: boolean = false

_jumpDates

_jumpDates: Date[]

_jumpTimes

_jumpTimes: Time[]

_jumps

_jumps: Array<Handle<Quote>>

_latestReference

_latestReference: Date

Private _maxDate

_maxDate: Date

_maxEvaluations

_maxEvaluations: Size

_maxStationaryStateIterations

_maxStationaryStateIterations: Size

_moving

_moving: boolean

_nJumps

_nJumps: Size

_observables

_observables: Set<Observable> = new Set()

_observers

_observers: Set<Observer> = new Set()

_referenceDate

_referenceDate: Date

_settlementDays

_settlementDays: Natural

_simplexLambda

_simplexLambda: Real

_updated

_updated: boolean

allowsExtrapolation

allowsExtrapolation: () => boolean

Type declaration

    • (): boolean
    • Returns boolean

alwaysForwardNotifications

alwaysForwardNotifications: () => void

Type declaration

    • (): void
    • Returns void

calculate

calculate: () => void

Type declaration

    • (): void
    • Returns void

calendar

calendar: () => Calendar

Type declaration

checkRange1

checkRange1: (d: Date, extrapolate: boolean) => void

Type declaration

    • (d: Date, extrapolate: boolean): void
    • Parameters

      • d: Date
      • extrapolate: boolean

      Returns void

checkRange2

checkRange2: (t: Time, extrapolate: boolean) => void

Type declaration

    • (t: Time, extrapolate: boolean): void
    • Parameters

      • t: Time
      • extrapolate: boolean

      Returns void

dayCounter

dayCounter: () => DayCounter

Type declaration

deepUpdate

deepUpdate: () => void

Type declaration

    • (): void
    • Returns void

disableExtrapolation

disableExtrapolation: (b: boolean) => void

Type declaration

    • (b: boolean): void
    • Parameters

      • b: boolean

      Returns void

discount1

discount1: (d: Date, extrapolate: boolean) => DiscountFactor

Type declaration

discount2

discount2: (t: Time, extrapolate: boolean) => DiscountFactor

Type declaration

dispose

dispose: () => void

Type declaration

    • (): void
    • Returns void

enableExtrapolation

enableExtrapolation: (b: boolean) => void

Type declaration

    • (b: boolean): void
    • Parameters

      • b: boolean

      Returns void

forwardRate1

forwardRate1: (d1: Date, d2: Date, resultDayCounter: DayCounter, comp: Compounding, freq: Frequency, extrapolate: boolean) => InterestRate

Type declaration

forwardRate2

forwardRate2: (d: Date, p: Period, resultDayCounter: DayCounter, comp: Compounding, freq: Frequency, extrapolate: boolean) => InterestRate

Type declaration

forwardRate3

forwardRate3: (t1: Time, t2: Time, comp: Compounding, freq: Frequency, extrapolate: boolean) => InterestRate

Type declaration

freeze

freeze: () => void

Type declaration

    • (): void
    • Returns void

isDisposed

isDisposed: boolean

jumpDates

jumpDates: () => Date[]

Type declaration

    • (): Date[]
    • Returns Date[]

jumpTimes

jumpTimes: () => Time[]

Type declaration

maxTime

maxTime: () => Time

Type declaration

notifyObservers

notifyObservers: () => void

Type declaration

    • (): void
    • Returns void

recalculate

recalculate: () => void

Type declaration

    • (): void
    • Returns void

referenceDate

referenceDate: () => Date

Type declaration

    • (): Date
    • Returns Date

registerObserver

registerObserver: (o: Observer) => void

Type declaration

registerWith

registerWith: (h: Observable) => void

Type declaration

registerWithObservables

registerWithObservables: (o: Observer) => void

Type declaration

setJumps

setJumps: () => void

Type declaration

    • (): void
    • Returns void

settlementDays

settlementDays: () => Natural

Type declaration

timeFromReference

timeFromReference: (date: Date) => Time

Type declaration

    • (date: Date): Time
    • Parameters

      • date: Date

      Returns Time

tsInit1

tsInit1: (dc: DayCounter) => TermStructure

Type declaration

tsInit2

tsInit2: (referenceDate: Date, calendar: Calendar, dc: DayCounter) => TermStructure

Type declaration

tsInit3

tsInit3: (settlementDays: Natural, calendar: Calendar, dc: DayCounter) => TermStructure

Type declaration

unfreeze

unfreeze: () => void

Type declaration

    • (): void
    • Returns void

unregisterObserver

unregisterObserver: (o: Observer) => void

Type declaration

unregisterWith

unregisterWith: (h: Observable) => Size

Type declaration

unregisterWithAll

unregisterWithAll: () => void

Type declaration

    • (): void
    • Returns void

ytsInit1

ytsInit1: (dc: DayCounter, jumps?: Array<Handle<Quote>>, jumpDates?: Date[]) => YieldTermStructure

Type declaration

ytsInit2

ytsInit2: (referenceDate: Date, calendar: Calendar, dc: DayCounter, jumps?: Array<Handle<Quote>>, jumpDates?: Date[]) => YieldTermStructure

Type declaration

ytsInit3

ytsInit3: (settlementDays: Natural, calendar: Calendar, dc: DayCounter, jumps?: Array<Handle<Quote>>, jumpDates?: Date[]) => YieldTermStructure

Type declaration

zeroRate1

zeroRate1: (d: Date, resultDayCounter: DayCounter, comp: Compounding, freq: Frequency, extrapolate: boolean) => InterestRate

Type declaration

zeroRate2

zeroRate2: (t: Time, comp: Compounding, freq: Frequency, extrapolate: boolean) => InterestRate

Type declaration

Methods

discountImpl

fbdcInit1

fbdcInit2

  • Parameters

    • referenceDate: Date
    • bondHelpers: BondHelper[]
    • dayCounter: DayCounter
    • fittingMethod: FittingMethod
    • Default value accuracy: Real = 1e-10
    • Default value maxEvaluations: Size = 10000
    • Default value guess: Real[] = []
    • Default value simplexLambda: Real = 1
    • Default value maxStationaryStateIterations: Size = 100

    Returns FittedBondDiscountCurve

fitResults

  • Returns FittingMethod

maxDate

  • maxDate(): Date

numberOfBonds

  • numberOfBonds(): Size
  • Returns Size

performCalculations

  • performCalculations(): void

Private setup

  • setup(): void
  • Returns void

update

  • update(): void