Libraries refactor and add some sinks #4
|
@ -71,7 +71,7 @@ class Agora(object):
|
||||||
self.lc_dash = LoopingCall(self.loop_check)
|
self.lc_dash = LoopingCall(self.loop_check)
|
||||||
self.lc_dash.start(int(settings.Agora.RefreshSec))
|
self.lc_dash.start(int(settings.Agora.RefreshSec))
|
||||||
if settings.Agora.Cheat == "1":
|
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))
|
self.lc_cheat.start(int(settings.Agora.CheatSec))
|
||||||
|
|
||||||
@handle_exceptions
|
@handle_exceptions
|
||||||
|
|
|
@ -321,7 +321,7 @@ class IRCCommands(object):
|
||||||
class pubads(object):
|
class pubads(object):
|
||||||
name = "pubads"
|
name = "pubads"
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "View public adverts. Usage: pubads <XMR/BTC> <currency>"
|
helptext = "View public adverts. Usage: pubads <XMR/BTC> <currency> [<provider,...>]"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
||||||
|
@ -333,7 +333,7 @@ class IRCCommands(object):
|
||||||
currency = spl[2]
|
currency = spl[2]
|
||||||
rtrn = agora.wrap_public_ads(asset, currency)
|
rtrn = agora.wrap_public_ads(asset, currency)
|
||||||
for ad in rtrn:
|
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:
|
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):
|
||||||
|
@ -343,7 +343,7 @@ class IRCCommands(object):
|
||||||
currency = spl[2]
|
currency = spl[2]
|
||||||
rtrn = agora.wrap_public_ads(asset, currency, providers)
|
rtrn = agora.wrap_public_ads(asset, currency, providers)
|
||||||
for ad in rtrn:
|
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):
|
class cheat(object):
|
||||||
name = "cheat"
|
name = "cheat"
|
||||||
|
@ -371,7 +371,7 @@ class IRCCommands(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
||||||
if length == 1:
|
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}")
|
msg(f"Running next asset for cheat in thread: {asset}")
|
||||||
|
|
||||||
class ads(object):
|
class ads(object):
|
||||||
|
|
|
@ -56,6 +56,9 @@ class Markets(object):
|
||||||
public_ads_currency = public_ads[currency]
|
public_ads_currency = public_ads[currency]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.log.error("Error getting public ads for currency {currency}", currency=currency)
|
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
|
continue
|
||||||
|
|
||||||
# Filter asset
|
# Filter asset
|
||||||
|
@ -68,6 +71,7 @@ class Markets(object):
|
||||||
if not our_ads:
|
if not our_ads:
|
||||||
continue
|
continue
|
||||||
new_margin = self.autoprice(public_ads_filtered, currency)
|
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}"
|
new_formula = f"coingecko{asset.lower()}usd*usd{currency.lower()}*{new_margin}"
|
||||||
for ad in our_ads:
|
for ad in our_ads:
|
||||||
ad_id = ad[0]
|
ad_id = ad[0]
|
||||||
|
|
Loading…
Reference in New Issue