Thursday, February 26, 2009
A new service for retail investors
A much more advanced version of the service will be rolled out soon -- I saw a demo today where you can backtest your strategies online, combining different fundamental and/or technical variables as entry or exit signals. They also have some built-in models for you to adapt (e.g. a model based on The Little Book that Beats the Market by Joel Greenblatt.) More interestingly, you can look at other people's trading models and their historical and/or real-time performance.
Matlab or Alphacet it is not, but I think it will be quite useful for many retail traders. It might even be useful to professional traders who want a quick-and-dirty way to test out ideas.
Sunday, February 22, 2009
Trader tax proposal will be the death knell for statistical arbitrage
Ladies and gentlemen, 0.25% is 50 basis points round-trip. Few if any statistical arbitrage strategies can survive this transaction tax.
And no, this is not "Wall Street paying for Wall Street's Bailout". This is small-time independent trader-entrepreneur like ourselves paying for Wall Street's Bailout.
Furthermore, this tax will drain the US market of liquidity, and ultimately will cost every investor, long or short term, a far greater transaction cost than 0.25%.
If you want to stop this insanity, please sign this online petition.
Wednesday, February 18, 2009
Finding seasonal spreads
Finding Seasonal Spreads
By Paul Teetor
I start with several years of spread data, compute the spread's daily changes, then group the daily changes by their calendar month, giving me 12 groups. The ANOVA analysis tells me if the groups (months) have significantly different averages. If so, I know the spread is seasonal since it is consistently up in certain months and consistently down in others.
The beauty is that I can automate the process, scanning my entire database for seasonal spreads. A recent scan identified the spread between crude oil (CL) and gasoline (RB), for example. The initial ANOVA analysis indicated the CL/RB spread is very likely to be seasonal. This bar chart of each month's average daily change demonstrates the seasonality. (Click on the graph to enlarge it.)
The lines show the confidence interval for each month's average. Notice how May and June are definitely "up" months because their confidence interval is entirely positive (above the axis). Likewise, November and December are definitely "down" months. For all other months, we cannot be certain because the confidence interval crosses zero, so the true average change could be either negative or positive. The conclusion: Be long the spread during May and June; be short during November and December.
For more details, please see my on-line paper regarding ANOVA and seasonal spreads.
- Paul Teetor
Thursday, February 12, 2009
The limitation of Sharpe ratio
Personally, I am more comfortable with strategies that do the opposite: those that seldom generate any returns, but always earn a large profit when financial catastrophes occur.
Friday, February 06, 2009
The peril of VaR
(Hat tip: Ray)
Sunday, February 01, 2009
Kelly formula revisited
Q:
"I am more than half way through your book and am stuck at a concept that I can't seem to find an answer in any other forum.A:
I have read Ralph Vince's "Portfolio Management Formulas," which uses Kelly's formula to calculate an optimal "fraction" of the bankroll to bet on each trial. So a trader can calculate a fraction of his total trading account value to risk on each trade. What I am referring to is the so-called "fixed-fractional" trading. There exists an optimal fraction that will maximize the geometric growth rate of the trading equity, in theory anyway.
However, in the money management chapter of your book, you use Kelly's formula to derive an optimal "leverage." This seems to be in conflict with what I learned from Ralph Vince, since leverage is usually great than unity and fraction is usually less than unity. I can't seem to make a connection between these two concepts. I have also seen the same optimal leverage formula in Lars Kestner's Quantitative Trading Strategies and asked the same question on some forums, but no one was able to give me a clear satisfactory answer. It would be greatly helpful if you can help me sort out the confusion."
I don't have Ralph Vince's book with me, but if I recall correctly, his formulation is based on discrete bets (win or lose, no intermediate outcome), much like horse-betting or in a casino game. My approach, or rather, Professor Ed Thorp's approach, is based on continuous finance, assuming that every second, your P&L could fluctuatate in a Gaussian ("log-normal") fashion.
For discrete bets where you could have lost all of your equity in one bet, surely one should only bet a fraction of your total equity. For continuous finance, there is very little chance one could have lost all of the equity in one time period, due to the assumed log-normal distribution of prices. Hence one should bet more than your equity, i.e. use leverage.
Q:
In example 6.2 in your book, the portfolio consists of only long SPY, which has little chance of going to zero. So I can see how it is reasonable that you use the continuous finance approach and apply the optimal leverage to scale up the return.A:
But let's assume that the portfolio consists of a single strategy that buys options. Suppose this strategy will lose most of the time due to time decay but will make profit once in a while due to black-swan events. I don't think it's a good idea to bet the entire portfolio equity on each trade for this strategy. Can you still apply the continuous finance approach in this case, since in reality trading is like making discreet bets? Should we expect the mean and variance of this strategy automatically result in an Optimal Leverage that is less than one? So that we actually need to risk a fraction of the account equity per trade?
The formula I depicted in the book is valid only if the P&L distributions are Gaussian. If one expects a fat-tailed distribution due to black-swan events, a different mathematical model needs to be used, though it can still be within the continuous finance framework. However, for simplicity's sake, if the distribution looks multinomial (e.g. high probability of "Win a lot" v "Lose a lot"), then you may model it with fractional betting just like a casino game.
Friday, January 16, 2009
Algorithmic Trading Technology Update
1) Matlab2IB API
I said in my book that it is difficult to use Matlab as an execution platform. As Max has pointed out, this is no longer true. This inexpensive API connects Matlab to your Interactive Brokers' account. It allows you to retrieve historical data, get real-time quotes, and send orders. In other words, all the basic functions you need to create your own execution engine.
2) R
Many people (hat tip: Steve H.) know that R is an open-source (i.e. free) alternative to Matlab. I find that there is also an API that connects R to Interactive Brokers, though I have not tried it myself.
3) Trade Ideas
Trade Ideas (hat tip: Russell M.) is a complete automated trading platform that provides connections to different brokerages (scottrade, IB, TD Ameritrade, etc.)
4) Amazon EC2 cloud computing platform
Running out of PC's to run your myriad strategies? Try Amazon's EC2 cloud computing platform. For a modest hourly fee, you get access to an instance of either Linux or Windows environment, and you can add as many instances as you want. The connection speed is supposed to be at least 10x T-1 line, well-suited to high frequency traders . Here is some other performance benchmarks.
Monday, January 12, 2009
Hedge funds move to "easy-to-understand liquid strategies"
(By the way, I have been urging traders to do just that in my book.)
Friday, January 09, 2009
How is the job market for quants these days?
In that same post, Felix wondered whether to incorporate the extraordinary period of 2008 as part of backtesting data. Actually, I don't see much of a problem here -- of course one should include 2008. The only reason a trading model would have performed poorly in 2008, as opposed to 2006, 2007 or 2009, would be that its parameters are fitted too tightly to historical data. If you try out some parameterless trading models like I advocated, 2008 is not that unusual except for its higher volatility.
Tuesday, December 09, 2008
The enduring profitability of mean-reversion strategies
Since the strategy was constructed over a year ago while I was writing the book, this most recent backtest is done on unseen data, with absolutely no look-ahead bias!
Tuesday, December 02, 2008
Josh Brolin on day trading
Below is the full interview, beginning with Sean Penn, then goes on to Gus Van Sant, then finally Josh Brolin mentioned his day-trading at the very end of the 1 hour show.
Interested? He is starting a multi-million dollar hedge fund to manage your money.
Friday, November 07, 2008
My book on Quantitative Trading is published
Tuesday, October 28, 2008
Some riskless profit, and why it exists
Here are some links kindly provided by a reader: 10 yr Fannie/Treasury, 5 yr Fannie/Treasury, 10 yr Freddie/Treasury, and 5 yr Freddie/Treasury.
Currently their spreads are above 150 bp. Since the US government has nationalized Fannie and Freddie, this 150 bp is a riskless profit. As the blog Accrued Interest has pointed out, one reason this riskless profit exists is hedge fund deleveraging: nobody has the risk appetite to arbitrage this spread at a meaningful scale.
Brad Setser, a blogger at the Council of Foreign Relations, suggests that the Chinese government, who does have a lot of cash to benefit from this high yield, should go ahead and buy up these agencies debt. However, if you read the Chinese blogs and online comments, there is enormous internal pressure for the government to spend some of this money on infrastructure projects, social security, health care, etc., so I doubt that the Chinese government will have stabilizing the US mortgage market at the top of its agenda. As a result, arbitrageurs out there should have no fear that this opportunity will disappear any time soon.
Monday, October 20, 2008
How does the financial crisis affect quantitative trading?
1) The paltry 10% annual returns that a mediocre statarb fund can deliver is suddenly looking pretty good when the risk-free rate is under 1% and a prolonged bear market is on the horizon.
2) Mean-reversal models continue to beat momentum models in this crisis environment, as in previous crisis environments. This is not surprising because market returns have completely dominated specific returns, and of course market returns have been highly mean-reverting lately.
3) Models involving shorts are under some tumoil because of regime-change induced by new and ever-changing short-sale regulations. (For a while, I even have difficulties locating SPY for hedging purposes!)
4) Models are generally trained on data with far lower volatility than is recently realized. (Even incorporting VIX in a model does not guarantee that it can match realized volatility any better.)
As a result, P&L's fluctuations are also much higher than usual, which induces deleveraging as a risk-management measure, which drains liquidity from the market, which in turn leads to still higher volatility. The usual viscious cycle.
5) Political risks in an election year have further reduced leverage and increased volatility. What if there is an assassination? What if the wrong party got elected? What if the paper-trailess electronic voting machines cause another dispute for a month? The nightmares will continue at least until the morning of Nov 5.
6) Normally, lack of liquidity in the market is good for statarb models since they profit from renting out temporary liquidity. However, this profitability assumes that there are buyers of last resort for the market: the long-term investors, the mutual funds, Warren Buffet, etc. When they are absent, statarb investors can be left holding the bag. Fortunately, Warren Buffet & Co. has indeed stepped in and we statarb traders can breathe a sigh of relief.
7) I have been paying particular attention to 3 websites since the crisis began in order to judge whether I should return to my normal leverage: the Ted spread (I am waiting for it to return to below 2), the Calculated Risk blog, and Paul Krugman's blog. This crisis is caused by panic in the credit market, so we should look for credit market returning to normal before declaring victory. The VIX? Not so much because I believe it is backward-looking in this environment.
8) Watching Fannie, Freddie, Lehman, AIG, WaMu, Wachovia, Iceland, and the initial bailout bill failed feels like reading Chapter 8 of Harry Potter and the Deathly Hallows: "The Ministry has fallen. Scrimgeour is dead. They are coming." The Dark Lord is taking over our economy.
Monday, September 29, 2008
Webinar on algorithmic trading system
Monday, September 08, 2008
Index change strategy
However, new research by University of Edinburgh Business School suggests that a similar strategy works well for FTSE350 stocks (Hat tip to J. Rigg for the link). The trick is to predict which stocks are to be added or deleted 30 days before the announcement ("review date"), buy/sell the stocks, and close out the positions just before the review date.
Since the criteria for inclusion in the FTSE index is well-defined (and primarily based on market capitalization), it should not be hard for the interested traders to make their own predictions and profit from this rebalancing.
Monday, August 25, 2008
Behavioral finance we can all use
Friday, August 22, 2008
Predicting SP500 futures using investor sentiment
In other words, the elite will benefit from the collective wisdom of other elites -- sort of like the real world, isn't it?
How well does it work in practice? Well, they correctly predicted whether SP500 index will go up, down, or flat, a whopping 65.2% of the time. The details can be found on his website, where you can also sign up to see if you can join the elite.
Saturday, August 16, 2008
More on parameterless trading model
The technique is simply this: maintain a long (or short) portfolio with capital proportional to the distance between a supposedly mean-reverting measure and its long-term mean value.
For e.g. if you are pair-trading PEP vs KO, and you believe that the spread between PEP and KO is mean-reverting, then this spread is the mean-reverting measure you should employ.
As the spread moves away from its mean, keep buying (or shorting) the spread in equal dollar amount. And as the spread reverts, keep selling (or buying) the spread in the same dollar amount. What this dollar amount should be depends on: a) the total buying power you possess, b) the expected maximum deviation of the spread from its mean, and c) how often you intend to buy/short. Note that point c is not a parameter: it is arbitrary and limited only by transaction costs, technology, and other operational issues. As for the expected maximum deviation, it can be obtained by observing the history of the spread since inception.
This scheme thus obviates the need for entry or exit thresholds, and with them, the possibility of data-snooping bias. (You may still want to impose an entry threshold based on transaction cost consideration - but that would not count as a free parameter.)
Friday, July 18, 2008
What are we hedging here?
Hedging should not be about reducing volatility in our portfolio. If reducing overall volatility is our goal, we should simply reduce leverage, as I have argued in my previous article. If volatility in a particular industry group is too much for us, (banks? brokerages? energy stocks?), just reduce the capital allocation in that group.
Sure, if hedging does increase your overall Sharpe ratio, go ahead and hedge to your heart's content. Kelly's formula tells us that the higher the Sharpe ratio, the higher the compounded growth rate of your wealth. The problem is, many of us hedge even when doing so do not clearly increase Sharpe ratio. A further problem is that we can achieve this maximum growth rate only if we use the high leverage recommended by Kelly's formula, but this leverage often exceeds what our brokerage would allow us. It is not clear that it is beneficial to waste our buying power on the hedge if we can only operate at sub-optimal leverage.
To me, hedging should be about eliminating the risk of ruin (equity reduced to zero) due to unexpected, catastrophic events. (Many sophisticated hedge fund managers cannot even meet this simple survival criterion, giving lie to the whole notion of "hedge" funds.)
For instance, let's assume that the worst one-day drop in the market index can be 20%. Furthermore, let's assume that you are able to endure a 30% reduction in equity during one trading period. Then you should not be afraid to have a net long exposure of 150% of your equity. In other words, not only should you not hedge, but you should go ahead and leverage your long-only portfolio 1.5 times.
I believe this notion of hedging, or buying insurance, extends to all spheres of our lives. We should avoid ruin, not mere losses. Otherwise, you will be paying too much on the insurance policy over the long term. In other words, max out the deductible on your insurance policy!