In-depth research on a quantitative trading strategy

Hello everyone! This is an article focusing on testing digital currency trading strategies. With the development of our community and platform, we intend to create more such articles. Please leave your feedback and remember to try our FMZ Quant Trading platform and join our community!

Claude Shannon, often known as the father of the digital age, is famous for his great contributions to information theory. Moreover, he also made important contributions to the fields of cryptography and finance. Since digital currency is the intersection of these three fields, if he is still alive, I think he will find this will be his new interest.

Shannon’s famous financial experiment is called Shannon’s Demon, whose findings can be applied to the investment strategy of digital currency.

Fortunately, there is a platform dedicated to testing digital currency asset algorithm trading strategy now. This platform is the FMZ Quant Trading platform.

Shannon’s Demon is an experiment designed by Claude Shannon, which proves that even without positive expected return, it is possible to gain profits from investment assets.

The investment asset of this experiment is a hypothetical stock with “random walk” behavior. It has a 50% chance to double the price and 50% chance to halve it every day. The investment plan is simple: invest 50% of assets and retain the remaining 50% of cash, and rebalance the process every day.

William Poundstone provides an example of how this investment plan yields returns in his book “Wealth Formula”:

“Imagine that you start with $1000, invest $500 in stocks, and then hold $500 in cash. Suppose that the price of stocks is halved on the first day. This provides you with a portfolio of $750: the value of stocks is $250, and the cash in hand is $500. The current situation tends to be cash in hand. Then you can rebalance by withdrawing $125 from your cash account to buy stocks. This will give you a new balanced combination of $375 in stocks and $375 in cash.”

In short:

Suppose a stock rises from 1 to 2, and then falls from 2 to 1, what should you do? If you are ready to invest 200 yuan, Shannon’s secret is that you take 100 yuan to buy stocks, and the other 100 to take a short position. Then what you need to do is to keep the market value of stocks equal to the total amount of cash. For example, when 100 yuan of stocks rises to 200 yuan, you have 200 stocks plus 100 yuan of cash, and the total asset is 300 yuan. Then you sell 50 yuan of stocks, so you have 150 yuan of stocks, 150 yuan of cash, and when the stock falls to 1 yuan, the stock market value is only 75 yuan, but your total assets are 225 yuan! If the stock falls first and then rises back, the result is the same. You can make 25 yuan properly!

In this way, Shannon’s Demon can earn fluctuations in asset prices (i.e., volatility gains), rather than through asset appreciation. The rebalanced portfolio is also more stable than the plan to buy the same asset and hold it. These findings provide insight into the benefits of diversification and portfolio rebalancing.

However, due to the limitations of the financial market at that time, Shannon never put this strategy into practice. In fact, the transaction costs required to rebalance the portfolio will have a significant negative impact on its performance. However, the main limitation is that this strategy requires extremely unstable investment target to obtain considerable profits (recall that the stock in the experiment has 100% increase or 50% decrease every day). At that time, there was no asset with enough fluctuation to cover the service charge cost.

However, significant changes have taken place in the financial market since then, so it is worthwhile to test the strategy again.

Is digital currency the right asset for Shannon’s Demon?

At first glance, it seems that digital currencies are the best candidates for this investment plan: as we all know, they are very unstable and difficult to evaluate, and their prices seem to be mainly driven by speculative transactions. However, more in-depth analysis is needed to draw a conclusion.

I conducted the first test of Shannon’s Demon on the most popular currency: Bitcoin (BTC). However, instead of rebalancing the portfolio every day (as I did in the original experiment), I programmed the algorithm to wait for the asset price to be twice or half of the previous rebalancing price. I used data from the Poloniex exchange. The test lasted from February 21, 2015 to August 7, 2017, for a total of 899 days.

In this test, the trading algorithm rebalances the portfolio three times after the initial portfolio construction. This means that the annual rebalancing rate is 1.21 times. This speed is not enough to reap attractive profits from the volatility.

In addition, the price of Bitcoin has soared by 1266% during this period, and the overall trend is upward. Therefore, it does not seem to follow the “random walk” pattern. Not surprisingly, the performance of the trading algorithm lags behind the buy-and-hold strategy by as much as 901%.

The following chart provides the schedule of algorithm performance:

*The green triangle on the first chart indicates that the algorithm rebalances the portfolio by purchasing Bitcoin, while the red triangle indicates the opposite.

Now, the fact that Shannon’s Demon did not exceed the buying and holding strategy during this period does not mean that we should abandon it, at least not yet. In fact, the reason why Bitcoin is the most popular currency has a lot to do with its appreciation, so they are what Soros calls “reflexivity” relationship, that is, mutually reinforcing relationship. In addition, the early volatility of assets is usually high. Since Bitcoin has been traded for more than seven years, its volatility may not be as high as before.

For this reason, I decided to test a new and less well-known currency for the second time: August (REP).

I used the historical price again to run the test on all dates: from October 4, 2016 to August 7, 2017 (308 days in total). During this period, the trading algorithm rebalanced the portfolio five times after the portfolio was constructed. This means that the annual rebalancing rate is 5.93 times. This should be sufficient to generate sufficient volatility returns.

From the perspective of return, Shannon’s Demon still lags behind the buy-and-hold strategy. It generates a cumulative return of 103%, while the return of the buy-and-hold strategy is 126%. However, individual return is not the most important indicator of portfolio performance. Compared with the buy-and-hold strategy, the risk of this strategy is much smaller. In the worst case, 68% of the initial value of the portfolio bought and held will be lost. Many investors will feel panic at that time. In contrast, Shannon’s Demon lost 35% of the most during this period.

In terms of risk-adjusted return, I compared the Sharp Ratio (SR) of the two strategies. This indicator tells us the return premium generated by each risk unit (higher than the risk-free treasury bill). The annual SR of buy and hold strategy is 1.15, while Shannon’s Demon is 1.21. This means that the latter generates 6 basis points of additional earnings per unit of volatility (i.e. standard deviation).

Based on these preliminary findings, we can draw two conclusions about the Shannon’s Demon: for assets with a strong upward trend in price, it will generate less income than the buy-and-hold strategy. Secondly, it reduces the risk of investment portfolio significantly.

If I want to invest a lot of money in digital currency today, I will undoubtedly choose Shannon’s Demon investment plan instead of buy-and-hold. Because I can’t judge where the price is going.

However, there are many other trading algorithms worth testing. With the FMZ Quant platform, you have the opportunity to become one of the first investors to write your own trading algorithm and conduct backtesting on its performance. Data-driven investment can give you an advantage in the market.

The information in this article is for reference only. It is not recommended to purchase or sell any securities or implement any investment strategy.

- Exploring FMZ: New Application of Status Bar Buttons (Part 1)
- 探索FMZ：状态栏按钮的全新应用（一）
- Introduction to the Source Code of Digital Currency Pair Trading Strategy and the Latest API of FMZ Platform
- 数字货币配对交易策略源码和FMZ平台最新API介绍
- Detailed Explanation of Digital Currency Pair Trading Strategy
- FMZ Quant & OKX: How Do Ordinary People Master Quantitative Trading? The Answers Are All Here!
- 数字货币配对交易策略详解
- Detailed Explanation of FMZ Quant API Upgrade: Improving the Strategy Design Experience
- Detailed Explanation of New Features of Strategy Interface Parameters and Interactive Controls
- FMZ 量化& OKX：普通人如何玩转量化交易？答案都在这儿！
- 详解发明者量化交易平台API升级：提升策略设计体验