NFO-FUT : Not Getting the Data

ashish_Innovantes
Hi, I want to get the Bids and Offers. I am using below code to access that but I am getting an error. The code and error are as below. Please let me know the code I should use to access the Bids and Offers.
Code Used:
===========

kites.SetAccessToken(MyAccessToken);

if(MyAccessToken != "" || MyAccessToken != null)
{

//DateTime date = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);

//string month = date.ToString("MMM").ToUpper();

Dictionary quotes = kites.GetQuote(InstrumentId: new string[] { "NFO-FUT:NIFTY18JULFUT" });

//Label2.Text += System.Environment.NewLine + "Data = " + Utils.JsonSerialize(quotes) + System.Environment.NewLine;

//Adding local data

if (quotes.ContainsKey("NFO-FUT:NIFTY18JULFUT"))
{
quote_data = quotes["NFO-FUT:NIFTY18JULFUT"];

}

foreach (var item in quote_data.Bids)
{
//Label1.Text += item.Quantity + System.Environment.NewLine;

mybuys.Add(new Bids
{

Buy_quantity = item.Quantity.ToString()

});

}

}



Error Received:
==============

quote_data.Bids throwing the below exception
'Object reference not set to an instance of an object.'


Thanks,
Ashish
Sign In or Register to comment.