← all research
VALIDATED

"Phase 5 — Long/flat backtester with honest execution costs (Alpaca crypto)"

2026-08-15

Status: DONE (2026-08-15) · Suite: 281 passed, 2 skipped (+11 tests in tests/test_alpaca_backtest.py)

What was built

data/alpaca/backtest.py — long/flat OOS backtester for the Phase-3/4 bar system. CLI: python -m data.alpaca.backtest.

Execution model (matches the executable label)

signal read  ->  bar t close   (feature row = bar t close)
entry fill   ->  bar t+1 OPEN:  fill = open[t+1] * (1 + slip + fee)
exit fill    ->  bar t+1+h OPEN: fill = open[t+1+h] * (1 - slip - fee)

Cost model — itemized, never hidden

modeentry slipexit slipfees (round trip, from config.risk)
maker002 × fee_maker_pct = 30 bps
taker+half_spread-half_spread2 × fee_taker_pct = 50 bps

Stats & persistence

Honest-economics battery (tests)

Finding worth highlighting

With the repo's conservative fee constants (15/25 bps per side), round-trip costs (30/50 bps) dominate the 1-minute crypto label noise (typical |y| ~ 10-20 bps). The backtester's job — rejecting edges that cannot clear the cost hurdle — will decide which (symbol, timeframe, horizon) cells are tradeable at all. 5Min/1Hour cells are the likely survivors.