Links for Dec 20: WTF edition

More Tim O’Reilly for you….
Narrative as Destiny: Steering Markets and Innovation to Serve Society

Tim O’Reilly, founder and publisher of O’Reilly Media, technology thought leader, and investor known to many as the “conscience of Silicon Valley,” brings a lens of storyteller to explore the role of technology and economics in today’s marketplace. In his many-worlds approach to the innovation multiverse, it is not simply technology that determines our future; the stories we tell about those developments also shape our destiny. Discussing his new book, WTF: What’s the Future and Why It’s Up To Us, and asking the essential question, “Who gets what and why?” O’Reilly looks at such fundamental issues as whether our basic model of growth in the old capitalist economy is the best one for society, and what the changing nature of tech platforms could mean for consumers and the economy if we had more wisdom to steer it.

A Decade of Stagnation, Why?
What explains the slow recovery from the financial crisis and great recession in so much of the world?

Some great ideas here:
– The nature of bank lending, interaction with real estate, Positional goods, Ecological limits, Decline of leisure time, Inequality

Roger McNamee On Being In The Right Place At The Right Time (And Making The Most Of It)

Update: Article Roger McNamee wrote recently: I was Mark Zuckerberg’s mentor. Today I would tell him: your users are in peril

Roger McNamee is one of the most successful technology investors of all time. While running the T. Rowe Price Science & Technology Fund, and generating a 17% compound average growth rate in the process, Roger made the unheard of move of committing capital, as a mutual fund manager, to venture investments in Electronic Arts and Sybase. From there, he started the industry’s first crossover fund with John Doer, investing in both late-stage venture capital and public market securities. In March of 2000, he co-founded private equity firm Silver Lake Partners in anticipation of the tech bust and, in 2004, founded Elevation Partners where he would become one of the first investors in Facebook and other nascent tech stars. In this episode, Roger shares what made him so successful as an investor, how music saved his life and why he has shifted his focus today from investing in tech to warning of the rising risks tech giants present to democracy and society.


Linkfest to podcasts/articles Nov 2017

I hope to elaborate more on some of these topics in the future, but in the meantime, check out some great conversations:

What is Technology Doing to Us? A Conversation with Tristan Harris on Sam Harris
“In this episode of the Waking Up podcast, Sam Harris speaks with Tristan Harris about the arms race for human attention, the ethics of persuasion, the consequences of having an ad-based economy, the dynamics of regret, and other topics. ”
*really interesting about how VR is an upcoming immersive technology where the next arms race for attention will be if not regulated

Philip Auerswald on the Rise of Populism
“Author and professor Philip Auerswald of George Mason University talks with EconTalk host Russ Roberts about the rise of populism in the United States and throughout the world. Auerswald argues that the rise of cities and the productivity of urban life has created a divergence in experience and rewards between urban and rural areas around the world. Auerswald ties these changes to changes in voting patterns and speculates about the sources of the increasing productivity of metropolitan areas”
It’s interesting how he tied in the cities aspect to productivity and inequality. He also quoted Henry George but didn’t seem to mention George’s theory about how most of the taxation should fall on unearned income (real estate gains) instead of labour and capital.

The Incredible Value of Deep Work, Instead of Distraction, with Cal Newport
I always appreciate Cal Newport’s thoughts on deep work

Tim O’Reilly on What’s the Future on EconTalk
“Author Tim O’Reilly, founder of O’Reilly Media and long-time observer and commenter on the internet and technology, talks with EconTalk host Russ Roberts about his new book, WTF? What’s the Future and Why It’s Up to Us. O’Reilly surveys the evolution of the internet, the key companies that have prospered from it, and how the products of those companies have changed our lives. He then turns to the future and explains why he is an optimist and what can be done to make that optimism accurate.”
-Key to next economy: As one thing becomes commoditized, something else becomes valuable (specialty coffees)
-Software: 20th century mindset, search results, relevant products. Software programs/algo’s are workers, and the programmers are managers, managers monitor real time data and make tweaks to program…..()
-Continuous education is the way of the future, We are doing the equivalent of teaching someone to Plow, On demand learning, how do we teach kids and give them access to the right. Potentially away from regimented schooling, to home schooling

