Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Refinitiv Data Platform /
  • Refinitiv Data Platform Libraries /
avatar image
Question by Natalia.Skaczkowska · Feb 28, 2020 at 10:26 AM · pythonrdpstreamingmultiplemultiple_rics

Python RDP StreamingPrices returns no data

I'm trying to process the streaming data from RDP in Python receiving updates on multiple RICs. It seems to me that the only class from the https://pypi.org/project/refinitiv-dataplatform/ library that can handle multiple RICs is StreamingPrices(). Unfortunately when I'm running my code below, I don't receive any data.

streaming_prices = rdp.StreamingPrices(
    universe=['EUR='],
    fields=['BID', 'ASK'],
    on_update=lambda streaming_price, instrument_name, f:
print("Update received for {}: {}".format(instrument_name, f))
)

streaming_prices.open()
while True: time.sleep(0.2)

The log looks as follows:

2020-02-28 09:44:28,347 Login to websocket successful

2020-02-28 09:44:48,347 Receive ping from server ...

2020-02-28 09:44:48,348 ... send pong response

2020-02-28 09:45:08,346 Receive ping from server ...

2020-02-28 09:45:08,346 ... send pong response

...

On the other hand, when I use the ItemStream() class with the following code, it works perfectly. But ItemStream() cannot handle multiple RICs, so it's not a solution to my problem.

streaming_prices = rdp.ItemStream(
    session=rdp.get_default_session(),
    name='EUR=',
    fields=['BID', 'ASK'],
    on_update=lambda s, msg:
    print("Update received: {}".format(msg)))
streaming_prices.open()
while True: time.sleep(0.2)

The log looks the same, but I can see the updates being printed in the console:

Update received: {'ID': 1, 'Type': 'Update', 'UpdateType': 'Unspecified', 'DoNotConflate': True, 'Key': {'Service': 'ELEKTRON_DD', 'Name': 'EUR='}, 'SeqNumber': 43854, 'Fields': {'BID': 1.1029, 'ASK': 1.1033}}

Update received: {'ID': 1, 'Type': 'Update', 'UpdateType': 'Unspecified', 'DoNotConflate': True, 'Key': {'Service': 'ELEKTRON_DD', 'Name': 'EUR='}, 'SeqNumber': 43918, 'Fields': {'BID': 1.103, 'ASK': 1.1033}}

Update received: {'ID': 1, 'Type': 'Update', 'UpdateType': 'Unspecified', 'DoNotConflate': True, 'Key': {'Service': 'ELEKTRON_DD', 'Name': 'EUR='}, 'SeqNumber': 43982, 'Fields': {'BID': 1.103, 'ASK': 1.1033}}

Update received: {'ID': 1, 'Type': 'Update', 'UpdateType': 'Unspecified', 'DoNotConflate': True, 'Key': {'Service': 'ELEKTRON_DD', 'Name': 'EUR='}, 'SeqNumber': 44046, 'Fields': {'BID': 1.1029, 'ASK': 1.1033}}

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Wiphoo.Methachawalit · Feb 28, 2020 at 10:57 AM

Hi Natalia.Skaczkowska,


Could you try to replace your loop forever code with asyncio run_forever?

while True: time.sleep(0.2)

with

import asyncio
asyncio.get_event_loop().run_forever()


The StreamingPrices is using the asyncio to manage the callback function.


Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
Natalia.Skaczkowska · Feb 28, 2020 at 11:47 AM 0
Share

Thank you, it works now!

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
8 People are following this question.

Related Questions

Python RDP get_historical_price_summaries

issue to use refinitiv_dataplatform with python

Cannot retrieve ESG data via RDP libraries in Python

RDP python library not raising exception on invalid_token

What is the best way to run scenario simulations on options using the RDP library? for a given listed option i would like to see the premium on a future date based on some vol and underlying price input.

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges