Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to track a stock w/out a given SID?

Greetings! I'm trying to figure out how to track a stock w/ one of my algorithms that doesn't have a listed SID. I'm not sure if Quantopian has its own listed database for stocks, if it queries the internet, or if it doesn't track penny stocks, but for some reason tracking by SID isn't an option for some stocks. This scenario obviously rises a couple other questions for myself:
- Is it possible to query stocks via URLs?
- What does Quantopian actually do in the background?
Any help is greatly appreciated!

10 responses

Hi Taylor,

Thanks for the question!
We maintain a database of listed US Equities and ETFs. We don't have global stocks, penny stocks, or anything OTC.

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.

Alright, thanks; that certainly does explain several things! So how would I go about making my algorithm use a URL or some other source to access information not in the database of Quantopian? Maybe Zipline utilities?

HI Taylor,

We have Fetcher for fetching external data. There is a builtin called fetch_csv - details are in our help docs: http://www.quantopian.com/help
We do not currently support simulated orders against fetcher, though you can fetch prices and do pretty much everything else.

thanks,
fawce

Hi there,
I still don't understand: What is the use of importing CSV securities data if I can nevertheless only backtest on securities listed in Quantopian's database (not talking about signal data here)? All the securities listed in the database already have their data, so why import my own data then? But otherwise, why can I import data, that I then cannot use for backtesting, because it is not listed in the database? Do I misunderstand something here?

There are two common use cases for importing data.

  • You have an external trading signal that is generic in nature, but affects stock prices. As an example, the price of oil drives a lot of stock prices. Quantopian doesn't have the price of oil in the database. So, you import that, and then you use it.
  • You have an external trading signal that is stock-specific. Examples would include the P/E ratio, or the amount of short interest, or Twitter sentiment. You can import that data, attached to each relevant security, and trade based on that imported data.

This isn't to say that we're done. I agree that being able to import and test on completely arbitrary securities (or commodities or bitcoins or whatever) is a neat feature.

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.

Okay, now it makes sense to me. Thanks for the fast answer. It'd be great to also have either non-us stocks in Quantopian one day or be able to import them as desired from any CSV file. But my guess is you are working hard on all those nice-to-haves already...

Hi, Along this same topic, is it possible to search for a very specific entry signal on all SIDs available in the database ? If this is possible could you point me to an example (if available), please ?

Thanks,

Hi there,
I am from Germany and I also miss this feature. It would be great to see it next time in action. At the moment I am not interested in the US markets. My first impressions about Quantopian is very good, but if I can not use my own market data for backtesting it's a little bit useless for me.

Regards
Alex

Hi Yadu,

Glad to help! You can apply a specific entry signal on 2% of the universe if you're running a backtest in minute mode or on 10% of the universe in daily mode. You cannot run the query on the entire database of stocks because of bandwidth limitations. To do this, use the set_universe() function to create a floor and ceiling for your subset of stocks. Check out this help link for more information: https://www.quantopian.com/help#ide-universe

I've also provided a sample algorithm as a reference. Try cloning this algo and run it in minute mode to get started!

Best,
Alisa

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.

Hi Alisa,

That looks awesome! Thanks for the sample, and really appreciate the quick response.

-Yadu-