Implement LBTC when getting wallet balances
This commit is contained in:
parent
e751fcd39d
commit
0e4fa8a0bb
|
@ -39,3 +39,8 @@ class Sources(util.Base):
|
||||||
"notify": self.notify,
|
"notify": self.notify,
|
||||||
}
|
}
|
||||||
util.xmerge_attrs(init_map)
|
util.xmerge_attrs(init_map)
|
||||||
|
|
||||||
|
def get_total_wallets(self):
|
||||||
|
"""
|
||||||
|
Get the total crypto in our wallets.
|
||||||
|
"""
|
||||||
|
|
|
@ -618,8 +618,12 @@ class Transactions(util.Base):
|
||||||
agora_wallet_btc = self.agora.agora.wallet_balance()
|
agora_wallet_btc = self.agora.agora.wallet_balance()
|
||||||
if not agora_wallet_btc["success"]:
|
if not agora_wallet_btc["success"]:
|
||||||
return False
|
return False
|
||||||
|
lbtc_wallet_btc = self.lbtc.lbtc.wallet_balance()
|
||||||
|
if not lbtc_wallet_btc["success"]:
|
||||||
|
return False
|
||||||
total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"]
|
total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"]
|
||||||
total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"]
|
total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"]
|
||||||
|
total_btc_lbtc = lbtc_wallet_btc["response"]["data"]["total"]["balance"]
|
||||||
# Get the XMR -> USD exchange rate
|
# Get the XMR -> USD exchange rate
|
||||||
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
||||||
|
|
||||||
|
@ -629,11 +633,14 @@ class Transactions(util.Base):
|
||||||
# Convert the Agora BTC total to USD
|
# Convert the Agora BTC total to USD
|
||||||
total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"]
|
total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"]
|
||||||
|
|
||||||
|
# Convert the LBTC BTC total to USD
|
||||||
|
total_usd_lbtc_btc = float(total_btc_lbtc) * btc_usd["bitcoin"]["usd"]
|
||||||
|
|
||||||
# Convert the Agora XMR total to USD
|
# Convert the Agora XMR total to USD
|
||||||
total_usd_agora_xmr = float(total_xmr_agora) * xmr_usd["monero"]["usd"]
|
total_usd_agora_xmr = float(total_xmr_agora) * xmr_usd["monero"]["usd"]
|
||||||
|
|
||||||
# Add it all up
|
# Add it all up
|
||||||
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc + total_usd_lbtc_btc
|
||||||
total_usd = total_usd_agora + total_sinks_usd
|
total_usd = total_usd_agora + total_sinks_usd
|
||||||
cast_es = {
|
cast_es = {
|
||||||
"price_usd": total_usd,
|
"price_usd": total_usd,
|
||||||
|
@ -666,8 +673,12 @@ class Transactions(util.Base):
|
||||||
if not agora_wallet_btc["success"]:
|
if not agora_wallet_btc["success"]:
|
||||||
self.log.error("Could not get Agora BTC wallet total.")
|
self.log.error("Could not get Agora BTC wallet total.")
|
||||||
return False
|
return False
|
||||||
|
lbtc_wallet_btc = self.lbtc.lbtc.wallet_balance()
|
||||||
|
if not lbtc_wallet_btc["success"]:
|
||||||
|
return False
|
||||||
total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"]
|
total_xmr_agora = agora_wallet_xmr["response"]["data"]["total"]["balance"]
|
||||||
total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"]
|
total_btc_agora = agora_wallet_btc["response"]["data"]["total"]["balance"]
|
||||||
|
total_btc_lbtc = lbtc_wallet_btc["response"]["data"]["total"]["balance"]
|
||||||
# Get the XMR -> USD exchange rate
|
# Get the XMR -> USD exchange rate
|
||||||
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
xmr_usd = self.money.cg.get_price(ids="monero", vs_currencies=["USD"])
|
||||||
|
|
||||||
|
@ -680,9 +691,13 @@ class Transactions(util.Base):
|
||||||
# Convert the Agora BTC total to USD
|
# Convert the Agora BTC total to USD
|
||||||
total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"]
|
total_usd_agora_btc = float(total_btc_agora) * btc_usd["bitcoin"]["usd"]
|
||||||
|
|
||||||
|
# Convert the LBTC BTC total to USD
|
||||||
|
total_usd_lbtc_btc = float(total_btc_lbtc) * btc_usd["bitcoin"]["usd"]
|
||||||
|
|
||||||
# Add it all up
|
# Add it all up
|
||||||
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
||||||
total_usd = total_usd_agora + total_sinks_usd
|
total_usd_lbtc = total_usd_lbtc_btc
|
||||||
|
total_usd = total_usd_agora + total_usd_lbtc + total_sinks_usd
|
||||||
|
|
||||||
# Convert the total USD price to GBP and SEK
|
# Convert the total USD price to GBP and SEK
|
||||||
rates = self.money.get_rates_all()
|
rates = self.money.get_rates_all()
|
||||||
|
|
|
@ -229,6 +229,23 @@ class GenericCommands(object):
|
||||||
rtrn = caller.nuke_ads()
|
rtrn = caller.nuke_ads()
|
||||||
msg(dumps(rtrn))
|
msg(dumps(rtrn))
|
||||||
|
|
||||||
|
class wallet(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, xmr, caller):
|
||||||
|
if xmr:
|
||||||
|
rtrn_xmr = caller.wallet_balance_xmr()
|
||||||
|
if not rtrn_xmr["success"]:
|
||||||
|
msg("Error getting XMR wallet details.")
|
||||||
|
return
|
||||||
|
balance_xmr = rtrn_xmr["response"]["data"]["total"]["balance"]
|
||||||
|
msg(f"XMR wallet balance: {balance_xmr}")
|
||||||
|
rtrn_btc = caller.wallet_balance()
|
||||||
|
if not rtrn_btc["success"]:
|
||||||
|
msg("Error getting BTC wallet details.")
|
||||||
|
return
|
||||||
|
balance_btc = rtrn_btc["response"]["data"]["total"]["balance"]
|
||||||
|
msg(f"BTC wallet balance: {balance_btc}")
|
||||||
|
|
||||||
|
|
||||||
class IRCCommands(object):
|
class IRCCommands(object):
|
||||||
class atrades(object):
|
class atrades(object):
|
||||||
|
@ -509,25 +526,23 @@ class IRCCommands(object):
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
GenericCommands.nuke.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
GenericCommands.nuke.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
class wallet(object):
|
class awallet(object):
|
||||||
name = "wallet"
|
|
||||||
authed = True
|
authed = True
|
||||||
|
name = "awallet"
|
||||||
helptext = "Get Agora wallet balances."
|
helptext = "Get Agora wallet balances."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
rtrn_xmr = agora.agora.wallet_balance_xmr()
|
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, True, agora.agora)
|
||||||
if not rtrn_xmr["success"]:
|
|
||||||
msg("Error getting XMR wallet details.")
|
class lwallet(object):
|
||||||
return
|
authed = True
|
||||||
rtrn_btc = agora.agora.wallet_balance()
|
name = "lwallet"
|
||||||
if not rtrn_btc["success"]:
|
helptext = "Get LBTC wallet balances."
|
||||||
msg("Error getting BTC wallet details.")
|
|
||||||
return
|
@staticmethod
|
||||||
balance_xmr = rtrn_xmr["response"]["data"]["total"]["balance"]
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
balance_btc = rtrn_btc["response"]["data"]["total"]["balance"]
|
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, False, tx.lbtc.lbtc)
|
||||||
msg(f"XMR wallet balance: {balance_xmr}")
|
|
||||||
msg(f"BTC wallet balance: {balance_btc}")
|
|
||||||
|
|
||||||
class apubads(object):
|
class apubads(object):
|
||||||
authed = True
|
authed = True
|
||||||
|
|
Loading…
Reference in New Issue