Is there a way to pull up TOP NEWS app -> COMMODITIES -> ENERGY into API in Eikon?

We wanna see trending topics, last news, market snap shop


1722530108015.png

Best Answer

  • Jirapongse
    Answer ✓

    @marceugene.belen

    Thank you for reaching out to us.

    You can use the Refinitv Data Library for Python to retrieve top news of Commodities/Energy. The code looks like this.

    top_news = news.top_news.hierarchy.Definition().get_data();
    df = top_news.data.df.reset_index()
    newsId = df[df["Subcategory"]=="Energy"]["topNewsId"].to_list()[0]
    front_page = news.top_news.Definition(newsId).get_data()
    front_page.data.df

    You can refer to the news example on GitHub.

    For the market snapshot, it should be the get_history method with rebasing the historical data.

    df = rd.get_history( 
            universe=['LCOc1'],
            fields=["SETTLE"],
            count=130
        ) 
    df["rebase"] = (100/df.iloc[0]["SETTLE"])*(df["SETTLE"]-df.iloc[0]["SETTLE"])
    df

    1722579690361.png

    However, I can't find the endpoints for trending topics, and last news. Please contact the RDP support team directly for the endpoints or the news query for the latest news.