For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 2 0 0

refinitiv data api via Python cannot retrieve some RICS

Hi

I am not able to retrieve these data from EIKON (None values)

IR =[


'EURSWFSR','EUR1MFSR','EUR2MFSR','EUR3MFSR','EUR6MFSR','EUR1YFSR','EURLIBOR',

'JPYSWFSR','JPY1MFSR','JPY2MFSR','JPY3MFSR','JPY6MFSR','JPY1YFSR',

'CHFSWFSR','CHF1MFSR','CHF2MFSR','CHF3MFSR','CHF6MFSR','CHF1YFSR','USDSOFR',

'USDSWFSR','USD1MFSR','USD2MFSR','USD3MFSR','USD6MFSR','USD1YFSR',

'GBPSWFSR','GBP1MFSR','GBP2MFSR','GBP3MFSR','GBP6MFSR','GBP1YFSR',

'EONIA','EURIBORSWD', 'EURIBOR1MD', 'EURIBOR2MD',

]




streaming_prices_ir = rdp.StreamingPrices(

universe =[c+'=' for c in IR] ,

fields = ['PRIMACT_1'],

on_complete = lambda streaming_prices :

create_dataframe(streaming_prices),

on_update = lambda streaming_prices, instrument_name, fields :

update_dataframe_ir(streaming_prices, instrument_name, fields)

)

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonrefinitiv-realtimerdp-apistreaming-prices
icon clock
10 |1500

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

12 Answers

Upvotes
Accepted
20.3k 73 10 20

Hi @gmtm.projectoffice

Thanks for the confirmation- so as per my earlier posts, you are not licenced for the streaming data you are trying to request.

You would use the same RIC code but need the appropriate licence. I will raise a ticket on your behalf with the My.Refintiv helpdesk.

You can also contact your Refinitiv Account team as I recommended earlier.

icon clock
10 |1500

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

Upvotes
20.3k 73 10 20

Hi @gmtm.projectoffice

Please add the following debug output code and rerun your code - ideally just requesting 1 or two of the above RICs (to reduce debug output)

import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)
import refinitiv.dataplatform as rdp

Look out for the response you get back after the RIC is requested e.g.

2021-01-20 14:22:25,145 - session - DEBUG - Send request: {'ID': 1, 'Domain': 'MarketPrice', 'Key': {'Name': 'EURSWFSR='}, 'Streaming': True, 'View': ['BID', 'PRIMACT_1']}

2021-01-20 14:22:25,204 - Session session - Thread 8928 | WebSocket 0 OMMStreamConnection._process_response_message(message={'ID': 1, 'State': {'Code': 'ConnectionError', 'Data': 'Suspect', 'Stream': 'Closed', 'Text': 'Access Denied: User req to PE(3420)'}, 'Type': 'Status'})

2021-01-20 14:22:25,204 - session - DEBUG - OMMStreamConnection._process_response_message(message={'ID': 1, 'State': {'Code': 'ConnectionError', 'Data': 'Suspect', 'Stream': 'Closed', 'Text': 'Access Denied: User req to PE(3420)'}, 'Type': 'Status'})

The above is what I see with my default credentials.

If you are seeing the same status message, this means that your credentials are not licenced for the RICS you are trying to consume. Please speak to your Refinitiv Account team to discuss changing your licence to include the required instruments.

If the status/error message after the Send Request differs from the above, please post it here inline or as a .txt attachment. Please don't include the full output, which will contain your private AppKey.


icon clock
10 |1500

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

Upvotes
3 2 0 0

Hi


it does show anything. I think the debug is not activated. Can you give the steps to to add to debug properly ?

and also the tested lined in python?

thanks


icon clock
10 |1500

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

Upvotes
20.3k 73 10 20

Hi @gmtm.projectoffice

I am not sure why you are not seeing debug output - could be a local environmental issue?

Are you opening a Desktop Session and then also calling streaming_prices_ir.open(), after you create streaming_prices_ir in your code snippet above?

Also, you mention Eikon and using the RDP library - so I assume you are using a local instance of Eikon and connecting via an RDP Library Desktop Session - is this correct?

I have attached an alternative example which outputs any data to the console, as well as any Status messages received - which is what we were looking for in the debug above.


import refinitiv.dataplatform as rdp
import datetime

rdp.open_desktop_session("your app key")

def display_refreshed_fields(streaming_price, instrument_name, fields):
    current_time = datetime.datetime.now().time()
    print(current_time, "- Refresh received for", instrument_name, ":", fields)    
    
def display_updated_fields(streaming_price, instrument_name, fields):
    current_time = datetime.datetime.now().time()
    print(current_time, "- Update received for", instrument_name, ":", fields)    
    
def display_status(streaming_price, instrument_name, status):
    current_time = datetime.datetime.now().time()
    print(current_time, "- Status received for", instrument_name, ":", status)    
    
