Add bank name to markets and filter currencies

This commit is contained in:
Mark Veidemanis 2022-04-18 17:21:58 +01:00
parent 6a33b82c28
commit d2d74a2086
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 10 additions and 3 deletions

View File

@ -51,6 +51,9 @@ class Markets(util.Base):
assets = self.get_all_assets(platform)
currencies = self.get_all_currencies(platform)
providers = self.get_all_providers(platform)
sinks_currencies = self.sinks.currencies
supported_currencies = [currency for currency in currencies if currency in sinks_currencies]
currencies = supported_currencies
brute = [(asset, currency, provider) for asset in assets for currency in currencies for provider in providers]
for asset, currency, provider in brute:
@ -75,7 +78,10 @@ class Markets(util.Base):
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)
if platform == "agora":
new_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{new_margin}"
elif platform == "lbtc":
new_formula = f"btc_in_usd*{new_margin}"
for ad in our_ads:
ad_id = ad[0]
asset = ad[4]
@ -178,10 +184,10 @@ class Markets(util.Base):
else:
yield (asset, countrycode, currency, provider)
def get_valid_account_details(self):
def get_valid_account_details(self, platform):
currencies = self.sinks.currencies
account_info = self.sinks.account_info
all_currencies = self.get_all_currencies()
all_currencies = self.get_all_currencies(platform)
supported_currencies = [currency for currency in currencies if currency in all_currencies]
currency_account_info_map = {}
for currency in supported_currencies:
@ -189,6 +195,7 @@ class Markets(util.Base):
for account in accounts:
if account["currency"] == currency:
currency_account_info_map[currency] = account["account_number"]
currency_account_info_map[currency]["bank"] = bank.split("_")[0]
return (supported_currencies, currency_account_info_map)
def _distribute_account_details(self, platform, currencies=None, account_info=None):