Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Execution simulation

I am a Quant Trader with 5 years of HFT experience. I had a look at the platform and am wondering to what extent strategies developed here can be transfered to profitable live systems. Here a few points:

  1. Market orders are executed at the close of the bar which triggered them with some non-price-dependent slippage. In a non-HFT setup with broker interface such as IB I would assume at least a latency of 1 second - i.e. actual execution time 1 second after the close. It doesn't sound like much but during faster markets the actual execution price can be quite different than the close of the last bar. Imagine a bar with close a lot below the recent market range - it will not be hard to filter out instruments and bars for which the sell-out continues for at least one bar and generates profit close-to-close. The problem is that we don't know where exactly we were filled around the first close, so this trade is not doable. There is also a statistical side: any optimization process employed during strategy development will push trading towards exactly such exploitable scenarios because they overwhelm the noisier and lower volatility signals.
  2. Limit orders are checked for execution every bar with its close price. This is very far from real simulation models. The advantage of limit orders in terms of execution costs can only be simulated if a models accounts for the scenarios in which a limit order is touched but the price reverts.

During slow time both complications are not in effect but from my experience there is no algo trading during slow times any way.

Does anybody have experience moving strategies developed here to live trading?

4 responses

Hi Ivaylo,

Anony Mole posted an example of how to manipulate the slippage model:

https://www.quantopian.com/posts/trade-at-the-open-slippage-model

The model can be applied to minute bars, to shift the execution price closer to the open, which should better represent the price you'd get when live trading at Interactive Brokers (since orders are submitted immediately/asynchronously, as they are encountered in the executing code).

There is further manipulation of the slippage model that can be accomplished using globals, as I posted on https://www.quantopian.com/posts/backtest-results-different-in-minute-and-daily-mode. Basically, I think you could inject any price in there that you pleased!

Regarding a detailed comparison of modeled slippage to live trading actual slippage, I've never seen anything for Quantopian/Interactive Brokers.

Grant

Hi Grant,

I dont get it, thought events in Quantopian are defined as 1M bars. Then, how can you get an event before the bar is complete, i.e. the minute is over?

Also, had a looked at the open-close range slippage model. If I am right, this trades on a price in the bar with information for the close of the very same bar. Using information from the future is the biggest mistake you can make in algo trading.

Best,
Ivaylo

Hello Ivaylo,

Anony's model does not use future information, so long as you don't use exactly the open price. It assumes a linear price drift between the open and the close over the minute, so you can estimate the price based on this model, just after the open price is posted. I have no idea how valid it is; I just wanted to illustrate that there is some flexibility in modelling slippage. Also, for thinly traded securities, it is sketchy, since the open and close could fall anywhere within the minute bar.

No time now, but if it is still not making sense, I'll put together an illustrative ASCII flow chart with more details.

Grant

Ivaylo,

You may be interested in Alisa's analysis of backtester/papertrading consistency: https://www.quantopian.com/posts/backtesting-to-live-trading-progression-example

She touches on some subtle differences in data, commissions, slippage, and EOD behavior between backtesting and paper trading.

Andrew

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.