Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Question on Stock Prices when Executing Trades

I have the following algorithm that will buy a stock (long or short) if the previous minute's price increases by .1% and holds it for 5 minutes, then sells. When I run it on one day of Apple, the stock price changes if I go long or go short. I assume it has to do with slippage, but I am only buying one share and Apple is liquid, so I am not sure why the price is influenced at all. I am wondering if someone can help me explain? Or somehow turn off slippage (which I am trying to do, but perhaps I'm not)?

2 responses

Just to be clear on what I am asking, I am attaching another backtest that is exactly the same as the one above, but switches my buying to selling and selling to buying statements. You can see by comparing transactions, that the stock price for each minute is different under each backtest. I am trying to understand why. Thanks!!

Hello Howie,

I've only looked at the first transaction in each backtest but I would say the price is $537.72 + $0.03 commission per share when you go long and $537.72 - $0.03 commission per share when you go short. $0.03 per share is the default commission model unless you specify otherwise. See: https://www.quantopian.com/help#ide-commission

P.