Notebooks for financial economics. Keywords: IPython notebook pandas statistics GDP inflation CPI PCE Fed FRED Ferbus unemployment wage income debt Case-Shiller housing asset portfolio equities SPX bonds TIPS rates currency Eurozone euro yen FX USD EUR JPY XAU gold Brent WTI oil Holt-Winters time-series forecasting econometrics
It is very interesting that Berkshire Hathaway has accumulated more than 100 million shares of Apple recently, which has a geometric mean rate of 16.6% over the last ten years -- extraordinary growth:
>>> gm2gem(get('s4aapl'))
Geometric mean rate: 16.5693
Arithmetic mean rate: 22.4526
sigma: 32.8234
kurtosis (Pearson): 10.3151
GM(2), sigma1: 24.0206
GM(2), sigma2: 82.0585
GM(2), q: 0.0813
GM(2), b: 2.5
yearly: 256
N: 2512
and the above does not include dividend yield of 1.6%. The Gaussian mixture model deduces two volatilities: 24% and 82%, the latter occurring with probability 0.0813.
In contrast, BRK.A pays no dividends and has less a third of Apple's geometric growth (only 4.7% over the same period). It seems strange for value equities that Berkshire returns exhibit extremely high kurtosis of 21.4 (which compares to 3 for an ordinary Gaussian, and 10.3 for Apple).
gemrat()
function, see https://git.io/gmix -- the section on monthly geometric returns is insightful for asset allocation: comparison across real estate, stocks, bonds, gold, and FX from the viewpoint of USD-based investor.
Our inflation measure is a composite of CPI and PCE, both core and headline versions for each.
>>> infl = get(m4infl)
>>> roundit(gemrat(infl['2015':], yearly=12))
[1.6045, 1.6052, 0.3525, 5.8699, 12, 28]
The volatility is so low (0.35%) that the geometric and arithmetic rates of inflation are very close: 1.6%. The Fed target is 2%, core PCE basis, so they are currently off by about 1 standard deviation. Yellen in her recent testimony seemed puzzled given the labor market situation.
To score the Federal Reserve's performance under its dual mandate for inflation and unemployment, rerun this Jupyter notebook using current data, https://git.io/fed
Re: #2 -- Git shell script to list commit dates, given path/filename(s)
The system's modification time for a committed file may not
be the actual commit date and time! This can be verified
if you checkout an older branch and switch back.
There is no nice builtin git utility, so I wrote one:
https://git.io/git-lu
Fed Funds forecast one-year out is 1.50% using forefunds('17z', '18z')
so if the street is right about a rate hike at the December 13 presser, then 2018 looks like a very flat year in terms of US interest rates.
[Please see https://git.io/fedfunds for forecasting the Fed Funds rate using futures contracts on LIBOR.]
In terms of the US bond market, the Fed will begin to reduce its assets from QE, and thus the market sentiment is extremely bearish. As evidence, here is the plot of get(w4cotr_bonds)
which translates data from the CFTC Commitment of Traders Reports:
[The notebook https://git.io/cotr discerns how various asset classes are positioned in the market.] So overall for 2018, the yield curve is more likely to widen.
The pre-Xmas decline of over 25% in Bitcoin price in less than 24 hours induced a backwardation in futures pricing relative to spot. Easy to imagine a trading strategy somewhat like a put, given the borrowing rate against such assets.
But is it hard to imagine a call option one-year out at $50,000 strike? Some institution paid close to a million dollars in premiums last Wednesday for notional 275 Bitcoins (source: LedgerX CEO Paul Chou). The usual Black-* models should avoided to price this option, for the stochastic process is extremely non-Gaussian (Levy).