From 5588d016f27c7f984b3ab67a167b4bc290ba3976 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 4 Apr 2022 17:23:25 +0100 Subject: [PATCH] Fix calls to CoinGecko --- handler/transactions.py | 12 ++++++------ handler/ux/commands.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/handler/transactions.py b/handler/transactions.py index 7746737..23fc380 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -365,10 +365,10 @@ class Transactions(util.Base): total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"] total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"] # Get the XMR -> USD exchange rate - xmr_usd = self.agora.cg.get_price(ids="monero", vs_currencies=["USD"]) + xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"]) # Get the BTC -> USD exchange rate - btc_usd = self.agora.cg.get_price(ids="bitcoin", vs_currencies=["USD"]) + btc_usd = self.money.cg.get_price(ids="bitcoin", vs_currencies=["USD"]) # Convert the Agora BTC total to USD total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"] @@ -416,10 +416,10 @@ class Transactions(util.Base): total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"] total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"] # Get the XMR -> USD exchange rate - xmr_usd = self.agora.cg.get_price(ids="monero", vs_currencies=["USD"]) + xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"]) # Get the BTC -> USD exchange rate - btc_usd = self.agora.cg.get_price(ids="bitcoin", vs_currencies=["USD"]) + btc_usd = self.money.cg.get_price(ids="bitcoin", vs_currencies=["USD"]) # Convert the Agora XMR total to USD total_usd_agora_xmr = float(total_xmr_agora) * xmr_usd["monero"]["usd"] @@ -510,11 +510,11 @@ class Transactions(util.Base): asset = contact["data"]["advertisement"]["asset"] if asset == "XMR": amount_crypto = contact["data"]["amount_xmr"] - history = self.agora.cg.get_coin_history_by_id(id="monero", date=date_formatted) + history = self.money.cg.get_coin_history_by_id(id="monero", date=date_formatted) crypto_usd = float(history["market_data"]["current_price"]["usd"]) elif asset == "BTC": amount_crypto = contact["data"]["amount_btc"] - history = self.agora.cg.get_coin_history_by_id(id="bitcoin", date=date_formatted) + history = self.money.cg.get_coin_history_by_id(id="bitcoin", date=date_formatted) crypto_usd = float(history["market_data"]["current_price"]["usd"]) # Convert crypto to fiat amount = float(amount_crypto) * crypto_usd diff --git a/handler/ux/commands.py b/handler/ux/commands.py index 1750f71..9de8b2a 100644 --- a/handler/ux/commands.py +++ b/handler/ux/commands.py @@ -396,7 +396,7 @@ class IRCCommands(object): @staticmethod def run(cmd, spl, length, authed, msg, agora, tx, ux): - xmr_prices = agora.cg.get_price(ids="monero", vs_currencies=["sek", "usd", "gbp"]) + xmr_prices = agora.money.cg.get_price(ids="monero", vs_currencies=["sek", "usd", "gbp"]) price_sek = xmr_prices["monero"]["sek"] price_usd = xmr_prices["monero"]["usd"] price_gbp = xmr_prices["monero"]["gbp"] @@ -409,7 +409,7 @@ class IRCCommands(object): @staticmethod def run(cmd, spl, length, authed, msg, agora, tx, ux): - xmr_prices = agora.cg.get_price(ids="bitcoin", vs_currencies=["sek", "usd", "gbp"]) + xmr_prices = agora.money.cg.get_price(ids="bitcoin", vs_currencies=["sek", "usd", "gbp"]) price_sek = xmr_prices["bitcoin"]["sek"] price_usd = xmr_prices["bitcoin"]["usd"] price_gbp = xmr_prices["bitcoin"]["gbp"]