Wednesday, July 31, 2013

Algorithmic Trading System Update 7/31/2013

I've been able to put a lot of time into my system lately. It's been emotionally and physically draining, but any tired runner will find that little extra energy when he sees the finish line coming up. I've ran and re-ran backtests over and over again, each iteration fixing more problems. I've been doing silly things like regressing the prices of my pairs instead of regressing the logs of the prices. Turns out I still had errors with dividends and split adjustments. I think I've finally ironed them all out, and unit tests are now in place to hopefully make sure I don't introduce breaking changes.

I've continued to optimize my code and I can now run a backtest for 7 years of 1 second data in 4-7 minutes (8 tests in parallel), depending on the pair. I feel this is an incredible improvement from the original ~50 minutes for 8 test in parallel. I honestly don't think I can optimize this any more. Dropping the running times let me test more combinations of parameters.

All this allowed me to be more productive. I'm now sitting on between 20-30 pairs which have been backtested to show significant alpha, and high sharpe, and low drawdowns. I've taken all of the equity curves for each pair that I plan to use and combined it into an equity curve for the whole portfolio. I've decided to stop looking at the returns of each trade and instead, look at the absolute dollar profit. I made this choice due to easier accounting.

The equity curve below is for the whole portfolio of ~20 strategies. Each strategy uses $10,000 for one of the legs. The size of the other leg depends on the quantity dictated by the generated beta. As a result, the expectation is to see equity increase linearly, not exponentially. The max drawdown of ~6k was a little fishy. I ended up re-creating the combined equity curve by hand and did not see any errors in my calculations. I guess ~20 strategies sufficiently reduces the variance to yield such a small overall drawdown.

I do have concerns though. I know that my live trading can't look this good. The strategies which I have chosen are known to work in the backtests, meaning this combined equity curve is subject to survivorship bias. I expect pairs to break down in live trading, causing smaller returns than what this curve suggests. At 1530 trades across all strategies over 7 years, I am confident that commissions will not be a prime concern. The equity curve already includes the effects of commissions as well.


I am still not confident enough to let my system auto-fire. However I am confident enough to manually enter all trades into my real money account., which I have started doing recently. There are still some accounting issues that I know about in my system. Once these are resolved, I will be ready to let it auto fire.

No comments:

Post a Comment