To get a list of of index constituents for a index the following steps must be done:
using System;
using log4net;
{
class IndexComposition
{
private static ILog log = LogManager.GetLogger("IndexComposition");
private MessageSerializer serializer;
private RoutingDataStore rds;
public void Main()
{
ConfigurationHelper.Initialize();
serializer = new MessageSerializer();
rds = ConfigurationHelper.RoutingDataStore;
IndexCompositionRequestMessage requestMessage = new IndexCompositionRequestMessage
{
header = new RequestHeaderMessage
{
user = Authentication.GetUser(),
password = Authentication.GetPassword(),
sourceTarget = SourceTargetType.SOURCE_TARGET_DMC
},
addQuotes = false,
isin = "DE0008469008",
};
StaticDataResponse response = rds.CallFunction(StaticDataFunctions.INDEX_COMPOSITION
, InputFormat.PROTO.ToString()
, OutputFormat.PROTO.ToString()
, serializer.Serialize<IndexCompositionRequestMessage>(OutputFormat.PROTO, requestMessage));
if (response.GetErrorCode() != 0)
{
log.Warn("Error from calling function: IndexComposition: " + response.GetErrorMessage());
return;
}
IndexCompositionMessage responseMessage = serializer.Deserialize<IndexCompositionMessage>(InputFormat.PROTO, response.GetData());
if (responseMessage.header.error_code != ErrorCodes.Ok && responseMessage.header.error_code != ErrorCodes.Default)
{
log.Error("Fatal: " + responseMessage.header.error_message);
return;
}
Console.WriteLine("RoutingDataStore response for IndexCompositionMessage : contained vwd codes: " + responseMessage.indexList.Count);
foreach (IndexCompositionEntryMessage indexEntry in responseMessage.indexList)
{
Console.Write(" vwd Code : " + indexEntry.quotationIdentifiers.vwdCode + " || ");
Console.Write(" Instrument type: " + indexEntry.quotationIdentifiers.instrumentType + " || ");
Console.Write(" ISIN : " + indexEntry.quotationIdentifiers.isin + " || ");
Console.Write(" Name : " + indexEntry.quotationIdentifiers.name + " || ");
Console.WriteLine("\r\n___________________________________________________________________________________________________________");
}
}
}
}