-
Notifications
You must be signed in to change notification settings - Fork 67
BotUpdater
Type = trading pair
It will refresh the pair(s) of your bot(s) based on the shared database (see [MarketCollector]) using the configured filters.
This script requires the shared database from [MarketCollector] to be available, using the SHAREDIR option. It will read this database and use the configured filters to fetch the matching coins from the database build by the MarketCollector. Then, the correct base for the pairs is determined (BTC, BNB and ETH are fixed) because USD can become USDT, BUSD or EUR. The determined pairs are checked against the exchange and local blacklist (if the BLACKLIST option is used) to determine if they are valid.
Then 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 (both should have the same SHAREDIR).
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.
3Commas does not allow a bot without trading pairs, however, based on the configuration and market an empty list can be the result. Enable allowmaxdealchange
and allowbotstopstart
to decrease the number of active deals, or stop the bot when no pairs are available. When the bot is stopped, and there are pairs available again, it will be started.
There are several filteroptions available and they are described below. Also an optional list of conditions can be used to determine if the bots within the configured section can only be enabled when this condition is met (for example only when BTC is increasing in price).
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.
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
.
NOTE: the percent-change
of 14d, 30d, 200d and 1y will only have effect when the MarketCollector is importing data from CoinGecko (as CoinMarketCap doesn't have data for these periods).
Author of this script is amargedon.
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)
-
debug-log-query - set to True to log SQL queries. (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.
-
[bu_]
-
botids - a list of bot id's to manage separated with commas
-
timeinterval - update timeinterval in seconds for this specific section. (default is 86400)
-
allowmaxdealchange - indicates if the max number of active deals in the bot may be changed to a lower value.
-
allowbotstopstart - indicates if the bot may be stopped when there are zero trading pairs, and may be started when there are trading pairs again.
-
base - base of the pair in the database (BTC, BNB, ETH or USD).
-
cmc-rank - list with two values; min and max rank. Leave empty to disable.
-
altrank - list with two values; min and max rank. Leave empty to disable.
-
galaxyscore - list with two values; min and max rank. Leave empty to disable.
-
percent-change-1h - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-24h - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-7d - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-14d - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-30d - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-200d - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
percent-change-1y - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
volatility-24h - list with two values; minimum and maximum percentage of change (increase or decrease) allowed in this timeframe. Leave empty to disable.
-
condition - list of condition objects and used to enable (conditions met) or disable (condtions not met) bots. Each object in this list must consist of a pair and one of the
percent-change-
options of above. An emptycondition
list means there are no conditions (and the condition will always evaluate as met). -
coin-whitelist - list of coins to whitelist, specifically for the bot(s) within this section. These coins are the only coins that will be used for any configured filters and updating the bot(s). (surround each coin with single quotes, for example ['BTC', 'ETH'])
-
coin-blacklist - list of coins to blacklist, specifically for the bot(s) within this section. These coins will be removed from the list of pairs before updating the bot(s). (surround each coin with single quotes, for example ['BTC', 'ETH'])
-
description - description for this section.
-
notify-succesful-update - send notification using Apprise on succesful update (default = True)
Example: (keys are bogus)
[settings]
timezone = Europe/Amsterdam
timeinterval = 86400
debug = False
debug-log-query = False
logrotate = 14
3c-apikey = 4mzhnpio6la4h1158ylt2
3c-apisecret = 4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt4mzhnpio6la4h1158ylt
3c-apikey-path =
notifications = True
notify-urls = [ "tgram://9995888120:BoJPor6opeHyxx5VVZPX-BoJPor6opeHyxx5VVZPX/" ]
[bu_default]
botids = [ 123456 ]
timeinterval = 86400
allowmaxdealchange = True
allowbotstopstart = True
base = BTC
cmc-rank = [0, 250]
altrank = []
galaxyscore = []
percent-change-1h = [-5.0, 5.0]
percent-change-24h = []
percent-change-7d = []
percent-change-14d = []
percent-change-30d = []
percent-change-200d = []
percent-change-1y = []
volatility-24h = []
condition = [{"pair": "USD_BTC", "percent-change-1h": [0.7, 3.5]}, {"pair": "USD_BTC", "percent-change-24h": [-0.5, 2.5]}]
coin-whitelist = []
coin-blacklist = []
description = some description
notify-succesful-update = True