Open sh1l0n opened 3 years ago
Here is an explanation but I wasn't able to apply it yet to python-binance. Did you solve it?
Yes, but I used another library https://github.com/m4st3rb0ts/Binance_Futures_python
Simply call client.get_position_v2()
I ended up deducing the position side like this
# check if position is long or short
info = client.futures_position_information(symbol=symbol)
entryPrice = float(info[0]['entryPrice'])
markPrice = float(info[0]['markPrice'])
unRealizedProfit = float(info[0]['unRealizedProfit'])
quantity = abs(float(info[0]['positionAmt']))
positionSide = ''
if(entryPrice < markPrice):
if(unRealizedProfit > 0):
positionSide = 'long'
if(unRealizedProfit < 0):
positionSide = 'short'
if(entryPrice > markPrice):
if(unRealizedProfit < 0):
positionSide = 'long'
if(unRealizedProfit > 0):
positionSide = 'short'
print(f'positionSide: {positionSide}\n')
futures_position_information
If the user is in One-Way-Mode cannot know if the current position is LONG or SHORT. In Hedge-Mode its displayed.
Is any way to know it in OWM?