From 0ba5cc38b375ce349c32075fe4aaa6cab237d0ea Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 19 Apr 2022 21:02:53 +0100 Subject: [PATCH] Simplify markets --- handler/markets.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/handler/markets.py b/handler/markets.py index 2739310..09c4718 100644 --- a/handler/markets.py +++ b/handler/markets.py @@ -75,6 +75,7 @@ class Markets(util.Base): our_ads = [ad for ad in public_ads_filtered if ad[1] == username] if not our_ads: + self.log.warning(f"No ads found in public listing for {asset} {currency} {provider}") continue new_margin = self.autoprice(username, min_margin, max_margin, public_ads_filtered, currency) # self.log.info("New rate for {currency}: {rate}", currency=currency, rate=new_margin) @@ -212,9 +213,7 @@ class Markets(util.Base): currencies = self.sinks.currencies if not account_info: account_info = self.sinks.account_info - # First, let's get the ads we can't support - all_currencies = self.get_all_currencies() - supported_currencies = [currency for currency in currencies if currency in all_currencies] + supported_currencies, currency_account_info_map = self.get_valid_account_details(platform) # not_supported = [currency for currency in all_currencies if currency not in supported_currencies] @@ -224,13 +223,6 @@ class Markets(util.Base): not_supported_ads = [ad for ad in our_ads if ad[3] not in supported_currencies] - currency_account_info_map = {} - for currency in supported_currencies: - for bank, accounts in account_info.items(): - for account in accounts: - if account["currency"] == currency: - currency_account_info_map[currency] = account["account_number"] - for ad in supported_ads: asset = ad[0] countrycode = ad[2] @@ -272,7 +264,7 @@ class Markets(util.Base): """ platforms = ("agora", "lbtc") for platform in platforms: - self.distribute_account_details(platform, currencies=currencies, account_info=account_info) + self._distribute_account_details(platform, currencies=currencies, account_info=account_info) def format_ad(self, asset, currency, payment_details_text): """