Add commands to get various totals
This commit is contained in:
parent
6872e0d164
commit
f116ed7cf3
|
@ -445,3 +445,23 @@ class IRCCommands(object):
|
|||
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
||||
remaining = tx.get_total_remaining()
|
||||
msg(f"Total remaining: {remaining}USD")
|
||||
|
||||
class tradetotal(object):
|
||||
name = "tradetotal"
|
||||
authed = True
|
||||
helptext = "Get total value of all open trades in USD."
|
||||
|
||||
@staticmethod
|
||||
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
||||
total = tx.get_open_trades_usd()
|
||||
msg(f"Total trades: {total}USD")
|
||||
|
||||
class dollar(object):
|
||||
name = "$"
|
||||
authed = True
|
||||
helptext = "Get total value of everything, including open trades."
|
||||
|
||||
@staticmethod
|
||||
def run(cmd, spl, length, authed, msg, agora, revolut, tx, notify):
|
||||
total = tx.get_total_with_trades()
|
||||
msg(f"${total}")
|
||||
|
|
|
@ -524,3 +524,10 @@ class Transactions(object):
|
|||
withdraw_threshold = float(settings.Money.BaseUSD) + float(settings.Money.WithdrawLimit)
|
||||
remaining = withdraw_threshold - total_usd
|
||||
return remaining
|
||||
|
||||
def get_total_with_trades(self):
|
||||
total_usd = self.get_total_usd()
|
||||
if not total_usd:
|
||||
return False
|
||||
total_trades_usd = self.get_open_trades_usd()
|
||||
return total_usd + total_trades_usd
|
||||
|
|
Loading…
Reference in New Issue