Tradibot - A trading bot on Kucoin

Tradibot - A trading bot on Kucoin
Signature: 4KU4huitIXbpPpBF80MG+IdyHwfCACn3EYlCimd9FEdOKGu/bG0MBSZvMz2MHUqQEN3OnzwitbjOJI0wcHM8mRPEgq9WjWo5BFifugg8fV7IwBbVuH++V3+q3Nfo9+1HE93gJkPwCkXnHEZ01eygbcQvwIRC90pGW6jyh2uxWXnTZTtLti1hfrjEUPnx/uTos2qw8huI8Nlj9CNNGUK8UWuhQ47tU7mcZtgMJjb4PFjItjOD+8FFC6EG8G/ycnyg

I've been working on a personal project for several years now. It's a bot that analyzes the KuCoin crypto market and places positions to generate a profit. I've apparently reached a fairly successful first version, which manages to be profitable despite some losses. The bot is available as open source on my personal GitHub repository.

Never forget that crypto or stock trading involves risks. Be careful!

The bot's purpose is to analyze price movements on the KuCoin exchange and, based on the resulting signals, place buy or sell orders to close positions. By default, it analyzes the 200 stocks with the highest trading volume over 24 hours to maximize liquidity and thus capture the largest price fluctuations. A "Take Profit" button can also be configured to set an automatic sell threshold when a limit is reached, guaranteeing a sale even if no sell signal is detected. All trading pairs are USDT.

A web interface is available for managing the bot and displaying public statistics if desired. Email reports can be sent to provide the current status of open and closed positions over the past 24 hours.

Configuration is possible via the web interface:

  • The maximum number of open positions
  • The number of USDT per position
  • The maximum number of cryptocurrencies to be traded (the x largest volumes)
  • The take profit percentage
  • The duration of the cache containing the prices (preventing the Kucoin API from blocking if the page is loaded by multiple people at the same time)
  • Email report frequency (in hours)
  • Enable or disable email reporting
  • Enable or disable public display

Bot prerequisites

Before proceeding with the installation, the following prerequisites are necessary:

  • Ideally, a server running Linux (but your PC will do).
  • A stable internet connection
  • Python 3 is installed on the machine running the bot.

API creation on Kucoin

Before you begin the setup process, you need a KuCoin account. If you don't have one, you can create one here using my referral link: https://www.kucoin.com/r/rf/QBSFHUA7

Once logged into your account, go to the API management page: https://www.kucoin.com/account/api

Click on the "Create API" button in the top right corner

Enter the API name and the API passphrase. The API name will be used to identify the API key if you have multiple keys, and the API passphrase will be used to connect. It must be complex and long. Write it down once you have entered it. In the "API restriction" section, only check the "Spot trading" option. These are the only permissions the bot needs. Finally, if your bot will connect from a fixed public IP address, you can add a layer of security by restricting access to that IP address only. Once validated, you will obtain your API secret. Make a note of it; we will need it later.

Never give your API passphrase and API secret to anyone else. These are the access keys to your bot, and therefore to your account.

Bot activation

Go to my GitHub repository and download the latest release here: https://github.com/gkaelin/tradibot/releases
You can download the zip file; it contains everything. Then, unzip it and place the contents in the folder of your choice.

Make a copy of the "env" file and name it ".env". Then enter the requested information.

Using the command line, navigate to the folder where the bot is located, and create a virtual environment.

python3 -m env venv

Next, activate this virtual environment.

source venv/bin/activate

Download the Python packages necessary for it to function

pip install -r requirments.txt

Finally, launch the bot and log in to its web interface to verify that everything is working correctly.

python3 main.py

Are there any improvements to be made?

If you have improvements to make, whether to the web interface and/or the signal detection engine, you can simply fork the repository and make a pull request to integrate your changes into the project.