A trading bot for Binance exchange, which is designed to trade cryptocurrencies. The bot is designed to be used with the Binance exchange. It is written in Python and uses the Binance API to interact with the exchange and provide API endpoints for the frontend.
- RESTful APIs for interacting with Binance & Exness exchange
- Order Management
- Wallet Management
- Position Management
- SMS push on mobile
- WebSocket Server for Real-Time Data
- Market Data
- Account Update (Wallet, Position)
- LINE Bot
- Daily PnL Report
- Funding Fee Notification
- Trading Signal Notification
- Discord Bot
- Financial Report
- ChatBot Integration with LLM
- Configuration Management
- Funding Fee Notification
- Trading Signal Notification
- Telegram Bot
- System Monitoring
- Trading Bot for Binance Exchange
- Auto Trading
# src/.env
# Binace API
API_KEY = '******'
API_SECRET = '*********'
# Telegram Bot
TELEGRAM_TOKEN = '****************'
# LINE Bot
LINE_TOKEN = '**********************'
CHANNEL_ACCESS_TOKEN = '!@#$%^&*'
CHANNEL_SECRET = '123456789qwerasdfzxcv'
# Admin website Login
ADMIN_LOGIN_PASSWORD = 'p@$$w0rd'
# JWT token
JWT_SECRET = '@#$%^&*!'
# Discord bot token
DISCORD_TOKEN = 'abc.efg.hijk'
DISCORD_WEBHOOK_NOTIFICATION = 'https://discord.com/api/webhooks/***********'
DISCORD_WEBHOOK_ANNOUNCEMENT = 'https://discord.com/api/webhooks/***********'
DISCORD_WEBHOOK_SECRET = 'https://discord.com/api/webhooks/*********'
DISCORD_WEBHOOK_WARNING = 'https://discord.com/api/webhooks/*********'
NUM_OF_UNITS = 9
# number of deposit unit
SIZE_OF_CONTRACTS = 9
# Initial deposit amount (USDT)
DEPOSIT = 9999
# SMS
SMS_APP_MOBILE_LIST = '+886*********,+886***********'
SMS_APP_MOBILE_HB_INTERVAL = 1800
sh/start_line_bot_server.sh
sh/start_ws_server_producer.sh
sh/futures_position_notify.sh
sh/funding_fee_notify.sh
sh/futures_account_status_notify.sh
sh/stop.sh
cd docker/
docker-compose up -d
docker ps
/usr/bin/ngrok http 5000 --log=stdout &
# Start up all services
# 00 10 * * * ~/workspace/binance-line-bot/sh/start.sh
# Account report notify per day
# 00 8 * * * ~/workspace/binance-line-bot/sh/futures_account_status_notify.sh > ~/workspace/binance-line-bot/log/futures_account_status_notify.log 2>&1
# Funding fee notify per 8 hours
# 01 0 * * * /home/ubuntu/workspace/binance-line-bot/sh/funding_fee_notify.sh
# 01 8 * * * /home/ubuntu/workspace/binance-line-bot/sh/funding_fee_notify.sh
# 01 16 * * * /home/ubuntu/workspace/binance-line-bot/sh/funding_fee_notify.sh
30 07 * * * ~/workspace/binance-line-bot/sh/funding_fee_notify.sh
# Time sync (Not necessary on AWS)
# * * * * * /usr/bin/uptime > /tmp/uptime
# Clean log
# 0 0 * * 7 rm -f ~/workspace/binance-line-bot/nohup.out
0 0 10 * * rm -f ~/workspace/binance-line-bot/log/*
0 0 10 * * rm -f ~/workspace/react-examples/lege-management/nohup.out
0 0 10 * * rm -f ~/workspace/ngrok/nohup.out
# PnL update notify
* * * * * ~/workspace/binance-line-bot/sh/futures_position_notify.sh
- Limit
- Market
- Post Only (Maker Only)
- Stop Limit
- Stop Market
- Take Profit Limit
- Take Profit Market
- Trailing Stop Market
- Trailing Stop Limit
- Iceberg
- TWAP
- Scaled Orders
-
Binance API
-
Real-Time Data API
- General Stream:
- wss://stream.binance.com:9443/stream
- Spot:
- wss://stream.binance.com:9443/ws
- Futures:
- wss://fstream.binance.com:9443/ws
- Binance Websocket Samples
- General Stream:
-
Python modules
-
Binance Spot Testnet URL
- https://testnet.binance.vision/api
- WebSocket API:
- Spot: Spot, Margin, Isolated Margin
- wss://testnet.binance.vision/ws
- Futures: Binance Futures
- wss://testnet.binance.vision/stream
- Spot: Spot, Margin, Isolated Margin
-
Wallet of Futures
- Margin Balance = Wallet Balance + Unrealized PnL
-
Websocket Streams
- @depth
- @depth@100ms
- @depth
- @depth@100ms
ex. btcusdt@depth10@100ms , push btc/usdt market data in depth 10 every 100ms