Skip to content

Repository files navigation

Bybit Trading Bot (Step 1)

Automated Telegram → Bybit signal-copying and trade-management bot.

Setup

npm install
cp .env.example .env   # fill in Bybit + Telegram credentials
npx tsx src/presentation/generateTelegramSession.ts   # one-time MTProto login

Business constants (leverage rules, thresholds, SL ladder, poll interval) live in config/trading.config.json — no magic numbers in code.

Commands

Command Purpose
npm run dev Run the bot from source
npm run build / npm start Compile and run
npm test Unit + integration tests (vitest)
npm run lint ESLint
npm run typecheck TypeScript strict check

Safety model

  • Bybit is the single source of truth — every state transition is confirmed against live Bybit data before the bot accepts it; on mismatch the trade halts with an error notification until Bybit state is re-verified.
  • No order without full validation — signal format, leverage, margin, TP/SL geometry, duplicates, and the docs/17 blocking rules all run first.
  • Crash-safe — trades are event-sourced into SQLite; on restart the bot rehydrates and reconciles everything against Bybit (trailing stops never loosen).
  • BYBIT_TESTNET=true until go-live is explicitly approved.

Go-live checklist (remaining operational steps)

  1. Provide 3–5 REAL signal messages from the monitored groups and tune the parser fixtures (assumption Q1 — patterns are currently the assumed format).
  2. Re-confirm the re-entry trigger mechanics (assumption Q5) and the leverage formula (Q8) against real expectations.
  3. Fill .env with real credentials; run the session generator; verify the account supports hedge mode on linear USDT perpetuals.
  4. Supervised testnet run: watch one full trade lifecycle (open → TP → SL move → trailing → close → summary) in your Telegram channel.
  5. Native Swedish read-through of templates.sv.ts if SV notifications are used.
  6. Only then flip BYBIT_TESTNET=false.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages