API call of Bank Nifty Spot Price giving 504

Hi ,
Today 22-06-2023 around 14:35 to 14:37 i got the error "b"

504 Gateway Time-out

\n The server didn't respond in time.\n\n" when i try to get the spot value of "Bank Nifty" using API call. Even though i mention 10 seconds delay it is keep on occurring. Please fix the issue.
kite.quote('NSE:NIFTY BANK')['NSE:NIFTY BANK']['last_price']
  • sujith
    If you are polling, we suggest you to switch to Websockets API. This could be because CDN considering this as DDOS.
  • rakeshr
    Was it only for a request? You can handle time-out exceptions with a re-try.
  • Dileep
    Hi @rakeshr and @sujith i am using WebSocket by subscribing instruments. My code is if through WebSocket if it(tick) did not find the symbol=="NIFTY BANK" then try the API call. And in the exception , i am again recalling (recursive function) the API call with 10 seconds delay. But still getting the 504 error frequently. Please suggest me to handle it.
  • sujith
    You need use instruments token to subscribe for tick data. The instrument token is present in the instruments master that updates once a day in the morning.
    You can check out documentation here.
  • Dileep
    Thanks @sujith for your response. I subscribed the token only i.e 260105 for understanding purpose i mentioned in the discussion as symbol=="NIFTY BANK" . Even though i am getting spot price through web socket some time data is missing then i am calling the API call.
Sign In or Register to comment.