Margins call works only when the user logins first time for the day. For subsequent logins when I use the same Access Token, "Margins" call throws {[message, Invalid token]} exception. All other methods / API calls are working fine as expected using the Access Token.
@sujith, @Kailash Could you please look into it as I am not able to retrieve Available Margin to place subsequent orders.
Hi, I think you need to create a new session when it happens. Margins and other(orders, positions, holdings) APIs are from the source. Don't use PI or NEST for monitoring, use Kite for monitoring purpose. If you log out from any platform then also this can happen.
No luck buddy. I never use PI or NEST. I use only Kite. I logged out of Kite and also I tried using InvalidatingToken on SessionHook(onTokenExpire) event and tried logging-in again, but still the user session is missing. Seems the user session got expired in your app server but AccessToken remains as it is even after invalidating.
Could you please tie the User Session/Margin information also to AccessToken ?
The strange behavior I see here is, GetOrders, GetPositions and GetTrades are part of Kite library like GetMargins. The Token expire event is not called in these cases, but it gets called only when I call GetMargins. Not sure about the behavior as I able to fetch the LoginTime as well from the User object prior to calling GetMargins.
Hi, We are in the process of migrating to new Kite Connect APIs. The source of funds and other calls are different. Once we do the complete migration, this issue will be gone. For now, you need to re-login.
Is this an issue with kiteconnectjs also? i am facing the same issue. I am still getting this issue when the market is closed and now I am not able to get the margins via kiteconnectjs.. Hope this does not happen in the morning tomorrow.
This is not an issue with any client. This is because the source of margins is different from other APIs. But the access token must not get expired in the first place. It is only invalidated if you log in to PI or NEST or log out of Kite or any platform.
Currently I am getting this Invalid Token for getMargins and also getting the same for retrieving the stocks. Although the websocket is able to connect "shows connected in websocket"
Also to make it unambiguos, Yes I am logged in via the https://kite3.zerodha.com/dashboard and also via my code. so the token is valid definitely.
I feel the issue might be related to the too many calls at the same time and crossing the threshhold of your APIs. but atleast Zerodha can provide a better error/failure reason if I am correct.
The webscokets will not throw a token exception because it is a long-standing connection, it won't validate for sending every tick, it will only validate while connecting. Kite Connect session is tied to Kite 2 and not Kite 3. Are you sure you didn't get logged out of Kite 2? We don't invalidate token for 429(too many requests) either.
I think you need to create a new session when it happens.
Margins and other(orders, positions, holdings) APIs are from the source.
Don't use PI or NEST for monitoring, use Kite for monitoring purpose. If you log out from any platform then also this can happen.
Could you please tie the User Session/Margin information also to AccessToken ?
We are in the process of migrating to new Kite Connect APIs. The source of funds and other calls are different. Once we do the complete migration, this issue will be gone. For now, you need to re-login.
I am still getting this issue when the market is closed and now I am not able to get the margins via kiteconnectjs.. Hope this does not happen in the morning tomorrow.
But the access token must not get expired in the first place. It is only invalidated if you log in to PI or NEST or log out of Kite or any platform.
Also to make it unambiguos, Yes I am logged in via the https://kite3.zerodha.com/dashboard and also via my code. so the token is valid definitely.
Kite Connect session is tied to Kite 2 and not Kite 3. Are you sure you didn't get logged out of Kite 2?
We don't invalidate token for 429(too many requests) either.