It looks like you're new here. If you want to get involved, click one of these buttons!
public void getmtm() { kite = new Kite(MyAPIKey, Debug: true); initSession(); kite.SetAccessToken(MyAccessToken); PositionResponse positions = kite.GetPositions(); //pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier); decimal pnls = 0; for (int i = 0; i < positions.Net.Count; i++) { Dictionary<string, Quote> ohlcs = kite.GetQuote(InstrumentId: new string[] { positions.Net[i].InstrumentToken.ToString() }); decimal LastPrice = 0; foreach (KeyValuePair<string, Quote> entry in ohlcs) { LastPrice = entry.Value.LastPrice; } pnls += (positions.Net[i].SellValue - positions.Net[i].BuyValue) + (positions.Net[i].Quantity * LastPrice * positions.Net[i].Multiplier); }//get pnl in label lbl_mtm.Text = pnls.ToString(); }
https://youtube.com/watch?v=wFih_6X5nV8&t=11s