System.FormatException when kite.GetInstruments() is invoked

rk_blitzkrieg
The return values for this API call returns the list of instruments but keeps on giving System.FormatException continuously. Anybody else faced with this problem?

Best Regards,
Rohit
  • sujith
    Can you let us know what version of the library you are using?
  • rk_blitzkrieg
    We're using version 3.0.3
  • sujith
    Is this still happening?
  • rk_blitzkrieg
    Hi Sujith...yes...it directly throws an exception within the kite.GetInstruments()
  • tonystark
    Can you post logs after enabling Debug: true in Kite's constructor?
  • KathrynArque
    Hi I am also using the Kite connect .Net API and have been facing the same issue.
    Exception thrown: 'System.FormatException' in mscorlib.dll
    String was not recognized as a valid DateTime.
    While enabling debug , I see all the instruments in the logs , however , the list of Instruments recieved from kite.GetInstruments() is missing several instruments such as basic ACC in NSE
  • exellion
    exellion edited June 2020
    Hi! I faced up with this issue too. The problem is into this code:
    TickSize = Convert.ToDecimal(data["tick_size"]);
    data["tick_size"] is a string, for example "0.25". It has '.' (dot) as separator, but my current system culture use ',' (comma) as separator. This is the reason of issue. When you parse the numbers with floating point, you should use
    CultureInfo.InvariantCulture
    My proposal is to use something like this:
    TickSize = Decimal.Parse(data["tick_Size"], CultureInfo.InvariantCulture);

    This also applies to LastPrice and Strike fields
Sign In or Register to comment.