def get_open_positions(symbol):
response = session.my_position(symbol=symbol)
if response['ret_code'] == 0:
positions = response['result']
print(f"Open positions for {symbol}: {positions}")
else:
print(f"Error fetching positions: {response['ret_msg']}")
return positions
get_open_positions('BTCUSD')
This function retrieves and prints all open positions for the BTC/USD trading pair.