Simplify markets

This commit is contained in:
Mark Veidemanis 2022-04-19 21:02:53 +01:00
parent 506fe82801
commit 0ba5cc38b3
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 3 additions and 11 deletions

View File

@ -75,6 +75,7 @@ class Markets(util.Base):
our_ads = [ad for ad in public_ads_filtered if ad[1] == username] our_ads = [ad for ad in public_ads_filtered if ad[1] == username]
if not our_ads: if not our_ads:
self.log.warning(f"No ads found in public listing for {asset} {currency} {provider}")
continue continue
new_margin = self.autoprice(username, min_margin, max_margin, public_ads_filtered, currency) 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) # 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 currencies = self.sinks.currencies
if not account_info: if not account_info:
account_info = self.sinks.account_info account_info = self.sinks.account_info
# First, let's get the ads we can't support supported_currencies, currency_account_info_map = self.get_valid_account_details(platform)
all_currencies = self.get_all_currencies()
supported_currencies = [currency for currency in currencies if currency in all_currencies]
# not_supported = [currency for currency in all_currencies if currency not in supported_currencies] # 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] 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: for ad in supported_ads:
asset = ad[0] asset = ad[0]
countrycode = ad[2] countrycode = ad[2]
@ -272,7 +264,7 @@ class Markets(util.Base):
""" """
platforms = ("agora", "lbtc") platforms = ("agora", "lbtc")
for platform in platforms: 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): def format_ad(self, asset, currency, payment_details_text):
""" """