Fix Agora tests
This commit is contained in:
@@ -4,9 +4,7 @@ from twisted.internet.threads import deferToThread
|
||||
|
||||
# Other library imports
|
||||
from json import loads
|
||||
from forex_python.converter import CurrencyRates
|
||||
from lib.agoradesk_py import AgoraDesk
|
||||
from pycoingecko import CoinGeckoAPI # TODO: remove this import and defer to money
|
||||
from time import sleep
|
||||
from pyotp import TOTP
|
||||
from datetime import datetime
|
||||
@@ -28,8 +26,6 @@ class Agora(util.Base):
|
||||
"""
|
||||
super().__init__()
|
||||
self.agora = AgoraDesk(settings.Agora.Token)
|
||||
self.cr = CurrencyRates() # TODO: remove this and defer to money
|
||||
self.cg = CoinGeckoAPI() # TODO: remove this and defer to money
|
||||
|
||||
# Cache for detecting new trades
|
||||
self.last_dash = set()
|
||||
@@ -361,7 +357,7 @@ class Agora(util.Base):
|
||||
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)
|
||||
rates = self.money.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=currencies)
|
||||
for asset in assets:
|
||||
for currency in currencies:
|
||||
cg_asset_name = crypto_map[asset]
|
||||
@@ -626,6 +622,7 @@ class Agora(util.Base):
|
||||
for ad_id, country, currency in repeated:
|
||||
rtrn = self.agora.ad_delete(ad_id)
|
||||
actioned.append(rtrn["success"])
|
||||
|
||||
return all(actioned)
|
||||
|
||||
@util.handle_exceptions
|
||||
@@ -671,7 +668,7 @@ class Agora(util.Base):
|
||||
|
||||
profit_usd = total_usd - float(settings.Money.BaseUSD)
|
||||
# Get the XMR -> USD exchange rate
|
||||
xmr_usd = self.cg.get_price(ids="monero", vs_currencies=["USD"])
|
||||
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
||||
|
||||
# Convert the USD total to XMR
|
||||
profit_usd_in_xmr = float(profit_usd) / xmr_usd["monero"]["usd"]
|
||||
|
||||
Reference in New Issue
Block a user