The only things that directly affect slippage is the stocks price & volume.
From my experience, market caps provide a much larger margin of error when calculating price impact & volume (both accessed through quantopians VolumeShareSlippage model), don't even pay attention to it when calculating slippage
If you want to calculate a worst case scenario with regard to the volume limit & price impact on your algorithm pass a volume limit as well as a price limit. Heres an example (if you actually use this, I would use a larger window length for volume & the current price as a reference point rather than a SMA when setting a price restriction)
sma_2 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length = 2)
avg_volumee = AverageDollarVolume(window_length = 2)
pipe_screen = ((avg_volumee >= 3000000) & (sma_2 >= 5.0))
pipe_columns = { 'sma2': sma_2, 'avg voII': avg_volumee}
pipe=Pipeline(columns=pipe_columns, screen=pipe_screen)
attach_pipeline(pipe, 'example')
Using quantopians default values for...
- volume_limit You have access to 2.5% of the current minutes trade volume
- price_impact Defaults to 0.1
Quantopians price impact example (default of 0.1 for a 25 share order in a minute where 1000 total shares are traded...)
.1 * (25/1000) * (25/1000) = 0.00625%
In our code sample, we filtered out
- Within 2 days (window length of 2) a stock must have traded at least 3,000,000 shares...
or 1,500,000 shares per day...
with this, we assume 3,846 shares are traded per minute (390 minutes in a market day)
*Note: there is a somewhat annoying amount of margin of error in these calculations
- The stock must also have a minimum price of $5
Volume limit calculation
(3,846 shares traded per minute) * ($5 minimum stock price) = $19,230 traded per minute
*Using quantopians default value that assumes you have access to 2.5% of a current minutes traded volume
($19,230) * (0.025) = $480.75 worth of stock can be bought that minute (<<again this is worst case scenario)
Price impact calculation
- The maximum price impact also uses quantopians default value assuming that we have access to 2.5% of a minutes traded volume.
*quantopians default price impact constant is set at 0.1
With this in mind, no matter how many shares are traded, we won't affect the stocks price by more than...
(0.1 * (25/1000) * (25/1000)) = 0.00625% (25 shares bought, which is 2.5% of 1000 total shares traded that minute)
My suggestion is to use quantopians default values for slippage models. Better explained here, my example was using the VolumeShareSlippage model.