Orders not filling for even small amounts

The good:

I love the idea of Quantopian, and I've become addicted. I'm a day trader, and I'm also a Sr. Solution Architect and software engineer. When I trade, I trade based on momentum. I look for new highs on stocks intra-day, and I trade in the $1 -$10 range, all the time in Scottrade. The idea that I could write code to do what I do, and go somewhere else and sip on a mojito is something I simply adore, and if I can program the system to do what I do normally, that will be awesome.

3
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 591124ed8d263061e4a27bd7
There was a runtime error.
6 responses

There is a good explanation of the slippage model used by the backtester in Quantopian documentation https://www.quantopian.com/help#ide-slippage

You might find interesting that it is possible to customize the slippage model, so that it better suit your evidence of how the market behaves.

Also, this is a blog post by Quantopian that you might like to read https://blog.quantopian.com/accurate-slippage-model-comparing-real-simulated-transaction-costs/

The notes below denote that you are restricted to a certain amount of the Market's volume:

When an order isn't filled because of insufficient volume, it remains open to be filled in the next minute. This continues until the order is filled, cancelled, or the end of the day is reached when all orders are cancelled. Slippage must be defined in the initialize method. It has no effect if defined elsewhere in your algorithm. If you do not specify a slippage method, slippage defaults to VolumeShareSlippage(volume_limit=0.025, price_impact=0.1) (you can take up to 2.5% of a minute's trade volume).

1. Let's say we are at bar 1
2. There are 300,000 traders who want to buy stock from company ABC
3. The first trade places a buy order for 10,000 shares, and prior to his trade, there is no volume.
4. If this platform is basing my ability to buy based on a percentage of the volume, assume all 300,000 traders were Quantopian algorithms, would anyone be able to get filled?

It may sound like a stupid question, but if I can only buy based upon 2.5% of the minutes trading volume. Then the slippage model is saying that I can't buy unless someone else buys. Isn't that a Chicken and Egg scenario? Shouldn't my buys be based on Company ABC's outstanding shares with respect to their demand? Maybe, I'm not understanding. So, someone who is an an expert level, please explain this paradox.

Slippage is used to simulate"What would have happened in the past if we had bought/sold those securities in that amount?". This obviously doesn't apply when you deploy your algorithm for live trading, in this case the orders are sent to your broker (IB or RH) and the market will decide when/how your orders will be filled. Quantopian slippage model (and commission model) is irrelevant in live trading.

So slippage is only used to have a reasonable simulation of the past so that you can evaluate your strategy. When you develop your Slippage model the main concern is to not be too optimistic so that you don't live trade strategies that work well only in backtesting. The second goal of a Slippage model is to be realistic, so that you can see if a trading strategy works. This might be difficult in the sense that the model might work well for the majority of the stocks (e.g. high volume stocks) but it might have some problem with a particular class of stocks (e.g. low volume stocks). This is the reason why Quantopian allows to define your custom slippage model, to better suit the class of stocks that your strategy trades.

The accuracy of Q slippage model seems to be your concern: you have evidence that your have better chances in reality to fill your orders than what happens in the backtester. I would suggest to customize your slippage model so that it is in line with what you see in reality and so you can trust the results of your backtests. If you have an Interactive Brokers account you can paper trade your algorithm with them before going live, in this way you also test another independent slippage model, reducing the risk of having been too optimistic before going live.

Volume is the number of shares or contracts traded in a security or an entire market during a given period of time. For every buyer, there is a seller, and each transaction contributes to the count of total volume.

Volume information makes sense only for historical data, that is when the slippage model is used. For live trading it is the market that decide when your orders are filled and how much. So I am not sure to understand the question you raised.

Thank you very, very much. It makes perfect sense the way you explained it.

"This obviously doesn't apply when you deploy your algorithm for live trading, in this case the orders are sent to your broker (IB or RH) and the market will decide when/how your orders will be filled. Quantopian slippage model (and commission model) is irrelevant in live trading."

I simply could not imagine not being able to purchase shares. I trade with Scottrade Elite and I trade large quantities of penny stocks all the time with no issues getting in or out with limit orders. I get filled in seconds and I'm out in seconds, after a penny or two on a move either way. I typically look for volume over a million and floats above 100 million.

Now, given you were smart enough to answer my question, and what you are stating actually makes sense, can I turn slippage off and get my orders filled immediately. Granted this is gleefully optimistic, but it's more in line with my experience during peak trading hours. Again, thank you for the awesome info.

You can set the following in the initialize function of your algorithm:

From the documentation:

Fixed Slippage

When using the FixedSlippage model, the size of your order does not
order, half of the spread is added to the price; when you place a sell
order, half of the spread is subtracted from the price.

Fills under fixed slippage models are not limited to the amount traded
in the minute bar. In the first non-zero-volume bar, the order will be
completely fille
d. This requires you to be careful about ordering;
naive use of fixed slippage models will lead to unrealistic fills,
particularly with large orders and/or illiquid securities.

Thanks. Based on what you stated, the typical spread for the stocks I trade is 1 to 2 cents. So, I'm assuming this would be in line with those metrics.