# Did Germany bond yields go negative in 1923?

By Helin Gai / August 14, 2016

I ran into this DB chart that has subsequently been annotated by other bloggers:

The implications of the annotations are:

1. German bond yields went negative in the early 1920s;
2. Hyperinflation ensued.

In reality, neither are true.

1. Until recently, long-term German bond yields have never turned negative. In September 1923, some bonds traded up to 2-3 million marks, with an implied yield close to 0, but still slightly above 0. So why does it look like a negative value in the chart? Because the creator of the chart used a very thick line in poor software (Excel?).

2. As said, the low point in yield happened in September 1923. By then, Germany was already experiencing the full force of hyperinflation. Bonds were trading at 2–3 million marks in price and yields declined to 0 precisely because speculators believed that the government would rebase the debt and repay them on an inflation-adjusted basis. Of course, the government was all too happy to have its debt wiped out. When this harsh reality finally set in, bonds quickly lost value and yields skyrocketed.

So what does this tell us? One, there’s no causation or even correlation between negative yields and hyperinflation. Two, drawing inference from poorly drawn charts is incredibly dangerous. For completeness, here’s my own compilation of German bond yield:

# Chart of the Day: Spanish 10-Year Government Bond Yield Drops Below 1%

By Helin Gai / August 8, 2016

… because all is well with Spanish finances.

# Three centuries of Bank of England Policy Rate

By Helin Gai / August 7, 2016

Bank of England policy rate since 1700:

# Diamond Sutra

By Helin Gai / June 17, 2016

The Diamond Sutra is one of the most important Buddhist texts. Alex Johnson provides a very accessible English translation for this magnificent text. Here are a few verses from the closing chapter:

“So I say to you – This is how to contemplate our conditioned existence in this fleeting world:”

“Like a tiny drop of dew, or a bubble floating in a stream; Like a flash of lightning in a summer cloud, Or a flickering lamp, an illusion, a phantom, or a dream.”

“So is all conditioned existence to be seen.”

# Handling dates before 1678 and after 2262 in pandas

By Helin Gai / April 2, 2016

Pandas’s Timestamp currently has a lower bound of 1677-09-22 and an upper bound of 2262-04-11. If a date falls outside of this range is used, the following nasty error is returned:

OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 1677-09-22 00:00:00


To construct very long time series that stretch back hundreds of years, I’ve been using using Period:

data = {pd.Period('1500-12-31', 'D'): 100,
pd.Period('1600-12-31', 'D'): 200}
df = pd.Series(data)


This generates a Series object that works with all the usual datetime operations, such as resampling.

# A Compendium of Data Sources for Financial & Economic Research

By Helin Gai / March 22, 2016

## Economics

• Fred, maintained by the Federal Reserve Bank of St. Louis, is one of the most comprehensive economic databases in the world. It currently provides 383,000 US and international time series from 80+ sources. Despite the many criticisms leveled against the Fed in recent years (decades?), I think the Fed has redeemed itself for providing mankind with this treasure.
• FRED-MD and FRED-QD are large macroeconomic databases designed for the empirical analysis of “big data.” (I’m not sure why it’s called “big data,” given that the entire dataset is only 500KB in size.)
• OECD.Stat provides a large collection of global economic and demographic datasets.
• Survey of Professional Forecasters is the oldest quarterly survey of macroeconomic forecasts in the US, with detailed forecasts for GDP, inflation, unemployment, etc. going back to 1968. In Q1 of each year, SPF also queries participants for their long-term forecasts of stock and Treasury bill returns. I use the latter for computing survey-based bond risk premium.
• Livingston Survey, started in 1946, is the oldest continuous survey of economists’ expectations.
• Real-Time Data Set for Macroeconomists consists of vintages of time series of major macroeconomic variables.
• Market-based inflation expectations are published by the Federal Reserve Bank of Cleveland, with data going back to 1982.
• Jeremy Piger provides monthly smoothed recession probabilities for the US.

## Equity

• Fama/French provides comprehensive US and international equity factor returns since 1926. This is the primary source for studying style investing in the equity market, particularly size and value premia.
• AQR provides comprehensive monthly and daily equity factor returns for many countries. The US series go back to 1926. With very little work, one can back-out equity returns for all the covered countries, making this a feasible replacement for MSCI indices.
• Shiller provides long-term equity and interest rate data since 1871. This is the primary source for long-term earnings yield, dividend yield, and of course the famous CAPE (cyclically adjusted price-to-earnings ratio).
• Schwert provides (“ok” quality) monthly US equity returns from 1802 to 1925 and daily returns from 1885 to 1962.

## Fixed Income

• Gürkaynak, Sack & Wright provide daily US Treasury par, zero coupon, and forward rates starting from 1961. The data is published with a two-day lag.
• Gürkaynak, Sack & Wright estimate daily TIPS par, zero coupon, and forward real rates starting in 1999. The data is published with a two-day lag.
• SHFuse Constant Maturity Par Bond Indices are daily total return indices for constant maturity Treasury par bonds. These are calculated by yours truly and are updated at the end of each month. Using this dataset is free, but requires the following citation: Helin Gai, “The Theory & Practice of Bond Risk Premium,” SHFuse Working Paper, 2014.
• The Kim-Wright term premium data are probably the most widely used bond risk premium estimates by far, with data going back to 1990.
• The ACM term premium, published by Adrian, Crump, and Moench at the New York Fed, provides an alternative estimate for bond risk premium. The data go back to 1961.
• NBER Macrohistory provides a large number of historical interest rate series, including long-term US government bond yield from 1919 to 1944 and from 1941 to 1967, municipal bond yield from 1857 to 1914, and railroad bond yield from 1857 to 1934.
• Wall Street Journal provides daily Treasury quotes and daily TIPS quotes.

## Futures

• CFTC provides important futures and options positioning data going back to 1986.

## Financial Indices

• MSCI is the de facto standard for international equity indices.
• Barclays (formerly Lehman Brothers) provides perhaps the most comprehensive fixed income indices in the world. This is the primary source for US investment grade FI (“US Aggregate”), Treasuries, high yield, and MBS returns.
• Citi (formerly Salomon Brothers) is another prominent fixed income index provider. This is the primary source for international government bond returns (“World Government Bond Index”).
• J.P. Morgan also provides quite a few fixed income indices, although the only widely used index is the Emerging Markets Bond Index (EMBI).
• Merrill Lynch is yet another fixed income index provider. Many of its indices can be access through Fred.

## Cross Assets

• Quandl provides a large collection of financial and economic data. Particularly noteworthy is their API, which allows easy data download in several programming languages.

## Books

