How To Print LTP In C#?

shubhamosy
shubhamosy edited May 2020 in .Net API client
I am Using Below Code

string[] x = { "121345", "1793", "4818433", "5332481", "4840449", "731905" };
Dictionary ltpResponse = kite.GetLTP(x);
foreach (string item in ltpResponse.Keys)
{
Console.WriteLine(item);
}

Getting OutPut:
121345
1793
4818433
4840449
5332481
731905


How to Print token + LTP?
  • trade_then
    trade_then edited May 2020
    look at line 147.

    to test your invocation.

    in your code above you are getting exactly what you asked for in the loop.
    Item is a key in the dictionary and that is what is getting printed. you need to print values.
    these keys refer to. like on line 617 .

    In your case it should be,
    Console.WriteLine( $"Instrument:{item,-25} LTP: {ltpResponse[item].LastPrice,-15}");


    Thanks
    Regards
This discussion has been closed.