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)
)
Best Answer
-
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.
0
Answers
-
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 rdpLook 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.
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
0 -
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
0 -
File "<ipython-input-13-0b637dfbc790>", line 28
streaming_prices = rdp.StreamingPrices( ^
SyntaxError: invalid syntax0 -
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.
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>
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.
0 -
and what about the delayed data? Normally we have access to these ones.
0 -
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.587430 -
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.
0 -
thanks.
Is there a way to get the real time stream ?
0 -
Yes - as mentioned, in my previous replies you need to discuss getting the appropriate licences for streaming data with your Refinitiv Account.
0 -
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]
1
Categories
- All Categories
- 6 AHS
- 38 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