Back to Community
Error parsing csv file from dropbox

Dear all,
I am having difficulty importing a custom csv file into quantopian.

vol_csv = ""  
def initialize(context):  
              date_column = 'vol_date',  
              date_format = '%Y-%m-%d')  
    context.etf = sid(19656) #XLF  
def handle_data(context, data):[context.etf]["vol"])  

This throws the exception
KeyError: u'no item named vol_date' My other question is that: is it possible to incorporate daily data in back testing with minute bar data?
Thanks for the help!

7 responses

Hi Shengian,

You need to use the public dropbox URL in your algorithm to avoid the error. It looks something like: Take a look at the fetcher API for more details.

It is possible to use daily data with a minutely backtest, but you will need to create a post_func function to prevent look-ahead bias. If you run a minutely backtest with daily fetched data, the data will be referenced in your algorithm at the beginning of the day, rather then the end of the day. Here is a thread with more details and an example of how to implement post_func.



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 @Alisa, after changing the link to Now I have the error: Something went wrong on our end. Sorry for the inconvenience. What should I do now? There is not even log output


I'm not a user of fetch_csv at present so this may not be entirely correct.


Clone Algorithm
Backtest from to with initial capital
Total Returns
Max Drawdown
Benchmark Returns
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5341dee5e35062071307aa1c
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

@Peter, Thanks for your code, it can now work with the minute data. However, by incorporating the daily volatility data, I am no longer able to use the built-in


function. It keeps giving me error on our end error.


I get the same. I've raised feedback with Quantopian.


Sorry, very new to python here. Can you break down the following segment specifically the show_df.

"pre_func = show_df, post_func = show_df"

Apologies for not following up in this thread. Peter submitted the issue to us and at the moment Fetcher is not supported with the returns() function. I filed the issue internally, but I don't have a timeframe when it will get updated.

pre_func and post_func are transformations you can make on the imported file from Fetcher. You can use them depending on if you're updating your data before or after it is imported into your algorithm. Peter is printing the dataframe to show the head and tail of the file. This is a great debugging tool to confirm you're importing the correct columns and data format. Our logging limits won't allow you to view the entire file, but this way you can get a snippet of the CSV.