Neaten up various money calls

This commit is contained in:
Mark Veidemanis 2022-05-05 18:24:40 +01:00
parent 1040579d37
commit c31175fea0
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 16 additions and 12 deletions

View File

@ -52,8 +52,8 @@ class Money(util.Base):
""" """
self.get_total() self.get_total()
self.get_remaining() self.get_remaining()
self.money.get_profit() self.get_profit()
self.money.get_profit(True) self.get_profit(True)
self.get_open_trades_usd() self.get_open_trades_usd()
self.get_total_remaining() self.get_total_remaining()
self.get_total_with_trades() self.get_total_with_trades()
@ -170,11 +170,11 @@ class Money(util.Base):
:return: profit in USD :return: profit in USD
:rtype: float :rtype: float
""" """
total_usd = yield self.tx.get_total_usd() total_usd = yield self.get_total_usd()
if not total_usd: if not total_usd:
return False return False
if trades: if trades:
trades_usd = yield self.tx.get_open_trades_usd() trades_usd = yield self.get_open_trades_usd()
total_usd += trades_usd total_usd += trades_usd
profit = total_usd - float(settings.Money.BaseUSD) profit = total_usd - float(settings.Money.BaseUSD)
@ -198,9 +198,9 @@ class Money(util.Base):
:rtype float: :rtype float:
""" """
total_sinks_usd = self.sinks.get_total_usd() total_sinks_usd = self.sinks.get_total_usd()
agora_wallet_xmr = yield self.agora.agora.wallet_balance_xmr() agora_wallet_xmr = yield self.agora.api.wallet_balance_xmr()
agora_wallet_btc = yield self.agora.agora.wallet_balance() agora_wallet_btc = yield self.agora.api.wallet_balance()
lbtc_wallet_btc = yield self.lbtc.lbtc.wallet_balance() lbtc_wallet_btc = yield self.lbtc.api.wallet_balance()
if not agora_wallet_xmr["success"]: if not agora_wallet_xmr["success"]:
return False return False
if not agora_wallet_btc["success"]: if not agora_wallet_btc["success"]:
@ -261,17 +261,21 @@ class Money(util.Base):
:rtype: tuple(tuple(float, float, float), tuple(float, float), tuple(float, float)) :rtype: tuple(tuple(float, float, float), tuple(float, float), tuple(float, float))
""" """
total_sinks_usd = self.sinks.get_total_usd() total_sinks_usd = self.sinks.get_total_usd()
agora_wallet_xmr = yield self.agora.agora.wallet_balance_xmr() agora_wallet_xmr = yield self.agora.api.wallet_balance_xmr()
agora_wallet_btc = yield self.agora.api.wallet_balance()
lbtc_wallet_btc = yield self.lbtc.api.wallet_balance()
if not agora_wallet_xmr["success"]: if not agora_wallet_xmr["success"]:
self.log.error("Could not get Agora XMR wallet total.")
return False return False
agora_wallet_btc = yield self.agora.agora.wallet_balance()
if not agora_wallet_btc["success"]: if not agora_wallet_btc["success"]:
self.log.error("Could not get Agora BTC wallet total.")
return False return False
lbtc_wallet_btc = yield self.lbtc.lbtc.wallet_balance()
if not lbtc_wallet_btc["success"]: if not lbtc_wallet_btc["success"]:
return False return False
if not agora_wallet_xmr["response"]:
return False
if not agora_wallet_btc["response"]:
return False
if not lbtc_wallet_btc["response"]:
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"] total_btc_lbtc = lbtc_wallet_btc["response"]["data"]["total"]["balance"]