【CJ Advanced Continuation 01/30 · Overall 29th Article】

The most dangerous thing is not that the order wasn’t sent out, but that the system thinks it’s already finished.

A typical hedging strategy usually involves at least several layers of status: whether the order was accepted, whether it was truly filled, how much was filled, whether the position was updated, and whether the other leg also completed. When the interface shows “Filled,” it only means that one step in the chain returned a result—it does not mean the entire paired combination has been fully closed.

Especially when both sides execute at the same time: one side may be completely filled while the other is only partially filled; or the exchange may return updates with a delay—your program receives an old status first, then receives the new fill report later. If the system immediately places additional orders in that moment, it may duplicate and increase exposure; if you treat an unknown status as a failure, you might end up cancelling orders twice.

There’s another easily confusing point: the order update answers about that specific order, while the position reconciliation answers what risks remain when considering both sides together. Only by putting the actual filled quantities of each leg into the same table can you distinguish what has already completed from what is still exposed.

So the strategy needs to preserve order identity, filled quantity, and the latest update time, and treat “unknown” as its own separate status. First verify the real position, then decide the next action. Arbitrage is not about sending two orders at the same time—it’s about driving both risk paths to places where they can be explained and accounted for.

Next article: After a restart, the first thing to restore is not the order placement function.

#套利执行 #risk management