How do I get a list of the current consituents of an index using the DSS REST API

BTh
BTh Contributor

I should retrieve on a monthly basis the list of the securities that constitute some of the populat indexes, over the DSS REST API, with a .Net application. Any idea how to do that ?

I can't find any mention of index anywhere, and the chains search (which could be one answer) in the DSS GUI does not find such a thing as the .DJI or ^DJI, although the latter is supposed to be the RIC code of the Dow Jones index, and the chains search want to have a RIC code...

Any help very welcome !

Regards

Bernard

Best Answer

  • @BTh

    Hi Bernard,

    Normally, there could be Chain RIC which provides list of constituent RICs. You can use the Chain RIC to retrieve list of constituent RICs with TermsAndConditions extraction. Below is the example code. As far as I know, the Chain RIC for .DJI is 0#.DJI.

    For Chain RICs of other index, please contact Content support via MyRefinitiv.

        var extractionsContext = new ExtractionsContext(new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), dssUserName, dssUserPassword);
        TermsAndConditionsExtractionRequest extractionRequest = new TermsAndConditionsExtractionRequest
        {
            IdentifierList = InstrumentIdentifierList.Create(
                new[] { new InstrumentIdentifier { Identifier = "0#.DJI", IdentifierType = IdentifierType.ChainRIC } }, null, false),
            ContentFieldNames = { "RIC" },
            Condition = new TermsAndConditionsCondition
            {
                IssuerAssetClassType = IssuerAssetClassType.AllSupportedAssets,
                ExcludeWarrants = false,
                //StartDate = new DateTimeOffset(DateTime.Now)
            }
        };

        var extractionResult = extractionsContext.ExtractWithNotes(extractionRequest);
        var extractedRows = extractionResult.Contents;

        //Output
        if (!extractedRows.Any())
            Console.WriteLine("No rows returned");
        else
        {
            foreach (var row in extractedRows)
                Console.WriteLine(
                    row.Identifier + " (" + row.IdentifierType + ") " +
                    String.Join(", ", row.DynamicProperties.Select(dp => dp.Key + "=" + dp.Value)));
        }