← all research
STUDY

"Phase 2 — Alpaca ETH/USD + SOL/USD Feature Construction"

2026-08-15

Status: DONE | Date: 2026-08-15 | Stack: Phase 1 raw store -> data/alpaca/features.py

Scope

Per-symbol feature frames over the raw bar + sparse-quote partitions, built exactly to the feed reality measured in Phase 1: ETH ~3.3k / SOL ~3k quotes per day (~2-3/minute), so most 1Min bars have no quote in-bar. Design choice: every quote feature is the last-known quote at-or-before the bar close, plus an explicit staleness column — we report liquidity honestly instead of backfilling fake freshness.

Feature catalogue (24 columns)

Deliberately absent: aggressor-side / order-flow imbalance features — Alpaca crypto trades carry no aggressor side and there is no historical deep book (Phase-1 limitation). Documented, not assumed away.

No-look-ahead guarantees

Files

FilePurpose
data/alpaca/features.pybuilders, schema, persist/load, leak guard
tests/test_alpaca_features.py10 offline tests (synthetic bars/quotes injected)
data/processed/alpaca/features/{SYM}/{TF}/v1.parquetsaved feature frames

Tests

10 passed new; full suite 251 passed, 2 skipped. Coverage: rolling first-row NaN, r_1 construction, spread/microprice/imb math, backward-asof no-future-leak, in-bar quote counting, staleness monotonicity, raw-store- driven build, persistence roundtrip, strict symbol rejection.

Real-data smoke (3-day live store, 2026-08-12→15)

SymbolTFrowsspread covermean quote ageatr_14 meanr_1 NA
ETH/USD1Min1,41399.9%152s0.000631
ETH/USD5Min651100%203s0.001011
SOL/USD1Min1,45399.9%147s0.000901
SOL/USD5Min68099.9%182s0.001511

Row counts exactly reproduce the stored 2,872 1Min bars across both symbols.

Findings / implications

Next steps