• Ibbotson SBBI Classic Yearbook provides monthly returns for stocks (large cap and small cap), bonds (long-term government and corporate), bills, and inflation since 1926.
• Barclays Equity Gilt Study, currently at its 61st edition, provides annual returns on equity and bonds for the US (since 1926) and the UK (sine 1900).
• A History of Interest Rates, a Sidney Homer classic, is the primary source for global interest rates before 1900.
• Triumph of the Optimists provides data charts for stocks, bonds, bills, inflation, and FX for sixteen countries since 1900. The underlying data, known as the “Dimson-Marsh-Staunton (DMS) Database,” costs $3000 in addition to the price of the book; I consider an outrage, since most of the data the authors use are from other academics. • An Analytical Record of Yields and Yield Spreads, a Salomon Brothers classic, provides monthly interest rate data from 1950. It is obviously out of print, but many libraries carry this title. # How Many Decimals of Pi Do We Really Need? By Helin Gai / March 20, 2016 The radius of the universe is about 46 billion light years. Now let me ask a different question: How many digits of pi would we need to calculate the circumference of a circle with a radius of 46 billion light years to an accuracy equal to the diameter of a hydrogen atom (the simplest atom)? The answer is that you would need 39 or 40 decimal places. # Barclays to Sell Risk Analytics and Index Unit to Bloomberg By Helin Gai / December 18, 2015 Barclays PLC on Wednesday said it has agreed to sell its risk analytics and index solutions business to Bloomberg LP for £520 million ($782 million), in the British bank’s latest move to focus on its core operations.

The dismantling of Lehman Brothers continues. A decent number of investors, myself included, still refer to the “Barclays Aggregate Bond Index” as “Lehman Agg.” I wonder how long it’ll take for “Bloomberg Agg” to take off…

# MacBooks Top Consumer Reports Survey in Reliability and Customer Satisfaction

By Helin Gai / December 3, 2015

The statistics are truly astounding:

Apple … has the most reliable notebooks by far - a 10 percent breakdown rate in the first 3 years - with Samsung and Gateway distant seconds at 16 percent, and the rest of the industry - including Acer, Lenovo, Toshiba, HP, Dell and Asus, at 18-19 percent.

71% of MacBook owners were “completely satisfied with system reliability,” compared to “only 38% of Windows notebook owners.”

Macbooks last longer even though people use them more. What more can you ask?

# Google breaks promise to not collect student data

By Helin Gai / December 2, 2015

Via Cult of Android:

“Despite publicly promising not to, Google mines students’ browsing data and other information, and uses it for the company’s own purpose,” said EFF Staff Attorney Nate Cardozo.

Why am I not surprised? To quote Steve Jobs, Google’s “Don’t be evil is a load of crap.”

# Patent troll claims HTTPS websites infringe crypto patent, sues everybody

By Helin Gai / December 2, 2015

Ars:

A Texas company is suing some of the biggest names in tech and retail, claiming their HTTPS websites infringe an encryption patent titled “Auto-Escrowable and Auto-Certifiable Cryptosystems.” CryptoPeak Solutions has filed about six dozen cases in all, and they began hitting the patent-troll friendly venue of the Eastern District of Texas in July.

I weep for American innovation.

# Sketch leaves the Mac App Store

By Helin Gai / December 2, 2015

Sketch announced its departure from the Mac App Store:

The customer experience on the Mac App Store hasn’t evolved like its iOS counterpart. We want to continue to be a responsive, approachable, and easily-reached company, and selling Sketch directly allows us to give you a better experience.

Personally, I think the Mac App Store has provided a terrific user experience for me. It’s great to have a centralized location for downloading and managing apps, not to mention the convenience of having apps automatically updated to the latest versions all at once.

For apps such as Coda, I understand that sandboxing can be a huge pain in the ass. For Sketch, though, I find it much more difficult to imagine what could be so constraining that they don’t think the extra development effort is worth a seat in the Mac App Store.

Of course, we can blame Apple for the present situation – “the control freaks at Apple are driving away developers.” On the other hand, Apple has ruled with an iron fist on iOS; this has worked out quite well, providing a highly consistent app management experience, while enhancing the security of the platform. It is difficult to argue against the track record there.

# Adobe Kills Flash (Sort of) and Introduces "Animate"

By Helin Gai / December 2, 2015

For nearly two decades, Flash Professional has been the standard for producing rich animations on the web. Because of the emergence of HTML5 and demand for animations that leverage web standards, we completely rewrote the tool over the past few years to incorporate native HTML5 Canvas and WebGL support. To more accurately represent its position as the premier animation tool for the web and beyond, Flash Professional will be renamed Adobe Animate CC, starting with the next release in early 2016.

This is not nearly as good as “announcing the end-of-life date for Flash,” called for by Facebook’s Chief Security Officer earlier this year, but it’s a step in the right direction. The writing has been on the wall for a while now. Most video websites now support HTML5 playback; Amazon stopped accepting Flash-based display ads two months ago as well.

It’s been five years since Steve Jobs published his “Thoughts on Flash”, denouncing the many sins of Flash. At the time, both the press and technology enthusiasts ridiculed Job. Nowadays, we take the resentment toward Flash and its inevitable demise for granted.

# Scientist says huge clumps of dark matter may lie just beyond the Moon

By Helin Gai / December 1, 2015

Ars:

In a new study published in the Astrophysical Journal, Gary Prézeau has proposed that Earth and other planets and stars in the Milky Way galaxy are surrounded by theoretical filaments of dark matter called “hairs.” By finding the roots of these hairs, he reports, physicists could uncover a trove of dark matter.

# Amazon Prime Video Coming to New Apple TV Possibly Within a 'Few Weeks'

By Helin Gai / November 29, 2015

I sent feedback to Amazon via the Amazon Instant Video iOS app about supporting tvOS. They say it’s in development.

I certainly thought the absence of the Prime Video app for the new Apple TV was another sign of Amazon turning to the dark side – that they were being petty and wanting to steer people toward their own Fire TV. Guess I’m wrong (or they’ve reversed course). No matter – Amazon Instant Video is coming to the new Apple TV “hopefully within a few weeks.” This is great for consumers and I myself have another solid reason to keep my Apple TV.

# The LaTeX Mathematics Companion (v2.0)

By Helin Gai / July 10, 2015

Back when I was a freshman in college, I started a fairly ambitious project – to write a comprehensive guide on LaTeX from a typographer’s perspective. In other words, I wanted a guide that discusses not just how to get something laid out in LaTeX, but also the fine details of typesetting/typography as applied to LaTeX. Unfortunately, after nearly 200-pages of writing, I had to drop the project for personal reasons.

I’m pleased to announce that I’ve re-initiated the project. As a starting point, I have thoroughly revised the manuscript of The LaTeX Mathematics Companion, which can be downloaded here.

This 70-page booklet provides a comprehensive discussion of the math mode in LaTeX. Of course, it tells you all about roots, fractions, delimiters, font switching, etc., but the focus is really on how to set math well. You’ll find a lot of suggestions regarding spacing in math equations, when to use slashed fractions ($$1/2$$) and when to use built-up fractions $$\left(\frac{1}{2}\right)$$, how to strategically break an equation, and so forth.

This is just the beginning of a long-term project. If you have any feedback, please comment below or email me!

# September 2014 FOMC Review – Front End Forwards Fully Priced

By Helin Gai / September 18, 2014

FOMC’s two-day meeting concluded yesterday. For the most part, there’s nothing too exciting. The assessment on labor market didn’t change much, although the language on inflation was downgraded a tad (“inflation moved somewhat closer to” target to “inflation has been running below” the target). Combined with the unexpectedly soft August CPI print, break-even inflation traded down quite a bit over the past two days, while the long end of the Treasury yield outperformed the belly very meaningfully.

With regard to forward guidance, the statement kept the “considerable time” language unchanged. The updated Summary of Economic Projections, however, does paint a picture of a faster hiking cycle. The 2014 year-end dot remained unchanged at 0.125%, while the 2015 and 2016 year-end median moved up by 25bp and 37.5bp, respectively, to 1.375% and 2.875%. The 2017 projections were published for the first time, with a median of 3.75%. The neutral rate is within sight!?! The curve reacted quite appropriately to the revised “dots,” with 2017 and 2018 forwards leading the selloff both yesterday and today. So what now?

In the chart below, I’ve recreated FOMC’s dot chart, with median and 25th percentile highlighted. The FOMC-meeting-date-matched Treasury forwards (based on the Merrill Lynch Exponential Spline) are also included. If we use the 25th percentile as proxy for Yellen (similar to the 4th lowest dot that other market participants have been using), we can see that the repricing over the past two days have pretty much removed opportunities in the ‘15 and ‘16 forwards. The 2017 forwards, however, are still lower than the Yellen dot. If I were to go short, that would be the area to focus on (i.e., EDZ7 or 3-year Treasuries). But given my concern about the long-term outlook on the economy and my belief that neutral rate is likely to end up in the 2.5%–3% range, I’d rather sit on the sideline.

# Fed Dots vs. Market

By Helin Gai / July 17, 2014

The dots-vs-market disconnect has become a hot topic. I thought I’d give it my take as well.

Many people have used this disconnect to argue for shorts in bonds. Overall, I’m inclined to think that the forwards might just stay here for the next three months, unless there are clearer signs of economic improvement.

Incidentally, here’s something I recently read (taken from a 2003 Lehman research note; emphasis added) –

Taking the forwards at face value, they seem to imply sub-3% economic growth for the next five years. With potential north of 3%, that is not a pretty scenario. Of course, the market may not actually expect this. In fact, the market is probably undershooting the level of future growth expectations in order to spur the growth that is desired, if not expected. This argument can get dangerously circular, but the market is clearly trying to stimulate the economy, and the Fed is giving the green light for the forwards to march southward. In fact, our view is that with the economy is sensitive not only to the spot level of the real funds rate, but also to the integral of expectations; the Fed would rather talk down the forwards, at this point, than lower the funds rate. So if we are reaching the limit on “stretching” out the forward curve, what better way to stimulate the economy but to lower longer-term expectations for the real rate of interest! The mean-reverting level of the funds rate, which has remained stubbornly near 5.25% throughout the economic malaise of the past three years, is due for a regime shift. As it increasingly looks as if sub-par growth for a long time is a reality, the choices are clear. We either live with that fact or we reduce long-term interest rates so low that we induce businesses to invest and the economy to recover more quickly than it naturally would. For yield curves, it means rates will head lower.

Some similarities to today?

Anyways, there are two conflicting hypotheses I’ve been thinking about:

• Take a look at the chart below. I’ve plotted forwards against Fed’s dots. I also used a very simplistic model to strip out term premium in the forwards. I should note that my simple model gives results vastly different from Kim-Wright, but it does give a very flattish long-term expectation path, which makes sense. If we take this chart at face value, it’s saying that the fed’s hiking speed is going to be glacial, and they’ll pause at just 2.5% (using Eurodollar futures should give slightly higher values). Now, we can debate whether or not this decomposition is too aggressive, but personally, I’m increasingly worried that this path may end up being realized – The Fed will deliver its promised hikes next year, and they’ll hike slowly, and then the economy might not be able to handle it, and they’ll just stay there for a while or revert back to an easing bias to give the economy some breathing room. If this bears out, then we should just sit here and collect the term premium being priced into the curve.

• Alternatively, I’ve been entertaining the idea that the term premium at the front end of the curve is actually (still) negative. In other words, market expectations are priced largely in line with the Fed’s path, but negative term premium is pulling the “market price” of yields down. Reasons for the negative premium might include 1) Carry and roll are really high at the front end right now, so there’s a large cushion before investors lose money when they buy front end paper; so why demand extra compensation? 2) fed still on hold and generally very little duration risk in holding front end papers at least for the next year; 3) ridiculously low rates vol in general; etc.

The truth probably lies somewhere in-between, although for now, I’m buying into the first line of thinking more. I think the market will eventually look at forwards and question whether it’s pricing in enough tightening and risk premium, but historically the market starts pricing for hikes about 6–8 months ahead of time – there’s time. For now, stay long!

# Swift + Linear Algebra By Example – Using the Accelerate Framework

By Helin Gai / July 11, 2014

This post provides a concise tutorial on how you may use Apple’s Accelerate framework with the Swift programming language to perform vector/matrix manipulations, including matrix transposes, dot products, matrix inversions, etc. A playground with these examples can be downloaded here.

## Linking Your Project Against Accelerate

• Select your project by clicking on the blue icon in the top left corner.
• In the TARGETS list (the panel in the middle), select the target you’re compiling and then activate the Build Phases tab.
• Click on the little triangle in front of Link Binary With Libraries.
• Click on the + sign and select Accelerate.framework in the popup.

## Importing Accelerate

Now that your project is linked against Accelerate, you can import it in your .swift file by issuing:

import Accelerate


## Vector & Scalars

The general syntax for adding a scalar to a vector and for multiplying or dividing a vector by a scalar is as follows

vDSP_vs***D(vector, 1, &scalar, &result, 1, length_of_vector)


The 1s tells the function to operate on each element of the vector. If you replace 1 with 2, it’ll operate on every other element instead. Needless to say, for most LA applications, you’ll be sticking with 1, as we do for the rest of the tutorial. A few example should make everything crystal clear:

$$\begin{pmatrix} 1 \\ 2 \end{pmatrix} + 3 = \begin{pmatrix} 4 \\ 5 \end{pmatrix}$$

var v = [1.0, 2.0]
var s = 3.0
var vsresult = [Double](count : v.count, repeatedValue : 0.0)
vDSP_vsaddD(v, 1, &s, &vsresult, 1, vDSP_Length(v.count))
vsresult    // returns [4.0, 5.0]


$$\begin{pmatrix} 1 \\ 2 \end{pmatrix} \times 3 = \begin{pmatrix} 3 \\ 6 \end{pmatrix}$$

vDSP_vsmulD(v, 1, &s, &vsresult, 1, vDSP_Length(v.count))
vsresult    // returns [3.0, 6.0]


$$\begin{pmatrix} 1 \\ 2 \end{pmatrix} \div 3 = \begin{pmatrix} 1/3 \\ 2/3 \end{pmatrix}$$

vDSP_vsdivD(v, 1, &s, &vsresult, 1, vDSP_Length(v.count))
vsresult    // returns [0.333333333333333, 0.666666666666667]


## Vector & Vector

