Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Identifying the Ticker Symbols for Global Equity Indian Market

I am trying to group all the stocks in each sector from only specified sectors in the Indian Market ( specifically: Banking, cement, Auto, IT, Pharma). In an attempt to do so I have coded a Pipeline as in the attached Notebook using the domain IN_EQUITIES and FactSet datasets.

However, I need to know the Ticker symbols as it is listed in the Indian Exchange. How can code this in Quantopian in order to come out with my trading universe for a pairs trading strategy I plan to model for the mentioned sectors?

5 responses

Good question. Many of the global exchanges don't have the same conventions as US exchanges for identifying stocks. For example, the Bombay Exchange (BOM) uses numbers to identify their listed stocks. However, the other major exchange in India, the National Stock Exchange (NSE), uses alpha characters similar to the US tickers (though they can be much longer).

Just like for US equities, the symbol shows up when the asset object is printed. Here is how the IBM asset object is displayed along with the asset object for 'Dr. Agarwal'S Eye Hospital ' on the BOM, and then the asset 'United Nilgiri Tea Estates' on the NSE:

Equity(3766 [IBM])  
Equity(1178883482794310 [526783])  
Equity(1178913799819604 [UNITEDTEA])

The first number is the internal Quantopian 'security ID' or SID. The string in brackets is the ticker or symbol. The result for the BOM listing just looks odd because their tickers are numeric. The result for the NSE listing has a familiar alpha ticker but it's 9 characters long.

Now, how to reference a security with a numeric symbol. Actually, this is a larger question "how to reference global non-US securities"? It turns out that using the symbols method with a ticker isn't implemented for non-US securities. If one were to do the following:

symbols('IBM')  
symbols('526783')  
symbols('UNITEDTEA')

The first one works fine while the last two fail. Passing the symbols method a ticker is only valid for US securities. However, one can also pass the SID as an number to the symbols method. This works for all US and global securities which Quantopian tracks. So, to specify an asset object for global securities use the symbols method and pass it the SID. One can also get a list of asset objects by passing a list of SIDs. Remember the SID is a number so do NOT put it in quotes.

ibm = symbols(3766)  
dr_agarwal = symbols(1178883482794310)  
ibm_and_dr_agarwal_list = symbols([3766, 1178883482794310)

It's often helpful to see the names of securities and the exchange it trades on -especially in the case of numeric tickers. The name and exchange are actually attributes of the asset object. So, one can access those values something like this.

argawals_object = symbols(1178883482794310)  
argawals_name = argawals_object.asset_name  
argawals_exchange = argawals_object.exchange  
argawals_exchange_full = argawals_object.exchange_full

It should be noted that typically global securities are identified using a combination of the exchange and the ticker with a colon separating them. So, to search for 'Dr. Agarwal'S Eye Hospital ' listed on the BOM, one would search BOM:526783, or 'United Nilgiri Tea Estates' NSE:UNITEDTEA

Attached is the notebook above with some added cells showing how one could append the security attribute data as columns in a dataframe for easy sorting and selecting. It also has a cell showing how to eliminate the annoying 'u' which python displays when printing unicode strings.

Again, good question!

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.

Hi Dan, thanks for the post, really informative! I am wondering if there is a way to achieve this in the IDE? I tried to pass in the numeric sid into symbol() but got the warning: non-string argument given to symbol()

Currently only US equities are supported in the IDE (ie the backtest environment). We are working to expand this to global equities but not there yet.

Hi Dan by when can you please add NSE(Indian Equities) Tickers include in the IDE ?

@Vivek Pathak Supporting non-US global equities in the IDE is something we are looking at but no specific dates. The current focus in on increased datasets. A large hurdle for us is to find a provider for historical minute level pricing data for non-US exchanges and then incorporate those onto the platform.