|
|
@ -263,8 +263,11 @@ class Transactions(util.Base):
|
|
|
|
matching_refs = []
|
|
|
|
matching_refs = []
|
|
|
|
# TODO: use get_ref_map in this function instead of calling get_ref multiple times
|
|
|
|
# TODO: use get_ref_map in this function instead of calling get_ref multiple times
|
|
|
|
for ref in refs:
|
|
|
|
for ref in refs:
|
|
|
|
|
|
|
|
print(f"ITER REF {ref}")
|
|
|
|
stored_trade = self.get_ref(ref)
|
|
|
|
stored_trade = self.get_ref(ref)
|
|
|
|
|
|
|
|
print(f"ITER REF STORED TRADE {stored_trade}")
|
|
|
|
if stored_trade["currency"] == currency and float(stored_trade["amount"]) == float(amount):
|
|
|
|
if stored_trade["currency"] == currency and float(stored_trade["amount"]) == float(amount):
|
|
|
|
|
|
|
|
print(f"APPENDING STORED TRADE AS MATCH {stored_trade}")
|
|
|
|
matching_refs.append(stored_trade)
|
|
|
|
matching_refs.append(stored_trade)
|
|
|
|
if len(matching_refs) != 1:
|
|
|
|
if len(matching_refs) != 1:
|
|
|
|
self.log.error(f"Find trade returned multiple results for TXID {txid}: {matching_refs}")
|
|
|
|
self.log.error(f"Find trade returned multiple results for TXID {txid}: {matching_refs}")
|
|
|
@ -368,7 +371,7 @@ class Transactions(util.Base):
|
|
|
|
:return: value in USD
|
|
|
|
:return: value in USD
|
|
|
|
:rtype float:
|
|
|
|
:rtype float:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
# TODO: get Sink totals
|
|
|
|
total_sinks_usd = self.sinks.get_total_usd()
|
|
|
|
agora_wallet_xmr = self.agora.agora.wallet_balance_xmr()
|
|
|
|
agora_wallet_xmr = self.agora.agora.wallet_balance_xmr()
|
|
|
|
if not agora_wallet_xmr["success"]:
|
|
|
|
if not agora_wallet_xmr["success"]:
|
|
|
|
return False
|
|
|
|
return False
|
|
|
@ -391,9 +394,7 @@ class Transactions(util.Base):
|
|
|
|
|
|
|
|
|
|
|
|
# Add it all up
|
|
|
|
# Add it all up
|
|
|
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
|
|
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
|
|
|
# total_usd = total_usd_agora + total_usd_revolut
|
|
|
|
total_usd = total_usd_agora + total_sinks_usd
|
|
|
|
# TODO: add sinks value here
|
|
|
|
|
|
|
|
total_usd = total_usd_agora
|
|
|
|
|
|
|
|
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,
|
|
|
@ -416,8 +417,7 @@ class Transactions(util.Base):
|
|
|
|
:return: ((total SEK, total USD, total GBP), (total XMR USD, total BTC USD), (total XMR, total BTC))
|
|
|
|
:return: ((total SEK, total USD, total GBP), (total XMR USD, total BTC USD), (total XMR, total BTC))
|
|
|
|
:rtype: tuple(tuple(float, float, float), tuple(float, float), tuple(float, float))
|
|
|
|
:rtype: tuple(tuple(float, float, float), tuple(float, float), tuple(float, float))
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
# TODO: get sinks value here
|
|
|
|
total_sinks_usd = self.sinks.get_total_usd()
|
|
|
|
# total_usd_revolut = self.revolut.get_total_usd()
|
|
|
|
|
|
|
|
agora_wallet_xmr = self.agora.agora.wallet_balance_xmr()
|
|
|
|
agora_wallet_xmr = self.agora.agora.wallet_balance_xmr()
|
|
|
|
if not agora_wallet_xmr["success"]:
|
|
|
|
if not agora_wallet_xmr["success"]:
|
|
|
|
self.log.error("Could not get Agora XMR wallet total.")
|
|
|
|
self.log.error("Could not get Agora XMR wallet total.")
|
|
|
@ -442,9 +442,7 @@ class Transactions(util.Base):
|
|
|
|
|
|
|
|
|
|
|
|
# Add it all up
|
|
|
|
# Add it all up
|
|
|
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
|
|
|
total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc
|
|
|
|
# total_usd = total_usd_agora + total_usd_revolut
|
|
|
|
total_usd = total_usd_agora + total_sinks_usd
|
|
|
|
# TODO: add sinks value here
|
|
|
|
|
|
|
|
total_usd = total_usd_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()
|
|
|
|