Vector-vector operations pose no challenge to Accelerate and the associated functions look like

vDSP_v***D(vector_1, 1, vector_2, 1, &result, 1, length_of_vector)


Here are a few worked-out examples:

$$\begin{pmatrix} 2 \\ 5 \end{pmatrix} + \begin{pmatrix} 3 \\ 4 \end{pmatrix} = \begin{pmatrix} 5 \\ 9 \end{pmatrix}$$

var v1 = [2.0, 5.0]
var v2 = [3.0, 4.0]
var vvresult = [Double](count : 2, repeatedValue : 0.0)
vDSP_vaddD(v1, 1, v2, 1, &vvresult, 1, vDSP_Length(v1.count))
vvresult    // returns [5.0, 9.0]


$$\begin{pmatrix} 2 \\ 5 \end{pmatrix} \begin{pmatrix} 3 \\ 4 \end{pmatrix} = \begin{pmatrix} 6 \\ 20 \end{pmatrix}$$

vDSP_vmulD(v1, 1, v2, 1, &vvresult, 1, vDSP_Length(v1.count))
vvresult    // returns [6.0, 20.0]


$$\begin{pmatrix} 3 \\ 4 \end{pmatrix} {\bigg/} \begin{pmatrix} 2 \\ 5 \end{pmatrix} = \begin{pmatrix} 1.5 \\ 0.8 \end{pmatrix}$$

vDSP_vdivD(v1, 1, v2, 1, &vvresult, 1, vDSP_Length(v1.count))
vvresult    // returns [1.5, 0.8]


## Dot Product

$$\begin{pmatrix} 1 \\ 2 \end{pmatrix} \cdot \begin{pmatrix} 3 \\ 4 \end{pmatrix} = 11$$

var v3 = [1.0, 2.0]
var v4 = [3.0, 4.0]
var dpresult = 0.0
vDSP_dotprD(v3, 1, v4, 1, &dpresult, vDSP_Length(v3.count))
dpresult    // returns 11.0


## Matrix Multiplication

Matrices are passed into Accelerate as 1D arrays. As a result, matrix addition/subtraction is the same as vector addition/subtraction.

Matrix multiplication, on the other hand, is a bit more involved and requires this function:

vDSP_mmulD(matrix_1, 1, matrix_2, 1, &result, 1,
rows_of_matrix_1, columns_of_matrix_2,
columns_of_matrix_1_or_rows_of_matrix_2)


For example,

$$\begin{pmatrix} 3 & 2 \\ 4 & 5 \\ 6 & 7 \end{pmatrix} \begin{pmatrix} 10 & 20 & 30 \\ 30 & 40 & 50 \end{pmatrix} = \begin{pmatrix} 90 & 140 & 190 \\ 190 & 280 & 370 \\ 270 & 400 & 530 \end{pmatrix}$$

var m1 = [ 3.0, 2.0, 4.0, 5.0, 6.0, 7.0 ]
var m2 = [ 10.0, 20.0, 30.0, 30.0, 40.0, 50.0]
var mresult = [Double](count : 9, repeatedValue : 0.0)

vDSP_mmulD(m1, 1, m2, 1, &mresult, 1, 3, 3, 2)
mresult    // returns [90.0, 140.0, 190.0, 280.0, 370.0, 270.0, 400.0, 530.0]


## Matrix Transpose

Matrix transpose can be obtained with

vDSP_mtransD(matrix, 1, &result, 1, number_of_rows_of_result, number_of_columns_of_result)


Like this,

$$\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}^{\sf T} = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}$$

var t = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
var mtresult = [Double](count : t.count, repeatedValue : 0.0)
vDSP_mtransD(t, 1, &mtresult, 1, 3, 2)
mtresult    // returns [1.0, 4.0, 2.0, 5.0, 3.0, 6.0]


## Matrix Inversion

Matrix inversion takes a bit more effort, but can be accomplished with the function below (see Stack Overflow):

$$\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}^{-1} = \begin{pmatrix} -2 & 1 \\ 1.5 & -0.5 \end{pmatrix}$$

func invert(matrix : [Double]) -> [Double] {

var inMatrix = matrix

var pivot : __CLPK_integer = 0
var workspace = 0.0
var error : __CLPK_integer = 0

var N = __CLPK_integer(sqrt(Double(matrix.count)))
dgetrf_(&N, &N, &inMatrix, &N, &pivot, &error)

if error != 0 {
return inMatrix
}

dgetri_(&N, &inMatrix, &N, &pivot, &workspace, &N, &error)
return inMatrix
}

var m = [1.0, 2.0, 3.0, 4.0]
invert(m)    // returns [-2.0, 1.0, 1.5, -0.5]


# SwiftDate – A Smart Date/Calendar Library Written in Swift

By Helin Gai / July 9, 2014

SwiftDate is a powerful Date/Calendar framework written completely in Swift. It is partially based on QuantLib, the popular quantitative finance library, and is designed to be very friendly to financial applications. Even if you are not building financial apps, you may still find its date shifting and business calendar capabilities useful.

The SwiftDate framework is released under the MIT license and is available on GitHub.

# Date

The Date class allows you to work with calendar days efficiently.

Creating a date is simple:

var d1 = Date(year : 2014, month : 5, day : 15)
var d2 = Date(string : "2014-05-15")


Simple date math works as expected:

d2 = d1 + 1
if (d2 > d1) {
...
}


More sophisticated date shifting functions are available:

var d = Date(string : "2014-04-30")
d.addMonths(1)                                  // returns "2014-05-30"
d.addMonths(1, rollDay : RollDay.ThirtyOne)     // returns "2014-05-31"
d + "1M"                                        // returns "2014-05-30"


# Calendar

The Swift Calendar class allows you to work with different calendars, such as the NYSE calendar. Try this:

var cal = USNYSECalendar()
var d1 = Date(string : "2014-07-03")
var nbd = cal.nextBizDay(d1)   // returns "2014-07-07" - skipped over fourth of July!


# Day Counter

The DayCounter class lets you compute the year fraction (day count fraction) between two dates using the Actual/Actual, Actual/360, Actual/365, NL/365, and 30/360 conventions. It works like this:

var dc = Actual360()
dc.dayCountFraction(Date(string : "2014-01-31"), date2: Date(string : "2014-02-28"))


# Setting up Django, MySQL, PHP & phpMyAdmin on OS X Mavericks

By Helin Gai / July 8, 2014

I went through a lot of trouble getting Django to work nicely on the Mac a few years ago. Fearing having to go through the agony a second time, I took some notes. I’ve cleaned them up in this post and hope they’ll help you get up-and-running much faster!

## Xcode

Ready to develop on the Mac? First things first, sacrifice a few gigabytes of your precious SSD drive and get Xcode installed from the Mac App Store.

## Homebrew

Because my computer skills are exceptionally limited, I use Homebrew to install Unix packages. Get it here, or just type this into the Terminal

## MySQL & MySQL++

MySQL can also be installed with Homebrew. Type this into the terminal –

brew install mysql mysql++


When the installation is complete, you’ll see some further instructions regarding how to load MySQL automatically when your system boots up. Just copy, paste, and execute those commands.

