Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Ticker changes

If a ticker changes does it maintain the same sid?

5 responses

In short, yes.

Security data is referenced by sid, current ticker is available as part of the code editor but the underlying data does not seem to provide the ticker symbol anyways. Algorithm attached illustrates the point, trading maker of Blackberry phones research in motion, ticker RIM that became BBRY.

Hi Vlatko,

I'm not sure what you mean when you say "the underlying data does not seem to provide the ticker symbol," but note that we did recently add access to the ticker symbol from within your algorithm. See the API documentation for details.

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.

That's cool, I was not aware of the fact the symbol and name were there. Some earlier threads indicated otherwise, but great, I'm glad to see it is there now. Is there a code example? I presume something like below should work.

# One stock I trade  
context.mySecurity= sid(24)

# Print it  
log.debug(context.security.symbol)

Presuming the ticker has changed during the backtest period...

A question arises, what is the ticker displayed in the Initialization code?

Also what is the ticker we get at tick handling function? When backtesting, if a ticker has changed, will each tick display a proper ticker for the time period, or will it all be set to the last one, regardless of the past?

Using this code, looks like it's just set to the most recent:

def initialize(context):  
    context.security = sid(19831) #RIM/BBRY  
def handle_data(context, data):  
    log.info(context.security.symbol)  

Makes sense to me, as outside of logging this would be mostly used to read .csvs so the consistency would be wanted.

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.