Live mtm calculation

Zen8_ith
Hi,
I am trying to calculate live mtm of the day . For that i am using positions["day"] mtm like this "day": [
{
"tradingsymbol": "GOLDGUINEA17DECFUT",
"exchange": "MCX",
"instrument_token": 53505799,
"product": "NRML",
"quantity": -3,
"overnight_quantity": 0,
"multiplier": 1,
"average_price": 23340,
"close_price": 23232,
"last_price": 23355,
"value": 69972,
"pnl": -93,
"m2m": -93,
"unrealised": -93,
"realised": 0,
"buy_quantity": 1,
"buy_price": 23388,
"buy_value": 23388,
"buy_m2m": 23388,
"sell_quantity": 4,
"sell_price": 23340,
"sell_value": 93360,
"sell_m2m": 93360,
"day_buy_quantity": 1,
"day_buy_price": 23388,
"day_buy_value": 23388,
"day_sell_quantity": 4,
"day_sell_price": 23340,
"day_sell_value": 93360
}, for each stock i am fetching its mtm and adding them to calculate the total mtm but its value is not coming right. Can you suggest me how to proceed it? Here i am taking position multiple time in the same stock according to the my strategy. Bascically i am switching between long and short position . Please suggest me how to proceed it.
Sign In or Register to comment.