# MTM calclation

I understand other parameter....Whats multiplier parameter here???

pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);
• Are you calculating P&L for F&O contracts?
If yes, then the multiplier here is the lot size of a specific contract.
• i got it...thanks a lot
• I used this code pnl = (position['sell_value'] - position['buy_value']) + (position['quantity'] * position['last_price'] * position['multiplier'])
Even then since yesterday pnl is showing wrong information.

There is nothing called net_quantity.

• @AnandMC,
You need to use `quantity` field.
• And you can't use the position response's last price, you need to use Websocket API or quote API to get the last traded price.
• position['pnl'] was working until OCT11. Fine. I'm using the below python code now

for position in positions :
pnl = (position['sell_value'] - position['buy_value']) + (position['quantity'] * position['last_price'] * position['multiplier'])
sum = sum + position['pnl']
print(sum)

Can you let me know how to use "Websocket API or quote API" in python to get last price
• You may refer to the readme and documentation here.
• Have used the below code as you mentioned. However even now there is a change pnl of what is show in the kite web and what is shown in the code. Every thing was working fine until OCT 11.

exit = 0
while exit == 0:
positions = kite.positions()
positions = positions['net']
sum = 0
print('positions is')
print(positions)
for position in positions :
print(position['pnl'])
print("quote is")