Screen to capture a list of tickers

Some of my Excel API queries involved fetching a list of tickers that are covered only by a certain broker, so I could get the EPS forecasts provided by that specific broker. Hence I constructed a screen query to get the Primary Tickers of that broker, and then ran a different query from that ticker list to get the data values.

My screening query looked something like this:

=TR("SCREEN(U(IN(Equity(active,public,primary))), avail(TR.EPSEstValue(Period=FY1,Brokers=US_2),TR.EPSEstValue(Period=FY1,Brokers=US_57030))>=-100)","TR.PrimaryRICCode", "SDate=0 EDate=0 Frq=d RH=IN")

The problem is that this query does not work in the Web API. Can you assist me to get it working?

Best Answer

  • Following code should be the equivalent of your TR function in EXCEL:

    >>> rics = 'SCREEN(U(IN(Equity(active,public,primary))), avail(TR.EPSEstValue(Period=FY1,Brokers=US_2),TR.EPSEstValue(Period=FY1,Brokers=US_57030))>=-100)'
    >>> params = {'SDate':0, 'EDate':0, 'Frq':'d'}
    >>> data, error = ek.get_data(rics, fields=['TR.PrimaryRICCode'], parameters=params)
    >>> data
    Instrument Primary RIC
    0 AMED.OQ AMED.O
    1 AAPL.OQ AAPL.O
    2 AAP.N AAP
    3 ABAX.OQ ABAX.O
    ... ... ...
    2707 CTEC.L CTEC.L
    2708 AALR3.SA AALR3.SA
    2709 DNAO.HE DNAO.HE
    2710 PNBH.NS PNBH.NS

    [2737 rows x 2 columns]

Answers

  • @Wessel

    This question was posted in Eikon Scripting APIs which is Python. However, the question is about Web API.

    Could you please confirm the API that you are using? Is it App Studio - Web SDK (JET)?

    It will be helpful if you can share the code that you are using in the Web API.

  • Apologies, I should have said Eikon Scripting API. I'm experiencing the problem in Python.