LastPrice from Positions is not updated

Mangesh
I am using following code

PositionResponse positions = kite.GetPositions();

int TCnt = 0;
double BuyValue = 0;
double SellValue = 0;
RunningM2M = 0;

for (TCnt = 0; TCnt < positions.Net.Count; TCnt++)
{

OrderSymbol = Utils.JsonSerialize(positions.Net[TCnt].TradingSymbol);

// THIS IS SHOWN VERY OLD (NOT REFRESHED) HENCE LATEST M2M IS NOT SHOWN CORRECTLY
lastPrice = Convert.ToDouble(positions.Net[TCnt].LastPrice);

buyValue = Convert.ToDouble(positions.Net[TCnt].BuyValue);
sellValue = Convert.ToDouble(positions.Net[TCnt].SellValue);
netQuantity = Convert.ToInt32(positions.Net[TCnt].Quantity);
multiplier = Convert.ToDouble(positions.Net[TCnt].Multiplier);

OrderProfit = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);

RunningM2M = RunningM2M + OrderProfit;
}

Sign In or Register to comment.