Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
SID to company name?

Hi friends, does anyone know how to get the name of a company give it's SID?

4 responses

First get an equity object by referencing the SID. In the IDE use the 'sid' method or in the research environment use the 'symbols' method. The equity object has several attributes. The 'asset_name' attribute should get you what you want. Something like this...


#  in the IDE  
my_equity = sid(24)

# in a notebook  
my_equity = symbols(24)

# once one has an equity object then reference the 'asset_name' attribute  
my_equity_name = my_equity.asset_name

# this returns a unicode string and by default prints with a preceding 'u'  
# to strip the preceding 'u' when printing one can use the str function  
str(my_asset_name)

For more info on the equity object and its other attributes see the docs https://www.quantopian.com/help#api-sidinfo .

Good luck

Thank you!

How could I show the asset names as a column in the Pipeline in the research environment, please?

Did you come to a solution? I'm not sure if there is a way to achieve this within the Pipeline class, but the code below should work on the pipeline output.

The code assumes you named your output as pipeline_output. If not, just replace this name with your output dataframe.

tickers = pipeline_output.index.get_level_values(1)

pipeline_output['company_name'] = [ticker.asset_name for ticker in tickers]  

Hope this helps.