For a deeper look into our DataScope Select SOAP API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
43 2 1 7

retrieve ric company hierarchy data from datascope in python

I tried integrating RKD financial and general info APIs using python. Now working on integrating company hierarchy data(subsidary and ultimate parents info) for a given company (ric_code).

I am not able to figure out the exact API and how to call the API. Please help in proceeding further and get this data.


To summarize : I want to get the company ownership hierarchy data(subsidaries and ultimate parent) for a given company(ric_code) using DataScope API and python.


How I am calling GetFinancialStatementsReports_1 API:

https://www.trkd.thomsonreuters.com/SupportSite/TestApi/Op?svc=Fundamentals_1&op=GetFinancialStatementsReports_1


message_headers = {
    'content-type': 'application/json;charset=utf-8',
    'X-Trkd-Auth-ApplicationID': app_id,
    'X-Trkd-Auth-Token': auth_token
}


message_request = {
    'GetFinancialStatementsReports_Request_1': {
        'companyId': IBM.N,
        'companyIdType': 'RIC'
    }
}
api_url = 'https://api.rkd.refinitiv.com/api/Fundamentals/Fundamentals.svc/REST/Fundamentals_1/GetFinancialStatementsReports_1'
import request
api_response = requests.post(api_url, data=json.dumps(message_request), headers=message_headers)
pythondss-rest-apidatascope-selectdss
icon clock
10 |1500

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

Upvotes
Accepted
23k 22 9 14

Hello @vijay.singh,

Yes, you can lookup LegalEntity by it's RIC as well, for example:

{
                {protocol}}{
                {host}}{
                {api}}Extractions/ExtractWithNotes 
{
  "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.LegalEntityHierarchyExtractionRequest",
    "ContentFieldNames": [
        "Official Name",
        "Entity ID",
        "ID",
        "ID Type",
        "Related Official Name",
        "Derived Parent Official Name"
    ],
    "IdentifierList": {
      "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.EntityIdentifierList",
      "EntityIdentifiers": [
          { "Identifier": "IBM.N", "IdentifierType": "Ric" }
      ]
    },
    "Condition": {
      "DeltaDays": "5"
    }
  }
}

Resulting in

