Skip to content

desenyon/sentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SENTINEL logo

SENTINEL

Safety-first equity stat-arb framework
Risk allocates first. Alpha competes for a capped budget second.

Quick Start Layers Tests No Leverage


Personal-scale quantitative equity framework inspired by institutional stat-arb (Citadel GQS, Renaissance, Two Sigma) — structurally inverted so survival precedes returns.

Ordinal only Cross-sectional ranks, never price forecasts
Risk first Regime governor sets budget before alpha
Signal lifecycle Admit → monitor → CUSUM retire
No leverage Gross exposure hard-capped at 1.0×
Anti-overfit CPCV, deflated Sharpe, parameter plateau

Architecture

flowchart TB
    subgraph L0["Layer 0 — Regime Governor"]
        RG[Vol · Correlation · Breadth · Liquidity]
    end
    subgraph L1["Layer 1 — Alpha Sleeves"]
        A1[Residual Momentum]
        A2[Quality]
        A3[PEAD]
        A4[Reversal]
        A5[Idio Vol]
    end
    subgraph L2["Layer 2 — Admission Gate"]
        AG[CPCV · DSR · Plateau · Rationale]
    end
    subgraph L3["Layer 3 — Meta Allocator"]
        MA[Equal weight · Multiplicative · CUSUM]
    end
    subgraph L4["Layer 4 — Portfolio"]
        PC[Rank → Weights · Constraints · DD Brake]
    end
    subgraph L5["Layer 5 — Execution"]
        EX[Limit orders · ADV cap · Tranches]
    end

    RG -->|budget B| MA
    L1 --> AG
    AG -->|admitted| MA
    MA --> PC
    PC --> EX
    RG --> PC
Loading

Safety Constraints (hard-coded)

Constraint Limit
Gross exposure ≤ 1.0× × regime budget
Single name ≤ 4%
Sector deviation ≤ 5 pp vs universe
Drawdown flat 20% (quadratic brake)
ADV participation ≤ 1%

Quick Start

git clone https://github.com/desenyon/sentinel.git
cd sentinel

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev,full]"

# Run all tests
make test

# Full validation suite
make validate

# Walk-forward backtest
make backtest

CLI

sentinel-backtest --walk-forward
sentinel-backtest --lean --tickers AAPL,MSFT,GOOG --walk-forward
sentinel-validate --output-dir reports
sentinel-lean-setup setup

QuantConnect LEAN

lean login
lean data download --dataset "US Equities" --resolution Daily --ticker AAPL
export LEAN_DATA_FOLDER=$(pwd)/data

sentinel-backtest --lean --walk-forward
cd lean && lean backtest SentinelAlgorithm

Project Structure

sentinel/
├── layers/          # Regime governor, alpha sleeves, admission, allocator, portfolio
├── backtest/        # Engine, harness, CPCV, purged CV, transaction costs
├── data/            # Synthetic + LEAN data providers
├── metrics/         # Sharpe, DSR, CUSUM, attribution
├── validation/      # Stress tests, sensitivity, CUSUM simulation
├── paper/           # Phase 4 paper trading monitor
├── lifecycle/       # Sleeve credential persistence
└── scripts/         # backtest, validate, lean_setup CLI
lean/SentinelAlgorithm/   # QCAlgorithm wrapper
tests/               # 41 tests

Alpha Sleeves

Sleeve Variant Rationale
Residual momentum 12−1 on factor residuals Less crowded than raw momentum
Quality composite Profitability, accruals, asset growth Fundamental, slow-moving
Post-earnings drift Standardized surprise Underreaction to earnings
Short-horizon reversal Weekly, patient execution Mean reversion without churn
Idiosyncratic vol tilt Underweight lottery stocks Risk control + low-vol anomaly

Validation

make validate
# [PASS] backtest_runs
# [PASS] walk_forward
# [PASS] stress_tests
# [PASS] sensitivity

Stress scenarios: correlation spike, volatility shock, liquidity crunch, momentum crash (2007-style).


Roadmap

Phase Status
Phase 1 — Data & harness ✅ Synthetic + LEAN
Phase 2 — Admission gate ✅ CPCV + DSR
Phase 3 — Full assembly ✅ Walk-forward 2010+
Phase 4 — Paper trading ✅ CUSUM live monitor

Design Document

Full architecture and research notes: AGENTS.md


License

MIT — see design doc for research context. Not financial advice.

Built for personal trading and research · No leverage · No ruin

About

Safety-first equity stat-arb framework: risk-first, ordinal-only, signal lifecycle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors