Limit orders placed close to (or at) the spread can occasionally error out with a 400 Bad Request
error. The typical error message returned is:
{
"ErrorInfo": {
"ErrorCode": "OnWrongSideOfMarket",
"Message": "Price is on wrong side of market"
}
}
This should be expected when trading near the spread, as the market can move beyond the chosen limit price in an instant. Especially in an active market and with substantial round-trip latencies (300+ ms), errors should be anticipated. Client-side quotes cannot be refreshed quick enough to overcome market movements in the latency interval.
The best strategy to ensure successful order placement at the chosen price is to use Immediate or Cancel
order durations. This duration is essentially a market order with a cap on the fill price: if the limit price cannot be met (or improved upon), the order is instantly cancelled. To increase the likelihood of a 'hit', allow for a slight tolerance in price by setting the limit order price 0.01% below the last-seen quote. If an error is observed, re-try the order (with updated limit price if available).
On Saxo Platforms, this feature is implemented as the "Quick Trade" order ticket. Note how the limit price tolerance is set 0.01%, or about 1 pip away from the spread (this value can be configured by the end-user). If a 0.00% price tolerance is chosen, the likelihood of a "out of market" limit price is increased, which means the order is rejected. This is shown on the platform: