GDA’s Next-Gen Strategy Testing Environment
We touched on strategy testing and the problems with existing solutions in a previous article. This article will give an update on our work into this issue and put forward our approach, the architecture design and features of a new strategy testing environment.
Important to creating new trading strategies, especially when managing large amounts of equity, is the ability to test the strategy in a safe environment without the risk of losing capital. Existing methods include backtesting and paper trading. This list is exhaustive. Both of these techniques do not fully capture the effectiveness of a trading strategy (except for market orders) because they fail to simulate the effect of the order book on individual trade events and vice versa. These testing methods are also not suitable for testing HFT strategies because they do not incorporate the order book at the “atomic level”. Backtesting and paper trading is done on low definition data, ignoring the intricacies of a higher definition order book and the effects these details have on trades. To overcome this issue, a new testing environment that can accurately simulate trading is required.
We have been asking ourselves, how do we bring the order book at the granular level into a testing environment so we can test our HFT strategies? Not only that, we also want to offer quantitative traders greater efficiency, programmability and risk management in their strategy testing. The solution we are developing is a virtual exchange that simulates the order book and its events from real exchanges. This virtual exchange will mirror the order book of an exchange, for example Binance, down to the “atomic level”. Operating and maintaining this exchange will give us administrative control of the trading platform, enabling us to configure users and their equity, API connections, user interfaces and event logging, as well as other admin functionality. Of course, this platform will not host real users, but rather it will be bots implemented as users which are controlled by GDA strategies. Strategies can be executed within this exchange, allowing for strategy evaluation without risking any capital. Importantly, this strategy evaluation incorporates the strategy’s effect on a real, high definition order book. This testing environment won’t just have a high-definition order book to test strategies on, it will also include additional data such as funding rate and maker/taker fees. This enables programmable risk management for traders. Quants can easily build comprehensive risk profiles and incorporate them into their strategies.
If you have been following this project, you are probably familiar with the data lake that is also being developed in parallel. An article on the data lake can be found here if you would like to know more about it. The data for this new strategy testing environment will be streamed through this data lake.
Architecture and Design Principles
At the centre of this environment is a backtesting “core”. This essentially is a virtual exchange that has an order book, user interface, users, API connectivity, and other standard exchange features.
Connected to the backtesting core is GDA’s data lake. The data lake will stream the order book of an exchange into the backtesting core, powering the order book. What is great about the GDA data lake is that it has order book data down to the atomic level; every order book event is captured at a frequency ranging from 5 ms to 100 ms depending on the exchange. Using the API connectivity of the backtesting core, GDA strategies can send trading instructions to users on the exchange.
Finally, the GDA ACPR infrastructure is connected to the backtesting core as well. This infrastructure will capture high resolution images of the market structure and patterns in the chart. These images will be labelled and stored, creating a dataset to train the ACPR model. Additionally, the backtesting core will capture chart images when virtual trades are made. These images will be labelled with trade metadata, such as chart patterns, signal name and trade success, and sent to the ACPR infrastructure.
Virtual exchange powered backtesting core
By powering our testing environment with an exchange, it enables us to incorporate a high-definition order book, admin functionality and performance evaluation through activity logging.
Atomic level order book data
By using data from GDA’s data lake, the order book on the virtual exchange can have the highest fidelity data. This allows HFT strategies to be tested, as well as all other forms of strategies. Mirroring order book data down to the atomic level is a foundational design principle of this solution.
Besides order book data, funding rate and maker/taker fee data will also be incorporated into the backtesting core. Traders can include this additional in their strategies, allowing for programmable risk management and making them more capital efficient.
Bots as users
Trade execution of GDA strategies is done by implementing bots as users on the virtual exchange. Trade instructions are received through the API connectivity and then the bots can execute the trade on the virtual order book.
All user activity — such as balances, orders and trade history — on the virtual exchange is logged and recorded. These logs are accessible to traders so they can evaluate the performance of their strategies.
Having admin control of the platform allows users to be given virtual capital to trade with. All trading on this backtesting platform is done with virtual capital meaning there is no risk to traders’ own funds.
The primary purpose of this new testing environment is to simulate trades as accurately as possible to a real world environment. This will not only give us a robust and accurate understanding of the strategies we develop, it will also promote rapid strategy development. TradingView GUI will be integrated into the platform to give us the additional functionality that is offered by TradingView. The user interface will be able to display configured FBR, WCM, VHW and ELV technical charts, as well as configured volume and liquidity clusters. Buy and sell orders are also visible on the chart. These visualisations can be exported to the ACPR infrastructure as well.
Another class of core functions of the testing environment is the admin functionality. Users can be created or deleted, and the virtual equity of these users is customisable. Included in admin functionality is event and activity monitoring. All user activities on the virtual exchange will be logged and accessible so their performance can be evaluated. Users on the platform will have API connectivity which will enable GDA’s strategies, external to the platform, to connect and execute via bots (as users).
This new platform, with its atomic level data, allows for the testing of advanced trading strategies that can’t be properly evaluated with existing strategy testing techniques. For example, high frequency strategies such as scalp trading, market making or arbitrage in any of its many forms, whether it be cross-exchange, intra-exchange, CEX-DEX arbitrage, or some other form of arbitrage, can be tested using this new environment. This environment isn’t limited to HFT strategies either. The best way to think of this new testing environment is as a virtual exchange with virtual capital — if you can implement your strategy on a real exchange, you can implement it here.
We have already spoken about ACPR and ACPR infrastructure and you may be wondering what we are referring to. ACPR stands for automated chart pattern recognition. It is another development vertical of GDA’s R&D lab. As a machine learning project, it requires a sophisticated dataset of chart images. By incorporating it into the backtesting environment, development of this dataset can be accelerated. We will release more information on this project at a later date so stay tuned for that.
This is the latest update on our development of a new generation backtesting engine. Of course, as we progress we will share future updates and information with you. If you don’t want to miss an update, follow our medium account.