Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A trading bot for trading stablecoins on the KuCoin exchange.

NotificationsYou must be signed in to change notification settings

albiDmtr/marvin

Repository files navigation

◤¯¯◥ marvin

A trading bot for trading stablecoins on the KuCoin exchange

This is a project I started in 2020 when I became interested in automated cryptocurrency trading and that's when the bulk of the code was written. It was written in Python and uses a strategy that profits off instances when stablecoin pairs such asDAI/USDC orUSDT/USDC depeg, that is the rate goes significantly below or above the 1:1 ratio. Given this is a simple strategy, I was able to achieve some success with it but nothing crazy.

The bot is also easily extendable, so new exchanges and strategies can be added effortlessly.

The strategy

The bot trades on stablecoin pairs, which are cryptocurrencies that have their value pegged to the dollar either because they are backed by the dollar or because of a central bank algorithm. Because of this, the exchange rate of all stablecoin pairs should be 1, but in the short term there is some fluctuation from the 1:1 ratio. We assume that, in the long run, the price will revert near it's intended value. That's what the bot uses to spot opportunities when the price is unusually low or high and uses it to make profitable trades.
Here is how it's intended to work:

Setup and usage

DISCLAIMER: The bot hasn't been tested thoroughly. Bugs and crashes are possible hence I don't recommend using it live without understanding the code.

Setup

  1. Clone this repository to have a copy of the files locally
  2. Get API keys from KuCoin (and setup your account if needed):

More information about this can be found onthis page

  1. In the project root directory, there is a folder calledkeys. Paste your API credentials there in the form provided by the example file KuCoin.json.
  2. Setup the email account to get notifications to

As Google changed its policy in 2022, apps can no longer sign in to Google accounts using only username and password. The bot is currently unable to send you notifications about events, but a solution that uses Telegram is on the way.

  1. Configurecore.pyYou can edit the parameters of the strategy by setting the following global variables:
  • strat_name: The name of the file inside the strat folder that contains the strategy being used. Currently the only option isstablecoin_depeg.
  • ex_name: Specifies what exchange connector should the bot look for. Currently onlyKuCoin connector is implemented.
  • pair: The market the bot should trade on, in a slash-separated format, e.g.:"DAI/USDT".
  • tick_time_s: Specifies how often should the bot run the strategy to check if there are opportunities. It's not recommended to change it as it can cause problems with API rate limits.
  • strat_specific_params: A JSON object specifying parameters specific to the strategy being used. For thestablecoin_depeg strategy, these are the following:
  • ma_dp_count: The number of datapoints the bot should use to calculate the moving average of the price. The default value is25.
  • ma_res: Specifies the time intervals at which the bot should take a new datapoints into the calculation of the moving average. Default value is"5m", other values are in the format:<integer><s/m/h>, wheres stands for second,m for minutes, andh for hours.

For example, anma_dp_count of25 and anma_res of"5m" means that the strategy calculates the moving average based on the last 25 snapshots of the price that were recorded at 5 minute intervals

  • threshold: A float between 0 and 1. A lower number means that the bot will make an order only if the price is very extreme, while a higher number means that the bot will make orders more frequently. The default value is0.3, which means that the bot will only buy if the current price is lower than 70% of the price snapshots in its memory, and sell if the price is higher than 70% of the price snapshots is its memory.

Usage

Once everything is set up just run core.py:

python -u ./core.py

Or you can also build a Docker image from it, there is aDockerfile to help with that.

About

A trading bot for trading stablecoins on the KuCoin exchange.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp