How to keep the API running

AbhiCoder
Question about handling daily access token refresh for algo applications

For algo applications using the Zerodha Kite Connect API, it seems that we need to log in to Zerodha and generate/refresh the access token every day.

I’d like to understand how other developers are handling this in production. For example:

1) How are you managing the daily login and access-token generation?
2) How do you keep your algo application running continuously without manual intervention every morning?
3) Is there a recommended approach or architecture for handling the daily authentication flow?
4) Are there any best practices or examples for deploying an algo application that needs to run 24/7?
50 Would appreciate any suggestions or insights from developers who have implemented this successfully.
  • nagavenij
    You need to log in manually once every day to generate a new access token. The access token cannot be refreshed or generated automatically for individual Kite Connect users.

    As per the exchange requirement, users are required to complete the login process manually at least once a day. We therefore do not recommend or support automating the login process.

    Once generated, you can store and reuse the access token for your application throughout the day. The token expires as part of the daily session expiry process, after which you will need to log in again and generate a new access token.

    There is no workaround to keep the authenticated Kite Connect session running continuously without the daily login. You can keep your application/service running 24/7; however, API requests that require authentication must use the newly generated access token after the daily login.

    This daily login requirement is in place as part of the applicable exchange and compliance requirements.

    You may check this similar discussion.
  • kakush30
    kakush30 edited October 13
    There are certain ways to enable auto-login, but I don't think anyone is going to provide you with a ready-made solution because of the compliance requirements imposed by the Exchange. I can give you a hint: analyze the network requests.

    For keeping the algo running, the best solution is to use a VPS with Linux and create a systemctl service for it, or if you want do a cronjob, but systemctl is more reliable from my experience.

    The best practice is always to start with paper trading and then move to a demo account. If there are any bugs, you will find them before investing any real money.

    To keep track of everything at your fingertips at all times, you can create a Discord bot.
Sign In or Register to comment.