question

Upvotes
Accepted
15 0 1 4

Retrieval of Snapshot data with RDP for Python

Hi,

Two years ago we started with Python for RDP and developed an interface to import prices. At that time Umar Nalla had adviced us to use streaming interface with the Snapshot option.

Now - from a contractual point we want to move fully to snapshot data. Brokers are requesting real time licensing unless we can show that technically we only read (slightly delayed) snapshot data. Can you show us how to move from the current solution - where we load streaming data, and then snapshot this - to a real snapshot API?

Additionally we want to be able to query historical data. Same as in Eikon with the Rhistory function we want to be able to retrieve historic close data points. Can you help us setup a API for this?


python#technologyrdp-apiapirefinitiv-data-platform
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
5.9k 21 3 6

Hi @VFM ,


Looking through the Developer Portal, I found the article 'Migrating COM API calls to Python'; while it does not answer your question directly, it has a lot of information you may be after. Namely:


rd.get_data:

realTimeImage = rd.get_data(
    universe=['GBP=', 'EUR=', 'JPY='],
    fields=['BID', 'ASK'])


rd.open_pricing_stream:

def display_data(data, instrument, stream):
    clear_output(wait=True)
    current_time = datetime.datetime.now().time()
    print(current_time, "- Data received for", instrument)
    display(data)
stream = rd.open_pricing_stream(
    universe=['GBP=', 'EUR=', 'JPY='],
    fields=['BID', 'ASK'],
    on_data=display_data
)
stream.open()
stream.close()


and rd.get_history:

FTSEConstituentDf1 = rd.get_data(
    universe=['0#.FTSE'],
    fields=['TR.TURNOVER.timestamp', 'TR.TURNOVER', 'TR.EVToSales'])

FTSEConstituents = list(FTSEConstituentDf1['Instrument'])

IntradayTimeSeriesDf2 = rd.get_history(
    universe=FTSEConstituents,
    fields=['TRDPRC_1'],
    interval="10min", # The consolidation interval. Supported intervals are: tick, tas, taq, minute, 1min, 5min, 10min, 30min, 60min, hourly, 1h, daily, 1d, 1D, 7D, 7d, weekly, 1W, monthly, 1M, quarterly, 3M, 6M, yearly, 1Y.
    start="2022-06-01T13:00:00",
    end="2022-06-01T16:00:00")
 
IntradayTimeSeriesDf2


Are those the calls you were after?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
15 0 1 4

Hi Jonathan,

Can you explain to me what is the difference between the refinitiv.data and refinitiv.dataplatform API? We used the Refinitiv Data Plaform API version 1.0.0a10 till now. The problem is that we want to transfer away from real time pricing to snapshots. (And want an option to retrieve historical rates).

So currently I have this:

pricing = rdp.StreamingPrices(session=session,

universe=df_rics['RIC'].dropna().tolist(),

fields=df_fids['FID'].dropna().tolist()

)

pricing.open()

pricing.get_snapshot()

pricing.close()

This is not what we want - as we are basicly still using streaming prices.





icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
15 0 1 4

Hi,

After consultation with the team, we understand that we need to use Refinitiv Data library. Trying to install the refinitiv data library we do encounter some problems:

So coming from refinitiv-dataplatform==1.0.0a10

First we installed Refintiv Data version 1.3.1

First we had an error: no module named simplejson.

We installed simplejson seperate.

Then we found that httpx delivered with the wheel for Refinitiv Data is version 0.19 while Refintiv Data required a higher version.

We installed httpx-0.24 manually

Next we got the error "module 'httpcore' has no attribute 'ConnectionPool'

We installed httpcore 0.17.3 manually

Now again we run into problems:

import refinitiv.data as rd

> Exception has occured: module 'h11' has no attribute 'Event'

Can you please check and let us know the correct way to install Refinitiv Data Library for Python under windows?







icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
14.5k 30 5 10

Hi @VFM ,

Have you had a chance to look into the RD Library for Python - Quick start guide that shows installation steps

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 57 17 14

Hello @VFM

Are you using Python or Anaconda/Miniconda distribution?

I suggest you create a new Python environment, and try "pip install refinitiv-data" in that environment again.

If you are using Python:

If you are using Anaconda/Miniconda"

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.