fixed price calculation

This commit is contained in:
Giulio De Pasquale 2020-11-29 13:01:30 +00:00
parent ae1c94d9a8
commit 3277392b8b

View File

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