fixed price calculation
This commit is contained in:
parent
ae1c94d9a8
commit
3277392b8b
@ -315,12 +315,14 @@ async def calculate_best_closing_price(status: Status):
|
|||||||
is_long_pos = p.amount < 0
|
is_long_pos = p.amount < 0
|
||||||
|
|
||||||
pub_tick = await bfx.get_public_ticker(status.symbol)
|
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:
|
if is_long_pos:
|
||||||
closing_price = ticker_price * (1 - OFFER_PERC / 100)
|
closing_price = bid_price * (1 - OFFER_PERC / 100)
|
||||||
else:
|
else:
|
||||||
closing_price = -ticker_price * (1 - OFFER_PERC / 100)
|
closing_price = ask_price * (1 + OFFER_PERC / 100)
|
||||||
|
|
||||||
return closing_price
|
return closing_price
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user