Joe Rogan Experience #1037 – Chris Kresser
“Chris Kresser is a health detective specializing in investigative medicine, blogger, podcaster, teacher and a Paleo diet and lifestyle enthusiast. His new book “Unconventional Medicine” is out now, available on Amazon and”
The need for prevention and proper nutrition
“The doctor of the future will give no medicine but will interest his patients in the care of the human frame, in diet and in the cause and prevention of disease.”
― Thomas Edison


“#1006. Jordan Peterson is a clinical psychologist and tenured professor of psychology at the University of Toronto. You can check out all Dr. Peterson’s self-improvement writing programs at Bret Weinstein is a biology professor at Evergreen State College in Olympia, WA. Currently he is in the middle of an intense controversy that has been documented by the Wall Street Journal, New York Times, and several other mainstream media outlets”

Interview With Derek Thompson: Masters in Business (Audio)
“Bloomberg View columnist Barry Ritholtz interviews Derek Thompson, author of the book “Hit Makers: The Science of Popularity in an Age of Distraction.” Thompson is a senior editor at The Atlantic, where he writes about economics, labor markets and the media. This commentary aired on Bloomberg Radio.”
-Content may be king, but distribution is the kingdom…..

Pattern matching Cryptocurrencies

Bitcoin, Ethereum and some other cryptocurrencies seem to be in the spotlight again due to their most recent acceleration.

Source: CEOTechnician

Ethereum is up multiples since January. I thought we could take a look at importing Etherum price data in R and then seeing if we can draw any parallels between Ethereum and Bitcoin using the pattern matching algorithm we’ve looked at here before.

But first we will load Bitcoin data in R, since it can be more easily accessed through the Quandl API.


BTCUSD = Quandl("BCHAIN/MKPRU",type="xts")
colnames(BTCUSD)[1] =  'avg_price'

ggplot(data=fortify.zoo(BTCUSD), aes(x=Index, y=avg_price))+
  geom_line(aes()) + scale_y_log10() + ggtitle("Bitcoin in USD (Log10)")

ggplot(data=fortify.zoo(BTCUSD), aes(x=Index, y=avg_price))+
  geom_line(aes()) + ggtitle("Bitcoin in USD ")


As you can see Bitcoin is undergoing another run-up in prices. It’s difficult to see previous runs in the price, so we will also plot bitcoin prices on a log scale, as to better see the percentage gains.


The price acceleration looks more tame in this view relative to previous ones, but the market capitalization of bitcoin has grown much larger than when it had its initial run.

Lets take a look at Ethereum now. We will pull in data via the Poloniex API, process the JSON object and convert the dates. Finally we will look at the linear and log price graphs.

url_m = ''

mkt_data <- fromJSON(url_m)

ETH <- as.xts(mkt_data[,5],[,1], origin="1970-01-01")))
colnames(ETH) <- 'ETH'

ggplot(data=fortify.zoo(ETH), aes(x=Index, y=ETH))+
  geom_line(aes()) + scale_y_log10() + ggtitle("Ethereum in USD (Log10)")

ggplot(data=fortify.zoo(ETH), aes(x=Index, y=ETH))+
  geom_line(aes()) + ggtitle("Ethereum in USD ")


What a run!

Lets take a look at the bitcoin data again and see what the closest matches are for the most recent run up. We will be using code similar to a previous post.


Using a 63 day period for pattern matching and dynamic time warping, we get these results. The prices highlighted in blue are the most recent prices we are matching, and the prices in red are the 10 closest matches.


It looks as though most of the upside in the price gains has already been had, as the forward week, month, quarter returns are all negative. Having said this, there was also one run (Match 5) that had a 1,044.7% run.

In the future, we may look at pattern matching log prices, or cross-market pattern matching, for example Ethereum’s recent price run on Bitcoin’s history.

*Not investment advice

If you are trading this parabolic spike, be careful and always use stops. I found this idealized image of stop placement fascinating. stops

Source: “Stop Techniques – The Implications From Inconsistent Forecasting Skills ” Nordea

Trading the index with seasonal strategies

I recently listened to an interesting interview at Better System Trader with Jay Kaeppel on Seasonality, a topic which I hadn’t done much backtesting on previously.

Jay outlined 3 rules for constructing a seasonal trading strategy on the stock index:
– Stay long the last 4 days and first 3 days of the month (S_EOM)
– Stay long the middle of the month, business days 9, 10, 11 (S_MOM)
– Stay long 3 days before and after holidays (S_HOL)

I’ve recreated these rules on the SPY ETF using R and the Systematic Investor Toolbox with the output below:

seasonal backtest

I’ve showed the equity curves for the 3 strategies separately (S_EOM, S_MOM, and S_HOL) as well as the combination of all 3 rules together (S_C2). A third variation (S_C3) is the combination of all 3 rules with a 200dma risk filter on the SPY itself, that is the strategy will only be long the index if one of the rules is true and the SPY is above its 200dma. Two benchmarks are also on the report: The SPY itself and SPY200, which is the SPY with the 200dma risk filter applied again.

The majority of the outperformance for the seasonal strategy is coming from the End of Month rule. The other two rules increase overall returns slightly but don’t have much of an effect on risk adjusted returns, with the sharpe ratio staying relatively constant. The seasonal strategy with the risk filter (S_C3) has a similar return to the SPY itself, but with half the volatility and nearly one quarter the drawdown. A much nicer ride for your portfolio!

In the future I may explore the impact of transaction costs on the strategy as well as how walk forward testing affects seasonal strategy out-of-sample performance.

Jay recently updated some of the strategies from his book, Seasonal Stock Market Trends, check out the links below for more of his work:
Updating my seasonal trends trading strategy Part 1
Updating my seasonal trends trading strategy Part 2

Pattern matching: a quick look at the last 11 months

John Hussman posted the following pattern on his twitter:

Source: John Hussman’s Twitter

So I thought this would be a great time to see which points in history the Systematic Investor Toolbox pattern matching algorithm would highlight. Instead of looking at the Dow Jones I will use the S&P500 Spyder (SPY). Choosing a window period of approximately 11 months and looking at 20 years of data lets see what happens:

# Load Systematic Investor Toolbox (SIT)
con = gzcon(url('', 'rb'))

# Load historical data
tickers = 'SPY'

data = getSymbols(tickers, src = 'yahoo', from = '1950-01-01', auto.assign = F)

# Dynamic time warping distance

obj = bt.matching.find(Cl(data), normalize.fn = normalize.mean, dist.fn = 'dist.DTW', plot=T,, n.query=228,n.reference = 252*20)

matches = bt.matching.overlay(obj, plot.index=1:90, plot=T)

matches = bt.matching.overlay(obj, plot=T, layout=T)
bt.matching.overlay.table(obj, matches, plot=T, layout=T)

Source: Time Series Matching with Dynamic Time Warping

Interestingly enough, the runup starting in july 2011 is chosen as the closest match, and we all know how that ended. There are multiple other scenarios however.

The average returns of the top 9 matches seem to under perform the anytime/benchmark return (not shown).

More pattern matching posts to come in the future….

Now back to turkey day…..

Update: I ran the same code for the DJIA diamonds (DIA):

The same conclusions hold true, the runup starting in july 2011 is the closest match and the next week/month return is below average. In the future we will examine more pattern matching methods….

Trahan and Lazar: Buy Domestic Consumer and Industrial stocks

Interesting interview with Francois Trahan and Nancy Lazar. I’ve long been a fan of Trahan and his ‘Inflation is the new fed funds rate’ thesis, and now that he’s moved to a new firm to focus only on macro strategy I’m watching Cornerstone Macro LP very closely. Check out the interview below in which they discuss the outlook for the US:

Source: WealthTrack

Some of the takeaways:
• Macroeconomic influences have an outsized impact on equity market returns
• Dividends will contribute less to equity returns over the next few years. Markets driven mostly by PE expansion
• US has a low cost of energy because of natural gas
• Structural story of inflation being contained in US
• Emerging market bond sell-off and inflation problem: Indonesia yields from 5% to 9%, much worse than change in US yields
• Retail/Consumer stocks will have structural and cyclical outperformance vs materials/energy
• Buy US based industrial companies

I also recently came across this presentation by Trahan to the CFA society which has some great charts. In particular here are two slides that highlight the shift from a fed dominated market cycle to inflation dominated.

Source: Francois Trahan presentation to the CFA

I’ve also mentioned Trahan’s LEI framwork from his book in a previous post.