How can I get all stocks satisfying some conditions and listed in NYSE on a certain date?

I tried to use R package ‘eikonapir’ to get all stocks listed in NYSE with a market cap bigger than 500 million. The code is as follows:

get_data('SCREEN(U(IN(Equity(active,public,primary))/*UNV:Public*/), IN(TR.ExchangeMarketIdCode,"XNYS"),TR.CompanyMarketCap>=500000000)','TR.TURNOVER,TR.CompanyMarketCap',list('Scale'=0,'SDate'='2010-01-04','FRQ'='D','Curn'='USD'))

It seems that the conditions in SCREEN are not based on the information on '2010-01-04'. The result has many stocks that was not listed in NYSE on '2010-01-04'. All I want is that the conditions in SCREEN are based on the information up to '2010-01-04'.

Thank you so much!

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    It's not possible exactly. The closest you can do is include inactive and non primary issues in the screener, and then filter out issues that have historical market cap below the threshold or null. E.g.

    ek.get_data('SCREEN(U(IN(Equity(active or inactive,public))/*UNV:Public*/),IN(TR.ExchangeMarketIdCode,"XNYS"))',['TR.CommonName','TR.CompanyMarketCap(SDate=20100104)']) 

    This is not fool proof, but it's the closest I can think of to get you to an exchange listing as of a given day. You'll have to play around with it to see if you can get satisfactory result this way. You may want to employ additional criteria in the screener such as TR.InstrumentTypeCode to filter out unwanted asset types. And you may want to use TR.IssueMarketCap instead of TR.CompanyMarketCap.

Answers