Libraries refactor and add some sinks #4

Closed
m wants to merge 136 commits from library-refactor into master
2 changed files with 11 additions and 9 deletions
Showing only changes of commit 1f17183b1f - Show all commits

View File

@ -429,7 +429,7 @@ class Agora(object):
self.slow_ad_update(to_update)
@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.
:return: dict of public ads keyed by currency
@ -444,8 +444,10 @@ class Agora(object):
if not assets:
assets = self.markets.get_all_assets()
# Get all currencies we have ads for, deduplicated
currencies = self.markets.get_all_currencies()
providers = self.markets.get_all_providers()
if not currencies:
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
rates = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=currencies)

View File

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