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): def __irc_started__(self):
self.agora.setup_loop() self.agora.setup_loop()
# self.lbtc.setup_loop() self.lbtc.setup_loop()
def __xmerged__(self): def __xmerged__(self):
""" """

View File

@ -537,7 +537,6 @@ class Transactions(util.Base):
if send_setting == "1": if send_setting == "1":
account_info = self.markets.get_matching_account_details(platform, currency) account_info = self.markets.get_matching_account_details(platform, currency)
formatted_account_info = self.markets.format_payment_details(currency, account_info, real=True) formatted_account_info = self.markets.format_payment_details(currency, account_info, real=True)
print("formatted", formatted_account_info)
post_message( post_message(
trade_id, trade_id,
f"Payment details: \n{formatted_account_info}", 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"] total_usd_agora_xmr = float(total_xmr_agora) * xmr_usd["monero"]["usd"]
# Add it all up # Add it all up
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc + total_usd_lbtc_btc total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
total_usd = total_usd_agora + total_sinks_usd total_usd_lbtc = total_usd_lbtc_btc
total_usd = total_usd_agora + total_usd_lbtc + total_sinks_usd
cast_es = { cast_es = {
"price_usd": total_usd, "price_usd": total_usd,
"total_usd_agora_xmr": total_usd_agora_xmr, "total_usd_agora_xmr": total_usd_agora_xmr,
"total_usd_agora_btc": total_usd_agora_btc, "total_usd_agora_btc": total_usd_agora_btc,
"total_usd_lbtc_btc": total_usd_lbtc_btc,
"total_xmr_agora": total_xmr_agora, "total_xmr_agora": total_xmr_agora,
"total_btc_agora": total_btc_agora, "total_btc_agora": total_btc_agora,
"total_btc_lbtc": total_btc_lbtc, "total_btc_lbtc": total_btc_lbtc,
"xmr_usd": xmr_usd["monero"]["usd"], "xmr_usd": xmr_usd["monero"]["usd"],
"btc_usd": btc_usd["bitcoin"]["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, "total_usd_agora": total_usd_agora,
} }
self.write_to_es("get_total_usd", cast_es) 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_lbtc = total_usd_lbtc_btc
total_usd = total_usd_agora + total_usd_lbtc + total_sinks_usd 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 # Convert the total USD price to GBP and SEK
rates = self.money.get_rates_all() rates = self.money.get_rates_all()
price_sek = rates["SEK"] * total_usd price_sek = rates["SEK"] * total_usd
@ -834,10 +841,10 @@ class Transactions(util.Base):
price_gbp, price_gbp,
), # Total prices in our 3 favourite currencies ), # Total prices in our 3 favourite currencies
( (
total_usd_agora_xmr, total_xmr_usd,
total_usd_agora_btc, total_btc_usd,
), # Total USD balance in only Agora ), # Total USD balance in only Agora
(total_xmr_agora, total_btc_agora), (total_xmr, total_btc),
) # Total XMR and BTC balance in Agora ) # Total XMR and BTC balance in Agora
cast_es = { cast_es = {
@ -846,12 +853,13 @@ class Transactions(util.Base):
"price_gbp": price_gbp, "price_gbp": price_gbp,
"total_usd_agora_xmr": total_usd_agora_xmr, "total_usd_agora_xmr": total_usd_agora_xmr,
"total_usd_agora_btc": total_usd_agora_btc, "total_usd_agora_btc": total_usd_agora_btc,
"total_usd_lbtc_btc": total_usd_lbtc_btc,
"total_xmr_agora": total_xmr_agora, "total_xmr_agora": total_xmr_agora,
"total_btc_agora": total_btc_agora, "total_btc_agora": total_btc_agora,
"total_btc_lbtc": total_btc_lbtc, "total_btc_lbtc": total_btc_lbtc,
"xmr_usd": xmr_usd["monero"]["usd"], "xmr_usd": xmr_usd["monero"]["usd"],
"btc_usd": btc_usd["bitcoin"]["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, "total_usd_agora": total_usd_agora,
} }
self.write_to_es("get_total", cast_es) self.write_to_es("get_total", cast_es)