Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
I want to understand the detail, where can I find the info

Hi,

So, I copied the "Sample Algorithm" and ran it, but I have some questions. Would be great if you could point me in the direction of help texts or similar so that I can find the answers.

  1. When I run it on daily data, is it working on close-prices? If so, is it assuming that the algorithm can observe the close price the same day as it is also trading on the close price? (may be a fair assumption, but I just want to understand)

  2. Depending on whether it executes on close or open prices, is there an assumption of difference between historical open and close and actual open and close - either on absolutes and/or in added variance?

  3. When running on minute prices, is there an assumption on spread and actual transaction price? Is it buying on the close for the minute? Does it take the volume for the actual minute into account and spread the placement of the order over a certain time period to minimize driving the price up/down?

  4. I read some other thread talking about survivorship bias. In this Sample Algorithm, there obviously is survivorship bias. What is the suggested approach to adjusting for this? I understand it's only possible to pick to stocks as of now. How do you suggest I pick my 10 stocks to avoid survivorship bias? Do you have a list of delisted stocks, mergers/acquisitions, etc.?

I really like what you're doing with Quantopian!

/Johan

2 responses

I guess I should not be so lazy and just dig into the documentation https://www.quantopian.com/help#ide-slippage or possibly even dig into "zipline". I think this should answer question 1-3. I'm still not sure about question #4...?

Hi Johan,

Thanks for your questions, they are all very insightful.

  1. If an order is placed in bar 1, it is filled in bar 2 using the closing price of bar 2. We send open_price, high, low, close_price to your handle_data method, and the price property is a copy of close_price. This way, you can either code as though you have a bar, and use the ohlc, or you can code as though you have a single event and use price. In both cases, you will not be allowing lookahead bias to creep into your results, because fills are done on the next bar.
  2. We don't modify the historical prices that we send to your algorithm.
  3. Yes, and you can configure some of this behavior. Please see the help docs you referenced ( https://www.quantopian.com/help#ide-slippage )
  4. Our source data is survivorship bias free, which means you could try your algorithm on defunct companies, such as Lehman Brothers. In your algo above, you are trading on Apple only. This is a subtle lookahead bias - you are giving your algorithm future information in the implementation. We have been working for several months on a way for your algorithm to request a sample of stocks instead of just a handful. We call the feature universe selection, because we choose a big sample of securities based on their trading dollar volume, and we periodically update the universe to add/remove stocks based on recent dollarvolume. This way you can try an algorithm like this on a basket of stocks, and that basket will be survivorship and lookahead free.

I hope this helps answer your questions, and please don't hesitate to ask more!

thanks,
fawce

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.