From 0c96d13c30443bd52f9b96cc630e498018036f4c Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 23 Apr 2022 18:03:48 +0100 Subject: [PATCH] Fix totals --- handler/sources/__init__.py | 2 +- handler/transactions.py | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/handler/sources/__init__.py b/handler/sources/__init__.py index ce93890..47e1de6 100644 --- a/handler/sources/__init__.py +++ b/handler/sources/__init__.py @@ -18,7 +18,7 @@ class Sources(util.Base): def __irc_started__(self): self.agora.setup_loop() - # self.lbtc.setup_loop() + self.lbtc.setup_loop() def __xmerged__(self): """ diff --git a/handler/transactions.py b/handler/transactions.py index f824864..9b067c8 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -537,7 +537,6 @@ class Transactions(util.Base): if send_setting == "1": account_info = self.markets.get_matching_account_details(platform, currency) formatted_account_info = self.markets.format_payment_details(currency, account_info, real=True) - print("formatted", formatted_account_info) post_message( trade_id, f"Payment details: \n{formatted_account_info}", @@ -761,18 +760,20 @@ class Transactions(util.Base): total_usd_agora_xmr = float(total_xmr_agora) * xmr_usd["monero"]["usd"] # Add it all up - 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_agora = total_usd_agora_xmr + total_usd_agora_btc + total_usd_lbtc = total_usd_lbtc_btc + total_usd = total_usd_agora + total_usd_lbtc + total_sinks_usd cast_es = { "price_usd": total_usd, "total_usd_agora_xmr": total_usd_agora_xmr, "total_usd_agora_btc": total_usd_agora_btc, + "total_usd_lbtc_btc": total_usd_lbtc_btc, "total_xmr_agora": total_xmr_agora, "total_btc_agora": total_btc_agora, "total_btc_lbtc": total_btc_lbtc, "xmr_usd": xmr_usd["monero"]["usd"], "btc_usd": btc_usd["bitcoin"]["usd"], - # "total_usd_sinks": total_usd_sinks, + "total_sinks_usd": total_sinks_usd, "total_usd_agora": total_usd_agora, } self.write_to_es("get_total_usd", cast_es) @@ -821,6 +822,12 @@ class Transactions(util.Base): total_usd_lbtc = total_usd_lbtc_btc total_usd = total_usd_agora + total_usd_lbtc + total_sinks_usd + total_btc_usd = total_usd_agora_btc + total_usd_lbtc_btc + total_xmr_usd = total_usd_agora_xmr + + total_xmr = total_xmr_agora + total_btc = total_btc_lbtc + total_btc_agora + # Convert the total USD price to GBP and SEK rates = self.money.get_rates_all() price_sek = rates["SEK"] * total_usd @@ -834,10 +841,10 @@ class Transactions(util.Base): price_gbp, ), # Total prices in our 3 favourite currencies ( - total_usd_agora_xmr, - total_usd_agora_btc, + total_xmr_usd, + total_btc_usd, ), # Total USD balance in only Agora - (total_xmr_agora, total_btc_agora), + (total_xmr, total_btc), ) # Total XMR and BTC balance in Agora cast_es = { @@ -846,12 +853,13 @@ class Transactions(util.Base): "price_gbp": price_gbp, "total_usd_agora_xmr": total_usd_agora_xmr, "total_usd_agora_btc": total_usd_agora_btc, + "total_usd_lbtc_btc": total_usd_lbtc_btc, "total_xmr_agora": total_xmr_agora, "total_btc_agora": total_btc_agora, "total_btc_lbtc": total_btc_lbtc, "xmr_usd": xmr_usd["monero"]["usd"], "btc_usd": btc_usd["bitcoin"]["usd"], - # "total_usd_revolut": total_usd_revolut, + "total_sinks_usd": total_sinks_usd, "total_usd_agora": total_usd_agora, } self.write_to_es("get_total", cast_es)