A fully automated Bybit Futures Trading Bot that scans the market for the best trading opportunities, executes trades, and manages positions based on technical indicators. The bot ensures effective risk management while optimizing trade execution.
- Automated Market Scanning: Finds high-volume, low-spread pairs.
- Trade Execution: Opens and manages trades based on EMA, RSI, and MACD signals.
- Dynamic Position Monitoring: Closes trades when profit or stop-loss levels are reached.
- Adjustable Parameters: Trade amount, leverage, and position limits can be customized.
- Execution: Trades are executed in a structured manner to avoid overloading the API.
git clone https://github.com/efeDaniels/fun.git
cd trading-bot
npm install
or if using Yarn:
yarn install
Create a .env
file in the root directory and add the following keys:
API_KEY=your_bybit_api_key
API_SECRET=your_bybit_api_secret
You can get your API Key and Secret from Bybit API Management.
- Monitoring Active Positions: The bot first checks open positions and tracks their Unrealized PnL.
- Position Management: If a trade reaches profit target (+15%) or stop-loss (-15%), the bot closes the position.
- Pair Selection: If there are available trade slots, it scans all available USDT trading pairs.
- Filtering Criteria:
- Volume: Excludes low-volume markets (< 500K USDT).
- Spread: Avoids pairs with a high bid-ask spread (> 0.5 USDT).
- Technical Indicators: Uses EMA (50 & 200), MACD, and RSI to determine trend direction.
- Trade Execution:
- BUY Signal: If EMA crossover, MACD crossover, and RSI confirm upward momentum.
- SELL Signal: If EMA crossover, MACD crossover, and RSI confirm downward momentum.
- Order Placement: Places a market order with the fixed trade amount (default $10 USDT).
- Repeating Process:
- The bot runs every 60 seconds.
- If all trade slots are full, it focuses on monitoring active positions instead of scanning new pairs.
Run the bot using:
node bot.js
or if using PM2 for 24/7 execution:
pm2 start bot.js --name "trading-bot"
To check logs:
pm2 logs trading-bot
To stop the bot:
pm2 stop trading-bot
If you want to adjust trading parameters, you can modify them in the config files:
tradeExecutor.js
→ Handles trade execution and position management.trendStrategy.js
→ Defines trend-based trading logic using EMA, RSI, and MACD.bot.js
→ Main entry point; manages scanning, trade execution, and position monitoring.
This bot is for educational purposes only. Use at your own risk. Always test in a demo environment before deploying with real funds.