Coder Social home page Coder Social logo

strydex / triangulartradingbot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 64 KB

This bot is a cryptocurrency trading bot designed to find and exploit triangular arbitrage opportunities on the Binance exchange, then send trade notifications to a Telegram group.

License: GNU General Public License v3.0

Python 100.00%

triangulartradingbot's Introduction

Binance Triangular Arbitrage Trading Bot

This is a trading bot that performs arbitrage trading on the Binance cryptocurrency exchange. The bot continuously monitors the order book depth for all available trading pairs on Binance, calculates potential profits from arbitrage trades, and executes trades when a profitable opportunity is found. It also checks the account balance and sends notifications to a Telegram group when a trade is executed.

Requirements

  • Python 3.7 or higher
  • Redis server
  • Binance API key and Secret key
  • Telegram Bot tokens
  • Telegram chat_id
  • A little bit of patience :)

Installation

  1. Clone the repository:
git clone https://github.com/strydex/TriangularTradingBot.git
  1. Create a virtual environment:
python3 -m venv env
  1. Activate the virtual environment:
source env/bin/activate
  1. Install the required packages:
pip3 install -r requirements.txt
  1. Rename the config.example.py file to config.py and edit it with your Binance API key and secret key, as well as your Telegram chat_id (if you want to receive notifications about trades):
cp config.example.py config.py
nano config.py
  • (Optional) You can change variable USDT_ORDER_SIZE: The size of each USDT order placed by the bot. Default value is 20.

Then fill your Binance API and SECRET keys in config.example.py located in balance_check folder, and rename it to config.py as well.

  1. Start the Redis server:
redis-server
  1. Run the get_all_coins.py script to fetch all available trading pairs on Binance and store them in Redis:
python3 get_all_coins.py
  1. Start the depth_check.py script to monitor the order book depth and calculate potential profits from arbitrage trades:
python3 depth_check.py
  1. (Optional) Start the balance_check.py script to check the account balance:
python3 balance_check.py
  1. (Optional) Set up the systemd services to run the bot as a background service on a Linux system:
sudo cp binance_parser_bot.service /etc/systemd/system/
sudo cp depth_check.service /etc/systemd/system/
sudo cp search_for_perspective.service /etc/systemd/system/
sudo systemctl enable binance_parser_bot.service
sudo systemctl enable depth_check.service
sudo systemctl enable search_for_perspective.service
sudo systemctl start binance_parser_bot.service
sudo systemctl start depth_check.service
sudo systemctl start search_for_perspective.service

Alternitavely, you can use PM2 instead.

Note on Telegram Bot Tokens

The depth_check.py script uses a list of bot tokens and selects a different bot for each message sent, in a round-robin fashion. This is to avoid exceeding the rate limit of a single bot. It is recommended to create multiple Telegram bots and add their tokens to the bot_tokens_list variable in depth_check.py.

To create a Telegram bots and get its tokens, follow these steps:

  1. Open Telegram and search for BotFather.
  2. Start a chat with BotFather and send the /newbot command.
  3. Follow the instructions to create a new bot and get its token.
  4. Repeat the process to create multiple bots.

After creating the bots, update the bot_tokens_list variable in depth_check.py with their tokens:

bot_tokens_list = ['TOKEN_1', 'TOKEN_2', 'TOKEN_3', 'TOKEN_4', 'TOKEN_5', 'TOKEN_6', 'TOKEN_7', 'TOKEN_8']

Replace TOKEN_1, TOKEN_2, etc. with your actual bot tokens. You also can use only 1 bot in a list.

Usage

Once the bot is running, it will continuously monitor the order book depth for all available trading pairs on Binance and calculate potential profits from arbitrage trades. When a profitable opportunity is found, the bot will execute the trades and send a notification to your Telegram group.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

[GPL-3.0]

Disclaimer

This bot is provided for educational purposes only. The author is not responsible for any losses or damages incurred while using this bot. Use at your own risk.

triangulartradingbot's People

Contributors

strydex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.