Fix totals

This commit is contained in:
Mark Veidemanis 2022-04-23 18:03:48 +01:00
parent 69e44b9fdb
commit 0c96d13c30
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 17 additions and 9 deletions

View File

@ -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):
"""

View File

@ -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)