Workspace Python API takes a long time to complete
When using Workspace Python API under Windows 10, some simple queries take a long time to complete.
For example, the Python commands:
import refinitiv.data as rd
rd.open_session()
df=rd.get_data('4296477482', ['TR.OrganizationID','AVAIL(TR.CompanyName,TR.CommonName)','(TR.InvestorSharesHeld/1000000-TR.InvtrPrevSharesHeld)/TR.InvtrPrevSharesHeld', \
'TR.SecurityOwnedName','TR.SecurityOwnedRIC','TR.InvestorValueHeld','TR.InvestorValueHeld.currency','TR.InvestorSharesHeld/1000000','TR.InvtrPrevSharesHeld'], \
parameters={'Scale':6,'NULL':'Blank','Curn':'NATIVE'})
df=df.sort_values(by=['Investor Based Value Held'],ascending=False,na_position='last').head(25)
df.to_excel('PythonOutput.xlsx', sheet_name='PythonData', index=False)
rd.close_session()
, take about half a minute to complete.
As this needs to be scaled to running this script around 10 times (I prefer to do so instead of a bulk download for all 10 at once), is there any way to make the code run faster?
Best Answer
-
Please try this one:
df=rd.get_data('4296477482', ['TR.OrganizationID',
'AVAIL(TR.CompanyName,TR.CommonName)',
'(TR.InvestorSharesHeld/1000000-TR.InvtrPrevSharesHeld)/TR.InvtrPrevSharesHeld',
'TR.InvestorSharesHeld',
'TR.InvtrPrevSharesHeld',
'TR.SecurityOwnedName',
'TR.SecurityOwnedRIC',
'TR.InvestorValueHeld',
'TR.InvestorValueHeld.currency',
'TR.InvestorSharesHeld/1000000',
'TR.InvtrPrevSharesHeld'],
parameters=
{'Scale':6,'NULL':'Blank','Curn':'NATIVE','StartNum':1,'EndNum':25,"SortOrder":"Descending"})Otherwise, please contact the helpdesk team via MyAccount for other supported parameters.
0
Answers
-
Thank you for reaching out to us.
As far as I know, the problem is not in the code. The backend or server needs times to extract the requested data. I ran the code and found that the response contains 15447 rows.
On my maching, it took around 20-30 seconds to get the response. I think this is an expected behavior of Data Libary to extract this size of data.
You may contact your LSEG account team for sales team for other solutions.
0 -
OK,thanks. So there is no way to sort the data (say, top 25) on the server, and just return this reduced set, but only to return the full set (of 15477 rows) and do the sorting later, is this right?
0 -
Thanks, is there also a way to specify in which field(s) (e.g. TR.InvestorValueHeld, TR.SecurityOwnedName) the sorting should be done?
0 -
You can specify the parameters to the field. For example:
TR.PvtOwnInvestorName(SortOrder=Descending)
However, I am unable to find those field in the Data Item Browser so I can't confirm which parameters can be used.
Please contact the helpdesk team via MyAccount for more information.
0
Categories
- All Categories
- 6 AHS
- 37 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 中文论坛