how to get all open positions of short and long futures

sir i am building a algo
so i want when i click on LONG BUTTON
first previous short position closes on market price
then enter long position on market price
so how to get a short or long position

in this function i am not getting long or Short position side
and we can consider if positionAmt > 0 means we have a open position
is there any other way to do that ???

[{‘symbol’: ‘TRXUSDT’, ‘positionAmt’: ‘0’, ‘entryPrice’: ‘0.0’, ‘markPrice’: ‘0.11697000’, ‘unRealizedProfit’: ‘0.00000000’, ‘liquidationPrice’: ‘0’, ‘leverage’: ‘1’, ‘maxNotionalValue’: ‘9.223372036854776E18’, ‘marginType’: ‘isolated’, ‘isolatedMargin’: ‘0.00000000’, ‘isAutoAddMargin’: ‘false’, ‘positionSide’: ‘BOTH’, ‘notional’: ‘0’, ‘isolatedWallet’: ‘0’, ‘updateTime’: 1631808652025}]

Hi. Please check positionSide attribute in the response payload. If the hedge mode is enabled, it will show LONG or SHORT in this field.