This is a test project. I am just testing my code.
I cannot guarantee whether you can make money or not.
So use it at your own risk! I have no responsibility for any loss or hardship incurred directly or indirectly by using this code.
Before update any changes, make sure record last buy price in the note. It may lose the configuration or last buy price.
This bot is buying at the lowest price without any indicator, never sell under purchase price. And chase rising money. Stop chaser methodology was the idea from @d0x2f. I have found MACD indicators often mislead buying signal. In box pattern market, buy signal with the lowest price is effective than using MACD indicators.
- The bot can monitor multiple symbols. Each symbol will be monitored per second.
- The bot is only tested and working with USDT pair in the FIAT market such as BTCUSDT, ETHUSDT. You can add more FIAT symbols like BUSD, AUD from the frontend. However, I didn't test in the live server. So use with your own risk.
- Note that if the coin is worth less than $10, then the bot will remove the last buy price because Binance does not allow to place an order of less than $10.
- The bot is using MongoDB to provide a persistence database. However, it does not use the latest MongoDB to support Raspberry Pi 32bit. Used MongoDB version is 3.2.20, which is provided by apcheamitru.
-
Get the next symbol to process
-
Process buy signal
- Get lowest closed price with period
- If the current price is lower than the lowest closed price, then buy
NOW.
- It will only purchase the maximum purchase amount or less.
- It will not purchase if the base asset, such as BTC, has enough balance to place a stop-loss limit order.
- If trading is disabled, then the bot won't place an order.
- If the current price is higher than the lowest closed price, then do not buy.
-
Process Stop-Loss-Limit order
- If there is no open order but have coins enough to sell, then check
- Get last buy price from the cache
- If the current price is higher than the minimum profit percentage last
buy price, then place Stop-Loss-Limit order.
- If trading is disabled, then the bot won't place an order.
- Otherwise, do not place Stop-Loss-Limit order.
- If there is an opened Stop-Loss-Limit order, then check the current price.
- If the current price is higher than stop price, then cancel the open order. Then it will place new Stop-Loss-Limit order in next process.
- If there is no open order but have coins enough to sell, then check
React.js based frontend communicating via Web Socket:
- List monitoring coins with buy/sell signals/open orders
- View account balances
- Manage global/symbol settings
- Delete caches that are not monitored
- Link to public URL
Use environment parameters to adjust parameters. Check
/config/custom-environment-variables.json
to see list of available environment
parameters.
Or use the frontend to adjust configurations after launching the application.
-
Create
.env
file based on.env.dist
.Environment Key Description Sample Value BINANCE_LIVE_API_KEY Binance API key for live (from Binance) BINANCE_LIVE_SECRET_KEY Binance API secret for live (from Binance) BINANCE_TEST_API_KEY Binance API key for test (from Binance) BINANCE_TEST_SECRET_KEY Binance API secret for test (from Binance) BINANCE_SLACK_WEBHOOK_URL Slack webhook URL (from Slack) BINANCE_SLACK_CHANNEL Slack channel "#binance" BINANCE_SLACK_USERNAME Slack username Chris BINANCE_LOCAL_TUNNEL_SUBDOMAIN Local tunnel public URL subdomain binance -
Check
docker-compose.yml
forBINANCE_MODE
environment parameter -
Launch the application with docker-compose
docker-compose up -d
or using the latest build image from DockerHub
docker-compose -f docker-compose.server.yml up -d
or if using Raspberry Pi 32bit. Must build again for Raspberry Pi.
docker build . --build-arg NODE_ENV=production --target production-stage -t chrisleekr/binance-trading-bot:latest docker-compose -f docker-compose.rpi.yml up -d
-
Open browser
http://0.0.0.0:8080
to see the frontend- When launching the application, it will notify public URL to the Slack.
Frontend Mobile | Setting |
---|---|
Frontend Desktop |
---|
Chart | Order History |
---|---|
Trade History | PNL Analysis |
---|---|
- Support multiple symbols
- Remove unused methods - Bollinger Bands, MACD Stop Chaser
- Support a maximum purchase amount per symbol
- Develop backend to send cache values for frontend
- Develop a simple frontend to see statistics
- Fix the issue with the configuration
- Update frontend to remove cache
- Fix the issue with rounding when places an order
- Fix the issue with persistent Redis
- Fix the bug last buy price not removed
- Update frontend to be exposed to the public using the local tunnel
- Display account balances in the frontend
- Update frontend to change symbols in the configuration
- Update frontend to change last buy price per symbol
- Change to more persistence database - MongoDB - for configuration and last buy price
- Display estimated value in the frontend
- Support other FIAT symbols such as BUSD, AUD
- Allow entering more decimals for the last buy price
- Override buy/sell configuration per symbol
- Support PWA for frontend - now support "Add to Home screen"
- Enable/Disable symbols trading, but continue to monitor
- Add max-size for logging
- Execute chaseStopLossLimitOrder on every process
- Support buy trigger percentage
- Apply chase-stop-loss-limit order for buy signal as well
- Override the lowest value in the frontend
- Re-organise configuration structures
- Allow browser notification
- Secure frontend with the password