expireTime parameter ignored for limit order when using replay

My script can successfully place limit orders using live API and orders expire automatically when I set the expireTime field. When using the same script to submit limit orders during replay, the orders execute but expireTime is ignored. I’ve tried current time, CMT, and replay time but expireTime is ignored in all cases using replay. Worth noting that when I set expireTime to replay time, the order did not execute at all - it never makes it to the order book. Any help is much appreciated!

1 Like

I’m reaching out again because I’m still facing an issue with the ‘expireTime’ field when using the replay API. My script has been successful in placing limit orders in live trading and the ‘expireTime’ feature works flawlessly there. However, the same script doesn’t behave as expected in the replay mode. It seems that the ‘expireTime’ field is simply ignored.

I’ve tried setting ‘expireTime’ to the current time, CMT, and even the replay time itself. The latter approach resulted in orders not executing at all - they never make it to the order book.

This issue has been a bottleneck for my progress, and I kindly request your assistance to troubleshoot and resolve this matter.

I am running into the same issue. If you pass a time that make sense in terms of the replay you get this error. Basically it looks like replay isn’t set up to handle expireTime limt orders

{ "s": 200, "i": 8, "d": { "errorText": "Set(RuleViolation(Some(2023-08-08T13:33:28.063Z),expireTime,Some(Expire Time should be in the future)))" }

if you pass a time that is in present time, aka actually in the future it seem to ignore as you stated above. @Alexander help appreciated.

@reason Is there a hacky solution we could toggle with a devMode boolean to replicate the expire time functionality? Like store the order id and send cancel order after x time

That’s what I’ve done to as a workaround. It works but it would still be nice to have the same exact flow during testing that I have live.

Hi All. Along the same lines, how do you place an order using replay? I’m getting an access denied error when sending my websocket orderstrategy/startorderstrategy message, and I believe it’s because the accountId I’m sending in the message is incorrect because it’s the accountId for my DEMO account. I’m using the /account/list endpoint to get the account attributes and accountId, but that is only returning the DEMO accountId. Any tips would be great on how you get that accountId for replay and successfully place an order.

And now it seems like something has changed. My cancel request results in the following 200 code error message:

Execution Provider Unavailable

Really need Tradovate to implement the expiration function in replay mode. At the very least, please restore this execution provider. @Alexander

I don’t believe using your demo account matters in replay matters. Placing an order in replay works exactly the same as in demo simulation only difference is what socket url you send the request to. For demo simulation you create a web socket with WS_DEMO_URL = 'wss://demo.tradovateapi.com/v1/websocket', and send requests.

Explicitly In replay you:

  1. Create a websocket with WS_REPLAY_URL = 'wss://replay.tradovateapi.com/v1/websocket'
  2. Send an replay/initializeclock request to start the replay
  3. Send a place order request as you normally would but to the replay socket connected WS_REPLAY_URL = 'wss://replay.tradovateapi.com/v1/websocket'

If you log into your Tradovate account on the web, click into Market Replay, and then start your replay session on your local machine you can watch the replay on Tradovate.

Do you have any code snippets to see further where your issue might be?

Thank you. I did get it working. One thing with watching the replay on Tradovate though is it seems to increase my probability of getting a 429 too many requests error. In fact, many times when I’m not even running a systematic replay from my code, I login to Tradovate and run a replay session from there (with no other replay sessions running) and it will run into the 429 issue. Do you know why that is happening, even just from the Tradovate UI? It seems to have happened more lately (in the last ~1 week) when it wasn’t happening nearly this much 1+ weeks ago.

1 Like

Unfortunately I do not. I have not ran into this bug

Glad you got your issue resolved. The problem of expireTime parameter in replay mode still exists. And the workaround no longer works so the original issue posted here still needs attention.