Nowadays we see the importance of new digital tech in changing how the world trades. These modern tools are giving traders a big leg up, helping them deal with and succeed in a world that's getting more complicated to do business in. Our client requested us to create an actionable AI-backed tool that would analyze traders’ behavior on the market with high operational efficiency and prediction accuracy. Read on to discover more about the project.
The client wanted us to create an actionable AI-backed tool that would analyze traders’ behavior on the market with high operational efficiency and prediction accuracy. From the functional perspective, the tool was expected to perform the following tasks: · Differentiation between several types of traders, including hedgers, arbitrageurs and speculators; · Recognition and processing of trader patterns, based on historical data analysis, i.e. previous trading activities; · Building profiles for each trading pattern to accurately predict the trader’s next moves on the market; · Simulation of traders’ behavior to provide insights on alternative steps a trader can take in ever-changing environments, such as in the case of market fluctuations; · Pinpointing the exact price at which a trader opens and closes the trade (Entry Type: IN/OUT) or increases the trade size.
We developed a solid ML-driven trainable model to track bot trader actions for this project. We have chosen two families of ML models to use for the prediction task:
Both XGB and LSTM models provide three types of outputs:
As inputs for both models, we used historical data. In other words, we backtracked changes in prices and a trader’s actions to predict what the trader would do next. There are four important co-requisite touchpoints or parameters we consider: · Time limits for historical data under analysis · Essential features to be taken for initial profiling · Relevant data aggregation. · Raw ticks data to better realize the current market situation
Context length can drastically impact the accuracy level of trader action prediction. To be objective, it should be backed by a comparison of typical time intervals between a trader’s transactions. Having a smaller context often results in accuracy drops. A broader context, on the other hand, is a waste of computational resources and makes learning harder for a model. As such, traders that we sampled in the initial exploratory data analysis had frequencies of around 1-2 hours, which accounts for 100 min for models training a standard context length.
Features that we employed at the training stage were based on the earlier-stage analysis. We collected data on the price, profits and position, volume for the aggregated interval, technical indicators, and the likelihood of price patterns. In principle, simple training on the price data can yield strong enough models, but pairing it with extra data like indicators and profits often adds a few percent to the accuracy. To extract the most relevant features for each trader, we developed a feature selection process based on the correlation with changes in the trader’s position. In this way, we can decrease the amount of features we use, speed up the algorithm, and reduce the memory required for it.
Aggregation helps cut down an input size by the time axis. ML-driven models often have a hard time extracting the sparse meaningful signal from the noise that will be inevitably produced by large-scale data. The best way to address this issue is to introduce aggregation of tick data by time intervals. We experimented with 1-hour, 30, 15, 5, and 1-min aggregation periods. Similarly to context length, the optimal aggregation period correlates with the trading frequency.
Raw ticks also appeared to be useful for a share of traders. The first model used aggregated data, while the second model employed a mix of aggregated data to get a larger context and raw ticks data to capture the current situation. In some cases, raw ticks accounted for up to 2-5% of improvement. However, in other cases, they didn’t affect or even decrease the resulting accuracy. It seems that raw ticks are more important for traders who have frequent transactions, while for traders who have 1 transaction per hour on average, all necessary information can be available in open prices for time intervals.
The project’s takeaways reveal the competitive advantages of using two ML-driven models for building bot traders:
We as developers can take away the following key findings from the project:
As a result, the customer enjoyed an actionable AI-fueled solution that can perform complex large-scale data processing tasks and come up with high-accuracy trade forecasts.