# jinwovo/polymarket-btc-updown-jury-bot architecture

> Architecture diagram of the GitHub repository jinwovo/polymarket-btc-updown-jury-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jinwovo/polymarket-btc-updown-jury-bot
- Repository: https://github.com/jinwovo/polymarket-btc-updown-jury-bot

## Overview

This repository is an automated Polymarket short-window trading system with a monitoring and control dashboard. The documented workflow collects market data, evaluates signals, stores them for live and paper traders, and presents trading status and history to operators. Backtesting and multi-market BTC/ETH trading are additional product capabilities. The collector and several specialized runners are unsampled, so their documented roles are shown without asserting unverified internal calls; dashboard-to-API wiring is likewise left unverified.

Main entry points: [`main.py`](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/main.py) (Live trader), [`db_config.py`](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/db_config.py) (Signal cache), [`data_collector.py`](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/data_collector.py) (Market collector), [`polymarket_client.py`](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/polymarket_client.py) (Polymarket client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Market data and signals"]
  node_collector["Market collector<br/>[data_collector.py]"]
  node_binance["Binance feed<br/>[binance_ws.py]"]
  node_polymarket["Polymarket client"]
  node_judges["Jury judges<br/>[judges.py]"]
end

subgraph group_trading["Trading and risk"]
  node_livebot["Live trader<br/>[main.py]"]
  node_paperbot["Paper trader<br/>[paper_trade_sim.py]"]
  node_risk["Risk manager<br/>[risk_manager.py]"]
  node_gate["Entry gate<br/>[trade_gate.py]"]
  node_auth["CLOB authentication<br/>[clob_auth.py]"]
  node_btceth["BTC/ETH runners<br/>[live_btc15.py]"]
end

subgraph group_operations["Operations and persistence"]
  node_signaldb[("Signal cache<br/>[db_config.py]")]
  node_config["Runtime configuration<br/>[config.py]"]
  node_telegram["Notifications"]
  node_api["Dashboard API"]
end

subgraph group_dashboard["Dashboard and controls"]
  node_web["Dashboard UI<br/>[live-dashboard.tsx]"]
  node_accounts["Account manager"]
  node_apiaccounts["Account endpoint<br/>[route.ts]"]
end

subgraph group_analysis["Replay and research"]
  node_backtest["Backtester<br/>[backtest.py]"]
  node_replay["Paper replay<br/>[paper_replay.py]"]
end

node_operator(("Operator"))

node_collector -.->|"reads feed"| node_binance
node_collector -.->|"polls markets"| node_polymarket
node_collector -.->|"evaluates signals"| node_judges
node_collector -.->|"writes signals"| node_signaldb
node_livebot -.->|"reads signals"| node_signaldb
node_paperbot -.->|"reads signals"| node_signaldb
node_livebot -->|"uses feed"| node_binance
node_livebot -->|"places orders"| node_polymarket
node_livebot -->|"requests verdicts"| node_judges
node_livebot -->|"checks risk"| node_risk
node_livebot -->|"checks entries"| node_gate
node_livebot -->|"sends notices"| node_telegram
node_livebot -->|"reads PnL"| node_signaldb
node_polymarket -->|"authenticates"| node_auth
node_livebot -->|"loads settings"| node_config
node_operator -.->|"monitors controls"| node_web
node_web -.->|"requests status"| node_api
node_accounts -->|"manages accounts"| node_apiaccounts
node_operator -.->|"starts services"| node_api
node_backtest -.->|"uses history"| node_signaldb
node_replay -.->|"replays signals"| node_signaldb
node_operator -.->|"runs strategies"| node_btceth

click node_collector "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/data_collector.py"
click node_binance "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/binance_ws.py"
click node_polymarket "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/polymarket_client.py"
click node_judges "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/judges.py"
click node_signaldb "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/db_config.py"
click node_livebot "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/main.py"
click node_paperbot "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/paper_trade_sim.py"
click node_risk "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/risk_manager.py"
click node_gate "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/trade_gate.py"
click node_auth "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/clob_auth.py"
click node_config "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/config.py"
click node_telegram "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/telegram_notifier.py"
click node_api "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/dashboard_server.py"
click node_web "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/components/dashboard/live-dashboard.tsx"
click node_accounts "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/components/dashboard/account-manager.tsx"
click node_apiaccounts "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/app/api/accounts/route.ts"
click node_backtest "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/backtest.py"
click node_btceth "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/live_btc15.py"
click node_replay "https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/paper_replay.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,node_binance,node_polymarket,node_judges toneBlue
class node_livebot,node_paperbot,node_risk,node_gate,node_auth,node_btceth toneAmber
class node_signaldb,node_config,node_telegram,node_api toneMint
class node_web,node_accounts,node_apiaccounts toneRose
class node_backtest,node_replay,node_operator toneIndigo
```

## Components

### Market data and signals

- [Market collector](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/data_collector.py): `data_collector.py`
- [Binance feed](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/binance_ws.py): `binance_ws.py`
- [Polymarket client](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/polymarket_client.py): `polymarket_client.py`
- [Jury judges](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/judges.py): `judges.py`

### Trading and risk

- [Live trader](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/main.py): `main.py`
- [Paper trader](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/paper_trade_sim.py): `paper_trade_sim.py`
- [Risk manager](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/risk_manager.py): `risk_manager.py`
- [Entry gate](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/trade_gate.py): `trade_gate.py`
- [CLOB authentication](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/clob_auth.py): `clob_auth.py`
- [BTC/ETH runners](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/live_btc15.py): `live_btc15.py`

### Operations and persistence

- [Signal cache](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/db_config.py): `db_config.py`
- [Runtime configuration](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/config.py): `config.py`
- [Notifications](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/telegram_notifier.py): `telegram_notifier.py`
- [Dashboard API](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/dashboard_server.py): `dashboard_server.py`

### Dashboard and controls

- [Dashboard UI](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/components/dashboard/live-dashboard.tsx): `components/dashboard/live-dashboard.tsx`
- [Account manager](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/components/dashboard/account-manager.tsx): `components/dashboard/account-manager.tsx`
- [Account endpoint](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/app/api/accounts/route.ts): `app/api/accounts/route.ts`

### Replay and research

- [Backtester](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/backtest.py): `backtest.py`
- [Paper replay](https://github.com/jinwovo/polymarket-btc-updown-jury-bot/blob/main/paper_replay.py): `paper_replay.py`

### Other components

- **Operator**

## Connections

- Market collector → Binance feed: reads feed
- Market collector → Polymarket client: polls markets
- Market collector → Jury judges: evaluates signals
- Market collector → Signal cache: writes signals
- Live trader → Signal cache: reads signals (evidence: `main.py`)
- Paper trader → Signal cache: reads signals
- Live trader → Binance feed: uses feed (evidence: `main.py`)
- Live trader → Polymarket client: places orders (evidence: `main.py`)
- Live trader → Jury judges: requests verdicts (evidence: `main.py`)
- Live trader → Risk manager: checks risk (evidence: `main.py`)
- Live trader → Entry gate: checks entries (evidence: `main.py`)
- Live trader → Notifications: sends notices (evidence: `main.py`)
- Live trader → Signal cache: reads PnL (evidence: `main.py`)
- Polymarket client → CLOB authentication: authenticates (evidence: `polymarket_client.py`)
- Live trader → Runtime configuration: loads settings (evidence: `main.py`)
- Operator → Dashboard UI: monitors controls
- Dashboard UI → Dashboard API: requests status
- Account manager → Account endpoint: manages accounts (evidence: `components/dashboard/account-manager.tsx`)
- Operator → Dashboard API: starts services
- Backtester → Signal cache: uses history
- Paper replay → Signal cache: replays signals
- Operator → BTC/ETH runners: runs strategies
