bond

package
v0.0.0-...-b6a1b54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EPS = 1e-10

Variables

This section is empty.

Functions

func AsDiscountFactor

func AsDiscountFactor(rate m.SpotRate) m.DiscountFactor

func AsSpotRate

func AsSpotRate(discountFactor m.DiscountFactor) m.SpotRate

func ConstantSpotRateInterpolation

func ConstantSpotRateInterpolation(curve *FixedSpotCurve, t m.Time) m.Rate

func Convexity

func Convexity(bond Bond, t m.Time, rate m.Rate) float64

func DFByConstantRateInterpolation

func DFByConstantRateInterpolation(curve *FixedForwardRateCurve) m.DiscountFactor

func DollarConvexity

func DollarConvexity(bond Bond, t m.Time, rate m.Rate) float64

func Duration

func Duration(bond Bond, t m.Time, rate m.Rate) float64

func InterpolateOnArray

func InterpolateOnArray(interpolator func(m.Time) m.Rate, tenors []m.Time) []m.Rate

func MacaulayDuration

func MacaulayDuration(bond Bond, t m.Time, rate m.Rate) float64

Types

type Bond

type Bond interface {
	TimeToExpiration(t m.Time) m.Time
	CurrentYield(t m.Time, yield m.Rate) m.Rate
	Price(t m.Time, rate m.Rate) m.Money
	PriceByDF(t m.Time, df m.DiscountFactor) m.Money
	YieldToMaturity(t m.Time, price m.Money) m.Rate
}

type Cashflow

type Cashflow struct {
	Time   m.Time
	Amount m.Money
}

func (Cashflow) Price

func (cashflow Cashflow) Price(t m.Time, rate m.Rate) m.Money

func (Cashflow) PriceByDF

func (cashflow Cashflow) PriceByDF(t m.Time, df m.DiscountFactor) m.Money

type Expirable

type Expirable struct {
	Maturity m.Time
}

func (Expirable) TimeToExpiration

func (expirable Expirable) TimeToExpiration(t m.Time) m.Time

type FixedCouponBond

type FixedCouponBond struct {
	Expirable
	IssueTime m.Time
	Coupon    FixedCouponTerm
}

func (*FixedCouponBond) AccruedInterest

func (bond *FixedCouponBond) AccruedInterest(t m.Time) m.Money

func (*FixedCouponBond) CurrentYield

func (bond *FixedCouponBond) CurrentYield(t m.Time, rate m.Rate) m.Rate

func (*FixedCouponBond) Price

func (bond *FixedCouponBond) Price(t m.Time, rate m.Rate) m.Money

func (FixedCouponBond) PriceByDF

func (bond FixedCouponBond) PriceByDF(t m.Time, df m.DiscountFactor) m.Money

func (FixedCouponBond) RemainingCashflows

func (bond FixedCouponBond) RemainingCashflows(t m.Time) []Cashflow

func (*FixedCouponBond) YieldToMaturity

func (bond *FixedCouponBond) YieldToMaturity(t m.Time, price m.Money) m.Rate

type FixedCouponTerm

type FixedCouponTerm struct {
	Frequency float64
	PerAnnum  m.Money
}

func (FixedCouponTerm) Cashflows

func (coupon FixedCouponTerm) Cashflows(start m.Time, to m.Time) []Cashflow

func (FixedCouponTerm) NextCoupon

func (coupon FixedCouponTerm) NextCoupon(issueTime m.Time, t m.Time) m.Time

type FixedForwardRateCurve

type FixedForwardRateCurve struct {
	Tenors []m.Time
	Rates  []m.Rate
}

func NaiveBootstrapFromFixedCoupon

func NaiveBootstrapFromFixedCoupon(quotedYields []m.Rate, quotedBonds []*FixedCouponBond, t0 m.Time) *FixedForwardRateCurve

func NaiveBootstrapFromZCYields

func NaiveBootstrapFromZCYields(yields []m.Rate, ttms []m.Time) *FixedForwardRateCurve

type FixedSpotCurve

type FixedSpotCurve struct {
	Tenors []m.Time
	Rates  []m.Rate
}

func OLSBootstrapFromFixedCoupon

func OLSBootstrapFromFixedCoupon(
	interpolator func(terms []m.Time, rates []m.Rate) m.SpotRate,
	quotedYields []m.Rate,
	quotedBonds []*FixedCouponBond,
	t0 m.Time,
	terms []m.Time) *FixedSpotCurve

func SpotCurveByConstantRateInterpolation

func SpotCurveByConstantRateInterpolation(curve *FixedForwardRateCurve) *FixedSpotCurve

type ZeroCouponBond

type ZeroCouponBond struct {
	Expirable
}

func (*ZeroCouponBond) CurrentYield

func (bond *ZeroCouponBond) CurrentYield(t m.Time, rate m.Rate) m.Rate

func (*ZeroCouponBond) Price

func (bond *ZeroCouponBond) Price(t m.Time, rate m.Rate) m.Money

func (*ZeroCouponBond) PriceByDF

func (bond *ZeroCouponBond) PriceByDF(t m.Time, df m.DiscountFactor) m.Money

func (*ZeroCouponBond) YieldToMaturity

func (bond *ZeroCouponBond) YieldToMaturity(t m.Time, price m.Money) m.Rate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL