# expireTime parameter ignored for limit order when using replay

**URL:** <https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367>\
**Category:** Community Support\
**Created:** [August 21, 2022, 2:32am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367 "2022-08-21T02:32:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![reason](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@reason](https://community.tradovate.com/u/reason)\
**Post date:** [August 21, 2022, 2:32am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/1 "2022-08-21T02:32:34Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![reason](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@reason](https://community.tradovate.com/u/reason)\
**Post date:** [June 18, 2023, 5:19pm UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/2 "2023-06-18T17:19:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colby\_Gilbert](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Colby\_Gilbert](https://community.tradovate.com/u/Colby_Gilbert)\
**Post date:** [August 11, 2023, 3:36am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/3 "2023-08-11T03:36:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![reason](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@reason](https://community.tradovate.com/u/reason)\
**Post date:** [August 18, 2023, 12:23am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/4 "2023-08-18T00:23:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AaronL](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@AaronL](https://community.tradovate.com/u/AaronL)\
**Post date:** [August 21, 2023, 4:49am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/5 "2023-08-21T04:49:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![reason](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@reason](https://community.tradovate.com/u/reason)\
**Post date:** [September 3, 2023, 12:12am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/6 "2023-09-03T00:12:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colby\_Gilbert](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Colby\_Gilbert](https://community.tradovate.com/u/Colby_Gilbert)\
**Post date:** [September 6, 2023, 8:37am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/7 "2023-09-06T08:37:08Z")

</div>

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](https://api.tradovate.com/#operation/initializeClock) 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?

---

<div class="post-metadata">

**Author:** ![AaronL](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@AaronL](https://community.tradovate.com/u/AaronL)\
**Post date:** [September 6, 2023, 7:43pm UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/8 "2023-09-06T19:43:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colby\_Gilbert](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Colby\_Gilbert](https://community.tradovate.com/u/Colby_Gilbert)\
**Post date:** [September 7, 2023, 3:22am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/9 "2023-09-07T03:22:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![reason](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@reason](https://community.tradovate.com/u/reason)\
**Post date:** [September 7, 2023, 3:27am UTC](https://community.tradovate.com/t/expiretime-parameter-ignored-for-limit-order-when-using-replay/5367/10 "2023-09-07T03:27:36Z")

</div>

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.
