Is there time delay for "cf_last"?

I was downloading real-time stock price for constituents of S&P 500.

But, I checked there are same value for 09:30 ~ 9:45.

For all stock price.

I executed code as below.


spx_cons = ['MMM.N', 'AOS.N', 'ABT.N', ....]

data, err = ek.get_data(spx_cons, ['CF_LAST'])


check please.


And, is there other way to get real-time stock price data?

If is, please let me know.


Thank you

Best Answer

  • jason.ramchandani01
    Answer ✓

    @dw.jung Thanks for your question - I would use the Refinitiv Data Libraries to achieve this using a realtime pricing stream and a snapshot request -

    !pip install refinitiv-data
    import refinitiv.data as rd
    rd.open_session()
    df = rd.get_data('0#.SPX',['TR.RIC'])
    df

    1709568897734.png

    stream = rd.open_pricing_stream(
        universe= df['Instrument'].tolist(),
        fields=['BID', 'ASK']
    )
    stream.get_snapshot()

    1709568968326.png

    stream.close()
    rd.close_session()

    You can call get snapshot at any time as the pricing stream will populate a local cache in the background continuously. I hope this can help.

Answers