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


  • @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

  • Thank you for reply.


    is there guide for "refinitiv.data"?

    I have used only eikon module.

    So it's not familiar.


    Specifically, I want to get real-time data for "SPXL", "SPXS" and S&P 500 index.


  • @dw.jung We have full interactive examples which you can access using the CodeBook app (type Codebk into Eikon search bar) and the go the the Examples folder and under Data Retrieval:
    1709569615601.png If you goto 01.01. Refinitiv Data Library you will find the Access layer examples most helpful. These are the highest level of abstraction ie one-line function calls and are easiest to use. From the Library link I posted above you can see the Overview, Quickstart Guide, Documentation, Reference Guides and Tutorials. You can download the library using pip :

    pip install refinitiv-data

    I hope this can help.

  • Thank you your kind

  • My pleasure!
  • Is there no way get recently contracted price? not bid or ask?

    and for S&P 500 index real-time price?


    And data from streaming is not real-time.

    Do I did wrong way?

    I just followed your word

  • @dw.jung Streaming data is live assuming you have permission to live prices from that exchange - otherwise you might get a 15 minute delayed price - denoted by a / in front of the RIC eg /VOD.L. The field for last traded price or value is "CF_LAST" - so you can just add or replace that to the field list in the API call. To see a full list of fields available for any instrument - please use the Data Item Browser app (type DIB into the Eikon / WS search bar) - type the instrument into the instrument bar and you can see a list of fields and also values - you can also open up the filter panel on the left hand side and then narrow down the content sets you want to search.
    1709635109652.png

    I hope this can help.

  • Thank you for your reply.

    If you don't mind me asking, how can I get permission from exchange and how much for it?

  • Hello @dw.jung

    I strongly suggest you contact your LSEG representative to help you with the permission (and pricing).