How zadescoxp/calibrain-harness works
Calibrain Harness is a testnet-only trading and model-evaluation system. A closed-bar decision is orchestrated by the engine: it builds market state, requests model forecasts, applies calibration and policy, optionally executes a trade, then labels and evaluates every forecast. The terminal exposes monitoring, controls, reports, validation and trade history. Major evaluation and news capabilities are included from the README and source index; unsampled implementation details are not expanded into speculative call chains.
Main entry points: engine.py Decision orchestrator · server.py HTTP and WebSocket API · db.py SQLite records · executor.py Testnet executor
Components 24
Market data
- Market feed clients
ctb/market/bybit_public.py - Market state
ctb/market/store.py - News forecasts
ctb/kairos/news.py
Forecast and policy
- Decision orchestrator
ctb/engine.py - Feature state builder
ctb/features.py - Forecast questions
ctb/kairos/questions.py - Model clients
ctb/kairos/client.py - Probability calibration
ctb/calibration.py - Trade policy
ctb/policy.py
Execution and records
- Testnet executor
ctb/broker/executor.py - Bybit testnet REST
ctb/broker/bybit_rest.py - Account WebSocket
ctb/broker/bybit_private_ws.py - SQLite records
ctb/db.py
Evaluation
- Outcome labeler
ctb/evaluation/labeler.py - Evaluation metrics
ctb/evaluation/metrics.py - Independent validation
ctb/evaluation/validation.py - Evaluation report
ctb/evaluation/report.py
Terminal and API
- Trading terminal
web-next/components/Terminal.tsx - Terminal views
web-next/components/Views.tsx - Market monitor
web-next/components/Monitor.tsx - UI data client
web-next/lib/data.ts - HTTP and WebSocket API
ctb/server.py
Other components
- Operator
- Kairos and Jev APIs
Connections 29
- Operator → Trading terminal: uses
README.md - Trading terminal → Terminal views: selects views
web-next/components/Views.tsx - Terminal views → Market monitor: renders
web-next/components/Views.tsx - Trading terminal → UI data client: loads data
- UI data client → HTTP and WebSocket API: requests API
- HTTP and WebSocket API → Decision orchestrator: controls and streams
ctb/server.py - Decision orchestrator → Market state: reads market state
ctb/engine.py - Market feed clients → Market state: feeds updates
ctb/market/store.py - Decision orchestrator → Feature state builder: builds forecast state
ctb/engine.py - Feature state builder → Market state: reads bars and context
ctb/features.py - Decision orchestrator → Forecast questions: asks questions
ctb/engine.py - Decision orchestrator → Model clients: requests forecasts
ctb/engine.py - Model clients → Kairos and Jev APIs: calls model API
README.md - Decision orchestrator → Probability calibration: refits weights
ctb/engine.py - Decision orchestrator → Trade policy: evaluates forecasts
ctb/policy.py - Decision orchestrator → Testnet executor: submits eligible trades
ctb/engine.py - Testnet executor → Bybit testnet REST: places and reconciles orders
ctb/broker/executor.py - Testnet executor → Account WebSocket: uses account stream
- Decision orchestrator → SQLite records: records decisions
ctb/engine.py - Testnet executor → SQLite records: records trades
ctb/broker/executor.py - Decision orchestrator → Outcome labeler: labels forecasts
ctb/engine.py - Outcome labeler → SQLite records: reads and updates outcomes
ctb/evaluation/labeler.py - HTTP and WebSocket API → Evaluation metrics: computes evaluation
ctb/server.py - HTTP and WebSocket API → Independent validation: computes validation
ctb/server.py - HTTP and WebSocket API → Evaluation report: renders report
ctb/server.py - Evaluation metrics → SQLite records: reads records
ctb/evaluation/metrics.py - Independent validation → SQLite records: reads records
ctb/evaluation/validation.py - Decision orchestrator → News forecasts: uses news forecasts
ctb/engine.py - News forecasts → Market state: adds news context