Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
fetch_csv sample code seems not working ???

Hi everyone,

I want to use my own data so I tried fetch_csv code example here with the same data provided with this example, and I saved the same data on dropbox. however, I got the following error:

Something went wrong. Sorry for the inconvenience. Try using the
built-in debugger to analyze your code. If you would like help, send
us an email.

Exception: Error parsing remote CSV data. There was a
runtime error on line 7.

(line 7 is where date_format = '%m/%d/%y') at)

Could you help me figure out where went wrong?

Also does fetch_csv only accept dateformat as "%m/%d/%y"? how about "%Y/%m/%d"?

Thanks a lot

Here is the code and dropbox link:

def initialize(context):  
    # fetch data from a CSV file somewhere on the web.  
    # Note that one of the columns must be named 'symbol' for  
    # the data to be matched to the stock symbol  
    fetch_csv('https://www.dropbox.com/s/ef3aqzueaypdecq/dataTest.csv?dl=0',  
               date_column = 'Settlement Date',  
               date_format = '%m/%d/%y')  
    context.stock = symbol('NFLX')  
def handle_data(context, data):  
    if 'Days To Cover' in data[context.stock]:  
        record(Short_Interest = data[context.stock]['Days To Cover'])  
2 responses

I got it now, the problem is still about the public url. dropbox and google drive does not provide public url, but copy does

If you're interested in hosting your .csv file on Dropbox or Google Drive, check out the help docs for instructions on how to make the URL public!

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.