# allencake/mit-trader-skill architecture

> Architecture diagram of the GitHub repository allencake/mit-trader-skill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allencake/mit-trader-skill
- Repository: https://github.com/allencake/mit-trader-skill

## Overview

mit-trader is a Claude skill backed by a Python command-line toolkit for quantitative strategy research and paper trading. The main workflow tests strategy candidates through walk-forward, luck, and cost gates, saves approved strategies, then checks signals, estimates stops, position sizes and portfolio risk, and creates tickets for explicit user approval before simulated fills reach the ledger. Separate capabilities explain course concepts and run a planted synthetic-market check. The sampled sources show the main calls; some today.py sections were omitted, so links for those steps rely on README documentation.

Main entry points: [`mit_trader/cli.py`](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/cli.py) (Command router), [`mit_trader/research.py`](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/research.py) (Research gates), [`mit_trader/today.py`](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/today.py) (Daily signal and risk), [`mit_trader/data.py`](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/data.py) (Price data and cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Commands and learning"]
  node_cli["Command router<br/>[cli.py]"]
  node_concepts["Concept explanations"]
end

subgraph group_research["Strategy research"]
  node_research_run["Research gates<br/>[research.py]"]
  node_strategy_families["Strategy families<br/>[strategies.py]"]
  node_research_stats["Research statistics<br/>[stats.py]"]
end

subgraph group_today["Signals and risk"]
  node_today_run["Daily signal and risk<br/>[today.py]"]
end

subgraph group_paper["Paper trading and state"]
  node_approval["Ticket approval<br/>[today.py]"]
  node_ledger[("Paper ledger<br/>[ledger.py]")]
  node_state_files[("Run and ticket files<br/>[common.py]")]
end

subgraph group_shared["Market data and shared services"]
  node_market_data["Price data and cache<br/>[data.py]"]
  node_shared_services["Config and JSON helpers<br/>[common.py]"]
  node_planted_market["Planted test market<br/>[planted.py]"]
end

node_user(("User"))
node_market_providers["Market data providers"]

node_user -->|"runs command"| node_cli
node_cli -->|"dispatches research"| node_research_run
node_cli -->|"dispatches today"| node_today_run
node_cli -->|"dispatches approval"| node_approval
node_cli -->|"reads ledger"| node_ledger
node_cli -->|"loads concept"| node_concepts
node_cli -->|"selects test data"| node_planted_market
node_research_run -->|"loads prices"| node_market_data
node_research_run -->|"tests candidates"| node_strategy_families
node_research_run -->|"computes gates"| node_research_stats
node_research_run -->|"writes results"| node_shared_services
node_research_run -->|"saves approvals"| node_state_files
node_today_run -->|"reads approvals"| node_state_files
node_today_run -->|"loads prices"| node_market_data
node_today_run -->|"checks signals"| node_strategy_families
node_today_run -->|"checks positions"| node_ledger
node_today_run -->|"writes tickets"| node_state_files
node_approval -->|"records fills"| node_ledger
node_approval -->|"updates ticket"| node_state_files
node_ledger -->|"reads and writes JSON"| node_shared_services
node_market_data -->|"uses cache paths"| node_shared_services
node_market_data -->|"fetches OHLCV"| node_market_providers
node_planted_market -->|"generates synthetic prices"| node_market_data
node_user -->|"confirms ticket"| node_approval

click node_cli "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/cli.py"
click node_concepts "https://github.com/allencake/mit-trader-skill/tree/main/concepts"
click node_research_run "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/research.py"
click node_strategy_families "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/strategies.py"
click node_research_stats "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/stats.py"
click node_today_run "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/today.py"
click node_approval "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/today.py"
click node_ledger "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/ledger.py"
click node_state_files "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/common.py"
click node_market_data "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/data.py"
click node_shared_services "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/common.py"
click node_planted_market "https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/planted.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_cli,node_concepts,node_user toneBlue
class node_research_run,node_strategy_families,node_research_stats toneAmber
class node_today_run toneMint
class node_approval,node_ledger,node_state_files toneRose
class node_market_data,node_shared_services,node_planted_market,node_market_providers toneIndigo
```

## Components

### Commands and learning

- [Command router](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/cli.py): `mit_trader/cli.py`
- [Concept explanations](https://github.com/allencake/mit-trader-skill/tree/main/concepts): `concepts`

### Strategy research

- [Research gates](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/research.py): `mit_trader/research.py`
- [Strategy families](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/strategies.py): `mit_trader/strategies.py`
- [Research statistics](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/stats.py): `mit_trader/stats.py`

### Signals and risk

- [Daily signal and risk](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/today.py): `mit_trader/today.py`

### Paper trading and state

- [Ticket approval](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/today.py): `mit_trader/today.py`
- [Paper ledger](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/ledger.py): `mit_trader/ledger.py`
- [Run and ticket files](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/common.py): `mit_trader/common.py`

### Market data and shared services

- [Price data and cache](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/data.py): `mit_trader/data.py`
- [Config and JSON helpers](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/common.py): `mit_trader/common.py`
- [Planted test market](https://github.com/allencake/mit-trader-skill/blob/main/mit_trader/planted.py): `mit_trader/planted.py`

### Other components

- **User**
- **Market data providers**

## Connections

- User → Command router: runs command (evidence: `README.md`)
- Command router → Research gates: dispatches research (evidence: `mit_trader/cli.py`)
- Command router → Daily signal and risk: dispatches today (evidence: `mit_trader/cli.py`)
- Command router → Ticket approval: dispatches approval (evidence: `mit_trader/cli.py`)
- Command router → Paper ledger: reads ledger (evidence: `mit_trader/cli.py`)
- Command router → Concept explanations: loads concept (evidence: `mit_trader/cli.py`)
- Command router → Planted test market: selects test data (evidence: `mit_trader/cli.py`)
- Research gates → Price data and cache: loads prices (evidence: `mit_trader/research.py`)
- Research gates → Strategy families: tests candidates (evidence: `mit_trader/research.py`)
- Research gates → Research statistics: computes gates (evidence: `mit_trader/research.py`)
- Research gates → Config and JSON helpers: writes results (evidence: `mit_trader/research.py`)
- Research gates → Run and ticket files: saves approvals (evidence: `mit_trader/research.py`)
- Daily signal and risk → Run and ticket files: reads approvals (evidence: `mit_trader/today.py`)
- Daily signal and risk → Price data and cache: loads prices (evidence: `mit_trader/today.py`)
- Daily signal and risk → Strategy families: checks signals (evidence: `mit_trader/today.py`)
- Daily signal and risk → Paper ledger: checks positions (evidence: `mit_trader/today.py`)
- Daily signal and risk → Run and ticket files: writes tickets (evidence: `mit_trader/today.py`)
- Ticket approval → Paper ledger: records fills (evidence: `mit_trader/today.py`)
- Ticket approval → Run and ticket files: updates ticket (evidence: `mit_trader/today.py`)
- Paper ledger → Config and JSON helpers: reads and writes JSON (evidence: `mit_trader/ledger.py`)
- Price data and cache → Config and JSON helpers: uses cache paths (evidence: `mit_trader/data.py`)
- Price data and cache → Market data providers: fetches OHLCV (evidence: `mit_trader/data.py`)
- Planted test market → Price data and cache: generates synthetic prices (evidence: `mit_trader/planted.py`)
- User → Ticket approval: confirms ticket (evidence: `README.md`)
