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 /
avatar image
Question by Eikon10 · Aug 23, 2021 at 05:49 PM · rdp-apirefinitiv-data-platformrefinitiv-data-platform-libraries

Refinitiv.dataplatform "search" get's stuck when called inside a function

Hi everyone,

I like to implement a function that uses the "search" function of the package refinitiv.dataplatform (rdp) whenever it is called. However, when I run such a function, python always gets freezed without posting an error message. The strange thing is that when I run the function in debug mode, it works fine.


Here is a minimal example:

import refinitiv.dataplatform as rdp
Name="ADIDAS"
def getRelevantCDAXProducts(Name):
RDP_LOGIN = "<login>"

RDP_PASSWORD = "<password>"

APP_KEY = "<app_key>"


session = rdp.open_platform_session(
APP_KEY,
rdp.GrantPassword(
username = RDP_LOGIN,
password = RDP_PASSWORD
)
)

searchResults=rdp.search(view = rdp.SearchViews.EquityQuotes,query=Name)


return searchResults

results=getRelevantCDAXProducts(Name)


Has anybody an idea why this issue occurs? If not, I would be very grateful if someone would at least try to run the minimal example to see what happens ("please note that you have to add your credentials"). It would be interesting to see whether this is a general problem or not.


Thank you very much!

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.

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by nick.zincone · Aug 23, 2021 at 11:03 PM

Hi @Eikon10

I changed your application a little - you don't want to attempt to open the session over and over. That is, you don't need to open the session every time you search. Once opened, you can make as many calls while the session has been opened.

import refinitiv.dataplatform as rdp

RDP_LOGIN = "<login>"
RDP_PASSWORD = "<password>"
APP_KEY = "<appkey>"

session = rdp.open_platform_session(
    APP_KEY,
    rdp.GrantPassword(
        username = RDP_LOGIN,
        password = RDP_PASSWORD
    )
)

def getRelevantCDAXProducts(Name):
    searchResults=rdp.search(
        view=rdp.SearchViews.EquityQuotes,
        query=Name
    )
 
    return searchResults

Now you can simply call your function:

Name="ADIDAS"
results=getRelevantCDAXProducts(Name)
results

Note: I did the following in a simple Jupyter notebook but the same applies to a standard Python application.

Comment
Eikon10

People who like this

1 Show 0 · 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
REFINITIV
Answer by Alex Putkov.1 · Aug 23, 2021 at 10:07 PM

@Eikon10

I do not reproduce the behavior you describe. On my end the function returns dataframe with the results of the search as expected. On a side note I should say that opening RDP session inside the function, which you intend to call repeatedly, is not a good practice. The good practice is to open RDP session once through the lifetime of your application. But despite not following good practice for opening the session, your code works fine on my end.

Comment
Eikon10

People who like this

1 Show 0 · 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
Answer by Eikon10 · Aug 24, 2021 at 10:14 AM

Thank you very much for your answers! Your are right, opening the session within the function is bad programming style, I changed that. Unfortunately, this did not solve my issue.


However, since the code worked in your case, I set up a new minimal virtual environment and then it worked well. There might be some conflicts with other packages that explain these conflicts.

Comment

People who like this

0 Show 0 · 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.

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 >
11 People are following this question.

Related Questions

How can I download ESG controversies for a large amount of companies for the time span 2008 till 2018?

rdp.get_historical_price_summaries() : start, end , count

How do I set up call/put in parameter for IPA FX Volatility surface API ?

discrepancy between RDP API vs Excel RSearch for corporate bonds

How do I adjust Values of yAxis displayed on Matrix of FX Volatility Surface IPA?

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • FX Venues
    • FX Trading – RFQ Maker
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • 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
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • Yield Book Analytics
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges