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!