Mariner Backtesting - ARCA midpoint limit buy 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 ask_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:

round((120.33 + 121.08) / 2.0, 4) == 120.7050

 

Example 1 (limit buy, filled order): We place an arca_midpoint_limit_buy on GOOG for 800.

limit price bid ask last midpoint order filled?
800 798 799 798.43 798.5000 Yes

Since 798.43 < 798.5000, the order gets filled at 798.5000

Example 2 (limit buy, unfilled order): We place an arca_midpoint_limit_buy on GOOG for 800.

limit price bid ask last midpoint order filled?
800 798 799 798.61 798.5000 No

Since 798.61 > 798.5000, the order will not be filled yet. The order will be postponed until later.

Cancel Logic

The order can be cancelled at any time