Fix minor bugs with the cheat system

master
Mark Veidemanis 3 years ago
parent 5c10d5f044
commit 899a6e60e3
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -71,7 +71,7 @@ class Agora(object):
self.lc_dash = LoopingCall(self.loop_check)
self.lc_dash.start(int(settings.Agora.RefreshSec))
if settings.Agora.Cheat == "1":
self.lc_cheat = LoopingCall(self._update_prices, None, None)
self.lc_cheat = LoopingCall(self.run_cheat_in_thread)
self.lc_cheat.start(int(settings.Agora.CheatSec))
@handle_exceptions

@ -321,7 +321,7 @@ class IRCCommands(object):
class pubads(object):
name = "pubads"
authed = True
helptext = "View public adverts. Usage: pubads <XMR/BTC> <currency>"
helptext = "View public adverts. Usage: pubads <XMR/BTC> <currency> [<provider,...>]"
@staticmethod
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
@ -333,7 +333,7 @@ class IRCCommands(object):
currency = spl[2]
rtrn = agora.wrap_public_ads(asset, currency)
for ad in rtrn:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[4]}")
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[4]} {ad[5]}")
elif length == 4:
asset = spl[1]
if asset not in loads(settings.Agora.AssetList):
@ -343,7 +343,7 @@ class IRCCommands(object):
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]}")
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]}")
class cheat(object):
name = "cheat"
@ -371,7 +371,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
if length == 1:
asset = agora._update_prices(None, None)
asset = agora.run_cheat_in_thread()
msg(f"Running next asset for cheat in thread: {asset}")
class ads(object):

@ -56,6 +56,9 @@ class Markets(object):
public_ads_currency = public_ads[currency]
except KeyError:
self.log.error("Error getting public ads for currency {currency}", currency=currency)
if currency == "USD":
self.log.error("Error getting public ads for currency USD, aborting")
break
continue
# Filter asset
@ -68,6 +71,7 @@ class Markets(object):
if not our_ads:
continue
new_margin = self.autoprice(public_ads_filtered, currency)
self.log.info("New rate for {currency}: {rate}", currency=currency, rate=new_margin)
new_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{new_margin}"
for ad in our_ads:
ad_id = ad[0]

Loading…
Cancel
Save