bybit-ws: a trading tool, an analyst, and an assistant
Description and use
bybit‑ws is a unified live trading system that scans, scores, vets with an LLM, manages risk, and learns from closed trades. It uses SQLite, systemd, Telegram, and a two‑phase order process to ensure reliable execution and reconciliation.
Problem
Designing a robust live trading system that integrates market data, AI vetting, risk management, and self‑learning while ensuring reliability, transparency, and recoverability.
Outcome
The system achieves reliable live trading with built‑in safety nets: LLM vetting is fail‑closed, position reconciliation prevents silent failures, and self‑learning is versioned and bounded. Manual trades are isolated from learning, and health checks provide deterministic failure modes.
Workflow
- Scan candidates and score them on technical indicators
- Size the trade based on account equity and risk intent
- Preview the order via a two‑phase endpoint and confirm if approved
- Execute the order and verify execution against the exchange
- Tag manual entries to exclude them from learning
- Reconcile local SQLite state with exchange positions
- Run self‑learning updates on closed trades
- Maintain health checks and watchdogs for reliability
Evidence
A live Bybit futures system that scans, scores, argues with itself before every entry, learns from its own closed trades — and answers when I message it from my phone.
The LLM sits inside the decision path as a veto, never as the thing that picks the trade.
The entry endpoint is two‑phase. The first call returns what would happen — side, quantity, stop, target, leverage — with confirm_required: true, and places nothing.
After the order the system reads the position back and compares it with what it asked for.
The learner reads closed trades from SQLite, scores them across win rate, profit factor, Sharpe, drawdown and holding time, and adjusts parameters per regime.
- Record date: 2026-11-02T07:43:47.828Z