Closed akatsev1956 closed 1 year ago
The log files show that autorestart is working perfectly.
In fact there in only one autorestart shown in the files commencing at 2023-04-07 23:59:00:742, not between 05:47 and 05:55 UTC as you stated.
And what do you mean by 'weekly restart': it restarts every day.
In any case, IBC is not involved in any way in API client program connections. I suggest you check out your API settings and make sure your program is using the correct server address, port, and client id.
First of all, thank you very much!
The issue is that I found my app not running Sun morning. So I assumed there was famous weekly shut down of IBGateway around midnight between Sat an Sun, and IBC couldn’t survive it… I dare say my settings are right, because manual restart worked properly without any change in the settings. So, I still don’t understand what has happen there...
Again, thanks a lot, Sincerely, Aryeh Katsev.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
You seem to have a fundamental misunderstanding about something.
Both TWS and Gateway require to be restarted every day. There are two settings in the 'Lock and Exit' section of the configuration dialog that control this:
If you select AutoLogoff, then TWS/Gateway will shut down at the specified time. It is then your responsibility to start it again, and you will have to go through the full authentication process; if it's a live account, this includes Second Factor Authentication.
If you select AutoRestart, then TWS/Gateway will shut down at the specified time, but will automatically load a new instance of TWS/Gateway. This new instance is passed some cryptographically-protected restart information which it uses to automatically log in, so there is no need for user interaction.
Note however that the first time TWS/Gateway restarts after 01:00 on Sunday morning, it will insist on full authentication. If it's actually running at this time, it will automatically close down and will not generate any restart information. In other words, there has to be at least one full authentication each week. Note also that when this happens, it's your responsibility to restart IBC if that's what you want.
Now whenever a TWS/Gateway instance shuts down, any API program that is currently connected loses its connection, so you get a 502 error. This is true whether you use AutoLogoff or AutoRestart. It is absolutely your responsibility to make the application connect to the API again. IBC cannot help with this.
Thank you very much for the comprehensive explanation it sounds much more clear than all the stuff I saw before. Am I right, that error 502 I’ll receive only when I try to connect(), otherwise I shall receive error 504?
Thank you in advance,
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
[Please, when you respond to a GitHub issue, either do it directly on the repository itself (using the 'view it on GitHub' link), or if you must use email, don't quote the post you're responding to. It's pointless having the whole of my last post repeated in your response. Can you please edit your last two posts to remove the quoted stuff.]
I don't know the answer to your 502/504 question, because i don't use IB's API implementation: I have my own version.
This is the sort of thing you should just discover for yourself, by experimentation, or reading the documentation, or asking on the IBAP User Group at https://groups.io/g/twsapi.
Thank you!
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
@akatsev1956 Please re-read part where you were asked to remove the quoted stuff. It annoys others as well :)
After weekly restart (Saturday night, at 2023.04.09 between 05:47 and 05:55 UTC) my IB API app receives error 502. When I shut down IBC and start it again manually everything works properly. IBC-3.15.2_GATEWAY-1019_SATURDAY.txt IBC-3.15.2_TWS-1019_FRIDAY.txt IBC-3.15.2_GATEWAY-1019_FRIDAY.txt IBC-3.15.2_GATEWAY-1019_SUNDAY.txt