# aulekator/polymarket-btc-15-minute-trading-bot architecture

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

- Interactive diagram: https://gitdiagram.com/aulekator/polymarket-btc-15-minute-trading-bot
- Repository: https://github.com/aulekator/polymarket-btc-15-minute-trading-bot

## Overview

This repository is a Polymarket BTC 15-minute market trading bot. Its primary workflow gathers market and sentiment data, analyzes and fuses signals, applies risk controls, and places trades; monitoring and performance-based learning support that loop. The README documents the high-level phase flow, while source-index references and excerpts establish selected implementation links. Some runtime wiring is unsampled, so those relationships are omitted rather than inferred.

Main entry points: [`bot.py`](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/bot.py) (Bot Orchestrator), [`core/ingestion/adapters/unified_adapter.py`](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/adapters/unified_adapter.py) (Unified Adapter), [`core/nautilus_core/data_engine/engine_wrapper.py`](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/data_engine/engine_wrapper.py) (Nautilus Data Engine), [`monitoring/grafana_exporter.py`](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/monitoring/grafana_exporter.py) (Metrics Exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_feeds["Market Data"]
  node_coinbase["Coinbase Feed<br/>[adapter.py]"]
  node_binance["Binance Feed<br/>[websocket.py]"]
  node_news["News Sentiment<br/>[adapter.py]"]
  node_solana["Solana RPC<br/>[rpc.py]"]
end

subgraph group_framework["Data Runtime"]
  node_unified["Unified Adapter<br/>[unified_adapter.py]"]
  node_validator["Data Validator<br/>[data_validator.py]"]
  node_rate["Rate Limiter<br/>[rate_limiter.py]"]
  node_websocket["WebSocket Manager"]
  node_data_engine["Nautilus Data Engine<br/>[engine_wrapper.py]"]
  node_instruments["BTC Instruments<br/>[btc_instruments.py]"]
  node_provider["Custom Data Provider"]
  node_dispatcher["Event Dispatcher<br/>[dispatcher.py]"]
end

subgraph group_strategy["Signal Strategy"]
  node_processors["Signal Processors"]
  node_signal_types["Signal Definitions<br/>[base_processor.py]"]
  node_fusion["Signal Fusion<br/>[signal_fusion.py]"]
  node_fusion_divergence["Fusion Divergence"]
  node_strategy_15m["15-Minute Strategy"]
end

subgraph group_trading["Trading"]
  node_bot["Bot Orchestrator<br/>[bot.py]"]
  node_runner["Bot Runner<br/>[15m_bot_runner.py]"]
  node_risk["Risk Engine<br/>[risk_engine.py]"]
  node_execution["Execution Engine"]
  node_integration["Nautilus Integration"]
  node_polymarket["Polymarket Client"]
end

subgraph group_operations["Monitoring Learning"]
  node_metrics["Metrics Exporter"]
  node_performance["Performance Tracker"]
  node_learning["Weight Learning<br/>[learning_engine.py]"]
  node_redis["Redis Mode Control<br/>[redis_control.py]"]
end

node_operator(("Bot Operator"))
node_grafana["Grafana"]

node_operator -->|"starts"| node_runner
node_runner -.->|"runs"| node_bot
node_bot -->|"fetches data"| node_coinbase
node_unified -->|"uses feed"| node_coinbase
node_unified -->|"uses feed"| node_binance
node_unified -->|"uses feed"| node_news
node_unified -.->|"uses feed"| node_solana
node_bot -->|"invokes"| node_processors
node_processors -->|"emits signals"| node_signal_types
node_strategy_15m -->|"uses processors"| node_processors
node_strategy_15m -->|"fuses signals"| node_fusion
node_bot -->|"uses fusion"| node_fusion
node_bot -->|"checks risk"| node_risk
node_execution -->|"checks risk"| node_risk
node_execution -->|"places orders"| node_integration
node_integration -.->|"uses client"| node_polymarket
node_data_engine -->|"registers"| node_instruments
node_data_engine -->|"connects provider"| node_provider
node_provider -->|"uses adapter"| node_unified
node_data_engine -->|"uses dispatcher"| node_dispatcher
node_bot -->|"tracks trades"| node_performance
node_bot -->|"exports metrics"| node_metrics
node_metrics -->|"reads statistics"| node_performance
node_metrics -.->|"serves metrics"| node_grafana
node_bot -->|"updates weights"| node_learning
node_learning -->|"reads trades"| node_performance
node_learning -->|"adjusts weights"| node_fusion
node_operator -->|"switches mode"| node_redis

click node_bot "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/bot.py"
click node_runner "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/15m_bot_runner.py"
click node_coinbase "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/coinbase/adapter.py"
click node_binance "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/binance/websocket.py"
click node_news "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/news_social/adapter.py"
click node_solana "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/solana/rpc.py"
click node_unified "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/adapters/unified_adapter.py"
click node_validator "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/validators/data_validator.py"
click node_rate "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/managers/rate_limiter.py"
click node_websocket "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/managers/websocket_manager.py"
click node_data_engine "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/data_engine/engine_wrapper.py"
click node_instruments "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/instruments/btc_instruments.py"
click node_provider "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/providers/custom_data_provider.py"
click node_dispatcher "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/event_dispatcher/dispatcher.py"
click node_processors "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/tree/main/core/strategy_brain/signal_processors"
click node_signal_types "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/signal_processors/base_processor.py"
click node_fusion "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/fusion_engine/signal_fusion.py"
click node_fusion_divergence "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/fusion_engine/divergence_processor.py"
click node_strategy_15m "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/strategies/btc_15min_strategy.py"
click node_risk "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/risk_engine.py"
click node_execution "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/execution_engine.py"
click node_integration "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/nautilus_polymarket_integration.py"
click node_polymarket "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/polymarket_client.py"
click node_metrics "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/monitoring/grafana_exporter.py"
click node_performance "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/monitoring/performance_tracker.py"
click node_learning "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/feedback/learning_engine.py"
click node_redis "https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/redis_control.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_coinbase,node_binance,node_news,node_solana toneBlue
class node_unified,node_validator,node_rate,node_websocket,node_data_engine,node_instruments,node_provider,node_dispatcher toneAmber
class node_processors,node_signal_types,node_fusion,node_fusion_divergence,node_strategy_15m toneMint
class node_bot,node_runner,node_risk,node_execution,node_integration,node_polymarket toneRose
class node_metrics,node_performance,node_learning,node_redis,node_operator,node_grafana toneIndigo
```

## Components

### Market Data

- [Coinbase Feed](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/coinbase/adapter.py): `data_sources/coinbase/adapter.py`
- [Binance Feed](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/binance/websocket.py): `data_sources/binance/websocket.py`
- [News Sentiment](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/news_social/adapter.py): `data_sources/news_social/adapter.py`
- [Solana RPC](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/data_sources/solana/rpc.py): `data_sources/solana/rpc.py`

### Data Runtime

- [Unified Adapter](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/adapters/unified_adapter.py): `core/ingestion/adapters/unified_adapter.py`
- [Data Validator](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/validators/data_validator.py): `core/ingestion/validators/data_validator.py`
- [Rate Limiter](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/managers/rate_limiter.py): `core/ingestion/managers/rate_limiter.py`
- [WebSocket Manager](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/ingestion/managers/websocket_manager.py): `core/ingestion/managers/websocket_manager.py`
- [Nautilus Data Engine](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/data_engine/engine_wrapper.py): `core/nautilus_core/data_engine/engine_wrapper.py`
- [BTC Instruments](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/instruments/btc_instruments.py): `core/nautilus_core/instruments/btc_instruments.py`
- [Custom Data Provider](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/providers/custom_data_provider.py): `core/nautilus_core/providers/custom_data_provider.py`
- [Event Dispatcher](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/nautilus_core/event_dispatcher/dispatcher.py): `core/nautilus_core/event_dispatcher/dispatcher.py`

### Signal Strategy

- [Signal Processors](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/tree/main/core/strategy_brain/signal_processors): `core/strategy_brain/signal_processors`
- [Signal Definitions](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/signal_processors/base_processor.py): `core/strategy_brain/signal_processors/base_processor.py`
- [Signal Fusion](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/fusion_engine/signal_fusion.py): `core/strategy_brain/fusion_engine/signal_fusion.py`
- [Fusion Divergence](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/fusion_engine/divergence_processor.py): `core/strategy_brain/fusion_engine/divergence_processor.py`
- [15-Minute Strategy](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/core/strategy_brain/strategies/btc_15min_strategy.py): `core/strategy_brain/strategies/btc_15min_strategy.py`

### Trading

- [Bot Orchestrator](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/bot.py): `bot.py`
- [Bot Runner](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/15m_bot_runner.py): `15m_bot_runner.py`
- [Risk Engine](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/risk_engine.py): `execution/risk_engine.py`
- [Execution Engine](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/execution_engine.py): `execution/execution_engine.py`
- [Nautilus Integration](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/nautilus_polymarket_integration.py): `execution/nautilus_polymarket_integration.py`
- [Polymarket Client](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/execution/polymarket_client.py): `execution/polymarket_client.py`

### Monitoring Learning

- [Metrics Exporter](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/monitoring/grafana_exporter.py): `monitoring/grafana_exporter.py`
- [Performance Tracker](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/monitoring/performance_tracker.py): `monitoring/performance_tracker.py`
- [Weight Learning](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/feedback/learning_engine.py): `feedback/learning_engine.py`
- [Redis Mode Control](https://github.com/aulekator/polymarket-btc-15-minute-trading-bot/blob/main/redis_control.py): `redis_control.py`

### Other components

- **Bot Operator**
- **Grafana**

## Connections

- Bot Operator → Bot Runner: starts (evidence: `README.md`)
- Bot Runner → Bot Orchestrator: runs
- Bot Orchestrator → Coinbase Feed: fetches data (evidence: `bot.py`)
- Unified Adapter → Coinbase Feed: uses feed (evidence: `core/ingestion/adapters/unified_adapter.py`)
- Unified Adapter → Binance Feed: uses feed (evidence: `core/ingestion/adapters/unified_adapter.py`)
- Unified Adapter → News Sentiment: uses feed (evidence: `core/ingestion/adapters/unified_adapter.py`)
- Unified Adapter → Solana RPC: uses feed (evidence: `core/ingestion/adapters/unified_adapter.py`)
- Bot Orchestrator → Signal Processors: invokes (evidence: `bot.py`)
- Signal Processors → Signal Definitions: emits signals (evidence: `core/strategy_brain/signal_processors/base_processor.py`)
- 15-Minute Strategy → Signal Processors: uses processors (evidence: `core/strategy_brain/strategies/btc_15min_strategy.py`)
- 15-Minute Strategy → Signal Fusion: fuses signals (evidence: `core/strategy_brain/strategies/btc_15min_strategy.py`)
- Bot Orchestrator → Signal Fusion: uses fusion (evidence: `bot.py`)
- Bot Orchestrator → Risk Engine: checks risk (evidence: `bot.py`)
- Execution Engine → Risk Engine: checks risk (evidence: `execution/execution_engine.py`)
- Execution Engine → Nautilus Integration: places orders (evidence: `execution/execution_engine.py`)
- Nautilus Integration → Polymarket Client: uses client
- Nautilus Data Engine → BTC Instruments: registers (evidence: `core/nautilus_core/data_engine/engine_wrapper.py`)
- Nautilus Data Engine → Custom Data Provider: connects provider (evidence: `core/nautilus_core/data_engine/engine_wrapper.py`)
- Custom Data Provider → Unified Adapter: uses adapter (evidence: `core/nautilus_core/providers/custom_data_provider.py`)
- Nautilus Data Engine → Event Dispatcher: uses dispatcher (evidence: `core/nautilus_core/data_engine/engine_wrapper.py`)
- Bot Orchestrator → Performance Tracker: tracks trades (evidence: `bot.py`)
- Bot Orchestrator → Metrics Exporter: exports metrics (evidence: `bot.py`)
- Metrics Exporter → Performance Tracker: reads statistics (evidence: `monitoring/grafana_exporter.py`)
- Metrics Exporter → Grafana: serves metrics (evidence: `README.md`)
- Bot Orchestrator → Weight Learning: updates weights (evidence: `bot.py`)
- Weight Learning → Performance Tracker: reads trades (evidence: `feedback/learning_engine.py`)
- Weight Learning → Signal Fusion: adjusts weights (evidence: `feedback/learning_engine.py`)
- Bot Operator → Redis Mode Control: switches mode (evidence: `README.md`)
