Check Logic
The following conditions must be met for the order to be accepted by the exchange: 1. The order must be submitted to the exchange at least 1 minute before the close if there is no imbalance. (Transmission latency must be factored in when placing the order) 2. If there is an imbalance, and the order has the right direction (e.g. buying for a sell-imbalance), the order may be submitted any time before the close.
Fill LogicWait for the closing print (aka 6 print) and then fill the order at the closing price. The number of shares filled is the symbol's ask_size * lot_size. If the order is partially filled, the remainder will be cancelled at the end of the simulation since there is at most one closing print for each symbol.
Cancel LogicAllow the order to be cancelled if the cancel is requested at least 1 minute before the market closes.