Mariner Backtesting - ARCA midpoint limit sell Logic

Check Logic

Accept the order if the limit is greater than 0

Fill Logic

Fill the order at the midpoint of the bid/ask if the last price is less than the midpoint and the midpoint locks or crosses the limit.

midpoint = (ask + bid) / 2.0

 

The number of shares filled is the symbol's bid_size * lot_size or order shares, whichever is smaller. If the number of shares filled doesn't completely fill the order, the remainder of the order is put back into the queue for later fill attempts. This fill provides liquidity.

Example 3 (limit sell, filled order): We place an arca_midpoint_limit_sell on AAPL for 120.

limit price bid ask last midpoint order filled?
120 120.33 121.08 120.82 120.7050 Yes

The hundredth-penny-rounded midpoint is (120.33 + 121.08) / 2.0 == 120.7050. Since 120.82 > 120.7050, the order gets filled at 120.7050

Cancel Logic

The order can be cancelled at any time