question

Upvotes
Accepted
98 5 5 15

Display fields selected in RDP Search

Hi 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
rdp
icon clock
10 |1500

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

<AHS>

I asked Gravestock, Paul to suggest me who can answer this, will put an update here

<AHS>

case 10871053 is still in progress, extend the triage. The RDP team has provided a workaround for the client.

Upvotes
Accepted
14.2k 30 5 10

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
  1. 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(","
  2. 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']
icon clock
10 |1500

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

Upvotes
14.2k 30 5 10

hi @anass.yazane.1

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.

icon clock
10 |1500

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

Upvotes
98 5 5 15
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
icon clock
10 |1500

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

hi @anass.yazane.1

sorry for this inconvenience, let me try to ask the RDP search expert to help answering this

hi @anass.yazane.1

Thank you for your patience, case number 10871053 has been raised and the content specialist should contact you to provide this information soon.

Upvote
17.1k 80 39 63

Hi @anass.yazane.1

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.df

If you were to display the response as is, you can observe the order issue:

outoforder.png

However, because you placed your field input as an array, you can simply do this:

bonds[properties]

ordered.png


outoforder.png (36.2 KiB)
ordered.png (35.3 KiB)
icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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