I would like to extract the unrealized_pnl from fyres.positions() and store it in a variable. Can someone please show how to do it with an example? Thank you!
Hi Rajesh,
Try below code:
data = fyers.positions()
print(data[“overall”][‘pl_unrealized’])
Hi Rajesh,
Try below code:
data = fyers.positions()
print(data[“overall”][‘pl_unrealized’])
Thank you!
When I tried it, it gave the following error
total_PNL = fyers.positions()[“overall”][‘pl_unrealized’]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: ‘overall’
Could you please help me out
Thank you!