Skip to content

Commit

Permalink
Merge pull request #22 from amargedon/main
Browse files Browse the repository at this point in the history
Ability to use multiple USDT or BTC bots
  • Loading branch information
cyberjunky authored Nov 24, 2021
2 parents e1e0f74 + d0accc5 commit 6055de3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ The `watchlist` bot helper has a different layout:
- **timezone** - timezone. (default is 'Europe/Amsterdam')
- **debug** - set to true to enable debug logging to file. (default is False)
- **logrotate** - number of days to keep logs. (default = 7)
- **usdt-botid** - the bot id of the USDT multipair bot to use. (can also be using BUSD)
- **btc-botid** - the bot id of the BTC multipair bot to use.
- **usdt-botids** - a list of bot (USDT multipair) id's to use. (can also be using BUSD)
- **btc-botids** - a list of bot (BTC multipair) id's to use.
- **numberofpairs** - number of pairs to update your bots with. (default is 10)
- **accountmode** - trading account mode for the API to use (real or paper). (default is paper)
- **3c-apikey** - Your 3Commas API key value.
Expand Down
41 changes: 21 additions & 20 deletions watchlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def load_config():
"timezone": "Europe/Amsterdam",
"debug": False,
"logrotate": 7,
"usdt-botid": 0,
"btc-botid": 0,
"usdt-botids": [12345, 67890],
"btc-botids": [12345, 67890],
"accountmode": "paper",
"3c-apikey": "Your 3Commas API Key",
"3c-apisecret": "Your 3Commas API Secret",
Expand Down Expand Up @@ -496,35 +496,36 @@ async def callback(event):
logger.debug(f"Trade type '{trade}' is not supported yet!")
return
if base == "USDT":
botid = config.get("settings", "usdt-botid")
if botid == 0:
botids = json.loads(config.get("settings", "usdt-botids"))
if len(botids) == 0:
logger.debug(
"No valid botid defined for '%s' in config, disabled." % base
"No valid botids defined for '%s' in config, disabled." % base
)
return
elif base == "BTC":
botid = config.get("settings", "btc-botid")
if botid == 0:
botids = json.loads(config.get("settings", "btc-botids"))
if len(botids) == 0:
logger.debug(
"No valid botid defined for '%s' in config, disabled." % base
"No valid botids defined for '%s' in config, disabled." % base
)
return
else:
logger.error("Error the base of pair '%s' is not supported yet!" % pair)
return

error, data = api.request(
entity="bots",
action="show",
action_id=str(botid),
)

if data:
await client.loop.run_in_executor(
None, check_pair, data, exchange, base, coin
)
else:
logger.error("Error occurred triggering bot: %s" % error["msg"])
for bot in botids:
error, data = api.request(
entity="bots",
action="show",
action_id=str(bot),
)

if data:
await client.loop.run_in_executor(
None, check_pair, data, exchange, base, coin
)
else:
logger.error("Error occurred triggering bot: %s" % error["msg"])
else:
logger.info("Not a crypto trigger message, or exchange not yet supported.")

Expand Down

0 comments on commit 6055de3

Please sign in to comment.