If you have difficulty connecting to the MySQL server at this point, the following code does magic:

unset TMPDIR
mysql_install_db --verbose --user='username' --basedir="(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp mysql.server start  ## Apache Apache comes preinstalled on OS X. Just type the following into the Terminal to (re)start it: sudo apachectl restart  ## PHP Open /private/etc/apache2/httpd.conf in a text editor and uncomment this line: LoadModule php5_module libexec/apache2/libphp5.so ## phpMyAdmin After downloading the zip file from here, type the following into the Terminal (you may need to change the version numbers if you didn’t download v4.2.5: sudo unzip phpMyAdmin-4.2.5-english.zip -d /usr/local/ mv /usr/local/phpMyAdmin-4.2.5-english/ /usr/local/phpMyAdmin cd /usr/local/phpMyAdmin sudo cp config.sample.inc.php config.inc.php  Now open config.inc.php in the /usr/local/phpMyAdmin/ folder and change ['host'] = 'localhost' to ['host'] = '127.0.0.1'. Finally, create phpMyAdmin.conf in /etc/apache2/other/ with the following content Alias /phpMyAdmin /usr/local/phpMyAdmin <Directory /usr/local/phpMyAdmin> Options Indexes Order allow,deny Allow from all </Directory>  Restart Apache sudo apachectl restart  Now type http://localhost/phpMyAdmin/ into your browser. Are you seeing the phpMyAdmin login page? ## Django It’s finally time to install Django. It’s quite straightforward, just type the following into your Terminal: pip install django pip install MySQL-python  You’re all set! # Bond Risk Premium (Part IV) – Decomposing the Yield Curve By Helin Gai / July 6, 2014 Decomposing the yield curve into expectations and ex-ante bond risk premium is no easy thing. In this post, I discuss a few methods for performing such a decomposition. ## Slope of Long-Dated Forward Rates To apply this method, we need to make a fairly strong assumption – the slope at the long end of the yield curve reflects bond risk premium only. This is not unreasonable. After all, it is difficult to argue that market expectation of interest rate nine years ahead would be very different from rate expectations ten years from today. Accordingly, the long end of the expectation curve should be relatively flat. The table above illustrates how this method works with a detailed example, using actual data from December 31, 2003 (chosen because of visual appeal on this day): • Strictly speaking, a risk-free bond yield is the sum of rate expectations, bond risk premium, and convexity bias.1 Thus, to separate expectations from bond risk premium, we need to remove the convexity bias first. I ignore this component in other posts for technical reasons,2 but experience indicates that this adjustment is necessary to apply this method successfully. The convexity bias for the $$n$$-year forward rate3 is $$-\frac{1}{2} C\sigma^2$$, where $$C$$ is the $$(n-1)$$-year zero coupon bond convexity, and $$\sigma$$ is the normal volatility of $$(n-1)$$-year zero coupon yields. For example, the required convexity-adjustment for the 5-year forward rate (column A) is roughly $$-\frac{1}{2}\times 4^2\times (120.3/10000)^2 = -0.12\%$$ (column C). The convexity-adjusted forward rate is then $$5.08\% + 0.12\% = 5.19\%$$ (column D). • We assume that market participants have no rate views beyond 8-years. Thus the slope between 8 years and 10 years can be attributed to bond risk premium alone. We further assume that risk premium increases linearly with duration. If we run a linear regression of 8–10-year convexity-adjusted forwards with respect to time, then we obtain that the risk premium per year (the slope coefficient) is about 25.3 bp.4 Note that the starting point (8 years) and ending point (10 years) of the regression have been chosen based on my (not-very-rigorous) testing of historical predictive performance and represent a good compromise between short- and long-horizon interest rate forecasting between 1971 and 2014. • The rate expectation is computed as the convexity-adjusted forward rate minus bond risk premium. For example, the 5-year rate expectation is the 5-year convexity-adjusted forward rate (5.19%) (column D) minus a total risk premium of $$5\times 25.3=127$$ bp (column E), which leaves us with a forward expectation of 3.93% (column F). The fully decomposed curves are shown in the chart below. Note that the ten-year ahead expectation was roughly 4.35%, not far from the market’s perception of equilibrium short-rate at the time (4%–5%). This method is fairly simple to implement and is wildly popular on the Street. Empirical performance of this method, however, has been mixed. I’ll show in a later section that this framework does provide rate expectations that predict future rate changes more accurately than unadjusted forward rates. However, the historical bond risk premium calculated using this framework (shown in the chart below) turns out to be negatively correlated with my preferred bond risk premium estimates described below.5 ## Survey-Based Bond Risk Premium The most direct way of estimating bond risk premium is to use survey data as proxy for market expectations. The best option is probably the Blue Chip Survey of Professional Forecasters, although free alternatives exist. For example, the Federal Reserve Bank of Philadelphia publishes their quarterly Surveys of Professional Forecasters. In each year’s Q1 survey, they query market participants’ expectations for 10-year T-bill returns. As an example, the Q1 2014 survey indicates that the median forecast of annualized T-bill returns over the next ten years was 2.5%. At the time, 10-year Treasury zero coupon yield was about 2.9%, suggesting that the 10-year bond risk premium was about 40 bp. The chart below shows the historical survey-based bond risk premium since 1993. Since these numbers are not subject to model misspecification, they are likely the most defensible choices available. However, these estimates are of relatively low frequency, potentially too delayed to be useful for most market participants. ## Kim–Wright Bond Risk Premium An alternative is the Kim–Wright term premium estimates.6 The details of the Kim–Wright model is somewhat complex. At a very high level, the framework is based on a three-factor term structure model; i.e., we assume that the entire yield curve is driven by three unobserved factors. These factors can roughly be related to the level of rates, the slope of the yield curve, and a slow-moving measure of the yield curve. Very importantly, the model also specifies the market price of risk associated with each factor, providing a linkage between the “risk neutral world” (where investors are risk neutral) and the “real world” (in which investors are risk averse). This model then allows us to compute interest rate in the two different worlds – yields in the risk neutral world are actual yields we observe in the market, while yields in the real world represent “pure” expectations. The differences can then be attributed to bond risk premium. The innovative aspect of the Kim–Wright framework is the incorporation of survey data in the calibration, which provides an important anchor for the “real world.” Without these survey anchors, the model can produce very unintuitive results. The estimates are shown in the figure above. Overall, the contour is quite similar to survey-based bond risk premium. The model estimates are updated by Fed staff on a quarterly basis (about 1–2 weeks after quarter end). For investors who need real-time estimates, but do not have the resource to rebuild the model, a fast-and-dirty proxy for the 10-year zero coupon yield risk premium is $$BRP_{KW}^{10} = -1.5981 - 0.8952 y_2 + 1.2379 y_5 + 0.1050 y_{10},$$ where $$y_n$$ is the $$n$$-year bond yield. The chart below shows term premium estimated with the equation above tracks the actual term premium very well. ## D’Amico–Kim–Wei Bond Risk Premium More recently, I have been using the D’Amico–Kim–Wei model for decomposing the yield curve.7 This model retains the spirit of Kim–Wright, but incorporates TIPS and CPI data to break down nominal rate expectations further into real rate expectations and inflation expectations. It also allows us to separate inflation risk premium from real rate risk premium. It even sheds light on the liquidity premium TIPS command over nominal Treasuries. The chart below provides a decomposition of 10-year zero coupon yields using this model. I’ll provide longer horizon estimates later. For now, I simply highlight that the DKW bond risk premium is virtually identical to that of the Kim-Wright model. Below, I use the two measures interchangeably. 1. See chapter 8 of Bruce Tuckman, Fixed Income Securities — Tools for Today’s Markets (3rd Edition) (John Wiley & Sons, Inc., 2012). 2. Technically speaking, the models in other sections (e.g., Kim–Wright and D’Amico–Kim–Wei) assume that the convexity bias is constant over time, so it doesn’t contribute to the time-variation of bond yields. Following standard literature, I have combined it with bond risk premium. 3. To be specific, this is $$f_{n-1,n}$$. 4. There are a few variations to this method: 1) Instead of using convexity-adjusted forward rates, some market participants use long-dated Eurodollar futures contracts to compute BRP. This, of course, assumes that the term structure of credit risk premium is flat. 2) Instead of using regression techniques, most practitioners simply use average or median changes between consecutive curve points. 3) Another method I find interesting is to numerically solve for bond risk premium so that the slope of the expectations curve between two select points is as flat as possible. See Tuckman, Fixed Income Securities — Tools for Today’s Markets (3rd Edition), Bruce Tuckman and Dana Calistru, “The FEDISCOPE,” Lehman Brothers Fixed Income Research (2003), and Yi Tang and Bin Li, Quantitative Analysis, Derivatives Modeling, and Trading Strategies (World Scientific Publishing Co. Pte. Ltd, 2007). 5. In case you are wondering, the correlation remains negative after I strip out convexity-bias from the other bond risk premium estimates discussed in the following sections. 6. Don H. Kim and Jonathan H. Wright, “An Arbitrage-Free Three-Factor Term Structure Model and the Recent Behavior of Long-Term Yields and Distant-Horizon Forward Rates,” Finance and Economics Discussion Series (2005); Don H. Kim and Athanasios Orphanides, “Term Structure Estimation with Survey Data on Interest Rate Forecasts,” Finance and Economics Discussion Series (2005). 7. Stefanie D’Amico, Don H. Kim, and Min Wei, “Tips from TIPS: The Informational Content of Treasury Inflation-Protected Security Prices,” Federal Reserve Board, Washington, D.C. (2010). # Bond Yield Forecast Update By Helin Gai / May 19, 2014 I’m lowering year end forecast for UST 10yr yield slightly to 2.95% (from 3.1% before). This forecast reflects the following: • Rate expectation of 2.6% (in par yield term): This is based on my Fed funds forecasts between 12/31/2014 and 12/31/2024, which in turn come from a modified Taylor rule. At a high level, I assume the Fed will start hiking rates in mid-2015 and will gradually raise the policy rate to a terminal level of 3.5% in roughly 5 years. • Bond risk premium of 40bp, or about 9bp/year of forward term premium. • Convexity of -6.5bp: assuming 10yr spot vol of about 70bp/y. # Bond Risk Premium (Part III) – Defining Bond Risk Premium By Helin Gai / May 1, 2014 In this rather boring post, I formally define bond risk premium. Just like there are different kinds of yield curves, bond risk premium can also be defined in a few different ways: • The return premium is the expected excess return of a long-maturity bond over cash (e.g., T-bills). In other words, a long-term bond’s expected return over the next year is the 1-year bond return (i.e., 1-year bond yield) plus a return premium. (I remind the readers that I use one year as the shortest investment horizon. Strictly speaking, the return premium should be defined as the the long-term bond’s excess return over the next instant.) • The forward risk premium is the difference between a forward rate and the market expectation for the same interest rate. For example, the amount by which the 5-year forward 1-year rate differs from market expectation of 1-year interest rate 5-years ahead represents the embedded forward risk premium. • The yield risk premium is the difference between a zero coupon yield and the market expectation of average short-term interest rates over the same horizon. For instance, the 10-year zero coupon yield is the market’s expectation of average short-term interest rates over the next ten years plus the 10-year yield risk premium. It is interesting to note that each of these risk premia corresponds to a simple bond portfolio:1 • The return premium can be captured by buying an $$n$$-year bond for one-year, while shorting a one-year bond at the same time. • The forward risk premium is the expected return of buying an $$n$$-year bond and holding it to maturity, while simultaneously shorting an $$(n-1)$$-year bond followed by a one-year bond in the final year. • Finally, the yield risk premium can be captured by buying an $$n$$-year bond, while selling one-year bonds for $$n$$ consecutive years. Furthermore, these risk premia are equivalent and can be translated to each other:1 • The yield risk premium is simply the average forward risk premia over the same horizon. • The relationship between the yield risk premium and the return premium is more complex, but it can be shown that the 10-year yield risk premium is the average of a 10-year bond’s return premium next year, a 9-year bond’s return premium the year after, and so on. • The forward risk premium is the sum of the following expected returns: buying an $$n$$-year bond, shorting an $$(n-1)$$-year bond in year 1; then in year 2, buying an $$(n-1)$$-year bond and shorting an $$(n-2)$$-year bond; and so forth. 1. Cochrane, John H., and Monika Piazzesi. “Decomposing the Yield Curve.” March 2008. # Bond Risk Premium (Part II) – Clash of Two Theories By Helin Gai / April 27, 2014 Going back to the definition of forward rate in Part I of the series, I said somewhat casually that after year one, we “can” reinvest the proceeds at the next year’s interest rate, $$f_{1,2}$$. Of course, we have no way of knowing what interest rate will prevail next year, but does $$f_{1,2}$$ accurately reflect market’s expectation for 1-year interest rate a year from today? The answer is yes according to the Pure Expectation Hypothesis. This hypothesis says that the yield curve reflects only market expectation of future interest rates. For example, the 5-year forward 1-year rate is the same as the market’s expectation of one-year interest rate five years ahead, and the ten-year zero coupon yield is the market expectation of average short-term interest rates over the next ten years. Accordingly, an upward-sloping yield curve indicates market expectation of rising rates, while a downward-sloping yield curve suggests that the market is expecting interest rates to decline in the future. The pure expectation hypothesis has another implication – market participants expect all risk-free bonds to have the same expected return, which is the short-term risk-free rate. Consider a 2-year zero coupon bond, whose price today is $$P_0 = \frac{1}{(1+y_2)^2}.$$ One year later, the 2-year zero coupon bond becomes a 1-year zero coupon bond. If the 1-year forward 1-year rate reflects only market expectation, i.e., if $$f_{1,2}$$ is the expected 1-year interest rate one year later, then the expected price of the bond must be $$P_1 = \frac{1}{1+f_{1,2}}.$$ In this case, the expected one-year holding period return of the bond is \begin{aligned} \frac{P_1}{P_0} - 1 &= \frac{1}{1+f_{1,2}}\frac{(1+y_2)^2}{1} - 1 = \frac{(1 + f_{0,1})(1+f_{1,2})}{1 + f_{1,2}} -1= f_{0,1} = y_1.\end{aligned} It is easy to see that we can perform similar algebra for any comparable bond. As a result, the 1-year expected returns of all riskless bonds must be $$y_1$$ to conform to the pure expectation hypothesis. Unfortunately, empirical evidence gives an abundance of bad news for the pure expectation hypothesis. The chart below shows the average yield curves from June 1961 to April 2014. All three curves are monotonically upward sloping. In fact, as is shown in the second chart below, the slope of the yield curve (measured by the difference between 7-year and 1-year forward rates) has been positive over 85% of the time! Over such a long sample (over five decades) that covers both a secular bear market (about 25 years) and a secular bull market (nearly 30 years), and given that the sample period is relatively neutral (7-year forwards started at 3.92% in June 1961 and is 3.83% at the time of this writing), it is hard to believe that the market has almost always expected interest rates to rise in the future. Instead of yield curves, we can also study historical bond returns. The chart below shows the annualized (geometric) returns of investing in constant maturity par bonds and zero coupon bonds from 1971 to 2014, while the second chart below plots the annualized returns against annualized volatilities. These returns are computed using total return indices I constructed using the Fed’s fitted curves.1 The ex-post returns of longer maturity (and more volatile) bonds appear to be higher than shorter-term bonds (at least up to the intermediate sector), contradicting the “all bonds are created equal” assertion. Some time-series perspectives should also help. The next chart shows the rolling ex-post one-year excess returns of investing in 7-year par bonds over 1-year par bonds (1961–2014). Not only are the excess returns nonzero, they are time-varying and positive nearly 60% of the time. It should be clear at this point that the pure expectation hypothesis has failed to reflect market realities. Fortunately, there are others. One of them, all the way at the other end of the pendulum, is the random walk hypothesis. This hypothesis postulates that the market has no view – the expectation curve should be flat and the reason why the yield curve has typically been upward sloping is because of risk premium. Longer maturity bonds have longer duration, are more volatile, and thus carry higher interest rate risks. Since investors are risk-averse, they demand a higher yield to compensate for taking on the additional duration risk. This yield advantage is one form of bond risk premium. Assuming that unexpected rising and declining rate expectations have completely washed out over the past five decades (which is not unreasonable given the neutrality of the sample period), then the average yield curves and average return curves shown above effectively provide measures of historical realized bond risk premia (after subtracting the first point in each series). If we further assume that bond risk premium is constant over time (spoiler alert, it’s not!), then these are also reasonable estimates of ex-ante bond risk premia. It is worth noting that the return curves shown above are concave in time to maturity and duration. In fact, they are also concave in volatilities. In other words, although duration extension has historically been rewarded up to the intermediate sector, the marginal return declines the further out the curve we move. These findings are largely consistent with earlier research done by Antii Ilmamen. In 1995, he found that the average return curve from 1970 to 1994 plateaued at around the 3–4-year sector but began to dip thereafter.2 His updated research, using data from 1952 to 2009, suggests that duration extension is rewarded up to the 5–7-year sector, although the marginal return is rather muted beyond 1-year.3 It should also be noted that the longest maturity bonds, both in my and in Ilmanen’s analyses, offered no return advantages over bonds in the intermediate sector, likely because of demand from long-horizon investors such as pensions. For the sake of completeness, I also show return curves over eleven sub-periods in the chart below, which should provide investors with some ideas for the (fairly significant) variations in realized bond returns and risk premia over time. OK, I bashed the pure expectation hypothesis quite a bit, and then presented some evidence supporting the existence of bond risk premium. Of course, given that short-term interest rates are near 0% right now, it would be bonkers to believe that the steeply upward-sloping yield curve today reflects bond risk premium alone and that the market expects interest rate to stay near the zero bound forever. In reality, both expectations and bond risk premium play a role in determining the shape of the yield curve, so that an upward-sloping yield curve could reflect both rising rate expectations and positive bond risk premium. It is equally possible that the positive slope reflects expectation of sharply higher interest rates in the future, combined with negative bond risk premium. Disentangling rate expectations from bond risk premium is notoriously difficult and we’ll discuss this important topic on a different day. 1. The CMT Total Return Indices are constructed using the Gurkaynak, Sack & Wright’s fitted curves. More specifically, I assume the index rolls into a new zero coupon or par bond at the end of each month. Note that the returns reported here are higher than the returns of comparable benchmark bond indices (annualized excess return of 1.5% for 10s since 1981). Here are a few reasons: 1) Bonds in my indices typically have higher durations than benchmark issues. For example, if 10-year notes are issued once a year, then 11 months after issuance, the bond in the benchmark index would have only 9.1 years to maturity. In my index, the bonds would have at least 9.9 years to maturity, since they are rolled into new 10-year bonds monthly. 2) Benchmark bonds tend to be rich at issuance, and gradually cheapen as they age, thus reducing their returns, all else equal. Hypothetical bonds created with fitted curves don’t suffer from this issue. It’s debatable whether it’s a good idea to use hypothetical bonds, since an index should ideally reflect actual investable performance. I devised these indices mainly because most bond indices do not have long enough a history and do not provide the kind of granularity I’m interested in. On the other hand, my indices more accurately reflect yield curve dynamics, instead of being plagued by other idiosyncratic factors. Furthermore, it sheds some light on possible return enhancement opportunities. For example, instead of rolling on-the-run issues, buying and holding cheaper off-the-run issues not trading special in the repo market may generate higher returns. 2. Ilmanen, Antti. Understanding the Yield Curve. Salomon Brothers Portfolio Strategies, 1995–1996. 3. Ilmanen, Antti. Expected Returns: An Investor’s Guide to Harvesting Market Rewards. Wiley, 2011. # Bond Risk Premium (Part I) – A Review of Different Yield Curves By Helin Gai / April 20, 2014 Bond risk premium is the expected excess return of holding long-term default-free bonds (e.g., buying-and-holding a ten-year Treasury note), instead of rolling their short-term counterparts (e.g., buying T-bills monthly for ten years). There is extensive literature on this topic from both policy and investment perspectives. This is the first part of a series summarizing what I have learned about its theory and practice over the past few years. A thorough understanding of this concept should allow investors to make more intelligent investment decisions, even in the absence of directional market views. A frequently quoted hindrance to more sophisticated fixed income analysis is the lack of high quality data. Throughout this series, I will provide some guidelines on where investors may find freely accessible data, thus eliminating the need to create in-house models from scratch. The target audience are investors with relatively long investment horizons. In fact, I’ll focus on holding periods of at least one year throughout this note. Further, I restrict the investment universe to coupon Treasuries with 0–10 years to maturity for the most part, although there is evidence that the theory can be applied successfully to other markets. I should note that my research on this topic has been heavily influenced by the publications of Antti Ilamnen.1 I will quote some of his findings in this series, supplemented by my own analyses and interpretations. # A Review of Different Yield Curves Bond analysis has been made more difficult than necessary thanks to the confusing vocabulary practitioners and academics have adopted. In this post, I provide a cursory review of different yield curves, mainly to ensure that there is no ambiguity about the terminology I use.2 The most commonly seen yield curve, thus worthy of at least an honorary mention, is the on-the-run Treasury curve. This curve plots the yields of benchmark Treasury issues (“on-the-run Treasuries”) against their remaining time to maturities. It is the yield curve typically displayed at bloomberg.com or on the Wall Street Journal. Despite its dominance in the financial press, the on-the-run yield curve is almost completely useless from an analytical perspective: the bonds on the curve are not of constant maturities (the 30-year bond may have only 29.8 years to maturity); the maturity gaps between two bonds can be substantial (up to 20 years); furthermore, on-the-run bonds sometimes trade richer than their fair values due to liquidity and financing advantages. Our main focus will be information contained in zero coupon curves, forward curves, and to a lesser extent, par yield curves. This does pose some challenges for certain investors, since these fitted curves cannot be observed directly in the market and need to be constructed using curve fitting techniques. More specifically, practitioners usually select a large universe of off-the-run Treasuries and statistically derive a smooth curve that best fits the prices or yields of all these securities. Fortunately, Federal Reserve staff have been diligently publishing their estimates of these theoretical curves (henceforth the “GSW fitted curves”), although with a two business day delay.3 Most banks also provide fitted curve data on a daily basis. Note that different researchers and vendors will inevitably series different fitted yields. The divergence could be substantial in the forward space, particularly at the long end. Fortunately, our primary focus is the 0–10-year part of the curve, which tends to be well anchored given the large number of securities spanning this maturity spectrum. The figure above shows the Treasury zero coupon curve, forward curve, and par yield curve I estimated on April 16, 2014. The zero coupon curve plots zero coupon yields against time to maturity. A zero coupon yield, or a spot rate, is the interest rate on a “spot loan.” This is a loan with only one repayment that occurs on the redemption date. For example, if you lend out1 in the form of a 10-year spot loan today at an interest rate of $$y_{10}$$, then the repayment will happen in ten years and amount to $$1\times(1+y_{10})^{10}$$. Now consider a bond that matures in $$t$$-years with only one cash flow – $1 on the maturity date. This is known as a zero coupon bond and its price today, $$P(t)$$, must satisfy $$P(t) \times (1 + y_t)^t = 1$$, or $$P(t) = \frac{1}{(1 + y_t)^t}.$$ For readers familiar with continuous compounding, the price/yield relationship can be written as $$P(t) = e^{-y_t^c t}.$$ Instead of a 10-year spot loan, we can also start by lending money for one year at an interest rate of $$f_{0,1}$$. At the end of year one, we’ll receive $$1\times(1 + f_{0,1})$$, and we can then lend out this balance for a second year at an interest rate of $$f_{1,2}$$. At the end of two years, we’d have a balance of $$1\times(1+f_{0,1})\times(1+f_{1,2})$$. We can repeat this process ten times to match the investment horizon of the spot loan. Note that we have denoted the $$(n-m)$$-year interest rate $$m$$-years from today $$f_{m,n}$$. For example, $$f_{5,6}$$ is the 1-year interest rate 5 years from today. If we are indifferent between the 10-year spot loan and rolling 1-year loans ten times, it must be true that $$(1 + y_{10})^{10} = (1+f_{0,1})(1+f_{1,2})\ldots(1+f_{9,10}).$$ This identity demonstrates that the 10-year zero coupon yield is simply the geometric average of forward 1-year rates over the next ten years. The relationship is simpler if we use continuous compounding: \begin{gather} e^{10y_{10}^c} = e^{f_{0,1}^c}e^{f_{1,2}^c}\ldots e^{f_{9,10}^c} \Rightarrow y_{10}^c = \frac{f_{0,1}^c + f_{1,2}^c + \cdots + f_{9,10}^c}{10}.\end{gather} As can be seen, under continuous compounding, a zero coupon yield is the arithmetic average of forward rates. Finally, the par yield curve provides the yields of bonds trading at par ($100). Note that a coupon bond can be considered as a package of zero coupon bonds. Given a set of zero coupon yields then, it would be trivial to price a coupon bond. For example, consider a 10-year bond that pays annual coupons of $$c$$, then its price is

