Ghost Orders Randomly Appear Over Night

I have been trying to make sense of “ghost orders” appearing over night via API Key on my paper account.

I haven’t figured out why this is happening. These orders should not be appearing as there is no API activity on my end. I don’t have a client online to make the API calls at the times listed below.

In this example for PFE, I open an order with the API at 2:51 PM and then close the order via UI at 2:52 PM. Randomly, overnight at 3:00 AM, a close order populates via API Key (even though my API client is offline). It’s impossible for me to have initiated the close order.

Probably a user error on my end, but I haven’t figured it out.

I am thinking these late, end-of-day orders are stuck in a queue somewhere on Alpaca’s side and not populating in the Alpaca Order Status UI. It feels like an end-of-day race condition where orders closed via UI remain “on-the-books” until some batch process runs on Alapaca’s side.

1 Like

hi! Mahmoud from the product team here. Can you give me an example order_id to check it on our end?

1 Like

@cmaer348 I looked at the Alpaca logs and all 4 of the orders you are showing were submitted with the same API key and from the same IP address. Your algo is placing these orders.

The confusion may be the time listed is the submitted time. That is the time which Alpaca actually sends the order to an execution partner. The order submitted on Monday at 03:00:08 was actually created the previous Friday 2023-10-06 at 3:36:22 PM. The created time is when Alpaca receives the API request to place the order. That is the time your client sent the order.

The markets were closed when the order was created (these times are in US Central Time) so it was held over the weekend and submitted for execution the next trading day (which was Monday). Your client was running when the order was created (and sent to Alpaca) but it doesn’t need to be running when Alpaca subsequently submits it for execution.

The created_at time can be seen by clicking on the order to then show all the order detail as seen in the example below (for some reason the created_at time isn’t a column option).

Does that clear up the mystery of the “ghost orders”?


Thanks, Dan and Mahmoud! I appreciate this. It clears things up on my end.

1 Like

@cmaer348 Glad that helped. Good luck!