diff --git a/signals.py b/signals.py index 293c8d5..91ed7d6 100644 --- a/signals.py +++ b/signals.py @@ -177,9 +177,9 @@ def topcoin(self, pairs, rank, volume, exchange, trademarket): ): self.logging.info( str(pair) - + " ranked " + + " is ranked #" + str(symbol["market_cap_rank"]) - + " and passed marketcap filter of <= " + + " and has passed marketcap filter minimum of #" + str(rank) ) # Check if topcoin has enough volume @@ -197,9 +197,10 @@ def topcoin(self, pairs, rank, volume, exchange, trademarket): ): self.logging.info( str(pairs) - + " ranked " + + " is ranked #" + str(symbol["market_cap_rank"]) - + " passed marketcap filter" + + " and has passed marketcap filter minimum of #" + + str(rank) ) # Check if topcoin has enough volume if self.topvolume(symbol["id"], volume, exchange, trademarket): @@ -207,14 +208,7 @@ def topcoin(self, pairs, rank, volume, exchange, trademarket): break if not pairlist: - self.logging.info( - str(pairs) - + " ranked " - + str(symbol["market_cap_rank"]) - + " in marketcap not under the top " - + str(rank) - + " coins" - ) + self.logging.info(str(pairs) + " did not match the topcoin filter criteria") else: if isinstance(pairlist, str): self.logging.info(str(pairlist) + " matching top coin filter criteria") diff --git a/singlebot.py b/singlebot.py index 891d73a..944f14a 100644 --- a/singlebot.py +++ b/singlebot.py @@ -19,6 +19,16 @@ def __init__(self, tg_data, bot_data, account_data, attributes, p3cw, logging): self.prefix = self.attributes.get("prefix") self.subprefix = self.attributes.get("subprefix") self.suffix = self.attributes.get("suffix") + self.bot_name = ( + self.prefix + + "_" + + self.subprefix + + "_" + + self.attributes.get("market") + + "(.*)" + + "_" + + self.suffix + ) def strategy(self): if self.attributes.get("deal_mode", "signal") == "signal": @@ -42,7 +52,7 @@ def deal_count(self): action="", action_id=account["id"], additional_headers={"Forced-Mode": self.attributes.get("trade_mode")}, - payload={"limit": 1000, "scope": "active"}, + payload={"limit": 1000, "scope": "active", "account_id": account["id"]}, ) if error: @@ -53,13 +63,7 @@ def deal_count(self): return self.attributes.get("single_count") else: for deal in data: - if ( - self.prefix - + "_" - + self.subprefix - + "_" - + self.attributes.get("market") - ) in deal["bot_name"]: + if re.search(self.bot_name, deal["bot_name"]): deals.append(deal["bot_name"]) self.logging.debug(str(deals)) @@ -72,9 +76,7 @@ def bot_count(self): bots = [] for bot in self.bot_data: - if ( - self.prefix + "_" + self.subprefix + "_" + self.attributes.get("market") - ) in bot["name"] and bot["is_enabled"]: + if re.search(self.bot_name, bot["name"]) and bot["is_enabled"]: bots.append(bot["name"]) self.logging.info("Enabled single bot count: " + str(len(bots))) @@ -298,17 +300,17 @@ def trigger(self): + str(self.tg_data["pair"]) + " is not in the top coin list - not added!" ) + else: + self.logging.info( + "Maximum bots/deals reached. Bot with pair: " + + pair + + " not added." + ) elif self.tg_data["action"] == "STOP": self.logging.info( "Stop command on a non-existing single bot with pair: " + pair ) - else: - self.logging.info( - "Maximum bots/deals reached. Bot with pair: " - + pair - + " not added." - ) else: self.logging.debug("Pair: " + pair) self.logging.debug("Bot-Name: " + bot["name"])