# atul2501/alpha-centure architecture

> Architecture diagram of the GitHub repository atul2501/alpha-centure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atul2501/alpha-centure
- Repository: https://github.com/atul2501/alpha-centure

## Overview

Alpha Centure collects Binance USD-M perpetual market data into PostgreSQL/TimescaleDB, then supports cost-aware signal research, live prediction, and simulated paper trading. Its primary live decision flow combines point-in-time features, regime and strategy gates, and a meta-model to produce and score LONG/SHORT/PASS signals. A separate P6 portfolio workflow powers the paper engine; the dashboard exposes collection health, signals, and paper activity. Relationships below are limited to README statements and SOURCE INDEX references; unsampled wiring is omitted where those do not establish calls.

Main entry points: [`src/alpha/predict.py`](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/predict.py) (Live predictor and scorer), [`src/alpha/research/models.py`](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/models.py) (Research models), [`src/alpha/live/engine.py`](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/live/engine.py) (P6 paper engine), [`dashboard/app.py`](https://github.com/atul2501/alpha-centure/blob/main/dashboard/app.py) (Audit and trading dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Market collection"]
  node_collector_entry["Collector entrypoint<br/>[main.py]"]
  node_binance_clients["REST and websocket clients<br/>[ws.py]"]
  node_payload_parsing["Payload parsing<br/>[parse.py]"]
  node_market_collectors["Market data collectors"]
  node_history_repair["Backfill and gap repair<br/>[backfill.py]"]
  node_db_layer["Database access<br/>[db.py]"]
end

subgraph group_signals["Signals and modeling"]
  node_feature_frames["Point-in-time features<br/>[build.py]"]
  node_indicators["Technical indicators<br/>[indicators.py]"]
  node_regime_model["Regime HMM<br/>[hmm.py]"]
  node_strategy_setups["Strategy playbook<br/>[playbook.py]"]
  node_setup_labels["Cost-aware setup labels<br/>[labels.py]"]
  node_meta_model["Meta-model scoring<br/>[meta.py]"]
  node_decision_engine["Signal decisions<br/>[decision.py]"]
  node_predictor["Live predictor and scorer<br/>[predict.py]"]
end

subgraph group_research["Research and validation"]
  node_research_models["Research models<br/>[models.py]"]
  node_research_panel["Hourly research panel<br/>[panel.py]"]
  node_portfolio_sim["Portfolio simulation<br/>[portfolio_sim.py]"]
  node_screening["Research screening<br/>[screen.py]"]
  node_signal_research["Signal research<br/>[signals.py]"]
  node_walkforward["Walk-forward backtest<br/>[walkforward.py]"]
  node_trainer["Champion retraining<br/>[trainer.py]"]
end

subgraph group_paper["Paper trading and audit"]
  node_paper_engine["P6 paper engine<br/>[engine.py]"]
  node_p6_strategy["P6 portfolio strategy<br/>[p6.py]"]
  node_order_management["Paper order management<br/>[oms.py]"]
  node_fill_simulator["Paper fill simulation<br/>[fillsim.py]"]
  node_audit["Data quality audit<br/>[audit.py]"]
  node_dashboard["Audit and trading dashboard<br/>[app.py]"]
  node_live_workflow_page["Live workflow page<br/>[0_Live_Workflow.py]"]
  node_signals_page["Signals page<br/>[1_Signals.py]"]
  node_paper_page["Paper page<br/>[2_Paper.py]"]
end

node_operator(("Operator"))
node_binance{{"Binance USD-M"}}
node_database[("PostgreSQL / TimescaleDB")]

node_operator -->|"starts collection"| node_collector_entry
node_collector_entry -->|"starts collectors"| node_market_collectors
node_collector_entry -->|"repairs gaps"| node_history_repair
node_collector_entry -->|"initializes schema"| node_db_layer
node_market_collectors -->|"uses clients"| node_binance_clients
node_market_collectors -->|"parses payloads"| node_payload_parsing
node_binance_clients -->|"fetches streams"| node_binance
node_market_collectors -->|"writes market data"| node_db_layer
node_history_repair -->|"fetches history"| node_binance_clients
node_history_repair -->|"repairs stored data"| node_db_layer
node_db_layer -->|"reads and writes"| node_database
node_operator -->|"runs predictor"| node_predictor
node_predictor -->|"builds features"| node_feature_frames
node_feature_frames -->|"uses indicators"| node_indicators
node_feature_frames -->|"queries data through"| node_audit
node_predictor -->|"applies regime"| node_regime_model
node_predictor -->|"generates setups"| node_strategy_setups
node_predictor -->|"scores candidates"| node_meta_model
node_predictor -->|"makes decisions"| node_decision_engine
node_strategy_setups -->|"labels outcomes"| node_setup_labels
node_operator -->|"runs backtest"| node_walkforward
node_walkforward -->|"uses models"| node_research_models
node_research_models -->|"builds on panel"| node_research_panel
node_research_models -->|"uses screening"| node_screening
node_research_models -->|"uses signals"| node_signal_research
node_research_models -->|"simulates portfolios"| node_portfolio_sim
node_operator -->|"runs retraining"| node_trainer
node_operator -->|"starts paper engine"| node_paper_engine
node_paper_engine -->|"requests targets"| node_p6_strategy
node_paper_engine -->|"manages orders"| node_order_management
node_paper_engine -->|"simulates fills"| node_fill_simulator
node_paper_engine -->|"uses database"| node_db_layer
node_operator -->|"opens dashboard"| node_dashboard
node_dashboard -->|"shows audit data"| node_audit
node_dashboard -->|"offers workflow view"| node_live_workflow_page
node_dashboard -->|"offers signals view"| node_signals_page
node_dashboard -->|"offers paper view"| node_paper_page
node_signals_page -->|"queries audit data"| node_audit
node_paper_page -->|"queries audit data"| node_audit

click node_collector_entry "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/main.py"
click node_binance_clients "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/binance/ws.py"
click node_payload_parsing "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/binance/parse.py"
click node_market_collectors "https://github.com/atul2501/alpha-centure/tree/main/src/alpha/collectors"
click node_history_repair "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/backfill.py"
click node_db_layer "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/db.py"
click node_feature_frames "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/features/build.py"
click node_indicators "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/features/indicators.py"
click node_regime_model "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/regime/hmm.py"
click node_strategy_setups "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategies/playbook.py"
click node_setup_labels "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategies/labels.py"
click node_meta_model "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/models/meta.py"
click node_decision_engine "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/decision.py"
click node_predictor "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/predict.py"
click node_research_models "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/models.py"
click node_research_panel "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/panel.py"
click node_portfolio_sim "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/portfolio_sim.py"
click node_screening "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/screen.py"
click node_signal_research "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/signals.py"
click node_walkforward "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/backtest/walkforward.py"
click node_trainer "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/trainer.py"
click node_paper_engine "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/live/engine.py"
click node_p6_strategy "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategy/p6.py"
click node_order_management "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/exec/oms.py"
click node_fill_simulator "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/exec/fillsim.py"
click node_audit "https://github.com/atul2501/alpha-centure/blob/main/src/alpha/audit.py"
click node_dashboard "https://github.com/atul2501/alpha-centure/blob/main/dashboard/app.py"
click node_live_workflow_page "https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/0_Live_Workflow.py"
click node_signals_page "https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/1_Signals.py"
click node_paper_page "https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/2_Paper.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_collector_entry,node_binance_clients,node_payload_parsing,node_market_collectors,node_history_repair,node_db_layer toneBlue
class node_feature_frames,node_indicators,node_regime_model,node_strategy_setups,node_setup_labels,node_meta_model,node_decision_engine,node_predictor,node_database toneAmber
class node_research_models,node_research_panel,node_portfolio_sim,node_screening,node_signal_research,node_walkforward,node_trainer toneMint
class node_paper_engine,node_p6_strategy,node_order_management,node_fill_simulator,node_audit,node_dashboard,node_live_workflow_page,node_signals_page,node_paper_page toneRose
class node_operator,node_binance toneIndigo
```

## Components

### Market collection

- [Collector entrypoint](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/main.py): `src/alpha/main.py`
- [REST and websocket clients](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/binance/ws.py): `src/alpha/binance/ws.py`
- [Payload parsing](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/binance/parse.py): `src/alpha/binance/parse.py`
- [Market data collectors](https://github.com/atul2501/alpha-centure/tree/main/src/alpha/collectors): `src/alpha/collectors`
- [Backfill and gap repair](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/backfill.py): `src/alpha/backfill.py`
- [Database access](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/db.py): `src/alpha/db.py`

### Signals and modeling

- [Point-in-time features](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/features/build.py): `src/alpha/features/build.py`
- [Technical indicators](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/features/indicators.py): `src/alpha/features/indicators.py`
- [Regime HMM](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/regime/hmm.py): `src/alpha/regime/hmm.py`
- [Strategy playbook](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategies/playbook.py): `src/alpha/strategies/playbook.py`
- [Cost-aware setup labels](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategies/labels.py): `src/alpha/strategies/labels.py`
- [Meta-model scoring](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/models/meta.py): `src/alpha/models/meta.py`
- [Signal decisions](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/decision.py): `src/alpha/decision.py`
- [Live predictor and scorer](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/predict.py): `src/alpha/predict.py`

### Research and validation

- [Research models](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/models.py): `src/alpha/research/models.py`
- [Hourly research panel](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/panel.py): `src/alpha/research/panel.py`
- [Portfolio simulation](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/portfolio_sim.py): `src/alpha/research/portfolio_sim.py`
- [Research screening](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/screen.py): `src/alpha/research/screen.py`
- [Signal research](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/research/signals.py): `src/alpha/research/signals.py`
- [Walk-forward backtest](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/backtest/walkforward.py): `src/alpha/backtest/walkforward.py`
- [Champion retraining](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/trainer.py): `src/alpha/trainer.py`

### Paper trading and audit

- [P6 paper engine](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/live/engine.py): `src/alpha/live/engine.py`
- [P6 portfolio strategy](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/strategy/p6.py): `src/alpha/strategy/p6.py`
- [Paper order management](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/exec/oms.py): `src/alpha/exec/oms.py`
- [Paper fill simulation](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/exec/fillsim.py): `src/alpha/exec/fillsim.py`
- [Data quality audit](https://github.com/atul2501/alpha-centure/blob/main/src/alpha/audit.py): `src/alpha/audit.py`
- [Audit and trading dashboard](https://github.com/atul2501/alpha-centure/blob/main/dashboard/app.py): `dashboard/app.py`
- [Live workflow page](https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/0_Live_Workflow.py): `dashboard/pages/0_Live_Workflow.py`
- [Signals page](https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/1_Signals.py): `dashboard/pages/1_Signals.py`
- [Paper page](https://github.com/atul2501/alpha-centure/blob/main/dashboard/pages/2_Paper.py): `dashboard/pages/2_Paper.py`

### Other components

- **Operator**
- **Binance USD-M**
- **PostgreSQL / TimescaleDB**

## Connections

- Operator → Collector entrypoint: starts collection
- Collector entrypoint → Market data collectors: starts collectors (evidence: `src/alpha/main.py`)
- Collector entrypoint → Backfill and gap repair: repairs gaps (evidence: `src/alpha/main.py`)
- Collector entrypoint → Database access: initializes schema (evidence: `src/alpha/main.py`)
- Market data collectors → REST and websocket clients: uses clients (evidence: `src/alpha/collectors/futures.py`)
- Market data collectors → Payload parsing: parses payloads (evidence: `src/alpha/collectors/futures.py`)
- REST and websocket clients → Binance USD-M: fetches streams
- Market data collectors → Database access: writes market data (evidence: `src/alpha/collectors/futures.py`)
- Backfill and gap repair → REST and websocket clients: fetches history
- Backfill and gap repair → Database access: repairs stored data (evidence: `src/alpha/main.py`)
- Database access → PostgreSQL / TimescaleDB: reads and writes (evidence: `src/alpha/db.py`)
- Operator → Live predictor and scorer: runs predictor
- Live predictor and scorer → Point-in-time features: builds features (evidence: `src/alpha/predict.py`)
- Point-in-time features → Technical indicators: uses indicators (evidence: `src/alpha/features/build.py`)
- Point-in-time features → Data quality audit: queries data through (evidence: `src/alpha/features/build.py`)
- Live predictor and scorer → Regime HMM: applies regime (evidence: `src/alpha/predict.py`)
- Live predictor and scorer → Strategy playbook: generates setups (evidence: `src/alpha/predict.py`)
- Live predictor and scorer → Meta-model scoring: scores candidates (evidence: `src/alpha/predict.py`)
- Live predictor and scorer → Signal decisions: makes decisions (evidence: `src/alpha/predict.py`)
- Strategy playbook → Cost-aware setup labels: labels outcomes (evidence: `src/alpha/strategies/labels.py`)
- Operator → Walk-forward backtest: runs backtest
- Walk-forward backtest → Research models: uses models (evidence: `src/alpha/backtest/walkforward.py`)
- Research models → Hourly research panel: builds on panel (evidence: `src/alpha/research/models.py`)
- Research models → Research screening: uses screening (evidence: `src/alpha/research/models.py`)
- Research models → Signal research: uses signals (evidence: `src/alpha/research/models.py`)
- Research models → Portfolio simulation: simulates portfolios (evidence: `src/alpha/research/models.py`)
- Operator → Champion retraining: runs retraining
- Operator → P6 paper engine: starts paper engine
- P6 paper engine → P6 portfolio strategy: requests targets (evidence: `src/alpha/live/engine.py`)
- P6 paper engine → Paper order management: manages orders (evidence: `src/alpha/live/engine.py`)
- P6 paper engine → Paper fill simulation: simulates fills (evidence: `src/alpha/live/engine.py`)
- P6 paper engine → Database access: uses database (evidence: `src/alpha/live/engine.py`)
- Operator → Audit and trading dashboard: opens dashboard
- Audit and trading dashboard → Data quality audit: shows audit data (evidence: `dashboard/app.py`)
- Audit and trading dashboard → Live workflow page: offers workflow view
- Audit and trading dashboard → Signals page: offers signals view
- Audit and trading dashboard → Paper page: offers paper view
- Signals page → Data quality audit: queries audit data (evidence: `dashboard/pages/1_Signals.py`)
- Paper page → Data quality audit: queries audit data (evidence: `dashboard/pages/2_Paper.py`)
