Quant Mashup - John Orford
Programming's Achilles Heal [John Orford]
I am building a small Domain Specific Language (spreadsheet style calculations) called FlatLang with some interesting properties. These are my notes. ~ FlatLang is a functional, pure, total, statically typed language. To simplify, 1) (almost) everything is a function 2) each function's
- 5 years ago, 1 Jan 2019, 12:48pm -
Conclusion - JavaScript for Financial Analysts Book - First Draft [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 16. ~ This book was aimed at introducing a VBA replacement. No doubt VBA has its place, but it is also stuck in that same niche, unable to evolve and in turn not giving VBA developers a chance to grow. Set in stark contrast is the
- 8 years ago, 25 Feb 2016, 12:03pm -
Babel - Chapter 15 First Draft - JavaScript for Financial Analysts [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 15. ~ Like all superheroes JavaScript's biggest strength is also its main weakness. JavaScript can be distributed and run anywhere, easily. The problem is that each browser or platform supports a slightly different subset of
- 8 years ago, 10 Feb 2016, 10:10pm -
Immutability - Chapter 14 - Javascript for Financial Analysts [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 14. Download all the code here and give it a test run! ~ There has been a subterranean theme flowing under each chapter of this book. Furthermore, you see it again and again in far flung fields and yet people rarely discuss it.
- 8 years ago, 31 Jan 2016, 11:54am -
Numerical Analysis - JavaScript for Financial Analysts - Chapter 13 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 13. Download all the code here and give it a test run! ~ The central theme of this book has been transforming data in a stateless manner using map and reduce. Data flows through our code until it's in the form we want it to
- 8 years ago, 20 Jan 2016, 12:21pm -
Turbo Boost - JavaScript for Financial Analysts - First Draft [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 12. ~ Starting JavaScript development is like deciding to support the Yankees or Manchester United. It's got a lot of history; the most money; and the deepest bench of developers, but sometimes, sometimes you wish it was a
- 8 years ago, 7 Dec 2015, 11:56pm -
Statistics - JavaScript for Financial Analysts [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 11. ~ Finance is a super slow mo movie of investment decision logic colliding into chaotic markets. The narrow space in between is inhabited by statistics. JavaScript has a capable statistics library called jStat which offers a
- 8 years ago, 4 Dec 2015, 12:54pm -
D3 - Javascript for Financial Analysts - Chapter 10 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 10. ~ D3 is a foreboding beast. It eschews classic programming styles in favour of a more functional approach. Luckily however, if you have come this far, get ready to sit back and enjoy of the fruits of your labour. Almost every
- 8 years ago, 30 Nov 2015, 11:19pm -
Visualisation (Now with 3D!) - JavaScript for Financial Analysts [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 9. ~ The web dominates our communication. The driver of this crushing victory? The humble webpage increasingly coupled with JavaScript. Up until now we have focused on the basics of how to code JavaScript in a functional manner,
- 8 years ago, 26 Nov 2015, 03:29pm -
Visualisation Pt 1 - Javascript for the Financial Analyst Chapter 9 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 9. ~ The web dominates our communication. The driver of this crushing victory? The humble webpage increasingly coupled with JavaScript. Up until now we have focused on the basics of how to code JavaScript in a functional manner,
- 8 years ago, 24 Nov 2015, 01:27pm -
Relationship Between Growth & Momentum [John Orford]
Matt wrote me a while back about how thinking about Value and Growth lead you to Mean Reversion and Momentum. I like connections. Here's the line of reasoning. Value stocks are priced low by whichever definition you feel like using, but when investing in value stocks you are betting against the
- 8 years ago, 22 Nov 2015, 12:06pm -
First draft of 'JavaScript for Financial Analysts' Chapter 8 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 8. ~~ As we saw in the previous chapter, doing things asynchronously is really appealing when you can pull it off elegantly. A bit like juggling, there's a lot going on, but a skilful juggler only ever interacts with one ball
- 8 years ago, 19 Nov 2015, 11:14am -
Asynchronicity & Performance - 'JavaScript for Financial Analysts' Chapter 7 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 7. ~ We are all waiting for something, and our computers are no different. Computers are built on four building blocks. CPUs, memory, hard disk and network. Our programs are only as fast as the slowest component. To put
- 8 years ago, 8 Nov 2015, 02:26pm -
10 Reasons to Use Elixir in Finance [John Orford]
Elixir is the new hot programming language on the block. The bastard child of Ruby and Erlang. Syntax Ruby is designed like Apple designs phones. It looks and feels right. I love that the goal of Ruby language design is to reduce cognitive dissonance when implementing features. Everything has to fit
- 8 years ago, 1 Nov 2015, 11:47am -
Information Ratio Hypothesis Testing [John Orford]
Spurned by reading an account of a trader who swears by machine learning, few days ago I wrote about aesthetics in finance. Maths and tech without a narrative is pointless. My own attempts at providing a narrative foundered a few months back. Suspend Your Disbelief! I started using the Sharpe as a
- 8 years ago, 21 Oct 2015, 04:02pm -
First draft of 'JavaScript for Financial Analysts' Chapter 6 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 6. ~ Before I start - mulling over a change in function syntax for the book. So that for example, [0,1,2,3].map(function(i){return i+1;}) becomes [0,1,2,3].map( i => i+1 ) If you have an opinion, let me know! ~ So far we have
- 8 years ago, 20 Oct 2015, 09:34pm -
First draft of 'JavaScript for Financial Analysts' Chapter 5 [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 5. ~ The most difficult thing to do in computer science is naming things. It has made many a programmer go insane. Exhibit A - Android's code names. Cupcake Donut Eclair Froyo Gingerbread Honeycomb Ice Cream Sandwich Jelly
- 8 years ago, 17 Oct 2015, 01:14pm -
'Javascript for Financial Analysts' - Help Wanted [John Orford]
The still-in-progress 'Javascript for Financial Analysts' book is now up on Leanpub. The goal of the book is to help financial analysts automate their daily tasks by using Javascript in the browser. Not only that, but do it elegantly. Giving people a viable alternative to Excel is a lofty
- 8 years ago, 15 Oct 2015, 06:18am -
Javascript for Financial Analysts Book - 'Fold' [John Orford]
First draft of 'JavaScript for Financial Analysts' Chapter 4. ~ Up until now we have introduced a handful of new concepts which needed just two words of vocabulary - map and filter. Fold however, is a new piece of vocabulary and one of the most powerful concepts in computer science rolled
- 8 years ago, 14 Oct 2015, 11:58am -
Accentuating [John Orford]
A bunch of people got in touch about the recent 'Duality' strategy. Frankly, I see a result and post it up here, thinking these ideas through as I write and as you read 'em. I used current DJIA constituents to backtest the strategy, but mentioned the need to test with random
- 8 years ago, 3 Oct 2015, 09:51pm -
Volatility Reconcialiation [John Orford]
Yesterday I wrote up a post, and immediately after, was sure I got something wrong. This is the offending chart. Volatility increases linearly as we add more positions to the equally weighted portfolio. What I failed to mention is that each position was weighted by 100% of the portfolio. So two
- 8 years ago, 2 Oct 2015, 02:13pm -
Timing / Stock Pick Duality Strategy [John Orford]
Months ago I came up with an idea. How about building a portfolio where choosing positions and a holding period is interchangeable? Weird right? Let me explain. Academics assume day over day returns have little to do with each other and that markets are more or less efficient. So increasing your
- 8 years ago, 30 Sep 2015, 08:05am -
'Javascript for Financial Analysts' Chapter 3 - First Draft [John Orford]
The first chapter ended with code which included a map and a filter which we will dive back into now with a less applied more intuitive example. Open up the JavaScript console and paste or type in the following code, [0,1,2,3,4,5,6,7,8,9] .filter( function(j){ return j%2===1; } ); This code filters
- 8 years ago, 23 Sep 2015, 07:31am -
First draft of 'JavaScript for Financial Analysts' Chapter 2 [John Orford]
irst draft of 'JavaScript for Financial Analysts' Chapter 2. ~ Most bankers, whether they admit it or not are really high tech plumbers. They receive data; process it; and send it on to a fancy risk or aggregation system. Extract, Transform and Load (ETL) takes up an inordinate amount of
- 8 years ago, 22 Sep 2015, 11:36am -
Getting Started with Javascript - First Draft [John Orford]
First draft of 'Javascript for Financial Analysts' Chapter 1. ~ Much of our coding time is spent in an interactive environment, colloquially called the 'REPL', 'Read-Eval-Print Loop' or console. The REPL reads input, evaluates it according to our code and prints it.
- 8 years ago, 20 Sep 2015, 12:32pm -
Javascript for Financial Analysts - Intro - Draft [John Orford]
First draft of an introduction to the "Javascript for Financial Analysts" book. ~ The humble spreadsheet is the workhorse of the finance industry. Every financial analyst has spent hours, preparing complex spreadsheets, only for an error to creep in here or there. The spreadsheet is a gift
- 8 years ago, 17 Sep 2015, 10:43am -
Backtesting Data Independence [John Orford]
Light is the most precious resource to a photographer, everything you can do with your camera is budgeted by the amount of light available. Financial analysis is similarly constrained by the amount of data available. So more available data is always good. With Big 'O' Sharpe you can
- 8 years ago, 4 Sep 2015, 09:48pm -
Steady Vol & Skewerage Combination Critique [John Orford]
Recently Big 'O' Sharpe scrubbed out my Steady Vol and Skewerage strategies. I've never been sentimental. Bullet to the head. Move on. But Wait! I forgot, that I once combined both strategies together, like so, weight.INDEX_SP500 = 1 / realisedVol - skewChange; and weighted on a
- 8 years ago, 31 Aug 2015, 12:44pm -
Lazy IDE Update [John Orford]
Bar some evolutionary improvements, the Lazy Backtest IDE is now about as efficient as it is possible to be. This enables me to introduce the latest feature - Big 'O' analytics. The IDE generates multiple backtesting results in the background by changing the starting dates of backtests.
- 8 years ago, 30 Aug 2015, 01:17pm -
Steady Vol & Big 'O' Sharpe [John Orford]
Big 'O' Sharpe changes backtest starting dates day by day until the lowest Sharpe is found. When strategies rebalance on periodic basis it turns out that such very small changes cause very large differences in results. Big 'O' Sharpe is the pessimistic grumpy brother of the
- 8 years ago, 29 Aug 2015, 09:38am -
5 Ways to Plot Returns [John Orford]
There's an infinite number of ways to plot financial time series, let's look at the main ones. The most basic way is just plonking returns on a plot. This has one very nice feature. The returns are comparable across time, which makes a lot of sense, right? A return at the beginning of our
- 8 years ago, 28 Aug 2015, 10:13am -
Luck [John Orford]
My grandfather was a gambler. Nice. Smart. But he thought he was smarter than everybody else in the room. I haven't gambled much, as a direct consequence of what happened decades before I was born. Going to the bookies is popular in Ireland but unheard of in our family. I started playing Poker
- 8 years ago, 27 Aug 2015, 12:35pm -
Super Reliable Backtesting [John Orford]
Big 'O' is a measure of many things, with respect to backtesting it helps because results are always ambiguous. Backtesting results are almost iffy for a variety of reasons, but a salient one is the 'day bump' problem. Say, I have a strategy that trades at the 'beginning of
- 8 years ago, 26 Aug 2015, 10:25am -
Atom Smashing Returns [John Orford]
My Lazy PCA analysis tool plots returns against lagged returns and then fits principal components to the data. ('SP5HBI' S&P 500 High Beta index weekly) The surprising thing is that the fitted components almost always have a slope of plus or minus one (except when there's a lack
- 8 years ago, 24 Aug 2015, 12:30pm -
Financial Rohrschach Plot [John Orford]
Here's a cumulative return plot of the lazy Drop the Mic trading strategy outlined yesterday. Long periods of flatlining show when the strategy is in hibernation. Just for fun, here is how the strategy weights its holding in the S&P 500 over time. How often do you see a symmetric picture
- 8 years ago, 23 Aug 2015, 02:12am -
Lazy Financial Strategies [John Orford]
One of the major themes of War and Peace will resonate with all practitioners of stochastic finance. Essentially, Napoleon's nemesis, the Russian general Kutuzov, keeps dropping back before the invading French until at last he spots a weakness in the French and pounces. Tolstoy tells us that
- 8 years ago, 21 Aug 2015, 10:33am -
Millennium Auto-Correlation Apocoplyse [John Orford]
You can count dead air on the radio by the millisecond, when you expect to hear something but don't, your ears become acutely aware of not hearing anything at all. This doesn't happen with white space on a page. Look at a well designed website; your eyes will happily swim around it;
- 8 years ago, 20 Aug 2015, 10:30am -
Intertemporal PCA Analysis [John Orford]
Taking a leaf out of Mike Harris' recent Momersion theme, here's a PCA point of view of the balance between momentum and mean reversion over the previous 10 years from the Lazy PCA tool. August 2015 - 2014 PCA fits momentum and mean reversion components to the daily returns, they balance
- 8 years ago, 18 Aug 2015, 12:24pm -
Strategy Gamma Overview [John Orford]
Economics 101 tells us that people have 'convex' utility curves. Which means there are diminishing returns to having more, but losing what you currently have diminishes your well being precipitously. Convexity is such a human property, it shows up again and again in unexpected places.
- 8 years ago, 17 Aug 2015, 12:25pm -
Fractal Strategy Applied to Indonesian Index [John Orford]
When I lived in New York, every other night I'd have a drink with our head of financial engineering. Beer in the winter, G&Ts in the summer. In any case once he was telling me how in Japan even ordering coffee was tricky, because the Japanese didn't want to cause offence by not knowing
- 8 years ago, 14 Aug 2015, 07:27pm -
Low Vol, Steady Vol & Positive Skew [John Orford]
Steady Vol inversely weights holdings in an asset with respect to current volatility. Initially there was a little confusion about how Steady Vol was different from Low Vol strategies. Low Vol strategies weight individual constituent stocks by their volatility whereas steady vol weights periods
- 8 years ago, 13 Aug 2015, 03:57am -
Equal Weighting Investigation [John Orford]
I landed in a town in Western Sumatra called Padang a few days after an earthquake hit. 7 or 8 on the Moment Magnitude scale. Just as in finance there are various ways of measuring quakes. The Richter scale measures ground motion whereas the more modern Moment Magnitude scale measures energy
- 8 years ago, 12 Aug 2015, 12:20pm -
Short Term T-Bill Momentum [John Orford]
Short term t-bills are an astoundingly bad investment. The Sharpe ratio is 0.047 over 50 years - a tenth of the S&P 500. The skew is negative and Max Wait to profitability is 14 years! The Sharpe Trajectory shows that the IRX (13 week t-bill) index is all over the place - extremely inefficient,
- 8 years ago, 6 Aug 2015, 07:13am -
Australia All Ords Steady Vol Strategy [John Orford]
In a round about way from New York to Singapore, I landed in Oz in 2012. It was like walking into a pre '08 New York or Ireland with funnier accents. They call '08 the 'GFC' or the 'Global Financial Crisis' and talk about it in a sort of detached way - because that
- 8 years ago, 29 Jul 2015, 11:03am -
Low Vol vs High Beta Premium [John Orford]
Low volatility stocks are better than those with high betas, right? Wrong! Completely and utterly wrong. High betas are costlier because as not-very-many point out - convexity or gamma is important! When the S&P is doing well the high beta index has a beta of 1.84 and when it's doing badly,
- 8 years ago, 28 Jul 2015, 12:06am -
Generalising the Mojito Strategy [John Orford]
The Mojito uses a step function to switch up allocations between the VXX and VXZ ETFs over time. A bunch of rules which says... If the spot VIX to VXV (3 month VIX future) ratio ('IVTS') is lower than 0.91 then short the VXX (short term VIX future ETF) and weight by -0.7, while long the
- 8 years ago, 24 Jul 2015, 06:57pm -
Bond Premia [John Orford]
Contrary to popular belief, bonds and stocks are non linear derivatives, just as options are. They are just less obviously so. Stocks can be thought of call options on the value of a company with a strike of zero. Bonds can be seen as short put options on the value of the company with a strike of
- 8 years ago, 18 Jul 2015, 11:10pm -
Comparing Timing Strategies [John Orford]
Way back when I got interested in testing market efficiency, which led me to build the Lazy PCA site; and then I noticed that the principal components / drivers / ideas of almost every return time series are momentum and mean reversion. I never expected that returns could be sliced up so neatly.
- 8 years ago, 16 Jul 2015, 02:23am -
Introducing Sharpe Trajectories [John Orford]
It's my final week in Singapore. Contrary to hearsay the 'Red Dot' is not zero dimensional; it's as multi-layered as the time you take to investigate it. A bunch of 'lasts' in Singapore will soon be followed by many 'firsts-in-a-long-time' back in Germany.
- 8 years ago, 13 Jul 2015, 02:42am -
The Mojito Vix ETN Strategy [John Orford]
I like girls like my asset classes. Bubbly. ... What do you mean you don't know whether whether we should take the business or not? All money is green. ... I like my cocktails like my money. Green! ... ~~ That was the CEO sitting behind a younger me. He didn't have an off
- 8 years ago, 9 Jul 2015, 10:56pm -