Paper MOC orders partially fill remainder expires, same setup on live works

I run a daily strategy that submits market-on-close orders (type=market, time_in_force=cls) around 15:40 ET.

On my live account these MOC orders fill 100%, no issues. On a paper account running identical logic, each order fills partially at the 16:00 close and the unfilled balance gets status=expired a few seconds later.

Paper (account ACTIVE, ~$100k cash, ~$332k buying power, so not a BP issue):

(my live orders are smaller than the paper ones)

Symbol Ordered Filled Status
SGOV 99 99 filled
IEF 277 274 expired
GLD 71 40 expired
TQQQ 492 30 expired

filled_at ≈ 19:59:55Z (right at the close), expired_at ≈ 20:00–20:02Z.

Has anyone else experienced this?

Is there a work around?

@Coconut While paper accounts mimic the behavior of live accounts very well, there are a few differences. One is partial fills. Paper accounts randomly add partial fills. They will typically eventually fill, but in the case of an order placed at market close, they may expire before filling completely. Partial fills can always occur in live trading, but they are rare. A higher percentage of partial fills is intentionally introduced in paper trading to ensure one’s algo sees these situations and handles them gracefully.

A few other things to note specifically about time_in_force=cls orders. Paper trading treats these simply like market orders placed at the close. They will fill at the current bid exactly like any other market order. They will not fill at the actual end of day auction price. Additionally, MOC orders are not generally supported in live trading unless one has chosen the elite smart router order handling.

1 Like

Thank you for clarifying what’s going on here.
I am trading highly liquid assets like SGOV, TQQQ, GLD, so I would assume most of the time MOC orders would fill in live.
Is there a way to get my Paper to function similar way?

The reason I want this is that I have two engines running the same strategy so I can detect any error/ discrepancy easily. (I consider switching in the future from one to the other but want to monitor for a longer period first)

Or would it be best to do a work around and do market day orders at T-30s of closing for the paper trading?