Multi-strategy Bitcoin trading system with institutional-style risk controls. Paper trade first, validate on testnet, then run live on Binance or Coinbase — with a real-time dashboard, Telegram/Discord alerts, and full auditability.
- Paper by default — No real orders until you switch to testnet or live. Your keys never leave your machine.
- Binance & Coinbase — Connect via API key + secret. Optional Binance Testnet for risk-free rehearsal.
- Five strategies in one engine — Trend, Momentum, Mean Reversion, Grid/DCA, and experimental Market Maker. Combine them with configurable weights and regime awareness.
- Risk first — Per-strategy caps (size, concurrent trades, ATR), plus global circuit breaker (max daily loss, max drawdown, max exposure). Manual reset required after a breach.
- Entry/exit alerts — Telegram and Discord notifications for fills and exits by default; optional signal-level noise.
- Backtest before you risk capital — Run 6-month simulations from the dashboard; tune fees, slippage, and strategy mix.
| Area | What you get |
|---|---|
| Dashboard | Live price, 24h change, regime, signals, portfolio value, open positions, win rate, profit factor, drawdown |
| Strategies | Trend (MA + ATR), Momentum (RSI/breakout), Mean Reversion (Bollinger), Grid/DCA, Market Maker (experimental) |
| Risk | Max equity per trade, max concurrent trades, break-even and trailing stops, multi-target TPs |
| Execution | Paper (default), Binance Spot (mainnet/testnet), Coinbase Exchange; market orders with configurable fees/slippage in backtest |
| Alerts | Entry/exit messages (size, stop, targets); optional signal/regime spam; multi-channel Telegram/Discord |
| Data | SQLite by default; optional Postgres for multi-instance or scaling |
- Python 3.11+
- Node.js 18+ (for the dashboard)
Create a .env in the project root (or export in shell):
| Variable | Required | Description |
|---|---|---|
API_KEY |
Yes | Shared secret for API/dashboard access |
CAPITAL_USD |
No | Paper starting capital (default 10000) |
LIVE |
No | Set to true for live/testnet exchange |
EXCHANGE |
No | binance or coinbase when LIVE=true |
EXCH_API_KEY |
When live | Exchange API key |
EXCH_API_SECRET |
When live | Exchange API secret |
EXCH_SANDBOX |
No | true = Binance Testnet; false = mainnet |
NOTIFY_MODE |
No | entry_exit (default) or signals |
POSTGRES_DSN |
No | Postgres connection string if not using SQLite |
Start the API:
uvicorn btc_sentinel.api.app:app --host 0.0.0.0 --port 8000Health check: open http://localhost:8000/health — should return {"ok": true}.
In frontend/:
# Copy env and set your API key and backend URL
cp .env.example .env
# Edit .env: VITE_API_URL=http://localhost:8000, VITE_API_KEY=your_api_key
npm install
npm run devOpen http://localhost:5173 and log in with your API_KEY (or use the app’s auth flow).
- Run in paper mode (default) — no
LIVEorEXCHANGEneeded. - Use Binance Testnet with
EXCH_SANDBOX=trueand testnet keys — see TESTNET_RUNBOOK.md. - When ready, set
LIVE=true,EXCHANGE=binance(orcoinbase), and mainnet API key/secret. Prefer API keys with trading only, no withdrawal rights.
- Telegram: set
TELEGRAM_BOT_TOKENand optionallyTELEGRAM_CHAT_ID; or register channels via Settings/API. - Discord: set
DISCORD_WEBHOOK_URLor add webhooks via Settings/API. - Modes:
NOTIFY_MODE=entry_exit(default) sends entry/exit alerts;signalsadds signal/regime updates.
Endpoints (with X-API-Key if API_KEY is set):
GET /channels,POST /channels/add— manage channelsPOST /notify/test,POST /notify/preview— test and preview messages
All protected routes require header X-API-Key: <API_KEY> (or valid session).
| Use case | Endpoints |
|---|---|
| Status & market | GET /status, GET /regime, GET /history |
| Portfolio & account | GET /portfolio, GET /account/balance, GET /account/deposits |
| Trading & config | GET /strategies, POST /config/update, POST /config/reset, GET /exchange/status, POST /exchange/apply |
| Risk | GET /config, POST /risk/global/update, POST /emergency/close-all |
| Performance | GET /trades, GET /metrics, GET /metrics/detail, GET /trades/export |
| Backtest | GET /backtest/run, GET /backtest/full, GET /backtest/config, POST /backtest/config |
| Alerts | GET /channels, POST /channels/add, GET /alerts/prefs, POST /alerts/prefs |
- Non-custodial — The bot submits orders via your exchange API; it does not hold funds.
- Secrets in env only — No API keys or secrets in config files or the repo.
- Audit — Order and API audit logs can be stored in your database.
- Your responsibility — Trading involves risk. Use paper and testnet first; restrict exchange API keys to trading and trusted IPs where possible.
Proprietary. Contact for commercial licensing or custom integrations.