← Back to Case Studies Trading Systems

Algorithmic Trading Systems

Two trading bots — crypto (Coinbase) and forex (OANDA) — with multi-indicator signal generation, backtesting engines, 7-layer risk management, and real-time SMS alerts. Currently paper trading with real market data.

Python Coinbase API OANDA API pandas SQLAlchemy

Problem

Manual trading is emotionally driven and inconsistent. The goal was to build fully automated trading systems that generate signals from technical indicators, execute trades with strict risk management, and run 24/7 without human intervention — while keeping the human informed via SMS.

Solution

Built two independent trading bots covering different markets, both currently running in paper trading mode with real market data:

Crypto Bot — Trades 7 pairs on Coinbase Advanced Trade. Runs a grid trading strategy on ETH-USD and SOL-USD with spread-based entries, plus a multi-indicator signal strategy (RSI, EMA, Bollinger Bands, volume) for the other pairs. Currently active and logging grid fills in paper mode.

Forex Bot — Trades 4 major pairs on OANDA ($100K practice account). Dual-mode strategy: mean reversion when ADX < 25 (ranging market) and trend following when ADX > 25 (trending market). Uses ATR-based stop-losses (1.5x ATR) and take-profits (3x ATR).

Both share the same risk management philosophy: no single trade risks more than 2% of capital. Neither has been deployed with real capital yet — the focus is on validating strategies with live market data before committing funds.

Architecture

Market Data (OHLCV) → Indicator Engine → Signal Generator → Risk Manager → Executor
        │                    │                  │                │            │
  Coinbase/OANDA API   RSI, EMA, BB,      BUY/SELL/HOLD    Position Sizer  Paper/Live
  Candle caching       ADX, Volume         Confirmation     Stop-Loss Mgr   Order routing
  Parquet storage      Multi-timeframe     Scoring          Daily Limits    SMS notifications

Key Decisions

Conservative risk management stack. Seven independent safety layers ensure no catastrophic losses:

  1. Protected assets (BTC/SHIB never traded)
  2. Daily loss limit (5% capital or $15 USD, whichever first)
  3. Max 3 concurrent positions
  4. 2% capital per trade
  5. Configurable stop-loss (currently 2.5% crypto, ATR-based forex)
  6. Trailing stop activates at profit threshold, trails by configurable percentage
  7. Volume filter requires above-average volume confirmation

Paper mode first. Both bots support paper trading with real market data but simulated execution. This approach validates the strategy logic, risk management, and infrastructure reliability before any real capital is at risk. The crypto bot is actively grid trading in paper mode; the forex bot is running on OANDA’s practice environment.

Backtesting engine. Both bots include backtesting frameworks for validating strategies against historical data before deploying them in paper or live mode.

Results

  • Crypto: 7 trading pairs, grid strategy actively running on ETH/SOL, multi-indicator signals on others
  • Forex: 4 major pairs, dual-mode strategy (mean reversion + trend following), $100K OANDA practice account
  • Risk: 7-layer safety stack, automatic pause on daily loss limit
  • Monitoring: SMS alerts via iMessage for trade events, daily summaries, and errors (with quiet hours 10PM-7AM)
  • Testing: 41 unit tests (forex) + 74 unit tests (crypto)
  • Infrastructure: launchd services, both running 24/7

How This Scales

  • Live capital deployment — Graduate from paper to live trading once strategies demonstrate consistent profitability over extended paper runs.
  • ML signal enhancement — Feed historical trade results into a classifier to weight indicators dynamically based on market regime.
  • Multi-exchange arbitrage — Monitor price discrepancies across exchanges (Coinbase, Binance, Kraken) for low-risk arbitrage opportunities.
  • Client deployments — Package the bot framework as a configurable system where clients define their own pairs, indicators, and risk parameters.
  • Performance dashboard — Web UI showing equity curves, win rates, drawdown charts, and per-pair P&L.

Tech Stack

  • APIs: coinbase-advanced-py, OANDA v20 REST
  • Analysis: pandas, ta (technical indicators), numpy
  • Database: SQLAlchemy + SQLite (trades, signals, daily performance)
  • Config: PyYAML, python-dotenv
  • Notifications: iMessage via osascript (queue-based with quiet hours)
  • Data: Parquet (historical candles), SQLite (trade log)

Need something similar?

I've built this before. Let's talk about adapting it for your needs.