Abstract
Financial trading environments are notoriously difficult for machine learning due to high-frequency noise and non-stationary market dynamics. We present mTrader, a novel deep reinforcement learning (DRL) framework designed to mitigate these challenges. mTrader utilizes multi-scale signal modeling and Vector Quantized Variational AutoEncoders (VQ-VAE) to extract robust, discrete latent features from noisy financial time series. Furthermore, an offline Action Optimizer (AO) is introduced to refine agent decisions, ensuring trades are only executed when expected gains exceed transaction costs and volatility thresholds. Our evaluation across cryptocurrency and stock markets shows that mTrader achieves superior total returns and risk-adjusted performance compared to state-of-the-art DRL baselines.
Introduction
Financial markets present two primary hurdles for autonomous trading agents: high-frequency noise and the impact of transaction costs. Standard models often fail to distinguish meaningful signals from random fluctuations, leading to erratic behavior. Moreover, in real-world scenarios, frequent trading can erode profits through fees. We model this environment as a Partially Observable Markov Decision Process (POMDP), acknowledging that the "true" market state is hidden behind noisy indicators. mTrader addresses these issues by combining multi-scale feature engineering with a discrete latent variable model and a pragmatic action-filtering mechanism.
Methodology
The mTrader framework is structured into three distinct stages: signal modeling, feature encoding, and policy optimization.
Multi-Scale Signal Modeling
To handle the "thorny" nature of financial data, we select 32 technical indicators (e.g., RSI, MACD) and apply LASSO (Least Absolute Shrinkage and Selection Operator) to eliminate irrelevant features. These are organized into a multi-scale sparse signal matrix ($M_t$) that captures short-term correlations, descriptive statistics, and long-term trends simultaneously.
Discrete Feature Extraction via VQ-VAE
A key innovation in mTrader is the use of a Vector Quantized Variational AutoEncoder (VQ-VAE). Unlike traditional VAEs that map inputs to continuous distributions, VQ-VAE maps observations to a sequence of discrete latent variables ($Z_t$). This discretization helps the model "cluster" market states, providing a more stable and consistent input for the reinforcement learning agent amidst market noise.
PPO with Action Optimizer (AO)
The core agent employs Proximal Policy Optimization (PPO) with an LSTM backbone to capture temporal dependencies. To prevent sub-optimal trades, we introduce an Offline Action Optimizer. The AO acts as a safety buffer, using mathematical boundaries based on price volatility to veto actions that are unlikely to be profitable after accounting for transaction fees.
Experimental Setup
We evaluated mTrader on three diverse datasets to test its robustness across different market conditions:
- Bitcoin: A highly volatile cryptocurrency market (2018).
- Tesla: A high-growth US technology stock (2021).
- CATL: A major industrial stock from the Chinese market (2021).
The experiments utilized five-minute interval data, providing a high-frequency environment to assess the model's agility and decision-making speed.
Results and Discussion
mTrader consistently outperformed baselines such as DQN, DDPG, and standard PPO across all metrics.
- Profitability: In the Bitcoin dataset, mTrader achieved a 3.04% total return, while baseline models like DQN and DDPG suffered significant losses (up to -16.69%).
- Risk-Adjusted Returns: The framework demonstrated high stability, particularly in the Tesla market, where it achieved a Sharpe Ratio of 3.46—nearly double that of DDPG.
- Ablation Studies: Removing either the VQ-VAE or the Action Optimizer led to a significant drop in performance, confirming that both discrete state representation and action filtering are critical components of the system.
Conclusion
mTrader provides a robust solution for financial trading by effectively filtering market noise and optimizing trade execution. By leveraging multi-scale modeling and discrete latent variables, the framework maintains stability in volatile environments. Future work will focus on incorporating macro-economic indicators and extending the model to multi-asset portfolio management.
Summary updated