Get open position information and close position in python

Hi I want to get open positions information and close position.
i don’t find any information for open positions info and closing positions.
how can i get amount of open position?

For U-M futures, GET /fapi/v2/positionRisk

Hi @MJW,

Is there any way to get only open positions rather than the positions of all assets? (In case I don’t know the symbols to pass as parameters)

Thanks for your help

You’ve got to query all and filter open positions in your code

Tell me, what criteria can be used to filter an open position?

I am leaving my function here. Maybe It works for someone

def getOpenPositions_Future():
    client = Client(api_key=keys.Pkey_TestNet_Futures,api_secret=keys.Skey_TestNet_Futures,testnet=True)
    positions = client.futures_account()['positions']
    positions = pd.DataFrame.from_dict(positions)
    positions = positions.loc[positions['maintMargin']==0]
    return positions