Taking Over the Stock Market: Adversarial Perturbations Against Algorithmic Traders

Elior Nehemya, Yael Mathov, Asaf Shabtai, Yuval Elovici

TL;DR

This paper demonstrates that machine learning-based algorithmic trading (AT) systems are highly vulnerable to Targeted Universal Adversarial Perturbations (TUAPs). By injecting tiny, imperceptible "noise" (just 0.02% of the stock price) into real-time market data streams, an attacker can manipulate trading bots into making specific, incorrect predictions—potentially triggering market-wide chaos through a cascade effect.

What Problem Does This Paper Address?

Algorithmic trading, particularly High-Frequency Trading (HFT), now dominates global markets. These systems rely on "alpha models"—machine learning components that ingest massive streams of market data to predict price movements and execute trades in milliseconds.

While adversarial examples (maliciously crafted inputs designed to fool models) are well-documented in computer vision, the trading domain presents unique challenges:

  1. Extreme Dynamism: Market data changes chaoticly and rapidly. A perturbation crafted for a specific data point might be obsolete by the time it's deployed.
  2. Real-time Constraints: Attackers cannot predict future market behavior perfectly, making real-time crafting difficult.
  3. Heavy Monitoring: Large anomalies are easily flagged by regulators or internal anomaly detectors.

The authors set out to prove that despite these hurdles, a "universal" attack—one that works across different time points and different model architectures—is not only possible but highly effective.

Methods

The authors propose a realistic attack flow where an attacker intercepts the data stream between a broker and a trading bot (see Figure 2).

Fig. 2. An illustration of the attack flow. The attacker can be one of the following: (1) A cyber attacker that targets a specific AT bot, (2) a malicious broker, or (3) a compromised broker. While (1) manipulates just the data feed for one AT bot, (2) and (3) perturb the data to all traders that collect data from the broker.

The core innovation is the creation of a Targeted Universal Adversarial Perturbation (TUAP). Unlike standard adversarial examples, a TUAP is a single, fixed vector added to any input sample to force a specific target classification (e.g., always predict "price increase").

The Algorithm: * Input: Past market data, a target label, and a target model. * Optimization: The algorithm uses a modified version of the Targeted Basic Iterative Method (BIM). It iteratively searches for the smallest possible perturbation that achieves a desired Targeted Fooling Rate (TFR)—the percentage of samples successfully flipped to the target label. * Constraint: The perturbation is projected into an epsilon-ball (using $L_2$ distance) to ensure it remains below a threshold (0.02% of the stock price), making it look like routine data noise or minor market fluctuations.

Datasets

The study utilizes real-world intraday market data from the S&P 500 index (via Kaggle).

  • Granularity: One-minute intervals (Open, High, Low, Close, Volume).
  • Timeframe: November 2017 to February 2018.
  • Target Stocks: A diverse set including high-priced (GOOG, AMZN), medium-priced (BLK, AZO), and low-priced (AAPL, IBM) stocks to test the impact of absolute vs. relative perturbation sizes.
  • Evaluation: The data was split into training sets for the alpha models, a set for crafting the TUAP, and six distinct weekly test sets to evaluate performance over time.

Key Insights and Ideas

  • Universality is the Key: Because the perturbation is universal, the attacker doesn't need to know the exact data point they are attacking in real-time. They craft it once offline and apply it continuously.
  • High Transferability: A TUAP crafted for one model architecture (e.g., a DNN) is remarkably effective at fooling others (CNNs or RNNs). This is likely because these models, despite different architectures, share similar preprocessing logic and features (like pseudo-log returns).
  • The "Stealth" Advantage: By keeping the perturbation at 0.02%, the attack bypasses standard anomaly detectors that look for "fat-finger" errors or massive price spikes.
  • Mitigation Paradox: Standard defenses like adversarial retraining (training the model on perturbed data) actually backfire here. While it makes the model more robust to the attack, it significantly degrades the model's ability to predict real market movements, rendering the trading bot useless.

Key Results

The authors evaluated the attack against three common architectures: Deep Neural Networks (DNN), Convolutional Neural Networks (CNN), and Recurrent Neural Networks (RNN).

  • White-Box Success: In settings where the attacker knows the model, the TUAP achieved a Targeted Fooling Rate (TFR) of over 92% across all models.
  • Black-Box Transferability: When attacking an unknown model using a surrogate, the TFR remained incredibly high, often exceeding 93-95%.
  • Temporal Persistence: While the attack's effectiveness naturally degrades as the market moves further away from the training period, it remained potent for weeks.
  • Price Sensitivity: The attack was most effective on lower-priced stocks (like AAPL), where even a tiny absolute change in price represents a significant relative perturbation to the model's features.

Limitations and Future Work

  • Detection Challenges: The authors found that simple supervised detectors (kNN or ANN) were either ineffective or suffered from high false-positive rates, which is unacceptable in the high-stakes world of HFT.
  • Broker Dependency: The most effective version of the attack assumes the attacker can manipulate the data stream at the broker level. While the paper suggests multi-broker verification as a defense, they acknowledge this is expensive and introduces latency—the enemy of HFT.
  • Future Directions: The authors suggest that future research should focus on even lower-priced stocks (under $100) and explore more sophisticated, adaptive anomaly detection systems that can distinguish between market volatility and adversarial noise without sacrificing predictive accuracy.

This research serves as a stark warning: as the financial sector rushes to automate, it is opening a new, invisible front for market manipulation that current regulatory frameworks are ill-equipped to handle.

Summary updated

BibTeX
@inproceedings{nehemya2021taking,
  author = {Elior Nehemya and Yael Mathov and Asaf Shabtai and Yuval Elovici},
  title = {{Taking Over the Stock Market: Adversarial Perturbations Against Algorithmic Traders}},
  booktitle = {ECML/PKDD},
  year = {2021},
  doi = {10.1007/978-3-030-86514-6\_14},
}
Figure