Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Fetcher - can it load non-US securities that are not in its database?

Hi,

Can the fetcher/Quantopian handle stocks that are not in its database, like foreign or arbitrary non-US stocks?

I have an abridged csv file, with some foreign stocks. How would I get these into Quantopian so I can run some analysis on them? I've read this post about a 'custom universe' but I'm not sure if that is what I need.

Here is my very basic code that generates a 'KeyError: 'symbol':

def initialize(context):  
    """  
    Called once at the start of the algorithm.  
    """  
    fetch_csv(  
        'https://dl.dropboxusercontent.com/s/reglqn2j1dwb4lp/test_data.csv?dl=0',  
        date_column ='Date',  
        date_format = '%m/%d/%Y')  
4 responses

Hi Charles,

While you can use Fetcher to load your non-US stock data, it will not integrate with the backtester because non-US securities aren't yet supported. Currently we only have US equities available for researching, backtesting, paper trading, and live trading, and we're working to integrate futures onto the platform.

The link in your post describes an easier way of defining a universe of tradable stocks using fetcher, but these stocks must be supported by the backtester.

The KeyError message that you see commonly results from trying to request a value from a python dictionary using a key that hasn't been previously added to that dictionary.

We are very much interested in expanding the asset classes offered through Quantopian. We've heard requests for options, in addition to international equities and markets. At this point it's not finalized yet. Stay tuned.

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.

Thanks for the information Ernesto. I suppose I'll have to write my own backtester. But why is fetcher not fetching the CSV file?

The URL that you've got in Fetcher is requesting a filedownload from DropBox. You want to use just a straight HTTP call. Take the argument off the URL, like this:

https://dl.dropboxusercontent.com/s/reglqn2j1dwb4lp/test_data.csv

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.

Thanks Dan, Ernesto. Just in case anyone else has a similar question, I'll summarize. You can't use non-US stocks that are not currently in Quantopian's database for backtesting in Quantopian. And as Dan pointed out, remove the 'get' argument from the Dropbox URL string. Also, make sure the column headers in the CSV exactly match what is prescribed in the code. Any whitespace present in one but not the other will throw a KeyError.