Back to Projects

Carry Trade Algo

Algorithmic Forex Strategy — 94-Day Paper Trading Validation

Quantitative DeveloperSolo Developer
Algorithmic TradingQuantitative FinancePaper Trading

Tech Stack

PythonOANDA APIpandasSQLiteDockerAWS
Architecture: Event-Driven Pipeline
41/94
Protocol Day
70%
Win Rate
0%
Ruin Probability
5.9%
Median Return (MC)

Overview

A systematic algorithmic trading system that exploits interest rate differentials across 6 JPY currency pairs. Built from scratch in Python with 473 tests, the system runs 24/5 on AWS with hourly decision cycles, adaptive risk management, ML signal filtering, and real-time Telegram monitoring. Currently in day 41 of a 94-day live validation protocol on OANDA paper trading — no real money at risk.

The Hypothesis

Carry trades exploit interest rate gaps between currencies — borrow in low-rate JPY (~0%) and hold higher-yield currencies (USD, AUD, GBP at 4-5%). The spread generates daily swap income even if price doesn't move. Historically, this is one of the most persistent edges in forex.

But manual carry trading is emotional and inconsistent. Human traders hold too long in downtrends, exit too early in uptrends, and can't monitor 6 pairs around the clock. The 2024 JPY carry unwind wiped out months of gains for discretionary traders in a single week.

The hypothesis: a systematic, trend-following approach with strict multi-layer risk management can capture carry income while avoiding the catastrophic drawdowns that historically devastate carry traders — preserving capital by only entering when trend, momentum, and regime all align.

The System

The V3 strategy enters only when price trades above the 50-day MA which itself is above the 200-day MA (golden cross confirms uptrend), the pair pays positive swap, RSI is below overbought, and the market regime is favorable. This multi-gate approach means the system stays flat during downtrends — exactly when carry traders get crushed.

Risk management operates through 5 independent layers: ATR-based position sizing adjusts for volatility, Kelly criterion optimizes bet size, regime detection scales exposure, correlation monitoring prevents over-concentration in correlated JPY pairs, and quadratic drawdown decay progressively reduces risk as losses mount. Three circuit breakers (daily -3%, weekly -7%, max DD -20%) provide hard stops.

The operational stack runs hourly via APScheduler on Docker/AWS: each tick fetches 300 candles from OANDA, runs the strategy pipeline through an ML bandit gate (Thompson Sampling), executes via limit orders, persists all state to SQLite (survives container restarts), and reports to Telegram for real-time monitoring.

Live Results

Day 41 of 94 on OANDA paper trading: $100,086.29 equity from $100,000 start. Peak equity reached $100,124.56. The system achieved a 70% win rate across 30 clean trades with a Sharpe ratio of 3.21 on active trading days.

The system correctly identified and avoided the February JPY strengthening, holding zero positions during the downtrend — exactly the capital preservation behavior that distinguishes systematic from discretionary trading. Monte Carlo simulation across 5,000 runs shows 0% probability of ruin and a 5.9% median annualized return.

What's Next

53 days remain in the 94-day validation protocol. The system needs 50+ completed trades for statistical significance and must maintain <15% drawdown to pass. Current trajectory: 30 clean trades with 70% win rate and 0.53% max drawdown.

After protocol completion, the Real Money Readiness checklist requires: regime detection as a hard entry gate (not just sizing), ML bandit activation (currently in shadow mode learning from outcomes), VIX > 25 hard block, BOJ meeting 48-hour blackout, and weekend gap protection.

Capital deployment follows a phased approach: $5-10K initial allocation with strict position limits, scaling to $20-25K after 3 months of live performance, with full deployment only after 6+ months of consistent, auditable results.

Active Development — Follow the Journey

Performance Dashboard

Live charts from the 94-day validation protocol and historical backtesting

Want similar results for your project?

Carry Trade Algo | Fernando Rodriguez