Skip to content

CoinMarketCap

Amargedon edited this page Nov 3, 2023 · 2 revisions

CoinMarketCap bot helper named coinmarketcap.py

Type = trading pair

What does it do?

It will monitor CoinMarketCap and use the Top X to create pairs for your 3Comma's composite DCA bots to use.

How does it work?

The CoinMarketCap API is used to request a list, sorted on marketcap and only containing start-number - end-number coins (Top X coins). The base pair of each of the specified 3Comma's bots is determined, from this new pairs are constructed, these are checked against your Blacklist on 3Comma's and the market data on 3Comma's (reflecting Binance or FTX data depending on your exchange) to see if the pairs are valid.

If this is the case -and the current pairs are different than the current ones- the bot(s) are updated.

After this the bot helper will sleep for the set interval time, after which it will repeat these steps.

This script can be used for multiple bots with different Top X coins by creating multiple cmc_ sections in the configuration file. For each section CMC data is fetched and processed as described above. Make sure each section starts with cmc_ between the square brackets, what follows does not matter and can be used to give a descriptive name for yourself.

When the SHAREDIR option is used, this script will try to read a .pairexclude file for each configured bot. If a pair is listed in the file it will be excluded from the pairs before updating the bot. This can be usefull when also using the DealCluster script in parallel with this script.

NOTE: the 'Trading 24h minimal volume' value in your bot(s) can be used to prevent deals with low volume. Random pairs can be excluded using the blacklist. The first top coins (like BTC and ETH) can also be excluded by increasing the start-number.

NOTE: configure the timeinterval correctly. Each section has it's own timeinterval and will be examined based on each timeinterval as configured in settings. So, a section timeinterval should be equal or multiply of the timeinterval configured in settings.

Author of this script is amargedon.

Configuration

This is the layout of the config file used by the coinmarketcap.py bot helper:

  • [settings]

  • timezone - timezone. (default is 'Europe/Amsterdam')

  • timeinterval - update timeinterval in seconds. (default is 86400)

  • debug - set to true to enable debug logging to file. (default is False)

  • logrotate - number of days to keep logs. (default = 7)

  • 3c-apikey - your 3Commas API key value.

  • 3c-apisecret - your 3Commas API key secret value.

  • 3c-apikey-path - path to your own generated RSA private key, or empty.

  • cmc-apikey - your CoinMarketCap API key value.

  • notifications - set to true to enable notifications. (default = False)

  • notify-urls - one or a list of apprise notify urls, each in " " seperated with commas. See Apprise website for more information.

  • [cmc_]

  • botids - a list of bot id's to manage separated with commas

  • start-number - start number for the pairs to request (exclude first x). (default is 1)

  • end-number - end number for the pairs to request. (default is 200)

  • timeinterval - update timeinterval in seconds for this specific section. (default is 86400)

  • max-percent-compared-to - what to compare the percent change to (BTC, ETH, EUR or USD) (default USD)

  • max-percent-change-1h - maximum percentage of change (increase or decrease) allowed in this timeframe. Leave at 0.0 to disable.

  • max-percent-change-24h - maximum percentage of change (increase or decrease) allowed in this timeframe. Leave at 0.0 to disable.

  • max-percent-change-7d - maximum percentage of change (increase or decrease) allowed in this timeframe. Leave at 0.0 to disable.

Example: (keys are bogus)

[settings]
timezone = Europe/Amsterdam
timeinterval = 86400
debug = False
logrotate = 14
3c-apikey = 4mzhnpio6la4h1158ylt2
3c-apisecret = 4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt
3c-apikey-path = 
cmc-apikey = 4czrn2yo3la4h4179grp2
notifications = True
notify-urls = [ "tgram://9995888120:BoJPor6opeHyxx5VVZPX-BoJPor6opeHyxx5VVZPX/" ]

[cmc_somename]
botids = [ 123456 ]
start-number = 1
end-number = 200
timeinterval = 86400
max-percent-compared-to = USD
max-percent-change-1h = 0.0
max-percent-change-24h = 25.0
max-percent-change-7d = 0.0

Example output

CoinMarketCap