@Robin Gane-McCalla You can 'get around' this message by closing all open orders at the end of the day. That is what the code above will do. The cancel_all_open_orders
function will cancel any unfilled, or partially filled, orders. Therefore, when the backtest engine checks for open orders at the end of the day, it will never find any, and therefore, won't generate those warning messages.
The short answers to your questions are 'yes' and 'yes'.
Yes, the reason why orders go unfilled, or partially filled, is there isn't enough volume traded. The order filling process is controlled by the slippage model. The default model fills an order with a maximum of 10% of the minute volume. Consider the case where one orders 100 shares of XYZ and the trading volume was 870 and 900 shares for the following two minutes. The order would fill 87 shares in minute 1 and the remaining 13 shares in minute 2. One can over-ride the slippage model or write a completely custom one. However, the default has been shown to be pretty close to 'real life'.
Note the situation where there may be enough daily volume but one trades in the last few minutes of the day. The same thing happens. Not only consider the total daily volume but the 'net volume left in the day'.
Yes, generally do not trade low volume stocks. The backtest engine will most certainly be wrong or misleading especially if placing market orders. It's not just a matter of eliminating the warnings, but ensuring the backtest results resemble live trading results. The QTradableStocks
universe will screen these out and is why it's good practice to start there.
Disclaimer
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.