Skip to content

Crypto momentum paper trader with dual-variant tracking #63

Description

@Magicalmeow

Parent PRD

#60

What to build

Create backend/strategy_decoder/momentum_trader.py — the main paper trading loop. Monitors live Polymarket prices, executes entry/exit signals, manages positions with TP/SL, runs both strategy variants in parallel, records snapshots, enforces risk limits.

End-to-end: discover markets → poll prices → check entries → manage open positions (TP/SL) → record results → snapshot collection.

Acceptance criteria

  • MomentumPaperTrader class with async run loop
  • Discovers markets via crypto_markets module, polls prices every ~10s
  • Enters positions when strategy signals fire (both variants run simultaneously)
  • Manages open positions: checks TP/SL on every poll, exits when triggered
  • For trailing TP variant: tracks whether TP level was touched, switches to trailing mode
  • 10% high-water-mark kill switch stops all trading when triggered
  • Kelly-based sizing using bankroll and estimated win rates from research
  • Per-position tracking: entry_time, entry_price, side, asset, timeframe, config, variant
  • Records every market price snapshot to TSV (timestamp, slug, up_price, down_price)
  • State persistence to JSON (survives crash/restart)
  • TSV trade log with all fields for analysis
  • Performance summary: per-asset, per-timeframe, per-config win rates and P&L
  • CLI entry point: python -m backend.strategy_decoder.momentum_trader
  • Uses $3,000 starting bankroll

Blocked by

User stories addressed

  • User stories 2, 3, 4, 5, 6, 7, 8, 10 from PRD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions