Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Orchestration Flows

A. Automated trading pipeline (cron every 5 minutes)

Default strategy default_filter — integrated scan with built-in checklist, no separate /custom_check step needed:

┌─────────────────────────────────────────────────────────────────┐
│  CRON  every 5m                                                 │
│   │                                                             │
│   ▼                                                             │
│  scout ──► GET /scan?bot=ta_trend                               │
│   │        strategy="default_filter" (default)                  │
│   │        pandas-ta: VWAP, EMA, RSI range, Volume bull        │
│   │        → returns candidates + checklist + ask_coo           │
│   │                                                             │
│   │  candidates?                                                │
│   ├── NO  → end                                                 │
│   │                                                             │
│   ▼  YES (for each candidate with ask_coo=true)                 │
│  scout ──sessions_send──► coo                                   │
│          (checklist already in scan response)                   │
│                          │                                      │
│                          ▼                                      │
│                    Telegram ──► boss                  │
│                          │    🔍 TRADE SIGNAL                   │
│                          │    ✓/✗ checklist custom filter       │
│                          │    YES or NO?                        │
│                          │                                      │
│                    boss reply (5-minute timeout)                │
│                          │                                      │
│               NO / timeout ──► scout: REJECTED → skip          │
│                          │                                      │
│                         YES ──► scout: CONFIRMED                │
│                          │                                      │
│   ◄──────────────────────┘                                      │
│   │                                                             │
│   ▼                                                             │
│  coo ──sessions_spawn──► finance                                │
│                          │  (signal JSON)                       │
│                          ▼                                      │
│                    AI Confirm (9router)                         │
│                    EV > 25% & confidence ≥ 8?                   │
│                          │                                      │
│               NO ──► finance: confirm=false → end               │
│                          │                                      │
│                         YES                                     │
│                          │                                      │
│                          ▼                                      │
│                  finance ──► POST /trade?symbol=X&...           │
│                          │  (bracket order on-chain)            │
│                          ▼                                      │
│                  finance ──sessions_send──► coo ──► boss        │
│                                            Telegram     │
│                                            🟢 ORDER PLACED      │
└─────────────────────────────────────────────────────────────────┘

When using strategy = "ta_filter": scout additionally calls /custom_check?symbol=X&direction=Y after the scan step to retrieve the checklist, then sends it to coo. The rest of the flow is the same.

B. Trailing stop (cron every 1 minute)

CRON every 1m
  │
  ▼
finance ──► GET /trailing
  │
  │  updated.count > 0?
  ├── NO  → ANNOUNCE_SKIP
  │
  └── YES ──sessions_send──► coo ──► Telegram
                                     📈 TRAILING STOP
                                     BTC: SL $X → $Y

C. Health check (cron every 1 hour)

CRON every 1h
  │
  ▼
ops ──► GET /status
  │
  │  anomaly?
  ├── NO  → ANNOUNCE_SKIP
  │
  └── YES ──sessions_send──► coo ──► Telegram
                                     ⚠️ SYSTEM ALERT

D. Daily PnL report (cron 21:00)

CRON 21:00
  │
  ▼
finance ──► GET /status
  │
  ▼
finance ──sessions_send──► coo ──► Telegram
                                   📊 Daily Report
                                   Win/Loss, PnL%

E. Drawdown alert (realtime)

finance (trailing loop)
  │  loss > 15% detected
  ▼
finance ──sessions_send──► coo ──► Telegram
                                   🚨 DRAWDOWN ALERT > 15%
                                   automated trading paused

F. Manual request from boss

boss ──► Telegram ──► coo
                                 │
                          routing table:
                          ┌──────────────────────────┬─────────┐
                          │ trade/AI confirm/execute  │ finance │
                          │ PnL/risk/drawdown/signal  │ finance │
                          │ TA scan/signal            │  scout  │
                          │ health/infra/watchdog     │   ops   │
                          │ backend/code/bug fix      │  tech   │
                          └──────────────────────────┴─────────┘
                                 │
                          sessions_send → agent
                                 │
                          result → coo → format → boss