{
    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult",
    "Contents": [
        {
            "IdentifierType": "OrgId",
            "Identifier": "18228",
            "Official Name": "Lenovo Group Limited",
            "Entity ID": "0x0003ef06c0f67da1",
            "ID": "18228",
            "ID Type": "ORG",
            "Related Official Name": "INTERNATIONAL BUSINESS MACHINES CORPORATION",
            "Derived Parent Official Name": "Lenovo Group Limited"
        },
        {
            "IdentifierType": "OrgId",
            "Identifier": "18228",
            "Official Name": "IBM Hungary Limited Liability Company",
            "Entity ID": "0x0003ef06c44d187b",
            "ID": "18228",
            "ID Type": "ORG",
            "Related Official Name": "IBM WORLD TRADE CORPORATION",
            "Derived Parent Official Name": "IBM Ireland Product Distribution Limited"
        },
...

I am a developer, so giving you a developer's view of this, if you are looking to retrieve the complete hierarchy, I think the hierarchy result will depend on the level of RIC. IBM.N is a primary RIC for IBM, see this previous discussion thread for more info.

If what you have at hand is RICs, and some of them are per exchange, I would test if the result that you get is as you require. You may be better off running InstrumentSearch first, mapping RIC to OrgId, and then requesting Hierarchy on OrgId.

For an in-depth answer on content, as a customer, you may wish to verify with Refinitiv content experts, via Refinitiv Helpdesk Online -> Content -> DSS.

icon clock
10 |1500

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

Upvotes
13k 32 12 18

Hello @vijay.singh,

Not sure if you are asking for help using RKD API or Datascope API (so that we can move this question into appropriate API category).

Either way, we can only provide technical help with API on these forums. For content questions, I would recommend that you raise a service ticket with my.refinitiv.com and directly engage with a content expert. Select the option - "I need help understanding the content in the product" and select Datascope as the product.

icon clock
10 |1500

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

Upvotes
11.5k 16 7 10

Hello @vijay.singh

Which API that you are using? The RKD API or DataScope Select API? For the RKD API, there are the Ownership Services, are they match your requirement?


rkd-ownership.png (130.4 KiB)
icon clock
10 |1500

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

@Gurpreet , @wasin.waeosri We have to use Datascope API Platform. Also we are new to Datascope platform and it seems confusing in first look. Therfore any kind of help from your side will be appreciated. https://hosted.datascopeapi.reuters.com/RestApi.Help/Home/Index


The data we require is Company Hierarchy Data i.e Ultimate Parent, Child companies

1620898920848.png (133.4 KiB)
Upvotes
43 2 1 7

@wasin.waeosri please provide me the link of DSS forum, where this question has been moved.

icon clock
10 |1500

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

Upvotes
11.5k 16 7 10

Hello @vijay.singh


The DSS forum link is available here, you can still access the question with the existing https://community.developers.refinitiv.com/questions/78082/retrieve-ric-company-hierarchy-data-from-datascope.html URL.

Regarding how to get the Company information via the DataScope Select(DSS), you need to know which field and report template to query. I suggest you raise a service ticket with my.refinitiv.com and directly engage with a content expert. Select the option - "I need help understanding the content in the product" and select Datascope as the product as suggested by @Gurpreet



icon clock
10 |1500

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

I am able to get the required company hierarchy data on DSS UI.

Now I have to get the same data using API in python. Could you please help in getting info abou how to make the API request and get the needed data.


1620918824438.png (180.3 KiB)
Upvote
23k 22 9 14

Hello @vijay.singh,

I think the request type you are looking for is LegalEntityHierarchyExtractionRequest.

For example:

{ {protocol}}{ {host}}{ {api}}Extractions/ExtractWithNotes

{
  "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.LegalEntityHierarchyExtractionRequest",
    "ContentFieldNames": [
        "Official Name",
        "Entity ID",
        "ID",
        "ID Type",
        "Related Official Name",
        "Derived Parent Official Name"
    ],
    "IdentifierList": {
      "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.EntityIdentifierList",
      "EntityIdentifiers": [
          { "Identifier": "100421204", "IdentifierType": "OrgId" }
      ]
    },
    "Condition": {
      "DeltaDays": "5"
    }
  }
}

for me this request results in:

{
    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult",
    "Contents": [
        {
            "IdentifierType": "OrgId",
            "Identifier": "100421204",
            "Official Name": "DHC Software Co., Ltd",
            "Entity ID": "0x0003ef06c0dc4bbd",
            "ID": "100421204",
            "ID Type": "ORG",
            "Related Official Name": "Tencent Technology (Shanghai) Company Limited",
            "Derived Parent Official Name": "Beijing Donghua Computer System Co., Ltd."
        },
        {
            "IdentifierType": "OrgId",
            "Identifier": "100421204",
            "Official Name": "UBISOFT ENTERTAINMENT S.A.",
            "Entity ID": "0x0003ef06c0e75598",
            "ID": "100421204",
            "ID Type": "ORG",
            "Related Official Name": "TENCENT HOLDINGS LIMITED",
            "Derived Parent Official Name": "UBISOFT ENTERTAINMENT S.A."
        },
        {
            "IdentifierType": "OrgId",
            "Identifier": "100421204",
            "Official Name": "FREEMAN FINTECH CORPORATION LIMITED",
            "Entity ID": "0x0003ef06c0f6419d",
            "ID": "100421204",
            "ID Type": "ORG",
            "Related Official Name": "LEYOU TECHNOLOGIES HOLDINGS LIMITED",
            "Derived Parent Official Name": "FREEMAN FINTECH CORPORATION LIMITED"
        },
   ...

To wrap the on-demand request in Python, please see RTH Python Code Examples.

REST API Reference Tree includes the request spec with the list of available fields.

Hope this helps.

icon clock
10 |1500

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

Upvotes
43 2 1 7

@zoya.farberov Thanks a lot for the information you provided. It helped us to move forward.

There are few more things which are required.

1. can we get the company hierarchy data based on ric_code of a given company? If yes how?

2. How can we get the data required to build the tree hierarchy. The data which I got from attached python tutorial doesn't provide who-owns-who or parent-child relation info.


This is the data I got from provided python tutorial:


1620983753494.png (153.6 KiB)
1620983813196.png (132.6 KiB)
icon clock
10 |1500

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

Upvotes
23k 22 9 14

Hello @vijay.singh,

For the tree hierarchy as presented in the GUI, I do not believe that there is an easy way. The way to rebuild it would be by using the content fields that indicate the relationships. For example

{
                {protocol}}{
                {host}}{
                {api}}Extractions/ExtractWithNotes 
{
  "ExtractionRequest": {
    "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.LegalEntityHierarchyExtractionRequest",
    "ContentFieldNames": [
        "Official Name",
        "Entity ID",
        "ID",
        "ID Type",
        "Immediate Parent OrgID",
        "Derived Parent OrgID",
        "Derived Ultimate Parent OrgID"
    ],
    "IdentifierList": {
      "@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.EntityIdentifierList",
      "EntityIdentifiers": [
          { "Identifier": "108845159", "IdentifierType": "OrgId" }
      ]
    }
  }
}

Resulting in:

...
 {
            "IdentifierType": "OrgId",
            "Identifier": "108845159",
            "Official Name": "TENCENT HOLDINGS LIMITED",
            "Entity ID": "0x0003ef06c0dec83c",
            "ID": "108845159",
            "ID Type": "ORG",
            "Immediate Parent OrgID": "100421204",
            "Derived Ultimate Parent OrgID": "100421204"
        },
...

This, however, gets complex from the content perspective. There is no one-to-one relationship, there is usually many-to-many, many children and many parents, a graph rather then a tree, and one would have to have subject matter expertise to filter out the some of the available hierarchy, leaving you with what you require.

For this reason, I would suggest not just examining the relationships via API but working with Refinitiv content experts, via Refinitiv Helpdesk Online -> Content on your specific requirements.


icon clock
10 |1500

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

Upvotes
43 2 1 7

@zoya.farberov Thanks a lot for the very precise and detailed solution that you have provided. Very much appreciated.

icon clock
10 |1500

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

Click below to post an Idea Post Idea