ADR-006: Paper/Forward Trading Setup — Executor V1
Date: 2026-04-19
Status: Proposed
Authors: Dave + Pecz
Context
Foundry V1 baseline (MACD Momentum + ADX+EMA) is committed as gold standard with 50% pass rate under unchanged gates. No further filter tests. Next step: prove the strategy works under real-time conditions with deterministic execution and kill-switches.
Decision
Build Executor V1 for paper/forward trading on Hyperliquid testnet with live data feed, simulated order flow, logging, Discord reporting, and runtime kill-switches.
Architecture
┌──────────────────────────────────────────────────────┐
│ EXECUTOR V1 — Paper Trading Engine │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌───────────┐ │
│ │ Data Feed │──▶│ Signal │──▶│ Position │ │
│ │ (Hyperliquid │ │ Generator │ │ Manager │ │
│ │ WebSocket) │ │ (ADX+EMA │ │ (simulated│ │
│ │ │ │ MACD Logic)│ │ orders) │ │
│ └─────────────┘ └─────────────┘ └─────┬─────┘ │
│ │ │
│ ┌─────────────┐ ┌─────────────┐ │ │
│ │ Discord │◀──│ Risk Guard │◀────────┘ │
│ │ Reporter │ │ (Kill-Switch│ │
│ │ │ │ Engine) │ │
│ └─────────────┘ └─────────────┘ │
│ ▲ │
│ │ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Trade Log │◀──│ State │ │
│ │ (JSONL) │ │ Manager │ │
│ └─────────────┘ │ (SQLite) │ │
│ └─────────────┘ │
└──────────────────────────────────────────────────────┘
Components
1. Data Feed (Hyperliquid WebSocket)
- Connect to
wss://api.hyperliquid.xyz/ws(mainnet for prices) - Subscribe to 1h candles for BTCUSDT, ETHUSDT (start with 2 assets)
- Reconnect on disconnect with exponential backoff
- Buffer last 200 candles for indicator calculation
2. Signal Generator (Deterministic)
- Exact same logic as backtest:
macd_hist > 0 AND close > ema_50 AND ema_50 > ema_200 AND adx_14 > 20 - Calculated on every new 1h candle close
- No LLM, no ambiguity — pure formula
- Output:
SIGNAL_LONGorSIGNAL_FLAT
3. Position Manager (Simulated)
- Track position state:
NO_POSITION,IN_LONG,COOLDOWN - Simulated order fills at close price + slippage (1bp)
- Trailing stop: 2.0%, Stop loss: 2.5%, Max hold: 48 bars
- Position size: 100% of capital (1x leverage)
- Log every entry, exit, stop, timeout as trade event
4. Risk Guard (Kill-Switch Engine)
| Guard | Threshold | Action |
|---|---|---|
| Daily Loss | > 5% of starting equity | STOP_NEW_ENTRIES for 24h |
| Max Drawdown | > 20% from peak | KILL_SWITCH: close all, stop trading |
| Max Open Positions | > 1 | Reject new entry signal |
| Consecutive Losses | ≥ 5 in a row | SOFT_PAUSE: 24h cooldown |
| Drift Monitor | Live metrics > 2σ from backtest expectations | ALERT + reduce position to 50% |
5. Runtime Guards (Explicit States)
RUNNING → Normal trading, all guards clear
SOFT_PAUSE → No new entries for 24h, existing positions managed normally
STOP_NEW → No new entries, existing positions managed (more restrictive than SOFT_PAUSE)
KILL_SWITCH → All positions closed immediately, no new trading until manual reset
COOLDOWN → Mandatory 24h wait after KILL_SWITCH before resuming
State transitions:
- RUNNING → SOFT_PAUSE: 5+ consecutive losses
- RUNNING → STOP_NEW: Daily loss > 5%
- RUNNING → KILL_SWITCH: Drawdown > 20% OR manual trigger
- SOFT_PAUSE → RUNNING: 24h elapsed, no losses in cooldown
- KILL_SWITCH → COOLDOWN: Automatic after position close
- COOLDOWN → RUNNING: 24h elapsed + manual confirmation via Discord
- Any → KILL_SWITCH: Manual Discord command !kill
6. Discord Reporter
- Trade execution: Entry/exit with PnL
- Hourly status: Position state, unrealized PnL, equity curve
- Guard triggers: Kill-switch, pause, cooldown events
- Daily summary: Total PnL, win rate, drawdown, Sharpe estimate
- Drift alerts: Live metrics deviating from backtest expectations
7. State Manager (SQLite)
- Persistent state: position, equity, guard states, trade history
- Recoverable after crash/restart
- Trade log as JSONL for post-analysis
8. Trade Log (JSONL)
{
"timestamp": "2026-04-19T14:00:00Z",
"event": "ENTRY",
"asset": "BTCUSDT",
"side": "LONG",
"price": 85432.50,
"size": 0.00117,
"equity": 100.00,
"signal": "macd_hist>0, close>ema50, ema50>ema200, adx14>20",
"guard_state": "RUNNING"
}
Paper Trading Success Criteria
| Criterion | Threshold | Notes |
|---|---|---|
| Min trades | ≥ 30 | Statistical relevance |
| Max drawdown | ≤ 25% | 5% buffer over backtest 20% gate |
| Win rate deviation | ≤ 10pp from backtest | e.g. 40%±10 |
| Avg trade PnL deviation | ≤ 2σ from backtest mean | |
| Execution quality | ≥ 95% of signals executed | Slippage/timeout tracking |
| Uptime | ≥ 99% during trading hours | |
| Kill-switch response | ≤ 60s from trigger to action | |
| Run duration | ≥ 30 days | Minimum observation period |
Implementation Order
- Week 1: Data feed + Signal generator + State manager
- Week 2: Position manager + Risk guard + Trade logger
- Week 3: Discord reporter + Monitoring dashboard
- Week 4: Integration test + 7-day dry run (paper only)
- Week 5-8: Live paper trading on Hyperliquid testnet (30-day min)
Consequences
- Positive: Real-time validation of strategy before risking capital
- Positive: Kill-switches ensure we never lose more than expected
- Positive: Drift monitoring catches regime changes early
- Negative: 30-day minimum means no live trading before late May 2026
- Negative: Simulated execution may differ from real (slippage, latency)
Out of Scope
- Real money trading (only after paper trading passes all criteria)
- Multiple strategies simultaneously (V2+)
- Short positions (V1 is long-only)
- News/macro risk layer (V2+, see ADR-005)