syncRequest under Market Replay mode

Hello everyone.

I’ve been trying to make a syncRequest using the /user/syncrequest endpoint.

I can successfully make the request with my demo account, however when I try to do it while in market replay it either connects to my realtime demo account (if I use “users” parameter in the body) or returns an empty array (if I use the “accounts” parameter in the body).

Is there any special socket url or configuration to make a syncRequest while in Market Replay mode?

Hi @gustrom,

When you’re using a Market Replay socket, use it for everything. The Market Replay protocol doubles as both the standard real-time protocol and the Market Data protocol. So instantiate one replay socket, then start your syncRequest and getChart/qoute/DOM requests to that same replay socket.

When I’m using market replay, what I’ll typically do is pass in the websockets that I want to use for whatever strategy I’m testing, something like this:

//I like to use global sockets, so I'm not wasting resources instantiating a bunch
const [syncSocket, mdSocket, replaySocket] = await connectSockets()

const myStrat = (syncSocket, mdSocket) => { /*strategy implementation*/ }

const myNonReplayStrat = myStrat(syncSocket, mdSocket)
const myReplayStrat = myStrat(replaySocket, replaySocket)

This way, I can use the same strategy code whether I’m using market replay or just playing with regular simulation mode.

2 Likes

Thank you @Alexander, worked like a charm! :ok_hand:

1 Like

Hi,

I just purchased the $49 market replay subscription, but it does not work.

I’ve tried adjusting the settings to no avail. Do I need a separate data feed for it?

Thx