Back to Community
Sourcing data in the Research Environment

I am trying to source US Treasury Yield Data in order to approximate a risk-free rate which I would like to use in a Notebook. I've made some attempts and I have several questions.

Attempt 1: Try to see if the data already exists in quantopian.pipeline.data.quandl
Here I would like to know how one can check what data is available in this module. I can't seem to figure out whats in there. Is there perhaps a way to see what modules/data exist after importing quandl? I've tried the following:

from quantopian.pipeline.data import quandl  
dir(quandl)  
help(quandl)  

Attempt 2: Use fetch_csv
I can't seem to use fetch_csv in the Notebook environment. How does one import this function? I've tried the following with error:

fetch_csv('https://www.quandl.com/api/v3/datasets/USTREASURY/YIELD.csv?api_key=MM5yxdNn66xWZVysGAQZ',  
            date_column='Date', usecols=['3 MO'], date_format='%Y-%m-%d')  

and received error: "NameError: name 'fetch_csv' is not defined"

Finally, how would I then refer to the csv file i.e. I would like to do the following:

df['yields'] = fetch_csv(...)  

Thanks ahead

1 response

Hi Jean-Michel,

Great questions. The fact that you can't tab-complete the quandl namespace looks to be a bug. We'll have to get that fixed.

In the meantime, you can see which quandl datasets are available here.

Alternatively, if you want to load your own data into research, you can upload a .csv file to the /data directory in the research environment. You can then load that data into a notebook with local_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.