using ticker price to calculate final closing

This commit is contained in:
Giulio De Pasquale 2020-11-28 19:47:14 +00:00
parent e13e0eea2e
commit a775317658

View File

@ -307,13 +307,12 @@ async def calculate_best_closing_price(status: Status):
is_long_pos = p.amount < 0
pub_tick = await bfx.get_public_ticker(status.symbol)
bid_price = pub_tick[0]
ask_price = pub_tick[2]
ticker_price = pub_tick[6]
if is_long_pos:
closing_price = bid_price * (1 - OFFER_PERC / 100)
closing_price = ticker_price * (1 - OFFER_PERC / 100)
else:
closing_price = -ask_price * (1 - OFFER_PERC / 100)
closing_price = -ticker_price * (1 - OFFER_PERC / 100)
return closing_price