コンテンツにスキップ

AEGIS System Architecture Overview

Purpose

この文書は、2026-04-13 時点の AEGIS 全体像を 1 ページで共有するための overview である。 実運用では、live trading、Rust shadow runtime、backtest/Fargate、Synology 配備、監視系が 別レーンとして動いており、それぞれの責務分離を明示することが重要である。

System map

flowchart LR
    subgraph Market["External markets / data"]
        Saxo["Saxo OpenAPI / streaming"]
        Polygon["Polygon.io"]
        UW["Unusual Whales"]
        ORATS["ORATS / S3 / snapshots"]
        IBKR["IBKR Paper + IBeam"]
    end

    subgraph Synology["Synology runtime (primary PT site)"]
        PT["aegis-wft\nPython PT main lane"]
        Token["aegis-token-keeper-live\nSaxo token keeper"]
        Quote["aegis-quote-collector\nlive quote sampling"]
        LTRust["aegis-lt-rust\nRust shadow runtime"]
        LTServices["lt-scan-cycle / lt-quote-collector /\nlt-token-keeper / lt-validator / lt-parity /\nlt-ibkr-gateway / lt-ibkr-quote-collector"]
        Dashboard["aegis-dashboard"]
        Monitor["aegis-monitor"]
        Tunnel["aegis-cloudflared"]
        State["/volume1/aegis/wft_state"]
        Tokens["/volume1/aegis/tokens"]
        Quotes["/volume1/aegis/quote_samples*"]
    end

    subgraph AWS["AWS batch / research lane"]
        Fargate["ECS RunTask / Fargate"]
        BT["Rust BT engine"]
        EBS["EBS snapshot mounted datasets"]
        S3["S3 configs / datasets / outputs"]
    end

    subgraph Control["Control plane"]
        GitHub["GitHub + Actions"]
        Deploy["aegis_v3/deploy.sh"]
        Docs["aegis-docs"]
        Logs["WORK_LOG / handover / MEMORY"]
    end

    Saxo --> PT
    Saxo --> Token
    Saxo --> LTServices
    Polygon --> PT
    Polygon --> Quote
    Polygon --> LTServices
    UW --> PT
    IBKR --> LTServices
    ORATS --> S3

    PT --> State
    PT --> Quotes
    Token --> Tokens
    Quote --> Quotes
    Tokens --> LTRust
    State --> LTRust
    State --> LTServices
    Quotes --> LTServices

    Dashboard --> Tunnel
    Monitor --> Tunnel

    GitHub --> Deploy
    Deploy --> Synology
    GitHub --> Fargate
    S3 --> Fargate
    EBS --> Fargate
    Fargate --> BT
    BT --> S3
    Docs --> GitHub
    Logs --> GitHub

Runtime lanes

1. Live trading lane

  • Primary executor は Synology 上の aegis-wft で、Python run_multi_scenario_pt.py から MultiScenarioPTEngine を起点に複数 scenario を回す。
  • Saxo token の正系 keepalive は aegis-token-keeper-live が担当する。
  • aegis-quote-collector が live quote sample を採取し、監視と事後比較に使う。

2. Rust shadow / migration lane

  • aegis-lt-rustlt-rust-docker/ 配下の sidecar 群は、本番注文を出さない shadow / parity / observation lane として動く。
  • shared state は /volume1/aegis/wft_state/lt_rust、token は /volume1/aegis/tokens、quote sample は quote_samples_rust に分離される。
  • 方針は Strangler Fig で、Python main lane を止めずに Rust lane を横で観測する。

3. Backtest / research lane

  • 数値計算系の本命は aegis_v3/aegis-bt-rs/
  • 小さな smoke test は Mac、意思決定に使う本番 BT は ECS RunTask / Fargate を使う。
  • launcher 群 (launch_fargate_rust_bt.py, launch_fargate_sweep.py, launch_fargate_cscv.py) が ECR / task launch / dataset handoff を担当する。

4. Ops / visibility lane

  • Dashboard は aegis-dashboard、監視通知は aegis-monitor、公開経路は aegis-cloudflared
  • 変更履歴と運用判断は AEGIS/WORK_LOG.md と個別 log、Claude/Codex handover、memory index で追跡する。

Deployment model

  1. 開発者は branch で変更する。
  2. GitHub Actions が path filter に応じて対象 workflow だけを起動する。
  3. workflow は Synology に deploy.sh を流し、対象 service だけを rebuild / verify する。
  4. Synology 上で直接編集しない。ホスト変更は Git push と CI/CD だけで反映する。

Storage and contracts

Path / store Role Main writers Main readers
/volume1/aegis/tokens Saxo token cache token keeper PT / Rust LT
/volume1/aegis/wft_state PT state / replay / LT artifacts PT / LT services dashboard / validators / observation jobs
/volume1/aegis/quote_samples* live quote evidence quote collectors parity / diagnostics
S3 + EBS snapshots BT datasets / configs / results BT launchers / BT engine Fargate tasks / analysis jobs

Current design principles

  • Python PT main lane is immutable during Rust migration.
  • Rust lane is isolated by container, workflow, and state namespace.
  • WebSocket-first is the target for Saxo live connectivity.
  • Heavy backtests run on Fargate, not on Mac.
  • Operational truth is recorded in WORK_LOG before and after each meaningful change.
  • docs/operations/live-runtime-rust-strangler-architecture.md
  • docs/operations/cicd_pipeline_overview.md
  • docs/operations/synology_container_inventory.md
  • docs/overview/architecture.md