$$P = \frac{c}{(1+y_1)} + \frac{c}{(1+y_2)^2} + \cdots + \frac{c}{(1+y_9)^9} + \frac{100 + c}{(1+y_{10})^{10}}.$$

In this equation, we have treated the first coupon payment as a 1-year zero coupon bond with redemption payment of $$c$$, …, and the final payment of $$100+c$$ as the face value of a 10-year zero coupon bond. Since this is a 10-year par bond, its price $$P$$ must be \$100 and we can easily solve for the par coupon rate $$c$$. It can be shown that the coupon rate and yield to maturity are identical for a par bond being priced on a coupon date. Therefore, by solving for $$c$$, we have also obtained the 10-year par yield.4

A few quick notes before preceding:

• It should be clear from the derivation above that the zero coupon, forward, and par curves can be derived from each other.5 Therefore, they contain exactly the same market information. More specifically, we have demonstrated that zero coupon yields are average forward rates. It can be seen from the equation above that a par yield is a complex average of zero coupon rates, and by extension, it is an even more complex average of forward rates. This explains why the zero coupon curve is smoother than the forward curve, while the par yield curve is smoother still. As mentioned, we will mostly focus on zero coupon yields and forward rates because they are simpler building blocks and provide better intuitions about information being priced into the bond market. Once a forward curve or a zero curve has been carefully analyzed, it is trivial to translate the results into par yield terms.

