Tech/SQLite Storage

SQLite Storage

Lightweight local storage for market data, forecasts, and trade history

Database Architecture

Three separate SQLite databases handle different data domains. This separation allows independent backup, migration, and performance tuning. SQLite was chosen for zero-config deployment, ACID compliance, and excellent single-writer performance that matches our sequential data collection pattern.

market_prices.db

Stores historical bracket prices from Polymarket with timestamps. Each snapshot captures all bracket prices for all 10 stations, enabling analysis of price movements, market efficiency, and optimal timing. The schema uses a composite key of (station, date, bracket, timestamp).

Table: snapshots — raw price data per bracket per timestamp
Table: normalized — prices adjusted to sum to 1.0
Indexes: station+date for fast lookups
Growth: ~240 snapshots/day across all stations

forecasts.db and trades.db

The forecast database stores every model prediction with input features for reproducibility and analysis. The trades database logs all paper and live trades with entry price, Kelly fraction, P&L, and resolution status. Together they enable backtesting, model drift detection, and performance attribution.

forecasts: station, date, predicted_mean, predicted_std, features_json
trades: station, bracket, side, price, size, pnl, resolved_at
Paper trades and live trades in the same schema with a mode flag
Full audit trail for every decision the system makes