Pass platform to open trades USD parse dash
This commit is contained in:
parent
086128396a
commit
df5ea51226
|
@ -368,7 +368,7 @@ class Money(util.Base):
|
|||
self.write_to_es("get_remaining", cast_es)
|
||||
return remaining
|
||||
|
||||
def open_trades_usd_parse_dash(self, dash, rates):
|
||||
def open_trades_usd_parse_dash(self, platform, dash, rates):
|
||||
cumul_usd = 0
|
||||
for contact_id, contact in dash.items():
|
||||
# We need created at in order to look up the historical prices
|
||||
|
@ -388,7 +388,10 @@ class Money(util.Base):
|
|||
date_formatted = date_parsed.strftime("%d-%m-%Y")
|
||||
|
||||
# Get the historical rates for the right asset, extract the price
|
||||
if platform == "agora":
|
||||
asset = contact["data"]["advertisement"]["asset"]
|
||||
elif platform == "lbtc":
|
||||
asset = "BTC"
|
||||
if asset == "XMR":
|
||||
amount_crypto = contact["data"]["amount_xmr"]
|
||||
history = self.cg.get_coin_history_by_id(id="monero", date=date_formatted)
|
||||
|
@ -427,8 +430,8 @@ class Money(util.Base):
|
|||
return False
|
||||
|
||||
rates = self.get_rates_all()
|
||||
cumul_usd_agora = self.open_trades_usd_parse_dash(dash_agora, rates)
|
||||
cumul_usd_lbtc = self.open_trades_usd_parse_dash(dash_lbtc, rates)
|
||||
cumul_usd_agora = self.open_trades_usd_parse_dash("agora", dash_agora, rates)
|
||||
cumul_usd_lbtc = self.open_trades_usd_parse_dash("lbtc", dash_lbtc, rates)
|
||||
cumul_usd = cumul_usd_agora + cumul_usd_lbtc
|
||||
|
||||
cast_es = {
|
||||
|
|
Loading…
Reference in New Issue