• Most equations in this series will use either annual or continuous compounding, even though the US Treasury market uses semiannual compounding. This is to remove unnecessary clutters in the equations and to make the intuitions stand out. However, none of the conclusions will change if we used different compounding conventions.

1. Antti Ilmanen, Understanding the Yield Curve (Salomon Brothers Portfolio Strategies, 1995–1996); Antti Ilmanen, Expected Returns: An Investor’s Guide to Harvesting Market Rewards (Wiley, 2011).

2. Investors who want a more detailed treatment of the concepts discussed here can refer to Tuckman’s Fixed Income Securities – Tools for Today’s Markets (2nd Edition) (John Wiley & Sons, Inc., 2002). (I prefer the second edition for pedagogical purposes.)

3. Refet S. Gurkaynak, Brian Sack, and Jonathan H. Wright, “The U.S. Treasury Yield Curve: 1961 to the Present,” Federal Reserve Board, Washington, D.C. (2006).

4. For par bonds with “irregular” maturity dates (as innocent as 9.75 years), the definition of par yields can be tricky. Some practitioners simply report the par coupon rate (like I do), in which case the yield may differ slightly from the coupon rate. Others solve for a coupon rate that is equal to the yield, causing the bond price to deviate very slightly from par.

5. This is true for government yield curves. The relationship for swap curves is more complex, given the transition to OIS discounting.