DataException while GetInstruments()

ZK2689
I am getting a data exception while calling GetInstruments:

An exception of type 'KiteConnect.DataException' occurred in KiteConnect.dll but was not handled in user code
Unable to parse data. {"instrument_token":"6656001","exchange_token":"26000","tradingsymbol":"NIFTY","name":"","last_price":"0.0","expiry":"","strike":"0.0","tick_size":"-0.01","lot_size":"-1","instrument_type":"EQ","segment":"NSE","exchange":"NSE"}

Because of this I am not able to start my app.
  • MadanGoyal
    Exactly. I am also facing the same problem with my app while calling Kite.GetInstruments("NSE"). Output window of VS says "Exception thrown: 'KiteConnect.DataException' in KiteConnect.dll" and Exception message is:

    Unable to parse data. {"instrument_token":"6656001","exchange_token":"26000","tradingsymbol":"NIFTY","name":"","last_price":"0.0","expiry":"","strike":"0.0","tick_size":"-0.01","lot_size":"-1","instrument_type":"EQ","segment":"NSE","exchange":"NSE"}

    As a result I am not able to update my instruments list.
  • trade_then
    trade_then edited March 2018
    I would like to second that but want to include the list of instruments that are causing this
    1. 6656001
    2. 6659841
    3. 6658305
    4. 6660353
    5. 6659073
    6. 6659585
    7. 6665985
    8. 6659329
    9. 6658049
    all of these cause exception of the exact message shown below
    obviously with respective instrument information changed.


    example 1

    <?xml version="1.0"?>
    <ExceptionCaused xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ExceptionName>DataException</ExceptionName>
    <HelpLink />
    <Hresult>0</Hresult>
    <InnerException>
    <Hresult>0</Hresult>
    </InnerException>
    <Message>Unable to parse data. {"instrument_token":"6656001","exchange_token":"26000","tradingsymbol":"NIFTY","name":"","last_price":"0.0","expiry":"","strike":"0.0","tick_size":"-0.01","lot_size":"-1","instrument_type":"EQ","segment":"NSE","exchange":"NSE"}</Message>
    <Source>KiteConnect</Source>
    <StackTrace> at KiteConnect.Instrument..ctor(Dictionary`2 data) in KiteDataDownloader\V_1_0_0_17\dotnetkiteconnect-kite3\KiteConnect\Structures.cs:line 462
    at KiteConnect.Kite.GetInstruments(String Exchange) in KiteDataDownloader\V_1_0_0_17\dotnetkiteconnect-kite3\KiteConnect\Kite.cs:line 563</StackTrace>
    </ExceptionCaused>
    example 2

    <?xml version="1.0"?>
    <ExceptionCaused xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ExceptionName>DataException</ExceptionName>
    <HelpLink />
    <Hresult>0</Hresult>
    <InnerException>
    <Hresult>0</Hresult>
    </InnerException>
    <Message>Unable to parse data. {"instrument_token":"6658049","exchange_token":"26008","tradingsymbol":"NIFTYIT","name":"","last_price":"0.0","expiry":"","strike":"0.0","tick_size":"-0.01","lot_size":"-1","instrument_type":"EQ","segment":"NSE","exchange":"NSE"}</Message>
    <Source>KiteConnect</Source>
    <StackTrace> at KiteConnect.Instrument..ctor(Dictionary`2 data) in KiteDataDownloader\V_1_0_0_17\dotnetkiteconnect-kite3\KiteConnect\Structures.cs:line 462
    at KiteConnect.Kite.GetInstruments(String Exchange) in KiteDataDownloader\V_1_0_0_17\dotnetkiteconnect-kite3\KiteConnect\Kite.cs:line 563</StackTrace>
    </ExceptionCaused>
    @ZK2689 @MadanGoyal in the mean time if you can change this line to what is below.

    foreach (Dictionary<string, dynamic> item in instrumentsData )
    {
    try
    {
    instruments.Add(new Instrument(item));
    }
    catch( Exception ex )
    {
    /// however you want to deal with excepion
    }

    }
    and recompile it.
    this will avoid your app blowing up.

    Thanks
    Regards
  • Jegan
    I am also facing the same problem "KiteConnect.ParseException: Unable to parse the response. Use ResponseData property to get original response." ,

    what is the solution for this ?
  • trade_then
    @jegan if you can download the source from Clone or download

    you can change the line as mentioned in above post. recompile, and reference .dll in your solution.

    as a temporary solution to this problem.
    Thanks
    Regards
  • Jegan
    @trade_then , Thank you very much for your quick solution ,

    but anyway mine is website, I don't have enough time to migrate my changes to web server,

    I have to skip trading today, Hope the issue will be resolved soon !:(

  • MadanGoyal
    MadanGoyal edited March 2018
    Thanks @trade_then for a work around solution for this issue. Fortunately, my trading for the day won't be impacted by this issue because my app updates itself from previous trading day's instrument lists. Usually there are not many changes in a day, so I'll still go with it. Hopefully this issue is resolved soon...
  • trade_then
    @Jegan I am also skipping placing orders today.
    @MadanGoyal yaa my app also relies on previously stored instrument list in case something goes wrong.

    Thanks
    Regards
  • sujith
    Hi,
    There was some issue with instrument master dump we received today earlier. We are taking this up with the concerned team and investigating this.
    You may have to re-download the latest instrument dump now to trade today.
  • trade_then
    @sujith
    Thanks, would do that.
    Instrument list was bit small today compared to other days. it might be that.

    Thanks
    Regards
  • Jegan
    @sujith , Please let us know once the issue is resolved , Thanks
  • sujith
    @Jegan,
    You won't be facing the issue anymore.
    @trade_then,
    It will have more entries today.
  • Jegan
    @sujith Thank you, its working fine now
Sign In or Register to comment.