API Trading on Demo Account - Multiple Demo Accounts?


I have been able to initialize the clock and get updated clock time steps in a demo account using the following:


{"startTimestamp": "2022-05-13T14:04:30.000Z", "speed": 400, "initialBalance": 51000}

What I then noticed is when I queried:

------ sending MD API  ------

------ end send ------

I then see RPLUSERID-##, where the ## I think keeps incrementing. I think I have ~80 demo accounts now ha. A few questions:

  1. I guess my code re-creates a demo account each time I restart it as I’m developing it… Is there a proper way to clean up old demo accounts?
  2. Using a orderStrategy/startOrderStrategy, I see there are parameters for “Account ID” and “Account Spec” . How do I specify which demo account to execute the trade on?
  3. Once you start a demo account, is the clock always running on the server, even after I disconnect?

Thanks for the feedback and all your help!

Hi @Boomerang, you’re actually using the replay mode doing what you are currently doing, not a demo account. What using replay does is create a unique session that replays some data from the past, with an account specifically for that session. Each new replay session creates a new account. Each of those accounts you see by querying replay represents a past session.

To use current data in demo mode on a WebSocket, connect to wss://demo.tradovateapi.com/v1/websocket and authorize it with a token retrieved from https://demo.tradovateapi.com/v1/auth/accesstokenrequest.

Ah! gotcha!

Do I need to clean up the replay accounts or anything? Or just leaving a minefield of them is alright?

Thanks so much @Alexander for all your help!

Nope, you can leave them alone (and in fact, you can’t do anything to them). They will be archived on their own and eventually disappear from that list. Look at the one with the latest timestamp. I’m pretty sure that the account that is active on replay mode will have its active property marked true, vs the old ones which will have active: false.