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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 1 1 1

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 512.0 KiB each and 1.0 MiB total.

@sandeep.kola

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

@sandeep.kola

Hi,

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
11.3k 25 9 14

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 512.0 KiB each and 1.0 MiB total.

Upvotes
22.1k 59 14 21

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 512.0 KiB each and 1.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;

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.