Skip to content
项目

Emran403/binance-trading-bot

在 GitHub 查看

关于

Community-driven Binance trading bot with FastAPI, React, and ML stacking strategies for live simula

商业与金融

这些数字如何统计

可以做什么

  • 📊 Two powerful engines, one bot — a classic moving-average crossover strategy for clean, understandable signals, plus a machine-learning strategy powered by a stacking ensemble (XGBoost, LightGBM, CatBoost) with a dedicated volatility pipeline. When both agree, the bot acts; when they don't, it waits.
  • 🧪 Live simulation first — run the whole thing in mock mode with synthetic prices so you can watch signals, positions and P&L evolve in real time without risking a single satoshi. Flip to live execution only when you're ready.
  • 🛡️ Risk management that actually manages risk — configurable stop-loss, take-profit, trailing stops, partial take-profits, time-based exits, ATR-adaptive stop-loss and a maximum position size cap. Your capital, your rules.
  • 💼 Portfolio allocation modes — spread capital across symbols equally, inverse to volatility, proportional to volatility, or weighted by ML confidence.

实测星标增长

24小时
0
7天
-46
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

🤝 Community-Powered Binance Trading Companion with ML Strategies for Discord & Telegram

🚀 PowerShell Quick Install

downloads lang ps-core channel build


Binance Trading Bot is a community-driven project that brings together a FastAPI backend, a React frontend, and machine learning strategies — including a stacking ensemble — to power live simulation and automated execution in one cohesive toolkit. Whether you're exploring signal generation, tuning risk controls, or watching positions update in real time over WebSocket, the bot offers a rich, hands-on environment built for tinkerers and traders alike. It's openly accessible to anyone curious enough to dive in, with a friendly setup that welcomes contributors of every skill level.

✅ Before You Start

  • OS: Windows 10 / 11
  • Shell: PowerShell 5.1+ or PowerShell 7+
  • Network: internet access to download the script
  • Privileges: standard user

Features

Here's what makes this project tick — and why the community keeps building on it:

  • 📊 Two powerful engines, one bot — a classic moving-average crossover strategy for clean, understandable signals, plus a machine-learning strategy powered by a stacking ensemble (XGBoost, LightGBM, CatBoost) with a dedicated volatility pipeline. When both agree, the bot acts; when they don't, it waits.
  • 🧪 Live simulation first — run the whole thing in mock mode with synthetic prices so you can watch signals, positions and P&L evolve in real time without risking a single satoshi. Flip to live execution only when you're ready.
  • 🛡️ Risk management that actually manages risk — configurable stop-loss, take-profit, trailing stops, partial take-profits, time-based exits, ATR-adaptive stop-loss and a maximum position size cap. Your capital, your rules.
  • 💼 Portfolio allocation modes — spread capital across symbols equally, inverse to volatility, proportional to volatility, or weighted by ML confidence.
  • 📈 Backtesting with real-world friction — commissions, slippage, Sharpe/Sortino ratios, max drawdown, profit factor and walk-forward validation, so you can judge a strategy before it ever touches the market.
  • ⚡ Real-time dashboard — a React panel streaming prices, signals, open positions, balance and P&L over WebSocket, refreshed every second. Dark theme included, because of course it is.
  • 🔔 Notifications where you already are — trade events, circuit-breaker triggers and security alerts delivered straight to your Discord or Telegram channel.
  • 🧠 Automatic configuration suggestions — the bot reads current market volatility and price, then proposes settings that fit the moment.
  • 📜 Trade history & stats — win-rate, cumulative P&L, best and worst trades, all at a glance.
  • 📡 Observability built in — Prometheus metrics, Grafana dashboards and Alertmanager hooks, plus health checks for the database and queue.
  • 🖥️ Desktop app included — an Electron shell bundles backend and frontend into a single installable application.
  • 🌍 Spanish-first, community-friendly — the entire interface, code and logs are in Spanish, and contributions of every size are welcome.

Whether you're here to learn how automated trading works under the hood, to stress-test your own strategies, or to tinker with ML ensembles over your morning coffee — pull up a chair. This project grows with its community, and every issue, idea and pull request makes it better for everyone.

Commands

🎮 Command Reference

Welcome to the command center! Whether you're poking at the bot from Discord or Telegram, everything is built around slash commands that feel natural and give you real control. Here's the full lineup — dig in, mix and match, and make the bot your own. 💙

🚀 Bot Control

Kick things off and steer the ship.

Command What it does
/start Ignite the trading engine in your current mode (simulation by default)
/stop Gracefully halt the bot and lock in the current state
/status Snapshot of uptime, active mode, and current positions
/switch Flip between simulation and live execution
/restart Clean restart of the engine, preserving your config

📊 Market & Signals

Peek under the hood of the strategies.

Command What it does
/price SYMBOL Live last price for any Binance pair
/signal SYMBOL Combined MA + ML ensemble verdict: BUY, SELL, or HOLD
/kline SYMBOL INTERVAL Quick OHLCV summary for the chosen timeframe
/strategy list Show every strategy currently loaded
/strategy use NAME Switch the active strategy on the fly
/confidence SYMBOL ML stacking confidence score with volatility hint

💼 Portfolio & Positions

Keep an eye on the money.

Command What it does
/balance Wallet overview: available, in-use, and P&L
/positions Every open position with entry, size, and stop levels
/trade SYMBOL SIDE QTY Manual order — respects your risk rules
/close SYMBOL Close a specific position at market
/closeall Flatten everything, carefully
/stats Win-rate, best/worst trade, profit factor, drawdown

⚙️ Configuration

Tune the bot to your taste.

Command What it does
/config show Full dump of current parameters
/config set KEY VALUE Adjust any setting inline
/risk set SL TP Define stop-loss and take-profit percentages
/risk trailing on/off Enable or disable the trailing stop
/portfolio mode MODE Pick capital split style: equal, inverse-vol, vol-weighted, or ML-confidence
/suggest Auto-recommend config based on current market conditions
/symbols add/remove SYMBOL Manage the watchlist

🧪 Simulation & Backtesting

Test ideas without touching real capital.

Command What it does
/sim start Launch a live simulation session
/sim status See simulated equity, trades, and open orders
/backtest SYMBOL INTERVAL Queue a historical run with Sharpe, Sortino, drawdown
/backtest result ID Fetch the report of a finished run
/walkforward SYMBOL Sequential validation across rolling windows

🔔 Alerts & Notifications

Stay informed, wherever you are.

Command What it does
/notify on/off Toggle trade notifications in this channel
/alert price SYMBOL LEVEL Ping when a symbol crosses a threshold
/alert pnl PERCENT Warn on portfolio P&L swing
/alert list See every active alert
/alert remove ID Delete a specific alert

🔐 Account & Security

Your keys, your rules.

Command What it does
/keys link Securely connect Binance API credentials (encrypted at rest)
/keys revoke Remove stored keys entirely
/profile Your settings, mode, and linked account summary
/mfa enable Turn on multi-factor verification
/sessions List active sessions with a one-tap revoke

🤝 Community & Support

Built with and for our community — so lean on each other.

Command What it does
/help Context-aware tips for any command
/changelog Latest features and fixes
/feedback TEXT Send suggestions straight to the team
/invite Share the bot with a friend

Every command supports /help <name> for a quick refresher, and everything you can do from chat is mirrored in the React dashboard — so you're never locked into a single interface. Happy trading, and welcome aboard! 🚀

Configuration

⚙️ Configuration

Getting your bot dialed in is where the fun really begins — and we've made it as friendly as possible. Everything lives in a single .env file at the project root, and sensible defaults mean you can be up and simulating in minutes. Tinker, experiment, share your favorite presets with the community — this is your cockpit. 🎛️

🔑 Environment essentials

Two values are required before the backend will boot:

  • JWT_SECRET — signs authentication tokens. Generate one with a quick token utility or any secure random string.
  • ENCRYPTION_KEY — a base64 urlsafe 32-byte key used to encrypt your Binance API keys at rest in the database.

Everything else ships with a working default, so you can grow into the advanced settings at your own pace.

🧩 Core variables

Variable Required Default What it does
JWT_SECRET ✅ — Token signing secret.
ENCRYPTION_KEY ✅ — Encrypts stored API keys.
DATABASE_URL No local PostgreSQL Connection string for users, configs, trades.
MOCK_MODE No true true = live simulation with synthetic prices; false = real execution.
USE_TESTNET No true Points market data and orders at Binance testnet.
REDIS_URL No local Redis Broker and result backend for async tasks.

💡 Start in simulation. MOCK_MODE=true is the default for a reason — you get the full experience, real-time dashboard and all, without risking a single satoshi. Flip to false only once you've watched the bot behave and you're comfortable with its logic.

🎚️ Strategy & risk tuning

The panel lets you shape the bot's personality without touching code. A few favorites from the community:

  • Moving-average crossover — set your fast and slow window lengths to match your trading rhythm.
  • Adaptive stop-loss / take-profit — enable ATR-based stops if you want the bot to breathe with market volatility.
  • Trailing stop & partial take-profit — lock in gains gradually instead of all at once.
  • Ensemble confidence filter — raise the ML threshold to demand stronger agreement before a signal fires.

Not sure where to start? Hit the automatic configuration suggestion endpoint from the dashboard — it reads current volatility and price, then proposes a balanced starting point. It's a great springboard, and tweaking from there is half the fun. 🧠

🔔 Notifications

Wire up Telegram or Discord to get pinged on trades, circuit-breaker events, and security alerts. Drop your channel credentials into the environment config, and the bot will keep you in the loop wherever you hang out. Perfect for the community-minded trader who likes a heads-up from the bot instead of refreshing a tab all day. 📲

🤝 Share your setup

Found a configuration that hums? Post it in the discussions — presets from fellow users are the fastest way for newcomers to find their footing. The more we swap ideas, the smarter every deployment gets. Welcome aboard, and happy tuning! 🚀

FAQ

Is the bot accessible to everyone? Absolutely — the whole project is open and community-driven, with no paywalls or locked tiers. Clone it, explore the strategies, and make it your own.

Can I try it without risking real funds? Yes. Simulation mode is enabled by default (MOCK_MODE=true), so you can watch the bot trade against synthetic prices and study its behavior before ever touching live markets. Switch to real operation only when you feel ready.

What strategies ship out of the box? You get a classic moving-average crossover, an enhanced strategy (Theil-Sen + MACD + Bollinger + RSI + volume), and an ML strategy powered by a stacking ensemble of XGBoost, LightGBM, and CatBoost. Mix and match, or plug in your own.

Do I need the ML model to run the bot? No — a trained model is bundled with the repo. If you'd rather retrain it on your own symbols and intervals, the training script is included and documented. Without a model, the ML strategy simply holds its positions.

Can I extend or customize the bot? That's the whole point. The layered architecture keeps strategies, risk management, execution, and the API cleanly separated, so adding a new indicator, risk rule, or notification channel is straightforward. Contributions and ideas are always welcome.

How do I get notified about trades and alerts? Hook up Telegram or Discord and the bot will ping you on trades, circuit-breaker events, and security alerts. Daily reports and cleanup jobs run asynchronously behind the scenes.

Where can I see performance? The real-time dashboard streams prices, signals, positions, balance, and P&L over WebSocket, while Prometheus and Grafana give you deeper monitoring. Trade history comes with win-rate, P&L, and best/worst-trade stats.

Is my configuration safe? API keys are encrypted before they hit the database, and JWT authentication protects every account. Keep your keys private and start in simulation mode until you're comfortable.

Something isn't working — where do I ask? Open an issue or start a discussion in the community. Friendly folks, feature-rich answers, and no question is too small.

Support

💬 We're here for you — and we're builders, just like you.

Binance Trading Bot is powered by a community that believes great tools grow through shared feedback and honest conversation. Whether you're running your first simulation or tuning an ML ensemble for live execution, you'll always find someone ready to lend a hand.

  • 🐞 Found a quirk? Open an issue and describe what happened — the more detail, the faster we can trace it. Logs, config snippets and the mode you were running (MOCK_MODE) go a long way.
  • 💡 Got an idea? Feature requests are genuinely welcome. Some of the best additions to this project started as a simple "what if…" in a discussion thread.
  • 🧠 Want to contribute? Pull requests are open to everyone. Whether it's a bug fix, a new strategy, a UI polish or a documentation refresh — every bit counts.
  • 📊 Sharing results — backtests, walk-forward runs, portfolio splits or risk configurations — helps the whole community learn what works and what doesn't.
  • 🤝 Respect first — be kind, be patient, and remember that everyone here is learning. Constructive feedback beats criticism every time.

A note on access: this project is openly available to everyone — no paywalls, no gated tiers. Fork it, explore it, extend it. If you build something cool on top of it, we'd love to hear about it.

Recognition: contributors who take the time to report, fix or improve are the heart of this project. Your name belongs in the changelog — and we make sure it gets there.

Thank you for being part of the journey. Now go build something great. 🚀

License

This project is released under the MIT License — a permissive, community-friendly license that keeps the door wide open for everyone. You're welcome to use, modify, merge, publish, distribute, sublicense, and build upon Binance Trading Bot for any purpose, including commercial projects, as long as the original copyright notice and permission notice are preserved.

In plain terms: take it, tweak it, ship it, share it. The only ask is that you keep the attribution intact and pass along the same permissions to anyone you hand it to.

🤝 Community spirit

Binance Trading Bot grows because people like you test it, break it, fix it, and suggest ideas. Whether you're running it in simulation mode on a weekend or extending the ML stacking ensemble with your own features, you're part of the story. Contributions of every size — bug reports, documentation improvements, new strategies, UI polish — are genuinely appreciated.

📦 What you get

  • Unrestricted use in personal and commercial settings, no strings attached beyond attribution.
  • Freedom to adapt the FastAPI backend, the React dashboard, or the ML pipeline to your own needs.
  • Freedom to share your modified versions with the same open terms, so improvements keep circulating.
  • No warranty — the software is provided "as is", without guarantees of any kind. Trading carries real financial risk, so always start in simulation mode and review the code before putting anything live.

💬 A note on trust

Because Binance Trading Bot is shared openly, please make sure you obtain it from the project's official source and verify the code yourself. Community-driven doesn't mean blind trust — it means shared responsibility and shared benefit.

Thanks for being here, for reading the license, and for helping make Binance Trading Bot better for everyone. Happy building — and happy, careful trading. 🚀

探索相关项目

加载中…