def display_complete_snapshot(streaming_prices):
    current_time = datetime.datetime.now().time()
    print(current_time, "- StreamingPrice is complete. Full snapshot:")
    display(streaming_prices.get_snapshot())
    

streaming_prices = rdp.StreamingPrices(
    universe = ['EURSWFSR=', 'EUR1MFSR=', 'EUR2MFSR=', 'EUR3MFSR='], 
    fields   = ['BID', 'ASK', 'PRIMACT_1'],
    on_refresh = lambda streaming_price, instrument_name, fields : 
        display_refreshed_fields(streaming_price, instrument_name, fields),
    on_update = lambda streaming_price, instrument_name, fields : 
        display_updated_fields(streaming_price, instrument_name, fields),
    on_status = lambda streaming_price, instrument_name, status : 
        display_status(streaming_price, instrument_name, status),
    on_complete = lambda streaming_price : 
        display_complete_snapshot(streaming_price)
)

streaming_prices.open()
streaming_prices.close()

Please try the above and check the output. When I run it with my credentials I see:

09:09:23.349871 - Status received for EURSWFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 09:09:23.402871 - Status received for EUR1MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 09:09:23.403871 - Status received for EUR3MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 09:09:23.403871 - Status received for EUR2MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'}


The RDP library version I am using is

rdp.__version__
'1.0.0a7.post1'

If you are on an older version, you can get the latest version on PyPi at refinitiv-dataplatform · PyPI


icon clock
10 |1500

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

Upvotes
3 2 0 0
  File "<ipython-input-13-0b637dfbc790>", line 28
    streaming_prices = rdp.StreamingPrices(                   ^
SyntaxError: invalid syntax
icon clock
10 |1500

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

Upvotes
20.3k 73 10 20

Hi @gmtm.projectoffice

You will probably need to remove unnecessary spaces / separators after you copy and paste the code. Python is particularly sensitive to indentation / spaces etc and formatting of the code before it will run.

I just tried to copy and paste the above into NotePad++ and save the file as .py file and it runs OK.

Alternatively, try downloading and rename the file below to a .py file and try running it.

RDPStreamingEvents.txt



icon clock
10 |1500

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

Upvotes
3 2 0 0
11:16:01.244188 - Status received for EURSWFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 11:16:01.429209 - Status received for EUR1MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 11:16:01.472186 - Status received for EUR2MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 11:16:01.473055 - Status received for EUR3MFSR= : {'status': <StreamState.Closed: 1>, 'code': 'ConnectionError', 'message': 'Access Denied: User req to PE(3420)'} 11:16:01.473221 - StreamingPrice is complete. Full snapshot:



InstrumentBIDASKPRIMACT_10EURSWFSR=NoneNoneNone1EUR1MFSR=NoneNoneNone2EUR2MFSR=NoneNoneNone3EUR3MFSR=NoneNoneNone

[1]:

<StreamState.Closed: 1>
icon clock
10 |1500

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

Upvotes
3 2 0 0

Can I know the equivalent code to get the latest data not real time data ?

Because in excel I use this formula: =RtGet("IDN","EURIBOR1MD=","PRIMACT_1") and I get the latest (delayed data).


Regards.

icon clock
10 |1500

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

Upvotes
3 2 0 0

and what about the delayed data? Normally we have access to these ones.

icon clock
10 |1500

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

Upvotes
20.3k 73 10 20

hi @gmtm.projectoffice

You can still use the Eikon API to call get_data as required for non-streaming data e.g.


import refinitiv.dataplatform.legacy as ek

ek.set_app_key('your app key')

df, err = ek.get_data(['EUR1MFSR=','EURIBOR1MD=', 'EUR1MFSR='], [ 'BID','PRIMACT_1'])

print(df)
 Instrument      BID  PRIMACT_1
0    EUR1MFSR= -0.58743   -0.58743
1  EURIBOR1MD= -0.55900   -0.55900
2    EUR1MFSR= -0.58743   -0.58743
icon clock
10 |1500

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

@gmtm.projectoffice

You can read more about the Eikon API on the Developer Portal - e.g. the Quick Start section includes various examples including get_data.

Note that the Eikon API has been incorporated into the RDP Library as noted in my example above:

 import refinitiv.dataplatform.legacy as ek

so you don't need to explicitly import eikon library when using RDP library.

Upvotes
3 2 0 0

thanks.

Is there a way to get the real time stream ?

icon clock
10 |1500

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

Yes - as mentioned, in my previous replies you need to discuss getting the appropriate licences for streaming data with your Refinitiv Account.

Upvote
39.2k 75 11 27

@gmtm.projectoffice

To subscribe to streaming delayed data, put "/" in front of the real-time RIC. E.g. instead of "EURIBOR1MD=" use "/EURIBOR1MD=". In your original code sample it would be very easy to achieve by modifying just one line of code:

from

universe =[c+'=' for c in IR]

to

universe =['/'+c+'=' for c in IR]
icon clock
10 |1500

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

Click below to post an Idea Post Idea