Firstly thanks for pybit, I'm building code around it nicely, but I have one area of confusion when getting position data via the websocket.
During tests, I had the bot enter 20 contracts long and then 40 contracts short to have the position be short/sell side.
However, ws.fetch("position") returned data for both the Buy and Sell sides of 20 contracts each. Is there something I'm missing? This doesn't reflect the actual position of the account at that time, which should only have data for the Sell side?
Here is the result of a fetch on the (BTCUSD) position so you can see what I mean.
'Buy':
{'user_id': 11111, 'symbol': 'BTCUSD', 'size': 20, 'side': 'Buy', 'position_value': '0.00059908',
'entry_price': '33384.52293517', 'liq_price': '16734.5', 'bust_price': '16692.5', 'leverage': '1', 'order_margin': '0', 'position_margin': '0.00059908',
'available_balance': '1.59463741', 'take_profit': '0', 'stop_loss': '0', 'realised_pnl': '0.000002', 'trailing_stop': '0', 'trailing_active': '0',
'wallet_balance': '1.59523739', 'risk_id': 1, 'occ_closing_fee': '0.0000009', 'occ_funding_fee': '0', 'auto_add_margin': 0,
'cum_realised_pnl': '0.00013621', 'position_status': 'Normal', 'position_seq': 0, 'Isolated': True, 'mode': 0, 'position_idx': 0
},
'Sell':
{'user_id': 11111, 'symbol': 'BTCUSD', 'size': 20, 'side': 'Sell', 'position_value': '0.00059725', 'entry_price': '33486.81456676',
'liq_price': '999999', 'bust_price': '999999', 'leverage': '1', 'order_margin': '0', 'position_margin': '0.00059723', 'available_balance': '1.59464108',
'take_profit': '0', 'stop_loss': '0', 'realised_pnl': '0.00000294', 'trailing_stop': '0', 'trailing_active': '0', 'wallet_balance': '1.59523833',
'risk_id': 1, 'occ_closing_fee': '0.00000002', 'occ_funding_fee': '0', 'auto_add_margin': 0, 'cum_realised_pnl': '0.00013715', 'position_status': 'Normal',
'position_seq': 0, 'Isolated': True, 'mode': 0, 'position_idx': 0
}
Any help / pointers as to why the data returned does not only have the "Sell" side information gladly received!