DailyTreasuryYieldCurve

DailyTreasuryYieldCurve.jl is a Julia package for downloading and working with historical daily yield curve data from the US Treasury.

Getting Daily Yield Curves

DailyTreasuryYieldCurve.getyieldcurvesFunction
getyieldcurves(;real::Bool=false,begdt::Date=Date(1990,1,2),enddt::Date=today())

Download the whole published history of daily US Treasury yield curves from the official data feed.

Optionally, pass a filename if you have already downloaded the data, eg. getyieldcurves(fn::AbstractString).

By default, gets the nominal yield curve. Pass realrates=true to get the real yield curve. The nominal series starts in 1990, while the real series starts in 2003.

Returns a DataFrame.

source

Structure of returned data for nominal curve:

Column NameDescription
dateDate of yield curve
m11 month constant maturity rate
m22 month constant maturity rate
m33 month constant maturity rate
m66 month constant maturity rate
y11 year constant maturity rate
y22 year constant maturity rate
y33 year constant maturity rate
y55 year constant maturity rate
y77 year constant maturity rate
y1010 year constant maturity rate
y2020 year constant maturity rate
y3030 year constant maturity rate

Structure of returned data for real curve:

Column NameDescription
dateDate of yield curve
y55 year constant maturity real rate
y77 year constant maturity real rate
y1010 year constant maturity real rate
y2020 year constant maturity real rate
y3030 year constant maturity real rate

Not all maturities were reported on every day.

Interpolation

The package contains some convenience utilities for interpolating/extrapolating with the yield curve data.

DailyTreasuryYieldCurve.RateInterpolatorType
RateInterpolator

A container for the series of daily yield curve interpolators.

Fields: dates and interpolators, both Vector.

To interpolate, just call it with the value to interpolate (days to maturity) and the date of the curve.

(ri::RateInterpolator)(d::Real,dt::Date)

Currently supports only linear interpolation and extrapolation. See createRateInterpolator for construction.

source
Last curve carried forward

If you request a date that does not exist in RateInterpolator.dates, it will (blindly) carry forward the curve from the previous available date. It is your responsibility to double-check your inputs.

Day Count Convention

The standard day count convention for valuing US Treasuries is Actual/Actual (ICMA) (as opposed to something like 30/360). However, it is unclear (to me) exactly how to match this to constant maturities. Therefore, I use the convention that months are 30 days (for maturities less than 1 year) and years are 365 days (for maturities 1 year or more).