Nodejs WebSocket + Rest API NetworkException issue

iamarunprasath
I’m trying the hybrid approach of websocket + rest api combination where the WebSocket is used to get live data for 208 stocks and, in parallel, using the REST API (Quote API) to fetch option chain data for the same set of stocks around 16K instruments with one request per second for each 3 mins. I’m aware of quote APIs rate limits and not making more than one request per second and fewer than 500 instruments per request yet I'm getting the following error especially during the market hours between 9:15 AM to 9:50 AM.

{
"status": "error",
"message": "Request failed (kt-quotes).",
"data": null,
"error_type": "NetworkException"
}

Upon enabling the debug mode, got the following info
{
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http', 'fetch' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse], [Function: formatQuoteResponse] ],
timeout: 7000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: [Function: FormData] [FormData] {
LINE_BREAK: '\r\n',
DEFAULT_CONTENT_TYPE: 'application/octet-stream'
},
Blob: [class Blob]
},
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/x-www-form-urlencoded',
'X-Kite-Version': '3',
'User-Agent': 'kiteconnectjs/5.1.0',
Authorization: 'token {api_jey}:{access_token}'
},
baseURL: 'https://api.kite.trade',
paramsSerializer: { serialize: [Function: paramsSerializer] },
method: 'get',
url: '/quote',
params: {
i: [
'NFO:SWIGGY26JAN325PE',
'NFO:HDFCAMC26JAN3080CE',
'NFO:ADANIGREEN26JAN970CE',
'NFO:NAUKRI26JAN1520PE',
... 200 more items
]
},
data: null,
allowAbsoluteUrls: true
}

  • nagavenij
    You can try fetching it and check.
  • Nivas
    There was an intermittent issue with Kite Ticker in the morning wherein ticks were freezing. We had done some changes to fix it and restarted the service. You might have observed the error response at that time. It should be resolved now.

    I've removed the api key and the access token from the above post. Please don't share it on the public thread.
  • iamarunprasath
    Thanks @Nivas! It's working fine so far, my bad for missing the token :) Thanks a lot!!
This discussion has been closed.