Skip to content

Repository files navigation

TradabilityGap

48.5% classification accuracy — only 30.0% of trades are profitable net of costs. Here's the model that measures the gap.

LOB mid-price direction models report strong ML metrics, but those numbers ignore spread, fees, and tick-size regime effects. TradabilityGap trains standard forecasters (logistic baseline + DeepLOB CNN-LSTM) and re-evaluates them through an execution-aware layer that converts every prediction into a simulated order and net-of-cost P&L.

Accuracy vs tradability

Quickstart

Reproduce the headline result from a fresh clone:

git clone <your-repo-url> tradabilitygap && cd tradabilitygap
python3.11 -m venv .venv && source .venv/bin/activate
pip install -r requirements.lock && pip install -e ".[dev,deep]"

# Core evaluation — accuracy vs tradability
tradabilitygap --config config/config.yaml --synthetic --stage tradability

# Cross-regime table (AAPL / MSFT / GOOG)
tradabilitygap --config config/config.yaml --synthetic --stage cross_regime

# Regenerate hero charts from frozen reports
python scripts/generate_charts.py

pytest tests/ -v

90-second walkthrough (record for portfolio GIF):

bash scripts/walkthrough.sh

Architecture

LOBSTER / synthetic L2
        │
        ▼
   ingestion/              lobster_loader (+ per-symbol synthetic regimes)
        │
        ▼
   features/               OFI, microprice, tick-regime, labels
        │
        ▼
   models/                 logistic baseline · CNN-LSTM · transformer (stretch)
        │
        ├─────────────────────────────┐
        ▼                             ▼
 evaluation/ml_metrics          evaluation/tradability_layer
 (step one — insufficient)       (net P&L · edge survival · tradability ratio)
        │
        ▼
   analysis/                tradability_gap · cross_regime

Full write-up: docs/methodology.md

Results

Accuracy vs tradability (AAPL synthetic, seed 42)

Model Accuracy Profitable trades Edge survival
Baseline logistic 48.5% 30.0% 62%
DeepLOB CNN-LSTM 42.2% 23.6% 56%

Cross-regime (v1.0-full-results)

Symbol Regime Accuracy Edge survival Net P&L (ticks)
AAPL large_tick 56.5% 48% −0.99
MSFT large_tick 27.8% 42% −1.70
GOOG small_tick 40.9% 42% −1.51

Cross-regime edge survival

Frozen artifacts: reports/tradability_gap_v1.0.json, reports/results_v1.0.json

Project layout

Path Purpose
config/config.yaml All hyperparameters — nothing hardcoded
src/tradabilitygap/ Pipeline source
tests/ Cost math (priority), no-lookahead, smoke
scripts/ Chart generation + walkthrough
docs/methodology.md Paper-style write-up

Disclosures

Assumption v1.0 value
Data Synthetic LOB (LOBSTER drop-in ready)
Half-spread cost 0.5 ticks on entry
Fee 1 bps round-trip
Latency 0 ms (stretch: 1/10/50 ms)
Train/test split Chronological 70/30, no shuffle

Reported numbers match git tag v1.0-full-results. Re-run from a clean clone and diff against reports/results_v1.0.json before interviews.

License

MIT — see LICENSE.

About

model that measures the gap.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages