← Back to Projects

PPOAlgo - Momentum Algorithm Using RTX 3090

PPOAlgo is a GPU-accelerated trading parameter optimizer that uses massive parallelism and machine-learning-driven selection to discover optimal buy and sell triggers across millions of strategy combinations—in seconds.

This post explains what problem PPOAlgo solves, how it works under the hood, and why GPU computing changes everything for systematic traders.

The Pain of Traditional Backtesting

If you’ve ever optimized trading strategies the “classic” way, you already know how painful it is.

Backtesting frameworks usually test strategies one parameter set at a time. That works fine for a handful of combinations—but completely breaks down once you start exploring real parameter space.

Parameter TestsTime Required (CPU)100 combinations~30 minutes10,000 combinations~5 hours1,000,000 combinations20+ days

At that scale, optimization becomes guesswork. Traders end up:

  • Narrowing ranges prematurely
  • Optimizing on intuition instead of data
  • Or worse—never testing robustly at all

PPOAlgo flips this model completely.

The Core Idea: Parallelize Everything

Instead of testing strategies sequentially, PPOAlgo uses GPU parallel processing to test all parameter combinations at the same time.

With NVIDIA CUDA and CuPy, strategy optimization becomes a matrix operation instead of a loop.

CPU vs GPU Thinking

Traditional CPU approach

for buy_trigger in buy_range:
    for sell_trigger in sell_range:
        backtest(buy_trigger, sell_trigger)

PPOAlgo GPU approach

[ 4,275 strategies × 500 trading days ] → evaluated simultaneously

On an NVIDIA RTX 3090 (10,496 CUDA cores):

  • 100,000 strategies → ~1 second
  • 1,000,000 strategies → ~25 seconds

What used to take days now finishes before you finish your coffee.

System Architecture Overview

1. Market Data Ingestion

PPOAlgo pulls professional-grade market data from multiple providers to ensure accuracy and redundancy:

  • Alpaca Markets – Real-time and historical equities data
  • Massive.com – Institutional-quality datasets
  • Widesurf – Alternative and supplemental market data

From this data, PPOAlgo builds minute-level OHLCV datasets and computes:

  • VWAP
  • Momentum
  • Volatility
  • Opening range metrics

All calculations are vectorized and GPU-friendly.

2. GPU-Accelerated Parameter Optimization

Once the data is prepared, PPOAlgo performs a massive grid search across all strategy parameters.

Instead of asking “Does this parameter work?”, PPOAlgo asks:

“Which parameters maximize performance given risk constraints?”

You can optimize for:

  • Sharpe Ratio (risk-adjusted returns)
  • Win Rate
  • Total Return
  • Maximum Drawdown

The optimizer doesn’t just find a winning strategy—it finds the best trade-off between profit and risk.

Trading Strategies Inside PPOAlgo

1. Dipper Strategy (Mean Reversion)

Idea: Buy weakness, sell recovery.

Rules

  • Buy when price drops X% below the previous close
  • Sell when price rebounds Y% from entry

Best for

  • Volatile stocks
  • Mean-reverting behavior

Example:

Buy Trigger:  -2.5%
Sell Trigger: +3.0%

Simple, effective, and surprisingly powerful when optimized correctly.

2. 10AM Momentum Strategy

Idea: Let the market establish direction, then follow it.

Rules

  • At 10:00 AM ET, enter if price is up X% from the open
  • Exit at profit target or end of day

Why 10AM?

  • The first 30 minutes are chaotic (gap fills, news reactions)
  • By 10AM, institutional positioning becomes clear
  • Momentum after 10AM often persists

This strategy shines in strong trend days.

Trade-By-Trade Transparency

One of PPOAlgo’s biggest advantages is explainability.

After optimization, you get a full trade log showing:

  • Why trades were taken
  • Why trades were skipped
  • Exactly how they exited

FieldDescriptionBuy?Entry taken or skippedSkipped Reasone.g. “VWAP slope ↓”TP / SLProfit & risk levelsExit TypeTP, SL, or CloseEquity CurveRunning account balance

No black boxes. No guessing.

Performance Benchmarks

TrialsCPU (Optuna)GPU (PPOAlgo)Speedup10,000~60 sec~1 sec60×100,000~10 min~3 sec200×1,000,000~2 hours~25 sec288×

Test system: Intel i9-10900K + NVIDIA RTX 3090

Technology Stack

  • Backend: Python 3.11, FastAPI
  • GPU Computing: CUDA, CuPy, NumPy
  • Optimization: Grid Search + Bayesian (Optuna)
  • Database: PostgreSQL (JSONB)
  • Frontend: HTML, CSS, Vanilla JS
  • Real-Time: WebSockets
  • Deployment: Docker & Docker Compose

License: MIT
Built with ❤️ for quantitative traders

Gallery