IBKR algorithmic order errors

Brian - I'm running some strategies and received the following error from IBKR:

quantrocket.blotter: WARNING ibg2 client 6001 got IBKR message code 202: Order Canceled - reason:In accordance with our regulatory obligations, we have rejected this order because it is too large compared to the liquidity that is generally available for this product. If you would like to submit an order of this size, please submit an algorithmic order (such as VWAP, TWAP, or Percent of Volume)

I know from the Usage Guide that using IBKRs VWAP algo is the answer when you receive this error message / rejected order. That said, a couple of comments / questions:

  • It's hard to know in advance which orders will be rejected. Can the order instructions be conditional so that the first attempt is to (for example) buy Market on Open and if it's rejected then use the VWAP algo? Or, does that strategy have to be all or nothing with the IBKR order instructions?
  • Does the "usstock-1min" price history include VWAP?
  • Any rules of thumb or observations about order sizes that tend to get rejected?

Thanks.

  • There's not a conditional order of that kind but you can monitor for rejected orders and resubmit them if needed.
  • US Stock does not include VWAP.
  • You may need some trial and error depending on your strategy, but one approach might be to limit your order to a certain percentage of daily (or minutely) trading volume.

You can also exclude illiquid stocks from your screen, since this is less likely to be an issue with liquid stocks.

@Brian got it, and makes sense.

In a Zipline algo if you want to take advantage of the IBKR Execution / Variant Algos I have a couple of follow on questions:

  1. Would the code to leverage VariantAlgos in Zipline be in MarketOnOpenOrder with Algo Params nested as follows:
    style = MarketOnOpenOrder(
    "Algo Strategy" = "Vwap",
    "AlgoParams" = { "maxPctVol": 0.1,
    "noTakeLiq": 1,
    },
    ????

  2. Do you have any Zipline IBKR Execution / Variant Algo examples? (The Usage Guide provides an example but it looks like it's more designed for Moonshot)

Thank you.

Execution orders must be exected in the continuous session, they're not compatible with the opening or closing auctions.

There's an example of using order_params to send an algo order in Zipline in the usage guide.

1 Like