Tradier broker is not connecting when WL is restarted premarket. (All times are Pacific.)
From the log viewer
This is a recent problem, possibly since I upgraded to B34 of the Tradier extension. It will connect once I restart WL again.
It looks like my Windows task scheduler is successfully shutting down and restarting WL premarket. Windows task scheduler log:
Shutdown
Restart
As I'm looking at this, the above log is not showing completion of the restart until 6:37 AM. That was the time I manually restarted WL. But WL was running when I got on my computer premarket today.
Any idea what might be going on?
From the log viewer
QUOTE:
Timestamp Source Message Exception
"10/3/2024 05:49:56:503" "Tradier" "05:49:56.503 Initiating Tradier accounts socket...Start"
"10/3/2024 05:49:57:905" "Tradier" "05:49:57.905 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/3/2024 06:36:43:703" "Tradier" "06:36:43.703 Initiating Tradier accounts socket...Start"
"10/3/2024 06:36:45:102" "Tradier" "06:36:45.102 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
This is a recent problem, possibly since I upgraded to B34 of the Tradier extension. It will connect once I restart WL again.
It looks like my Windows task scheduler is successfully shutting down and restarting WL premarket. Windows task scheduler log:
Shutdown
QUOTE:
Information 10/3/2024 5:44:00 AM 102 Task completed (2) c62544a3-c482-48d7-96d6-6775063d8fbc
Information 10/3/2024 5:44:00 AM 201 Action completed (2) c62544a3-c482-48d7-96d6-6775063d8fbc
Information 10/3/2024 5:44:00 AM 200 Action started (1) c62544a3-c482-48d7-96d6-6775063d8fbc
Information 10/3/2024 5:44:00 AM 100 Task Started (1) c62544a3-c482-48d7-96d6-6775063d8fbc
Information 10/3/2024 5:44:00 AM 129 Created Task Process Info
Information 10/3/2024 5:44:00 AM 107 Task triggered on scheduler Info c62544a3-c482-48d7-96d6-6775063d8fbc
Restart
QUOTE:
Information 10/3/2024 6:37:55 AM 102 Task completed (2) 3ecd342a-c01c-4127-836a-c532161faf7d
Information 10/3/2024 6:37:55 AM 201 Action completed (2) 3ecd342a-c01c-4127-836a-c532161faf7d
Information 10/3/2024 5:48:00 AM 200 Action started (1) 3ecd342a-c01c-4127-836a-c532161faf7d
Information 10/3/2024 5:48:00 AM 100 Task Started (1) 3ecd342a-c01c-4127-836a-c532161faf7d
Information 10/3/2024 5:48:00 AM 129 Created Task Process Info
Information 10/3/2024 5:48:00 AM 107 Task triggered on scheduler Info 3ecd342a-c01c-4127-836a-c532161faf7d
As I'm looking at this, the above log is not showing completion of the restart until 6:37 AM. That was the time I manually restarted WL. But WL was running when I got on my computer premarket today.
Any idea what might be going on?
Rename
"Tradier Broker socket disconnected ByServer".
This is an external disconnect from the socket. I can't tell you why, only that this is what the socket reported. You have to restart WealthLab like it says to reinitialize it.
My guess is that the Tasks are creating another instance of WeatlhLab when one is already running and that's causing the disconnect.
This is an external disconnect from the socket. I can't tell you why, only that this is what the socket reported. You have to restart WealthLab like it says to reinitialize it.
My guess is that the Tasks are creating another instance of WeatlhLab when one is already running and that's causing the disconnect.
Ah. Interesting thought. I will probably have to get on early and actually watch what happens.
I Did change a setting in the Task Scheduler to not open new session if one is not open. Didn't make any difference. I've tried restarting after market open. Same problem. I've watched Task scheduler Live and it's working properly. It just seems to reject the first connect of the day and works on the second one. It reminds me of a previous Tradier problem (now fixed) that required two fetches for it to work (download option chain?).
I am in discussion with Tradier support, but they have no clue what is causing this. This is a new problem I didn't have before, and it consistently fails each morning. Is it possible for me to undo the Tradier B34 update to test if the problem disappears? Or would I have to revert to B99 of WL as well?
QUOTE:
This is a recent problem, possibly since I upgraded to B34 of the Tradier extension. It will connect once I restart WL again.
I am in discussion with Tradier support, but they have no clue what is causing this. This is a new problem I didn't have before, and it consistently fails each morning. Is it possible for me to undo the Tradier B34 update to test if the problem disappears? Or would I have to revert to B99 of WL as well?
QUOTE:This only refers to other sessions that the Task Manager has opened. If WealthLab is already open and connected, then your Task is not going to work. I can't tell if that's your scenario or not.
I Did change a setting in the Task Scheduler to not open new session if one is not open.
No. First task is to shut down WL. 2 min later second task to start WL runs. Both working properly.
Okay, I'll see if I can duplicate that scenario.
Are you using TASKKILL or something else to shut down WealthLab?
Give me the details.
Are you using TASKKILL or something else to shut down WealthLab?
Give me the details.
I've gone through a few cyclesand it works fine for me. The named Workspace I'm loading just has an Order Manager with Tradier selected and a streaming chart.
The last time it went through a "Lost" disconnect about 1 minute after connecting, but that lasted only about 1 second before it reported that it reconnected. Stable ever since.
The last time it went through a "Lost" disconnect about 1 minute after connecting, but that lasted only about 1 second before it reported that it reconnected. Stable ever since.
yes.
I suspect it may have nothing to do with the Task Scheduler. To test this, I will manually shut down and restart WL tomorrow to see if the problem happens (i.e., take TS out of the picture).
Why do you think you are getting so many disconnects?
I suspect it may have nothing to do with the Task Scheduler. To test this, I will manually shut down and restart WL tomorrow to see if the problem happens (i.e., take TS out of the picture).
Why do you think you are getting so many disconnects?
You're calling one transient 0.5 second Disconnect "so many"?
It was one transient 0.5 second disconnect. I'm not going to try investigate the cause of that.
... although it did happen almost exactly 60 seconds after the Connect, so there could be something there - I will check that because it could be part of the default auto-reconnect logic working that should have been disabled.
It was one transient 0.5 second disconnect. I'm not going to try investigate the cause of that.
... although it did happen almost exactly 60 seconds after the Connect, so there could be something there - I will check that because it could be part of the default auto-reconnect logic working that should have been disabled.
Sorry. It looked like more. I see now only one. I was just surprised because I thought I was the only one getting disconnects and I still would like to know if it's my Internet connection, something happening at the broker side, or something between WL and broker.
Regarding Post #8
This morning, I had Task Scheduler (TS) shut down WL before 9am (Market time) and I manually started WL about 2 min later. It did not connect automatically with Tradier. No log error message When I manually connected (green connect button), It failed. Log message below:
So, the error has nothing to do with TS. This is what happened when I restarted WL.
What do you think of my idea in Post #3?
Finally connected at 9:26 am
Regarding Post #8
QUOTE:
I suspect it may have nothing to do with the Task Scheduler. To test this, I will manually shut down and restart WL tomorrow to see if the problem happens (i.e., take TS out of the picture).
This morning, I had Task Scheduler (TS) shut down WL before 9am (Market time) and I manually started WL about 2 min later. It did not connect automatically with Tradier. No log error message When I manually connected (green connect button), It failed. Log message below:
QUOTE:
Timestamp Source Message Exception
"10/9/2024 06:07:58:769" "Tradier" "06:07:58.769 Initiating Tradier accounts socket...Start"
"10/9/2024 06:08:00:164" "Tradier" "06:08:00.164 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
So, the error has nothing to do with TS. This is what happened when I restarted WL.
QUOTE:
Timestamp Source Message Exception
"10/9/2024 06:18:14:870" "Tradier" "06:18:14.870 Initiating Tradier accounts socket...Start"
"10/9/2024 06:18:16:268" "Tradier" "06:18:16.268 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/9/2024 06:18:30:348" "Tradier" "06:18:30.348 Initiating Tradier accounts socket...Start"
"10/9/2024 06:18:32:583" "Tradier" "06:18:32.583 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/9/2024 06:18:38:378" "Tradier" "06:18:38.378 Initiating Tradier accounts socket...Start"
"10/9/2024 06:18:39:770" "Tradier" "06:18:39.770 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/9/2024 06:18:46:148" "Tradier" "06:18:46.148 Initiating Tradier accounts socket...Start"
"10/9/2024 06:18:47:533" "Tradier" "06:18:47.533 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/9/2024 06:18:56:352" "Tradier" "06:18:56.352 Initiating Tradier accounts socket...Start"
"10/9/2024 06:18:57:779" "Tradier" "06:18:57.779 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
What do you think of my idea in Post #3?
QUOTE:
This is a new problem I didn't have before, and it consistently fails each morning. Is it possible for me to undo the Tradier B34 update to test if the problem disappears? Or would I have to revert to B99 of WL as well?
Finally connected at 9:26 am
Let me ask again. What process are you using in the TS to shut down WealthLab, and, are you sure that it shuts down.
I'm talking about a Windows Process - not just if there's a WealthLab window showing or not.
Re: Post #3 - We don't keep old builds. You can try if you downloaded it though.
I'm talking about a Windows Process - not just if there's a WealthLab window showing or not.
Re: Post #3 - We don't keep old builds. You can try if you downloaded it though.
QUOTE:
Let me ask again.
I responded in Post #8 but now I see it was separated by another post (likely added while I was responding) and was probably not clear what I was answering "Yes" to.
QUOTE:
What process are you using in the TS to shut down WealthLab
QUOTE:
are you sure that it shuts down. I'm talking about a Windows Process - not just if there's a WealthLab window showing or not.
Yes, I'm sure it's shut down. Here are snaps of Task Manager after I ran the TS shut down. Wealth-Lab does not appear.
Apps
Background processes
QUOTE:
We don't keep old builds. You can try if you downloaded it though.
Would I have to install *both* WL build (99) and Tradier (33) together?
No, without changing WL you can just go back to Tradier Build 33, and put up with the "Too many sessions" problem if you want, but please don't post about that.
The thing is, the "Server" is disconnecting you. I don't see that - ever (at least not that I can recall). This indicates a problem with your login, your session token, or something like that - like multiple logins.
The thing is, the "Server" is disconnecting you. I don't see that - ever (at least not that I can recall). This indicates a problem with your login, your session token, or something like that - like multiple logins.
QUOTE:
please don't post about that.
Hahaha. I promise I won't.
I am not planning to use B33 long-term. This idea is just to see if the connect problem appears with B33, as a quick troubleshooting step. Maybe it's just a coincidence. I'll be able to test tomorrow morning, assuming the downgrade works, and let you know what I find.
Unfortunately, I could not find the old install files in my download folder in my image backups. Either WL changed the install to fetch from the cloud instead of dl'ing the file or I don't have the right name for the install file.
At any rate, the symptom is consistent. My first WL startup of the day will not connect (auto or manual) with Tradier broker and will generate log error shown above. My second and every subsequent WL startup of the day will auto-connect with Tradier without error.
At any rate, the symptom is consistent. My first WL startup of the day will not connect (auto or manual) with Tradier broker and will generate log error shown above. My second and every subsequent WL startup of the day will auto-connect with Tradier without error.
If I could make it happen, we would dig into it.
If you tell me what's in your start-up workspace and how it's configured, I'd have something to try... And by "configured" I mean precisely how it's configured...
1. is streaming enabled on the chart windows?
2. are there active items in the S.Monitor?
3. if so, how is each configured for data and update mode
4. is Tradier the selected broker in the Order Manager?
5. what order of checked Hist. Providers,
6. Is Auto-Run and/or Auto-Reactivate enabled in the Workspace menu.
Or, a better idea is to simplify a Workspace that only has only:
1. the Order Manager with Tradier selected.
2. Streaming chart with Tradier
Try starting up to just that "mostly empty" workspace.
If that works, start building up your trading workspace by adding items one by one to try to find the "breaking point".
1. is streaming enabled on the chart windows?
2. are there active items in the S.Monitor?
3. if so, how is each configured for data and update mode
4. is Tradier the selected broker in the Order Manager?
5. what order of checked Hist. Providers,
6. Is Auto-Run and/or Auto-Reactivate enabled in the Workspace menu.
Or, a better idea is to simplify a Workspace that only has only:
1. the Order Manager with Tradier selected.
2. Streaming chart with Tradier
Try starting up to just that "mostly empty" workspace.
If that works, start building up your trading workspace by adding items one by one to try to find the "breaking point".
Bad, but not atypical, day with Tradier. Here's the abbreviated log:
Had to restart WL to get it going again. The irony is that I do not have Tradier streaming selected for data. It's not selected in the streaming chart, and it's not selected in the SM settings for Streaming: (Broker and Streaming Provider settings). Besides, I am using polling data. So why is it streaming and what kind of streaming is failing? Is the broker connection streaming?
QUOTE:
"10/10/2024 09:19:41:058" "Tradier" "Streaming Disconnected - attempting Reconnect: Lost, CloseStatus: , SessionId: e95b45c6-96ed-41db-803e-6147d747ae4e"
"10/10/2024 09:19:42:423" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: e95b45c6-96ed-41db-803e-6147d747ae4e"
"10/10/2024 09:19:42:649" "Tradier" "Streaming Reconnect Successful"
"10/10/2024 09:19:42:885" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: e95b45c6-96ed-41db-803e-6147d747ae4e"
"10/10/2024 09:34:08:789" "Tradier" "Streaming Disconnected - attempting Reconnect: Lost, CloseStatus: , SessionId: e76e6b1f-7c35-446a-835e-c1a881e93e69"
"10/10/2024 09:34:08:789" "Tradier" "09:34:08.789 Tradier Broker socket disconnected: Lost; Reconnecting..."
"10/10/2024 09:34:10:152" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: e76e6b1f-7c35-446a-835e-c1a881e93e69"
"10/10/2024 09:34:10:371" "Tradier" "Streaming Reconnect Successful"
"10/10/2024 09:34:10:612" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: e76e6b1f-7c35-446a-835e-c1a881e93e69"
"10/10/2024 09:34:12:661" "Tradier" "09:34:12.661 Tradier Broker reconnected after Lost"
"10/10/2024 09:34:14:241" "Tradier" "09:34:14.241 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/10/2024 10:30:05:985" "Tradier" "user/profile Get empty"
"10/10/2024 10:30:05:986" "Tradier" "10:30:05.986 Initiating Tradier accounts socket...Start"
"10/10/2024 10:30:07:987" "Tradier" "10:30:07.987 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/10/2024 10:40:08:214" "Tradier" "user/profile Get empty"
Had to restart WL to get it going again. The irony is that I do not have Tradier streaming selected for data. It's not selected in the streaming chart, and it's not selected in the SM settings for Streaming: (Broker and Streaming Provider settings). Besides, I am using polling data. So why is it streaming and what kind of streaming is failing? Is the broker connection streaming?
Bad? If you didn't have that log, you would have never noticed the disconnects - except for the last one, I guess. Initially, they were transient disconnects and it reconnected in less than 2 seconds.
I don't know why you keep getting disconnected "By Server". That's abnormal and seems to be only happening for you. If anyone else sees that, I'd like to hear about it.
I don't know why you keep getting disconnected "By Server". That's abnormal and seems to be only happening for you. If anyone else sees that, I'd like to hear about it.
Because I'm always programming, investigating, etc., I don't often get 12 consecutive hours on a machine without restarting WealthLab. But today I did, and the result was one solid Tradier connection for more than 12 hours straight.
At other times, I have seen transient disconnects that correspond to internet dropouts, but Tradier reconnects quickly when it becomes available again.
And since fixing the "Too many sessions" bug, I can't recall being disconnected "By Server" - this seems to be unique to your scenario/usage.
At other times, I have seen transient disconnects that correspond to internet dropouts, but Tradier reconnects quickly when it becomes available again.
And since fixing the "Too many sessions" bug, I can't recall being disconnected "By Server" - this seems to be unique to your scenario/usage.
QUOTE:
this seems to be unique to your scenario/usage.
@innertrader
I've been following your networking problems. Some thoughts from a computer engineer.
1) A passive component failure (cable connections, reflections, wiring) would last fractions of seconds due to the ringing in the transmission lines. This doesn't seem like the problem you are having.
2) An active component failure (like a digital computer chip) would last a second or two. This sounds more like your problem. Moreover, as the failing chip overheats and fries, it will eventually fail altogether, so it needs to be addressed. This means the problem is either in your computer or router.
I think it's unfortunate your local ISP can't send a tech with a digital network analyzer to precisely locate the networking problem source. That being said, I would hire an engineering consultant with a network analyzer to do this instead. It's worth the couple hundred bucks to get this done.
I'm "guessing" the problem is in the networking hardware of your computer itself because those chips get much hotter than those in your router. You don't need to replace the entire motherboard. For about $70 you can buy an Ethernet adapter PCIe card that plugs in your motherboard to bypass the problem. All the best to you.
You think hardware is a reason that the "Server" is disconnecting him?
I don't think so.
I don't think so.
QUOTE:
You think hardware is a reason that the "Server" is disconnecting him?
The server many be disconnecting him because to too many retries. Actually, there's a firewall type of device that's in charge of fending off Denial-of-Service attacks that may be kicking in with all the reconnecting retries from the same IP address. (If it was the server itself, it might provide more useful information.)
If it's an active component, it's only going to get worse as that component fries.
I did suggest he swap computers to see if the problem disappears, but that was four months ago. He needs to test the second computer with "streaming" because that's what's going to exacerbate the problem the most.
3 re-connections (all successful, by the way) in 6 seconds can hardly be mistaken for a DoS attack. Furthermore these were not the actual problem, which was being disconnected by the Server nearly 1 hour later. That's the one that required the restart.
Like I mentioned before, if the Server is rejecting the connection, there's probably something wrong with the login, token refresh, multiple connections to the same account, etc.
(By the way, it's a full 24 hours later now, and I still haven't had even one re-connect during that time.)
Like I mentioned before, if the Server is rejecting the connection, there's probably something wrong with the login, token refresh, multiple connections to the same account, etc.
(By the way, it's a full 24 hours later now, and I still haven't had even one re-connect during that time.)
QUOTE:
if the Server is rejecting the connection, there's probably something wrong with the login,...
If the security box has his IP address on a DoS watch list, the behavior of his login is going to be different than yours. I think he's seeing some unique behavior.
After testing/forcing disconnects, I got the "ByServer" scenario. It's complaining about the Session ID.
I don't know why, but at least we've got something to go on again.
I don't know why, but at least we've got something to go on again.
QUOTE:
Timestamp Source Message Exception
"10/16/2024 08:06:15:779" "Schwab" "Schwab Broker: Connected to Schwab."
"10/16/2024 08:06:30:897" "Tradier" "08:06:30.897 Initiating Tradier accounts socket...Start"
"10/16/2024 08:06:34:365" "Schwab" "Schwab Initial Streaming Connect"
"10/16/2024 08:06:34:564" "Schwab" "Connected"
"10/16/2024 08:20:04:586" "Tradier" "Streaming Disconnected - attempting Reconnect: Lost, CloseStatus: , SessionId: c7304e8d-f85e-4c3c-8296-f5e0a876aabd"
"10/16/2024 08:20:05:857" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: c7304e8d-f85e-4c3c-8296-f5e0a876aabd"
"10/16/2024 08:20:06:162" "Tradier" "Streaming Reconnect Successful"
"10/16/2024 08:20:06:398" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: c7304e8d-f85e-4c3c-8296-f5e0a876aabd"
"10/16/2024 09:17:44:495" "Tradier" "Streaming Disconnected - attempting Reconnect: Lost, CloseStatus: , SessionId: 5bcb41f8-3708-40ae-9bee-c6f6c9707fda"
"10/16/2024 09:17:44:495" "Tradier" "09:17:44.495 Tradier Broker socket disconnected: Lost; Reconnecting..."
"10/16/2024 09:17:45:874" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 5bcb41f8-3708-40ae-9bee-c6f6c9707fda"
"10/16/2024 09:17:46:077" "Tradier" "Streaming Reconnect Successful"
"10/16/2024 09:17:46:316" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 5bcb41f8-3708-40ae-9bee-c6f6c9707fda"
"10/16/2024 09:17:48:231" "Tradier" "09:17:48.231 Tradier Broker reconnected after Lost"
"10/16/2024 09:17:49:734" "Tradier" "09:17:49.734 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
"10/16/2024 09:17:55:341" "Tradier" "Streaming Reconnect Successful"
"10/16/2024 09:17:55:578" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 5bcb41f8-3708-40ae-9bee-c6f6c9707fda"
Now Tradier is disconnecting from broker during the day. Likely at 9:17:55 or some time after.
Here's what happened when I tried to reconnect ("Connect" button in OM).
QUOTE:
"10/16/2024 10:24:35:137" "Tradier" "10:24:35.137 Initiating Tradier accounts socket...Start"
"10/16/2024 10:24:36:610" "Tradier" "10:24:36.610 Tradier Broker socket disconnected ByServer. Restart WealthLab to Reinitialize."
I have to restart WL to reconnect, exactly as what happens on the disconnect on the first attempt each morning after the WL restart.
Note that I have zero disconnects from Schwab.
Post #16
I started up WL in the morning with Tradier selected in the Order Manager, all Data Providers unchecked except Tradier, only one streaming chart active using Tradier, and all Strategies in the SM disabled. It still failed.
QUOTE:
Or, a better idea is to simplify a Workspace that only has only:
1. the Order Manager with Tradier selected.
2. Streaming chart with Tradier
Try starting up to just that "mostly empty" workspace.
If that works, start building up your trading workspace by adding items one by one to try to find the "breaking point".
I started up WL in the morning with Tradier selected in the Order Manager, all Data Providers unchecked except Tradier, only one streaming chart active using Tradier, and all Strategies in the SM disabled. It still failed.
Thanks but updates aren't required. I've been working on the solution most of the week.
The main problem was the interpretation of Tradier's SessionID that "expires" after 5 minutes. We thought the session had to be refreshed constantly before 5 minutes expired otherwise we'd lose the session. That's not the case at all - the SessionID only needs to be updated if the payload changes. That's fixed, and I'm just cleaning up the Auto-reconnect for Streaming.
The main problem was the interpretation of Tradier's SessionID that "expires" after 5 minutes. We thought the session had to be refreshed constantly before 5 minutes expired otherwise we'd lose the session. That's not the case at all - the SessionID only needs to be updated if the payload changes. That's fixed, and I'm just cleaning up the Auto-reconnect for Streaming.
Yay!
Looking forward to the next release. BTW, Tradier has been having problems of its own. This morning, they actually shut down all trading for the remainder of the day because of a glitch they were having with a vendor. Just in case you are seeing some new weird stuff in your testing, it may be on their side.
Looking forward to the next release. BTW, Tradier has been having problems of its own. This morning, they actually shut down all trading for the remainder of the day because of a glitch they were having with a vendor. Just in case you are seeing some new weird stuff in your testing, it may be on their side.
QUOTE:
the SessionID only needs to be updated if the payload changes.
I'm just curious, but I'm assuming the http headers (and any http handshaking) aren't counted as part of the payload in a WebSocket connection. Is that correct?
If so, then if WL is simply "listening" to a stream, then the payload would never be changing. Right? Of course if WL makes any request to the server (like a polling request), that would be a payload change.
I'm wondering if the WL client drops out (e.g. bad network connection), if the server would continue to stream? I'm assuming if the http handshaking stops, then the server would drop the connection (and sessionID). That still raises the question whether the original sessionID is still active when the network connection is re-established? (I'm glad you're working on this, and not me.)
Tradier Build 36 is ready. This one should do the trick.
Woohoo!
Although I'm confident, I'm still crossing my fingers until you finish your smoke test.
fyi, after frequently disconnecting/reconnecting during some other dev today, I ran into "too many sessions". The scenario involves closing and restarting WL frequently in a short period of time. I don't see a way to avoid that outcome at the moment.
It worked fine for a day, and I had one unexpected disconnect today at timestamp 10:09, with an unexplained reconnect more than 2 hours later (12;34). I was away from the computer when these happened. When I got back to my computer the green Connect button was on, but not account connection. This time clicking on the Connect button re-established the connection (12:57) without having to restart WL., which never was possible before the latest Tradier release.
Progress.
Progress.
QUOTE:
Timestamp Source Message Exception
"10/23/2024 06:01:33:570" "Tradier" "06:01:33.570 Initiating Tradier accounts socket...Start"
"10/23/2024 06:01:34:838" "Tradier" "06:01:34.838 Tradier Broker Connected on sessionID: 9b234854-4bd7-48d7-8a05-b9793dd29000"
"10/23/2024 10:08:55:756" "Tradier" "10:08:55.755 Tradier Broker socket disconnected: Lost; Reconnecting..."
"10/23/2024 10:08:57:167" "Tradier" "10:08:57.167 Tradier Broker reconnected after Lost"
"10/23/2024 10:09:05:861" "Tradier" "Broker.GetSessionID returned a null. Are you connected?"
"10/23/2024 10:09:08:627" "Tradier" "10:09:08.627 {error:session not found}"
"10/23/2024 10:09:08:628" "Tradier" "10:09:08.628 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/23/2024 12:34:18:598" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 62b622f2-ab7a-4f9c-858e-247a2ebe2b58"
"10/23/2024 12:55:14:812" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 62b622f2-ab7a-4f9c-858e-247a2ebe2b58"
"10/23/2024 12:57:30:101" "Tradier" "12:57:30.100 Initiating Tradier accounts socket...Start"
"10/23/2024 12:57:31:491" "Tradier" "12:57:31.491 Tradier Broker Connected on sessionID: 3cd2225b-7203-42f7-b847-202beaafd018"
I also saw trouble with a "Lost" streaming connection today, which reconnected but then seemed to have lost the streaming subscriptions somehow. :(
In your case that "Broker.GetSessionID returned a null" is a rare thing. It occurred seconds after a reconnect, which probably means there was still a shaky connection. If it enters that routine it definitely needs a new SessionID - the Server disconnected you because we couldn't get one. We'll change that to try a few times before failing. Thanks for the log.
In your case that "Broker.GetSessionID returned a null" is a rare thing. It occurred seconds after a reconnect, which probably means there was still a shaky connection. If it enters that routine it definitely needs a new SessionID - the Server disconnected you because we couldn't get one. We'll change that to try a few times before failing. Thanks for the log.
Failed again today but required restart to re-connect.
QUOTE:
Timestamp Source Message Exception
"10/24/2024 06:01:33:176" "Tradier" "06:01:33.176 Initiating Tradier accounts socket...Start"
"10/24/2024 06:01:34:467" "Tradier" "06:01:34.467 Tradier Broker Connected on sessionID: e49da9f5-94e6-4a87-a911-b801ed8bf3a7"
"10/24/2024 07:19:29:223" "Tradier" "07:19:29.222 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/24/2024 07:31:07:891" "Tradier" "07:31:07.891 Initiating Tradier accounts socket...Start"
"10/24/2024 07:31:09:557" "Tradier" "07:31:09.557 Tradier Broker Connected on sessionID: "
"10/24/2024 07:31:09:642" "Tradier" "07:31:09.642 {error:sessionid is a required parameter}"
"10/24/2024 07:31:09:642" "Tradier" "07:31:09.642 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/24/2024 07:31:09:684" "Tradier" "Auto-Connect Failed."
"10/24/2024 07:55:31:302" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 68666871-11e1-4f00-a6e9-aa0549d6d690"
"10/24/2024 08:32:22:843" "Tradier" "08:32:22.843 Initiating Tradier accounts socket...Start"
"10/24/2024 08:32:24:234" "Tradier" "08:32:24.234 Tradier Broker Connected on sessionID: "
"10/24/2024 08:32:24:314" "Tradier" "08:32:24.313 {error:sessionid is a required parameter}"
"10/24/2024 08:32:24:314" "Tradier" "08:32:24.314 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/24/2024 09:14:55:395" "Tradier" "09:14:55.395 Initiating Tradier accounts socket...Start"
"10/24/2024 09:14:56:804" "Tradier" "09:14:56.804 Tradier Broker Connected on sessionID: "
"10/24/2024 09:14:56:884" "Tradier" "09:14:56.884 {error:sessionid is a required parameter}"
"10/24/2024 09:14:56:884" "Tradier" "09:14:56.884 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
Tell you what, we use websockets all over the place without this kind of problem, but maybe we should just give up with Tradier.
Thinking that maybe we needed to use only one session for both market data and accounts websockets, I pinged Tradier on this "too many sessions" thing. They confirmed that we're doing it correctly (separate sessions), but they also offered this:
The 'too many sessions' error most often occurs when a system is going through a lot of connection requests due to connectivity issues and old streams are not being properly closed. We clear out all market data sessions overnight so there will normally be a fresh start each morning but if you need any help clearing connections just reach out to us with the account/email of the user having issues.
There you have it. In a poor connectivity environment, there's no way to "properly close" an old stream. When you have to reconnect, it's already too late.
Thinking that maybe we needed to use only one session for both market data and accounts websockets, I pinged Tradier on this "too many sessions" thing. They confirmed that we're doing it correctly (separate sessions), but they also offered this:
The 'too many sessions' error most often occurs when a system is going through a lot of connection requests due to connectivity issues and old streams are not being properly closed. We clear out all market data sessions overnight so there will normally be a fresh start each morning but if you need any help clearing connections just reach out to us with the account/email of the user having issues.
There you have it. In a poor connectivity environment, there's no way to "properly close" an old stream. When you have to reconnect, it's already too late.
Re: error:sessionid is a required parameter
Actually for this one, I noticed a bug that might not get a sessionID when required for a new connection. I'll take the hit for that.
Actually for this one, I noticed a bug that might not get a sessionID when required for a new connection. I'll take the hit for that.
QUOTE:
In a poor connectivity environment, there's no way to "properly close" an old stream. When you have to reconnect, it's already too late.
Very well put. The fundamental problem is there's no way for the software to know if it's a "hard" error or a "soft" error, so how should the client software proceed?
Sure, if it's a soft error, just try reconnecting with the same port# and sessionID. That should always work. But how do you know that it's a soft error?
If it's a hard error, then it isn't recoverable. Maybe it's time to switch off the computer and let the chips cool a bit, then restart it and try a different port# and new sessionID assuming the server side was able to close the old port# by some "undocumented" mechanism.
I don't think what you're experiencing is unique at all. But that "undocumented" mechanism might be unique to Tradier. Cone is suggesting it is; I'm undecided. I'm thinking the security box that prevents DoS attacks has your IP address on its watch list, so some of the retries aren't even reaching the server.
QUOTE:
There you have it. In a poor connectivity environment, there's no way to "properly close" an old stream. When you have to reconnect, it's already too late.
Where do you suspect the connectivity problem is occurring?
Have you asked Tradier if any other 3P platforms are having this problem? I don't have anything like this happening with Schwab.
QUOTE:
Where do you suspect the connectivity problem is occurring?
This was answered in Post #20.
QUOTE:
I don't have anything like this happening with Schwab.
Different "undocumented" port# recovery mechanism, and your IP address isn't on their security box's DoS hit list (At least not yet.).
Connecting and reconnecting is not the problem. As I see it, the problem is Tradier's constraint to the number of times a session can be connected in a short period of time. They reject those connections (that's the "ByServer" disconnects) - see Post #38 about what they do overnight.
Other providers don't have the same constraint. You connect and disconnect whenever you want as long as you have the correct credentials. It happens seamlessly throughout the day.
Other providers don't have the same constraint. You connect and disconnect whenever you want as long as you have the correct credentials. It happens seamlessly throughout the day.
QUOTE:
Other providers don't have the same constraint.
But are there other platform partners like WL that have gotten past this, or does Tradier have this problem with all / some of their partners? Tradier seems to imply they have never seen this problem before.
QUOTE:
You mean you think it's happening at my computer?
Well, the connectivity problem's long time persistence (over one second) tells me it's an active device. That is, a device with chips. Chips are in both your router and computer, but the chips in the computer get hotter, so it's most likely there. But I'm just "guessing" here.
If you're handy, go to your neighborhood electronics store and buy a can of freeze mist. Then try freezing the chips closest to your RJ-45 jack (Ethernet jack) on your motherboard. One of those will be the Ethernet chip. If the connectivity problem disappears for a while when you freeze that chip, then you found your problem.
If I were you--and I suggested this before--I would borrow you neighbor's laptop and try to reproduce the problem on his machine over your network connection. That would be simpler than using the freeze mist.
QUOTE:
Tradier seems to imply they have never seen this problem before.
Your network connectivity problem is really unique. I'm surprised something hasn't permanently cooked by now.
@innertrader. It's not your fault and not your hardware. Look, I don't have any problems with other providers either and I have them all. Given time, Tradier disconnects for me too. I just explained the difference for Tradier in Post #43.
Tradier is very well aware of the "too many connections" issue. And they're very happy to do "resets" if send them a message with your account's email. It can't just be us.
Maybe our websocket software is more susceptible to this kind of thing. Maybe we haven't found the right set of delays to avoid disconnecting and reconnecting 2 seconds later (transients). That's the one I see that Tradier tends to have trouble with.
Tradier is very well aware of the "too many connections" issue. And they're very happy to do "resets" if send them a message with your account's email. It can't just be us.
Maybe our websocket software is more susceptible to this kind of thing. Maybe we haven't found the right set of delays to avoid disconnecting and reconnecting 2 seconds later (transients). That's the one I see that Tradier tends to have trouble with.
It's just that Tradier's "claim to fame" is that they are the "API's API provider." No Frills. They have minimal desktop / browser functionality for account information and trading (as compared, say, to Fidelity with Active Trader, or even Schwab now with SoS). I have to use spreadsheets to get the performance tracking I want.
They position themselves as "API first," which should be a great fit for a platform like WL. I'm amazed they can't help you through this and it makes me wonder if there is a core defect in their API approach. Thus, my question, "Has anyone gotten this working?"
However, they are an active trader's dream, with their "all you can eat" options plan for $10 / mo. they charge $0 commissions on trades. (My apologies for being off topic, but I don't know how many people are aware of this unique offering.)
They position themselves as "API first," which should be a great fit for a platform like WL. I'm amazed they can't help you through this and it makes me wonder if there is a core defect in their API approach. Thus, my question, "Has anyone gotten this working?"
However, they are an active trader's dream, with their "all you can eat" options plan for $10 / mo. they charge $0 commissions on trades. (My apologies for being off topic, but I don't know how many people are aware of this unique offering.)
QUOTE:
@innertrader. It's not your fault and not your hardware.
I think it's a perfect storm between a problematic Internet connection and an overly conservative websocket policy with the sessionID.
@innertrader If you honestly believe Cone is right (not your hardware, although I think it is in part), then you should cancel your Tradier account immediately because it's not going to get any better.
@Cone I would be sure to use the most modern .NET 8 routines possible for the websocket calls. If you're already doing that, then I would dump the .NET calls and go with a different websocket library that has a watchdog timer that forcibly closes the websocket if one is screaming data and suddenly all screaming stops for no reason. (Obviously, this effort will fail if it's a hardware problem. In that case, one needs to fix the hardware.)
But honestly, if such a watchdog timeout feature was necessary, I think all the websocket libraries would be already supporting it. Just my two cents.
@Cone
I don't know if these logs from today are technically helpful to you or not. If these are redundant, please let me know and I won't send any more.
I don't know if these logs from today are technically helpful to you or not. If these are redundant, please let me know and I won't send any more.
QUOTE:
Timestamp Source Message Exception
"10/25/2024 06:02:16:483" "Tradier" "06:02:16.483 Initiating Tradier accounts socket...Start"
"10/25/2024 06:02:17:759" "Tradier" "06:02:17.759 Tradier Broker Connected on sessionID: edcdc529-acce-490c-a280-d49e82bdbbd7"
"10/25/2024 08:38:56:014" "Tradier" "08:38:56.014 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/25/2024 08:41:02:175" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 9534ffcf-c281-4123-b76d-55a9e453a6d4"
"10/25/2024 10:05:03:642" "Tradier" "Streaming Disconnected - attempting Reconnect: Error, CloseStatus: , SessionId: 9534ffcf-c281-4123-b76d-55a9e453a6d4"
"10/25/2024 10:05:12:394" "Tradier" "Streaming Reconnect Successful"
"10/25/2024 11:00:27:093" "Tradier" "11:00:27.093 Initiating Tradier accounts socket...Start"
"10/25/2024 11:00:28:711" "Tradier" "11:00:28.711 Tradier Broker Connected on sessionID: "
"10/25/2024 11:00:28:793" "Tradier" "11:00:28.793 {error:sessionid is a required parameter}"
"10/25/2024 11:00:28:794" "Tradier" "11:00:28.794 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/25/2024 11:00:28:898" "Tradier" "Auto-Connect Failed."
"10/25/2024 11:10:20:620" "Tradier" "11:10:20.620 Initiating Tradier accounts socket...Start"
"10/25/2024 11:10:22:142" "Tradier" "11:10:22.142 Tradier Broker Connected on sessionID: "
"10/25/2024 11:10:22:223" "Tradier" "11:10:22.223 {error:sessionid is a required parameter}"
"10/25/2024 11:10:22:223" "Tradier" "11:10:22.223 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/25/2024 11:10:22:247" "Tradier" "Auto-Connect Failed."
"10/25/2024 11:20:08:922" "Tradier" "11:20:08.920 Initiating Tradier accounts socket...Start"
"10/25/2024 11:20:10:438" "Tradier" "11:20:10.438 Tradier Broker Connected on sessionID: "
"10/25/2024 11:20:10:520" "Tradier" "11:20:10.520 {error:sessionid is a required parameter}"
"10/25/2024 11:20:10:521" "Tradier" "11:20:10.521 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/25/2024 11:20:10:584" "Tradier" "Auto-Connect Failed."
"10/25/2024 12:03:13:815" "Tradier" "12:03:13.815 Initiating Tradier accounts socket...Start"
"10/25/2024 12:03:15:245" "Tradier" "12:03:15.245 Tradier Broker Connected on sessionID: "
"10/25/2024 12:03:15:338" "Tradier" "12:03:15.338 {error:sessionid is a required parameter}"
"10/25/2024 12:03:15:338" "Tradier" "12:03:15.338 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
"10/25/2024 12:03:27:204" "Tradier" "12:03:27.204 Initiating Tradier accounts socket...Start"
"10/25/2024 12:03:28:542" "Tradier" "12:03:28.542 Tradier Broker Connected on sessionID: "
"10/25/2024 12:03:28:627" "Tradier" "12:03:28.627 {error:sessionid is a required parameter}"
"10/25/2024 12:03:28:627" "Tradier" "12:03:28.627 Tradier Broker socket disconnected ByServer. Click Connect or restart WealthLab."
Not required. Like I said before I already own the error for {error:sessionid is a required parameter}. We'll get something out early next week, if not before.
Frist run after updated extension. Does this look better?
QUOTE:
Timestamp Source Message Exception
"11/4/2024 06:01:48:832" "Tradier" "06:01:48.831 Initiating Tradier accounts socket...Start"
"11/4/2024 06:01:50:278" "Tradier" "06:01:50.278 Tradier Broker Connected on sessionID: 6c674679-7231-4d5d-9e4b-4ce83e02cd36"
"11/4/2024 06:01:56:700" "Tradier" "Connected"
"11/4/2024 06:02:07:169" "Yahoo! Finance" "Connected"
"11/4/2024 06:48:16:394" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: fdd8d1d8-5536-4647-9c4d-4e298dc6ee3c"
"11/4/2024 07:58:23:378" "Tradier" "07:58:23.378 Tradier Broker socket transient disconnect: Lost;"
"11/4/2024 07:58:24:735" "Tradier" "07:58:24.735 Tradier Broker reconnected after Lost"
"11/4/2024 11:22:49:586" "Tradier" "11:22:49.586 Tradier Broker socket transient disconnect: Lost;"
"11/4/2024 11:22:50:979" "Tradier" "11:22:50.979 Tradier Broker socket disconnected: Error; Reconnecting..."
"11/4/2024 11:22:54:907" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: fdd8d1d8-5536-4647-9c4d-4e298dc6ee3c"
"11/4/2024 11:22:57:276" "Tradier" "11:22:57.276 Tradier Broker reconnected after Error"
One thing I've noticed immediately is after a
It's now able to recover the lost connection with the same SessionID. That's serious progress.
So are the same .NET 8 websocket routines being employed, or has the Tradier client switched to something else?
QUOTE:
Tradier Broker socket transient disconnect: Lost;
It's now able to recover the lost connection with the same SessionID. That's serious progress.
So are the same .NET 8 websocket routines being employed, or has the Tradier client switched to something else?
QUOTE:Was there a connection problem that you noticed (without looking at the log)?
Does this look better?
It looks to me like the socket recovered from a transient disconnect and another one that dropped out for several seconds.
QUOTE:
Was there a connection problem that you noticed (without looking at the log)?
No. I simply checked the log to see if there were any of the failure messages after the update and also to see if there were many disconnects / reconnects. Today I got only one disconnect / reconnect. Wonder why there's so much variation from day-to-day. What could be the source of that? My Schwab log is drama-free.
.
QUOTE:
Timestamp Source Message Exception
"11/6/2024 06:02:24:203" "Tradier" "06:02:24.202 Initiating Tradier accounts socket...Start"
"11/6/2024 06:02:25:476" "Tradier" "06:02:25.476 Tradier Broker Connected on sessionID: 1a705dd6-cb18-4a27-9185-1c3fed01b3c8"
"11/6/2024 09:14:36:287" "Tradier" "Tradier Streaming Reconnected after Lost on sessionID: 90f1f7cf-2c57-4912-9210-c76f86ebe669"
One difference is that our Schwab extension does not use a Websocket for broker connections, only streaming data. So if you are not using streaming data powered by Schwab you are not using any Websocket in Scwhab.
Apart from seeing 1 second reconnect events in the log (we can remove that logging), I think we're done here, finally. Closed!
Start a new topic if something else comes up.
Start a new topic if something else comes up.
Your Response
Post
Edit Post
Login is required