Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Using sid() fails from notebook
print sid(24)  

... Works in Algo but fails in Notebook with: NameError: name 'sid' is not defined

So maybe for the notebook I need to import sid, but in Algo it has been done automatically?

https://www.quantopian.com/help#api-sid doesn't give any clue.

print sid.__module__  # gives: algoproxy  

Searching https://www.quantopian.com/help for algoproxy yields nothing and trying stuff like from quantopian.algoproxy import sid fails.

Cannot import inspect as Q doesn't offer that module (https://docs.python.org/2/library/inspect.html).

Rats.

4 responses

Try "symbols" instead of sid.

That works, thanks!

It is unexpected behaviour though, this symbols is not the same as https://www.quantopian.com/help#api-symbols

Looking at https://www.quantopian.com/help#api-other -> "Within your algorithm, there are some other methods you can use:" -- I suppose that implies the IDE.

Ok so assuming that above link lists functions available to IDE only, somewhere there should be a section listing functions available to Notebooks only, which would contain the symbols function. Is there? How did you find it? Maybe there is some doc resource I haven't found yet...

π

Hi Pi,

You're right that the API differs between the IDE and Research. The IDE API is documented under the "API Documentation" header. The Research API is documented under the "Research Environment API" header. You can jump to these headers using the links in the sidebar. Please let me know if you need any help navigating the documentation.

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.

meh sometimes I cannot see what is right in front of me. Thanks @Nathan!