diff --git a/handler/commands.py b/handler/commands.py index 67ea71f..bd852f1 100644 --- a/handler/commands.py +++ b/handler/commands.py @@ -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}") diff --git a/handler/transactions.py b/handler/transactions.py index b6bd647..74e4354 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -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