Display fields selected in RDP Search

i have a question regarding the display order for fields selected using RDP Search.
why there are not displayed in the order indicated in the select section.
Regards
Best Answer
-
Hi @anass.yazane.1
For reference, I'd like to put the solution provided by the Customer support executive regarding the closed case number 10871053 here.Upon collaborating with our backend teams and Dev, I was able to confirm that the issue lies on the RDP.Search python library function.
To give more context to this, unlike the underlying RDP Search API, the RDP.Search python library function does not preserve the column order specified in the ‘SELECT’ parameter.
It will be considered for a future enhancement, hopefully on the next version.
For now, the only way to do this would be to manipulate the results to display the columns in the preferred order. A couple of possible ways to do this are below- Use the selected properties to specify the column names when displaying the dataframe - see changes to original highlighted below. (This works as long as all selected properties appear in the results. May not always be true with very small result sets.)
import refinitiv.dataplatform as rdp
import pandas as pd
import datetime as dt
Interval_IssueDate=30
Interval_MatDate=365
select_properties = "IssuerDescription,Currency,RIC,ISIN,CouponClass,MaturityDate,IssueDate,CouponRate,FaceIssuedTotal,AssetStatusDescription,SeniorityTypeDescription"
rdp.open_desktop_session(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
df_NewIssues=rdp.search(view=rdp.SearchViews.GovCorpInstruments,filter= "MaturityDate gt " + str(dt.date.today()+dt.timedelta(days=Interval_MatDate)) + " and IssueDate gt " + str(dt.date.today()+dt.timedelta(days=-Interval_IssueDate)) + " and \
DbTypeDescription eq 'Corporate' and IssuerTicker eq 'CAFDDC' and IsActive eq true and not(AssetStatus in ('MAT' 'DC'))",
select = select_properties,
order_by= "IssueDate,Currency",
top = 100
)
df_NewIssues[select_properties.split("," - Display the response in raw JSON format (as this does preserve the column order). This uses a lower level function rdp.Search.search, see highlighted changes below.
import refinitiv.dataplatform as rdp
import pandas as pd
import datetime as dt
Interval_IssueDate=30
Interval_MatDate=365
rdp.open_desktop_session(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
df_NewIssues=rdp.Search.search(view=rdp.SearchViews.GovCorpInstruments,filter= "MaturityDate gt " + str(dt.date.today()+dt.timedelta(days=Interval_MatDate)) + " and IssueDate gt " + str(dt.date.today()+dt.timedelta(days=-Interval_IssueDate)) + " and \
DbTypeDescription eq 'Corporate' and IssuerTicker eq 'CAFDDC' and IsActive eq true and not(AssetStatus in ('MAT' 'DC'))",
select = "IssuerDescription, Currency, RIC, ISIN, CouponClass, MaturityDate, IssueDate, \
CouponRate, FaceIssuedTotal,AssetStatusDescription,SeniorityTypeDescription",
order_by= "IssueDate,Currency",
top = 100
)
df_NewIssues.data.raw
Response:
{'Total': 5,
'Hits': [{'IssuerDescription': 'BANQUE FEDERATIVE DU CREDIT MUTUEL SA',
'Currency': 'EUR',
'RIC': 'FR0014007PV3=',
'ISIN': 'FR0014007PV3',
'CouponClass': 'FIX',
'MaturityDate': '2027-11-19T00:00:00.000Z',
'IssueDate': '2022-01-19T00:00:00.000Z',
'CouponRate': 0.625,
'FaceIssuedTotal': 750000000,
'AssetStatusDescription': 'Issued',
'SeniorityTypeDescription': 'Senior Non-Preferred'},
{'IssuerDescription': 'BANQUE FEDERATIVE DU CREDIT MUTUEL SA',
'Currency': 'EUR',
'RIC': 'FR0014007PW1=',
'ISIN': 'FR0014007PW1',
'CouponClass': 'FIX',
'MaturityDate': '2032-01-19T00:00:00.000Z',
'IssueDate': '2022-01-19T00:00:00.000Z',
'CouponRate': 1.125,
'FaceIssuedTotal': 1250000000,
'AssetStatusDescription': 'Issued',
'SeniorityTypeDescription': 'Senior Non-Preferred'},
etc
etc
Last line can also be changed to the following, to show only the records, not the total:
df_NewIssues.data.raw['Hits']
0 - Use the selected properties to specify the column names when displaying the dataframe - see changes to original highlighted below. (This works as long as all selected properties appear in the results. May not always be true with very small result sets.)
Answers
-
This forum is dedicated to software developers using Refinitiv APIs.
The moderators on this forum do not have deep expertise in every bit of content available through Refinitiv products, which is required to answer content questions such as this one.
The best resource for content questions is the Refinitiv Helpdesk, which can be reached by either calling the Helpdesk number in your country or submitting a new ticket to the support team via MyRefinitiv.
The Helpdesk will either have the required content expertise ready available or can reach out to relevant content experts to get the answer for you.
0 -
Hi Raskina
My request concerns RDP API and specialy RDP Search function.
It's the reason i post it in developer communicaty, i don't think HelpDesk will be able to respond such request, which suggest to rise to developer community each time it concerns API.
Regards
0 -
@anass.yazane.1hi
sorry for this inconvenience, let me try to ask the RDP search expert to help answering this
0 -
Thank you for your patience, case number 10871053 has been raised and the content specialist should contact you to provide this information soon.
0 -
In a past article, we encountered the same issue as you reported. While that article includes some additional functionality to deal with missing columns, it also addresses the order issue.
How we worked through the issue was to place the list of properties in an array:
# Define the collection of properties/fields within our result set
properties = ['IssuerDescription', 'Currency' , 'RIC', 'ISIN',
'CouponClass', 'MaturityDate', 'IssueDate',
'CouponRate','FaceIssuedTotal',
'AssetStatusDescription', 'SeniorityTypeDescription']When you perform your search, you apply a simple token function when specifying the 'select' statement to present the required comma-delimited string. For example:
maturity=f'{dt.date.today()+dt.timedelta(days=365)}'
issuedate = f'{dt.date.today()+dt.timedelta(days=-30)}'
response = rdp.Search.search(
view = rdp.SearchViews.GovCorpInstruments,
filter= f"MaturityDate gt {maturity} and IssueDate gt {issuedate} " + \
"and DbTypeDescription eq 'Corporate' and " + \
"IssuerTicker eq 'CAFDDC' and IsActive eq true " + \
"and not(AssetStatus in ('MAT' 'DC'))",
select = ','.join(properties)
)
bonds = response.data.dfIf you were to display the response as is, you can observe the order issue:
However, because you placed your field input as an array, you can simply do this:
bonds[properties]
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 693 Datastream
- 1.5K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 13 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 5 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 561 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 281 Open PermID
- 46 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 728 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 96 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