Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
NameError: name 'get_pricing' is not defined

After trying to run the script that is provided in the first tutorial, I get the following error:

asset = get_pricing('TSLA', fields='price', start_date=start, end_date=end)  

NameError: name 'get_pricing' is not defined

After getting this error, I tried to replace the exact code from the tutorial, which results in the same error. Can someone please help me in the right direction?

Best regards, Mike

7 responses

@Mike I'm unable to reproduce the issue you describe. Are you running the notebook on the Quantopian research plaform, or on your own notebook server? The get_pricing API function will only work when running on Quantopian, since it's loading data from our database.

Scott

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.

This fixed the problem, thank you!

Is there a way to get the API running on a notebook? I presume the same applies to Fundamental Data as well. Is there a way to get things to run on a local istance of Python that queries the database like the pyfolio examples?

I ran into the same issue when running it on a local notebook server. Would this be resolved by installing zipline or can I only run the lectures on your plattform?

I have the same issue as listed above and I input the code as you said. However, the error still shows that the get_pricing is not defined.
I don't know how to solve this. Do I need to import any package to use this function?

The code shows as below:
df = get_pricing('inputs', start_date=start, end_date=end)
The error shows as below:
Runtime exception: NameError: name 'get_pricing' is not defined

Thanks

I meet the same issue. My suggestion is to use zipline method to get the data price

Hi ! How do you use zipline to run notebooks locally. Do I replace get_pricing as it is with zipline ?