What is the best way to create a backtesting universe of stocks with the python API?

Hello.

I'm trying to use the Eikon python API to download a universe of stocks historically.

For each end of month since 1999, I want to get stocks with market cap greater than USD500m in the US. I used the screener to come up with this formula in excel. Is this correct? Is the historical market cap correct to get companies passing the market cap criteria as of that day? Do I have to use active and inactive?

=TR("SCREEN(U(IN(Equity(active or inactive,public,primary))/*UNV:Public*/), TR.CompanyMarketCap(SDate=2019-01-31)>=500000000, IN(TR.ExchangeCountryCode,""BM"",""CA"",""GL"",""US""), CURN=USD)","TR.CommonName;TR.CompanyMarketCap(SDate=2019-0"&"1-31);TR.ExchangeCountry","curn=USD RH=In CH=Fd SORTA=TR.ExchangeCountry")

What would be the best way to do that in python for each month end? Do you have any examples? That would be very useful.

Thanks. Charles

Best Answer

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

    For an authoritative answer I would suggest reaching out to Refinitiv Helpdesk, which you can do by either calling the Helpdesk number in your country or by using Contact Us capability in your Eikon application. This forum is intended for software developers using Eikon Data APIs, and the moderators on this forum do not have deep content expertise in every type of content available through Eikon. Refinitiv Helpdesk on the other hand will either have that expertise ready available or can reach out to content experts for the specific type of content you're interested in.
    When contacting the Helpdesk ask for help with modeling the construction of your backtesting universe in Excel. If it's possible to do in Excel, it's quite easy to replicate using Eikon Data API. If it's not possible in Excel, it's not possible through the API either.

Answers