|
|
|
@ -193,42 +193,11 @@ class IRCCommands(object):
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx):
|
|
|
|
|
total_usd_revolut = revolut.get_total_usd()
|
|
|
|
|
if total_usd_revolut is False:
|
|
|
|
|
msg("Error getting Revolut balance.")
|
|
|
|
|
return
|
|
|
|
|
agora_wallet_xmr = agora.agora.wallet_balance_xmr()
|
|
|
|
|
if not agora_wallet_xmr["success"]:
|
|
|
|
|
msg("Error getting Agora XMR balance.")
|
|
|
|
|
return
|
|
|
|
|
agora_wallet_btc = agora.agora.wallet_balance()
|
|
|
|
|
if not agora_wallet_btc["success"]:
|
|
|
|
|
msg("Error getting Agora BTC balance.")
|
|
|
|
|
return
|
|
|
|
|
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 = agora.cg.get_price(ids="monero", vs_currencies=["USD"])
|
|
|
|
|
|
|
|
|
|
# Get the BTC -> USD exchange rate
|
|
|
|
|
btc_usd = agora.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"]
|
|
|
|
|
|
|
|
|
|
# Convert the Agora BTC total to USD
|
|
|
|
|
total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"]
|
|
|
|
|
|
|
|
|
|
# Add it all up
|
|
|
|
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
|
|
|
|
total_usd = total_usd_agora + total_usd_revolut
|
|
|
|
|
|
|
|
|
|
# Convert the total USD price to GBP and SEK
|
|
|
|
|
rates = agora.get_rates_all()
|
|
|
|
|
price_sek = rates["SEK"] * total_usd
|
|
|
|
|
price_usd = total_usd
|
|
|
|
|
price_gbp = rates["GBP"] * total_usd
|
|
|
|
|
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
|
|
|
|
totals_all = tx.get_total()
|
|
|
|
|
totals = totals_all[0]
|
|
|
|
|
wallets = totals_all[1]
|
|
|
|
|
msg(f"Totals: SEK: {totals[0]} | USD: {totals[1]} | GBP: {totals[2]}")
|
|
|
|
|
msg(f"Wallets: XMR USD: {wallets[0]} | BTC USD: {wallets[1]}")
|
|
|
|
|
|
|
|
|
|
class ping(object):
|
|
|
|
|
name = "ping"
|
|
|
|
@ -430,3 +399,13 @@ class IRCCommands(object):
|
|
|
|
|
price_usd = xmr_prices["bitcoin"]["usd"]
|
|
|
|
|
price_gbp = xmr_prices["bitcoin"]["gbp"]
|
|
|
|
|
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
|
|
|
|
|
|
|
|
|
class withdraw(object):
|
|
|
|
|
name = "withdraw"
|
|
|
|
|
authed = True
|
|
|
|
|
helptext = "Take profit."
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def run(cmd, spl, length, authed, msg, agora, revolut, tx):
|
|
|
|
|
rtrn = agora.withdraw_funds()
|
|
|
|
|
msg(dumps(rtrn))
|
|
|
|
|