Architecture
MTS1B is a 7-layer ecosystem of 29 small, focused repos. Dependencies flow downward only; no upward arrows, no cycles.
The seven layers
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 7 — Frontends + AI bots │
│ mts1b-frontends mts1b-githubbot mts1b-discordbot │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 6 — Asset-class services │
│ mts1b-treasury mts1b-sports mts1b-prediction-markets │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 5 — Strategy + execution │
│ mts1b-research mts1b-oms mts1b-tradingview │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 4 — Engines + ops + data lake + LLM │
│ mts1b-GPUbacktester mts1b-datalake mts1b-llm mts1b-operations │
│ mts1b-cloudburst mts1b-reportslibrary │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 3 — Risk + portfolio + execution algos │
│ mts1b-riskengine mts1b-portfolio mts1b-oms-algos │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 2 — Adapters + quant library │
│ mts1b-brokers mts1b-marketdata mts1b-altdata │
│ mts1b-cryptodata mts1b-macrodata mts1b-quantkit │
└──────────────────────────────────────────── ────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 1 — Platform │
│ mts1b-platform mts1b-deploy mts1b-pluginsdk │
└────────────────────────────────────────────────────────────────────────┘
▲
┌────────────────────────────────────────────────────────────────────────┐
│ Layer 0 — Foundation │
│ mts1b-foundation (pydantic types + NATS schemas, zero runtime deps) │
└ ────────────────────────────────────────────────────────────────────────┘
Why this shape
One concept per repo, one direction of dependencies, zero duplicate implementations. Reading code at layer 5 you should never wonder "what's available?" — the answer is "everything at layers 0-4."
| Property | Enforcement |
|---|---|
| No upward dependencies | tests/contracts/test_dependency_direction.py (AST walk on every PR) |
| No cycles | Same lint, recursive check |
| Foundation has zero deps | pip-compile --strict mts1b-foundation/pyproject.toml must yield ≤ 2 deps |
| Protected symbols defined once | AST scan of 17 canonical names (HRP, BL, Kelly, ...) |
| All cross-repo types pass through foundation | mypy --strict per repo |
Runtime dataflow (live trading)
┌─────────────┐
│ marketdata │──┐
├─────────────┤ │
│ altdata │──┤
├─────────────┤ │ ┌──────────┐ ┌──────────┐ ┌─────────────┐ ┌──────────┐ ┌─────────┐
│ cryptodata │──┼────▶│ datalake │───▶│ research │───▶│ portfolio │───▶│riskengine│───▶│ oms │
├─────────────┤ │ └──────────┘ └────┬─────┘ └──────┬──────┘ └──────────┘ └────┬────┘
│ macrodata │──┘ │ ▲ │
└─────────────┘ ▼ │ ▼
quantkit ───────────────┘ ┌──────────┐
(HRP/BL/Kelly/ │ brokers │
walk-forward/ └────┬─────┘
Sharpe/metrics) │
▼
(IBKR/Coinbase/
Schwab/...)
GPUbacktester (offline): same engines, different data path
────────────────────────────────────────────────────────────
datalake → GPUbacktester (parquet results) → research (ladder)
operations: observes everything via NATS event bus
reportslibrary: reads result parquets → trade reports, RCA, NAV
llm: callable from any repo for AI assistance
Two side-cars not shown above: treasury allocates capital between sleeves (sets fund-level NAV targets that feed portfolio), and operations subscribes to the NATS event bus for compliance + drawdown halt + watchdog rules.
Two pre-launch corollaries
1. The 17-pattern dedupe contract
Across the source monorepo we found 17 implementations that are duplicated across 3-6 repos. Each becomes one canonical impl in its target repo before extraction. See the dedupe contract for the full table.
| Pattern | Sources merged | Canonical home |
|---|---|---|
| HRP | 4 | mts1b-quantkit |
| Black-Litterman | 3+ | mts1b-quantkit |
| Walk-forward CV | 3 | mts1b-quantkit |
| Sharpe / Calmar / MaxDD | 4 | mts1b-quantkit |
| Kelly / VolTarget | 5+ | mts1b-portfolio |
| Telegram / Slack dispatch | 6 | mts1b-platform/messaging |
| Fee / slippage models | 4+ | mts1b-quantkit/cost_models |
| Calendars / holidays | 5+ | mts1b-platform/calendars |
| Symbol normalization | 3+ | mts1b-platform/symbology |
| ADV / liquidity filters | 4+ | mts1b-quantkit/universe_filters |
| Logging setup | many | mts1b-platform/logging |
| Config (Pydantic Settings) | many | mts1b-platform/config |
| DB connection pools | many | mts1b-platform/db |
| Retry/backoff (tenacity) | many | mts1b-platform/retry |
| Rate limiters | many | mts1b-platform/ratelimit |
| HTTP client factory | many | mts1b-platform/http |
| Secrets redaction | scattered | mts1b-platform/security |
CI fails on any duplicate definition outside the canonical home.
2. Wave-based public release
Repos are created private invite-only. Each is flipped public via manual gh repo edit --visibility public only when:
- CI consistently green for 30 days
- README + per-repo docs complete
- License audit clean
- Maintainer sign-off
Wave 1 (months 1-3): foundation, platform, deploy, brokers, marketdata, quantkit, portfolio, riskengine, oms, oms-algos, GPUbacktester, docs.
Wave 2 (months 4-7): the 11 engines (datalake, research, llm, ...).
Wave 3 (months 8-12): treasury, sports, prediction-markets + community + plugin SDK.
See release waves for the full schedule.
Where to next
- Dependency graph — full edge list, layer-by-layer
- Design principles — the non-negotiables
- Foundation types — the type system everyone depends on
- Dedupe contract — the 17 protected symbols + CI enforcement
- Deployment profiles — Docker / Proxmox / K8s / native