You need to use Websocket or Quote API and use the last price and calculate P&L of each item in net positions list and then sum it up. You can refer to this thread.
Thanks for your reply, This is my code, I am trying to read Last_price, but its value is not changing over time.
ppp = kcon.positions()['day']
for i in ppp: if (i['tradingsymbol'][0:4] == 'BANK'): print(dt.hour,":",dt.minute,":",dt.second ) print(i['tradingsymbol'][0:4]) print(i['last_price'])
this is my output where last_price is not changing over time.
9 : 29 : 5 BANK 251.85 9 : 29 : 21 BANK 251.85 9 : 29 : 36 BANK 251.85 9 : 29 : 36 BANK 251.85 9 : 29 : 52 BANK 251.85 9 : 30 : 23 BANK 251.85
Thanks for your reply rakeshr, I am not checking pnl, I am trying to calculate pnl using 'last_price'(LTP) and suggested formula in your referred thread. but 'last_price' value is not changing. Then how to use this formula
You can refer to this thread.
ppp = kcon.positions()['day']
for i in ppp:
if (i['tradingsymbol'][0:4] == 'BANK'):
print(dt.hour,":",dt.minute,":",dt.second )
print(i['tradingsymbol'][0:4])
print(i['last_price'])
this is my output where last_price is not changing over time.
9 : 29 : 5
BANK
251.85
9 : 29 : 21
BANK
251.85
9 : 29 : 36
BANK
251.85
9 : 29 : 36
BANK
251.85
9 : 29 : 52
BANK
251.85
9 : 30 : 23
BANK
251.85
pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);