Fix pubads command after ads refactor

master
Mark Veidemanis 3 years ago
parent 80916648e3
commit aa4b623ae6
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -429,7 +429,7 @@ class Agora(object):
self.slow_ad_update(to_update) self.slow_ad_update(to_update)
@handle_exceptions @handle_exceptions
def get_all_public_ads(self, assets=None): def get_all_public_ads(self, assets=None, currencies=None, providers=None):
""" """
Get all public ads for our listed currencies. Get all public ads for our listed currencies.
:return: dict of public ads keyed by currency :return: dict of public ads keyed by currency
@ -444,8 +444,10 @@ class Agora(object):
if not assets: if not assets:
assets = self.markets.get_all_assets() assets = self.markets.get_all_assets()
# Get all currencies we have ads for, deduplicated # Get all currencies we have ads for, deduplicated
currencies = self.markets.get_all_currencies() if not currencies:
providers = self.markets.get_all_providers() currencies = self.markets.get_all_currencies()
if not providers:
providers = self.markets.get_all_providers()
# We want to get the ads for each of these currencies and return the result # We want to get the ads for each of these currencies and return the result
rates = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=currencies) rates = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=currencies)

@ -331,9 +331,9 @@ class IRCCommands(object):
msg(f"Not a valid asset: {spl[1]}") msg(f"Not a valid asset: {spl[1]}")
return return
currency = spl[2] currency = spl[2]
rtrn = agora.wrap_public_ads(asset, currency) rtrn = agora.get_all_public_ads([asset], [currency])
for ad in rtrn: for ad in rtrn[currency]:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[4]} {ad[5]}") msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
elif length == 4: elif length == 4:
asset = spl[1] asset = spl[1]
if asset not in loads(settings.Agora.AssetList): if asset not in loads(settings.Agora.AssetList):
@ -341,9 +341,9 @@ class IRCCommands(object):
return return
providers = spl[3].split(",") providers = spl[3].split(",")
currency = spl[2] currency = spl[2]
rtrn = agora.wrap_public_ads(asset, currency, providers) rtrn = agora.get_all_public_ads([asset], [currency], providers)
for ad in rtrn: for ad in rtrn[currency]:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]}") msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
class cheat(object): class cheat(object):
name = "cheat" name = "cheat"

Loading…
Cancel
Save