Not able to understand attribute Id in Exit Position suppose to close the position of symbol NSE:FINNIFTY-INDEX strike price :NSE:FINNIFTY23FEB17900PE id -123456789 what should be in data ? data = {} fyers.exit_positions(data) Tried with data = '1234

Not able to understand attribute Id in Exit Position

suppose to close the position of
symbol NSE:FINNIFTY-INDEX
strike price :NSE:FINNIFTY23FEB17900PE
id -123456789

what should be in data ?
data = {}
fyers.exit_positions(data)

Tried with
data = ‘123456789’
data = ‘NSE:FINNIFTY-INDEX’
data = {“id”:‘123456789’}
All throwing error {‘s’: ‘error’, ‘code’: -397, ‘message’: ‘Please provide a valid position Id’}

Hi Vishwas,

This might be due to an invalid position id. Kindly refer to the below document for reference.

https://myapi.fyers.in/docs/#tag/Other-Transactions/paths/~1OtherTransactions/options

HI Shruthi
Here ,position id means 123456789 ?
what should be data ?
data = {123456789 } or …?

In the link you have to go through Exit Position - By Id > Request samples > Python > “symbol”

Example:
print(fyers.exit_positions({“id”:“MCX:SILVERMIC20AUGFUT-MARGIN”}))

Thanks, this worked

Thanks for the update. Happy Trading!!