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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 1 0

C# RestAPI Create multiple securities request in one go

My RICS are available in a dynamic Array => string[] ArrRICS = RICs.Split('|');

==> usual code: manually if I create hardcoded each line as follows giving me output

InstrumentIdentifiers = new[]

{

InstrumentIdentifier.Create(IdentifierType.Ric, "IDFR0044="),

InstrumentIdentifier.Create(IdentifierType.Ric, "05968LAH5="),

InstrumentIdentifier.Create(IdentifierType.Ric, "IDFR0076="),

InstrumentIdentifier.Create(IdentifierType.Ric, "IDFR0077="),

InstrumentIdentifier.Create(IdentifierType.Ric, "IDFR0078="),

}

But this snippet to be replaced with a dynamic array ArrRICS[] to IdenterfierIntruments create highlighted in Bold <ArrayOfRics>

//***************************************************

var extractionRequest = new ElektronTimeseriesExtractionRequest()

{

IdentifierList = new InstrumentIdentifierList

{

InstrumentIdentifiers = new[]

{


InstrumentIdentifier.Create(IdentifierType.Ric, <ArrayOfRics>),


}

},

Condition = new ElektronTimeseriesCondition

{

ReportDateRangeType = ReportDateRangeType.Range,

QueryStartDate = new DateTimeOffset(new DateTime(sdate.Year, sdate.Month, sdate.Day)),

QueryEndDate = new DateTimeOffset(new DateTime(edate.Year, edate.Month, edate.Day)),


},

ContentFieldNames = new[]

{

"Ask", "Bid", "High", "Last", "Low", "Trade Date","Volume"}

};

var extractionResult = ExtractionsContext.ExtractWithNotes(extractionRequest);

var extractedRows = extractionResult.Contents;

dss-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
11.3k 25 8 13

Hi @sandeep.kola,

There is no interface provided which can add array of RICs directly to Instrument List. You can use the following code which creates IdentifierList outside of the ExtractionRequest scope.


    var IdentifierListtemp = new InstrumentIdentifierList();
    String[] RICsArray = { "IDFR0044=", "05968LAH5=" , "IDFR0076=", "IDFR0077="};

    foreach (var ric in RICsArray)
    {
        IdentifierListtemp.InstrumentIdentifiers.Add(InstrumentIdentifier.Create(IdentifierType.Ric, ric));
    }

    var extractionRequest = new ElektronTimeseriesExtractionRequest
    {
        IdentifierList = IdentifierListtemp,
        Condition = new ElektronTimeseriesCondition
        {
            ReportDateRangeType = ReportDateRangeType.Range,
            QueryStartDate = new DateTimeOffset(new DateTime(sdate.Year, sdate.Month, sdate.Day)),
            QueryEndDate = new DateTimeOffset(new DateTime(sdate.Year, sdate.Month, sdate.Day)),
        },
        ContentFieldNames = new[]
        {
"Ask", "Bid", "High", "Last", "Low", "Trade Date","Volume"}
    };
    var extractionResult = ExtractionsContext.ExtractWithNotes(extractionRequest);
    var extractedRows = extractionResult.Contents;

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 @sandeep.kola, It is not clear what you are asking here. If you want to create a list of RIC's from an array, then, can you not use the following:


string[] allRICS = RICs.Split('|')

foreach (var ric in allRICS)	{
  InstrumentIdentifier.Create(IdentifierType.Ric, ric),
}


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.

Thanks Mate, unfortunately provided snippet won't work:( which I already tried

//************Code(Pls refer commented section under <HELP> )******************//

var extractionRequest = new ElektronTimeseriesExtractionRequest()

{IdentifierList = new InstrumentIdentifierList

{

//Required HELP to replace with appropriate code to pass multiple RICs from array, E.g. compiler wont allow foreach loop in the below section

InstrumentIdentifiers = new[]{InstrumentIdentifier.Create(IdentifierType.Ric, <ArrayOfRics>),

//End of HELP required

}},

Condition = new ElektronTimeseriesCondition

{ReportDateRangeType = ReportDateRangeType.Range,

QueryStartDate = new DateTimeOffset(new DateTime(sdate.Year, sdate.Month, sdate.Day)),

QueryEndDate = new DateTimeOffset(new DateTime(edate.Year, edate.Month, edate.Day)),},

ContentFieldNames = new[]

{"Ask", "Bid", "High", "Last", "Low", "Trade Date","Volume"}};

var extractionResult = ExtractionsContext.ExtractWithNotes(extractionRequest);

var extractedRows = extractionResult.Contents;

var extractionRequest = new ElektronTimeseriesExtractionRequest() {IdentifierList = new InstrumentIdentifierList { //Required help to replace with appropriate code, E.g. compiler wont allow foreach loop in the below section InstrumentIdentifiers = new[]{InstrumentIdentifier.Create(IdentifierType.Ric, ), //End of help required }}, Condition = new ElektronTimeseriesCondition {ReportDateRangeType = ReportDateRangeType.Range, QueryStartDate = new DateTimeOffset(new DateTime(sdate.Year, sdate.Month, sdate.Day)), QueryEndDate = new DateTimeOffset(new DateTime(edate.Year, edate.Month, edate.Day)),}, ContentFieldNames = new[] {"Ask", "Bid", "High", "Last", "Low", "Trade Date","Volume"}}; var extractionResult = ExtractionsContext.ExtractWithNotes(extractionRequest); var extractedRows = extractionResult.Contents;

Click below to post an Idea Post Idea