Replay api

Replay api, the marketdata works but the api websocket seems unstable.

when I connect to the replay websocket, I use wss://replay.tradovateapi.com/v1/websocket for both marketdata and api websocket, the marketdata websocket works fairly well but the api websocket constantly disconnects.

Can I get some assistance with this issue?

bump… The replay websocket api just disconnects constantly…

Seems like it’s an http 429 error, what’s the rate/ time limit on the replay websocket?

--- request header ---
GET /v1/websocket HTTP/1.1
Upgrade: websocket
Host: replay.tradovateapi.com
Origin: https://replay.tradovateapi.com
Sec-WebSocket-Key: xxx
Sec-WebSocket-Version: 13
Connection: Upgrade

I think that means you have multiple connections going at the same time, that would cause the websocket to disconnect anytime you exceed 1 (or 2 if you have multiple connections) connection.

I don’t think it’s a multiple connection issue.
If I login to the browser, the replay, live and simulation all works fine.
If I connect via websockets, the simulation and live works but the replay api just returns http 429 errors.

This is a consistent issue, I cannot use the replay feature because it’s always errors with http 429 errors…

while the replay api i sending 429 errors, if I change the wss urls to demo or live they both work. It’s a consistent error with the replay api so much so that I can’t even use it… even though I pay extra for that service…

I think something is going on with how you are using the replay API. Could you walk me through your process for connecting to the API?

One thing I see commonly is people trying to connect a replay socket along with the user data API and/or market data APIs - when you use the replay API it should be used as a replacement for both the user data and market data APIs. You should send all requests through just the replay API if you use it at all. So that means that you can treat the replay API like its a combination of both the market data and user data APIs. I believe that it will consume one of your available connections to use the replay API as well, additional to standard live/demo connections. You also unfortunately cannot view your replay on the trader platform while it happens - it will start a new session unique to the Trader app if you try, and the old replay will be disconnected.

when I connect to the websocket I only use wss://replay.tradovateapi.com/v1/websocket

I use that for both marketdata and api calls. I typically login, call the replay init endpoint with a date, time and speed.

I seem to run into rate limits when either resetting the replay or if I need to change something in my code, where i disconnect then try to reconnect i’ll get 429 errors. Sometimes I get 429 errors on my first connection to the replay endpoint, if I change the wss url to either live or simulation, there’s no problems.

Before you start the replay session, do you use the replay/checkReplaySession endpoint to ensure that the timeframe is valid?

Yes I am sure that it’s valid. I can be in an active connection just replaying a session, then I start getting errors from api websockket connections, then when I enable debugging on my websocket connection I see these types of errors.

-----------------------
--- response header ---
HTTP/1.1 429 Too Many Requests
content-length: 0
Date: Sat, 21 May 2022 02:42:16 GMT
Via: 1.1 google
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Connection: close
-----------------------
--- request header ---
GET /v1/websocket HTTP/1.1
Upgrade: websocket
Host: replay.tradovateapi.com
Origin: https://replay.tradovateapi.com
Sec-WebSocket-Key: xxx
Sec-WebSocket-Version: 13
Connection: Upgrade

why would would an active websocket connection start sending these errors?

If you hit the rate limit, this is the response. Do you have any loops anywhere that may be continuing to make request that you aren’t seeing? Many requests in a few seconds will cause this type of response.