How masterputra169/polymarket-btc-15-minutes works
This repository is an automated Polymarket BTC 15-minute trading system, with an operator dashboard and a research portal. Its main runtime workflow streams market data into a low-latency decision loop, evaluates model probabilities and entry filters, routes orders, then tracks fills and settlement. Separate branches cover model training and evaluation, operational monitoring and persistence, and dashboard/research views. The workflow and product capabilities are documented in the README; source excerpts and the index substantiate selected internal calls. Unsampled runtime wiring is not inferred.
Main entry points: tradePipeline.ts Trade pipeline · loop.ts Trading loop · clobClient.ts CLOB client · trainStage2PipelineV4.py Model training
Components 30
Trading runtime
- Trading loop
bot/src/loop.ts - Market feeds
bot/src/streams - Data adapters
bot/src/adapters - Trade pipeline
bot/src/engines/tradePipeline.ts - Runtime config
bot/src/config.ts
Signals and models
- ML loader
bot/src/adapters/mlLoader.ts - Model profiles
bot/src/ml/modelProfiles.ts - JEV advisor
bot/src/ai/jevAdvisor.ts - Maker fill gate
bot/src/engines/makerFillGate.ts - Model training
backtest/ml_training/trainStage2PipelineV4.py - Feature extraction
backtest/ml_training/mltrain/features.py - Training metrics
backtest/ml_training/mltrain/metrics.py
Orders and state
- Limit order manager
bot/src/engines/limitOrderManager.ts - Order constraints
bot/src/trading/orderConstraints.ts - CLOB client
bot/src/trading/clobClient.ts - Fill tracker
bot/src/trading/fillTracker.ts - Position manager
bot/src/trading/positionManager.ts - Polygon RPC
bot/src/trading/polygonRpc.ts
Operations and data
- Market tape
bot/src/tape/marketTape.ts - Runtime integrations
bot/src/services/runtimeIntegrations.ts - Alerts
bot/src/monitoring/notifier.ts - Structured logger
bot/src/logger.ts
Dashboard and research
- React dashboard
src/App.tsx - Status API
bot/src/statusServer.ts - Research portal
study-site/app.js - Monte Carlo engine
study-site/mc-engine.js
Other components
- Operator
- Polymarket services
- Market data venues
- PostgreSQL
Connections 30
- Operator → Trading loop: starts
README.md - Trading loop → Market feeds: consumes streams
README.md - Market data venues → Market feeds: publishes quotes
README.md - Trading loop → Trade pipeline: evaluates entries
README.md - Trade pipeline → ML loader: uses inference
- Trade pipeline → Maker fill gate: checks fills
bot/src/engines/tradePipeline.ts - Trade pipeline → JEV advisor: consults advisor
bot/src/engines/tradePipeline.ts - Trade pipeline → Limit order manager: routes passive orders
- Limit order manager → Maker fill gate: checks erosion
bot/src/engines/limitOrderManager.ts - Limit order manager → Model profiles: loads settings
bot/src/engines/limitOrderManager.ts - Trade pipeline → Order constraints: applies constraints
- CLOB client → Order constraints: checks orders
bot/src/trading/clobClient.ts - CLOB client → Polymarket services: places orders
README.md - Fill tracker → CLOB client: tracks orders
bot/src/trading/fillTracker.ts - Position manager → CLOB client: places sells
bot/src/trading/positionManager.ts - Position manager → Polygon RPC: queries balances
bot/src/trading/positionManager.ts - Trading loop → Runtime config: uses settings
- Trading loop → Market tape: records decisions
- Market tape → Runtime integrations: persists data
- Runtime integrations → PostgreSQL: writes records
- Trading loop → Alerts: sends alerts
- Trade pipeline → Alerts: dispatches alerts
bot/src/engines/tradePipeline.ts - Structured logger → Operator: reports status
- Model training → Feature extraction: uses features
backtest/ml_training/trainStage2PipelineV4.py - Model training → Training metrics: uses metrics
backtest/ml_training/trainStage2PipelineV4.py - Model training → ML loader: exports models
- Status API → React dashboard: serves bot data
README.md - React dashboard → Operator: displays telemetry
README.md - Research portal → Monte Carlo engine: runs simulations
study-site/app.js - Operator → Research portal: explores research
README.md