I backtested my first crypto factor trading for 7 months. Here's why I didn't beat BTC

Hello! Recently I have picked up studying quant finance and I wanted to build my first strategy. Given how hot the markets have been year to date, I wanted to see if I could beat a simple buy and hold BTC strategy. Here is an outline of my steps taken to create my first three-factor long only strategy, and the pitfalls that I encountered along the way. I welcome any comments- after all, I'm a noob who's just learning 😄

The Setup

Avoiding bias in data collection is an essential step:

  1. Survivorship bias. My strategy involved longing the best the top n performing crypto assets. Silly me started with longing the top 3 assets at the point of backtesting- which screams data leakage! To prevent this survivorship bias, I used a dynamic universe by querying CoinGecko API for the top 10 assets fortnightly (when I rebalanced my portfolio).
  2. Filtering out stablecoins, wrapped tokens. Ok this is self-explanatory, but I'm frankly surprised at how far wrapped tokens have come to occupy spots in the top 10 market cap.
  3. Data extremism. We all know that crypto has some wild swings- my EDA found that crypto assets have annualised volatility of 25%-90% vs 15-30% for typical stocks.

The Core Factors

I started with generating the typical indicators such as momentum, RSI, MACD etc etc. I decided on three factors:

  1. Momentum/Volatility Ratio (40% weightage). In bull markets, we should pursue momentum. However, we should also penalise excessive risk. We do so by computing risk-adjusted return- momentum / (volatility / baseline_volatility).
  2. Relative strength vs BTC (35% weightage). I believe crypto is a highly correlated market, and we should be seeking assets that outperform the benchmark and not just rise because the benchmark is rising.
  3. Accumulation on dips (25% weightage). We want to identify 'quality dips' where volume spikes (accumulation) rather than falling volume (panic selling).

Strategy Iterations

Developing and refining this strategy was a largely iterative process. As mentioned earlier, I started with a lookahead bias where I picked the top 3 assets from the current universe by market cap, as opposed to the market cap during backtesting.

My first three factor long-only strategy rebalanced every week. I assumed a transaction cost of 1% along with slippage of 0.5%. This strategy netted a return of 6.34% vs a BTC buy and hold of 18.76%.

Next, I tried mean reversion (since momentum was working so poorly), and ended up with a return of 9.30%. Our Sharpe ratio for both strategies was also terrible.

In an attempt to work on mean reversion, I tried to filter for 'quality dips', which means that for the top 5 worst performing assets in our universe, we use our three factor model to find the three most 'attractive' assets. This strategy netted a slightly better return at 13.44%.

To prevent mean reversion in 'bear phases', I added a filter to ensure that we only long in 'bull phase', and switch to cash otherwise. I added the filter of BTC being above the 21 week exponential moving average to decide if a market is bullish. This strategy net us slightly lower total return of 18.69% than the buy and hold; however, the Sharpe ratio for this strategy was 2.38, much better than the 1.22 Sharpe ratio of BTC buy-and-hold. That being said, I've not tested rigorously the cost of selling and switching to cash.

Finally, I switched to long only three factor model with fortnightly rebalancing. This strategy used to outperform the buy and hold in percentage returns, albeit with slightly worse Sharpe ratio. However, this edge is now gone with the recent correction in BTC prices.

Learnings

  • The crypto universe is highly volatile and edges that may have appeared to exist a few weeks ago could be gone when the market corrects itself. I tested these strategies in a bull market, and as I write this, we are in a slight correction. As such, strategies that may have appeared to be worse in the bull market are now faring better.
  • My best guess now is that there is no 'killer alpha'- employing the appropriate strategy for the macro environment is key. We need better filters to decide if we are in a bull or bear market.

Next steps

  • Given how interesting these experiments are, I am considering combining the two factors- three factor long only with fortnightly rebalancing and mean reversion with quality dips, and use either depending on the bull vs bear sentiment of the market respectively.
  • Another area I can explore is stat arb, specifically the content in "Machine Learning for Algorithmic Trading".

If you are interested in checking out my notebook, you can do so at my Github repo.