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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
16 0 0 5

Universal Close Price not coming for non traded equities from API

I am having some difficulty in getting ‘Universal Close Price’ for equities. We have a schedule for Premium EOD for international equities. The file generated every day has ‘Universal Close Price’. If the equity is not traded on a particular day, then the previous ‘Universal Close Price’ is used in the file created.


Also I am trying to execute the same report using API. The result I get from API is very similar to the one generated above. However the only difference is that if the equity is not traded then the ‘Universal Close Price’ is null. (ex: RIC = 002236.SZ). Is there any reason or am I doing something wrong?


My code is as follows:


public void GetPricing()
{

extractionResult = new ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionResult();
var extractionsContext = ContextHelper.CreateExtractionsContext();

//Create the instrument list
var instrumentList = new InstrumentList { Name = "ImmediateNonCustomized" + Suffix.New() };
extractionsContext.InstrumentListOperations.Create(instrumentList);
extractionsContext.InstrumentListOperations.AppendIdentifiers(instrumentList, InstrumentIdentifiers, false);

//Create the report template
var retrievedTemplate = extractionsContext.ReportTemplateOperations.GetByName(ReportTemplateName);

//Schedule the extraction to run immediately
var schedule = new Schedule
{
Name = "ImmediateNonCustomized" + Suffix.New(),
TimeZone = TimeZoneInfo.Local.Id,
Recurrence = ScheduleRecurrence.CreateSingleRecurrence(DateTimeOffset.UtcNow, true),
Trigger = ScheduleTrigger.CreateImmediateTrigger(true),
ListId = instrumentList.ListId,
ReportTemplateId = retrievedTemplate.ReportTemplateId

};
extractionsContext.ScheduleOperations.Create(schedule);

try
{
//Wait for the extraction to complete. This involves polling GetLastExtractionForScheduleId until
//the returned ReportExtraction.Status is completed.
var extraction = extractionsContext.ScheduleOperations.WaitForNextExtraction(schedule);
//Get the list of files for this extraction. This includes the contents, notes files and RIC maintenance files.
extractionsContext.LoadProperty(extraction, "Files");

//Find the extract file. Other ExtractedFileTypes are: Note, RicMaintenanceNote, Full, Partial, Other
var extractFile = extraction.Files.FirstOrDefault(f => f.FileType == ExtractedFileType.Full);
if (extractFile != null)
{
//Output the contents of the extracted file
reutersResponse = extractionsContext.ExtractedFileOperations.GetReadStream(extractFile);
reutersResponseNotes = extractionsContext.ExtractedFileOperations.GetReadStream(extraction.Files[2]);
reutersResponseNotesTxt = extractionsContext.ExtractedFileOperations.GetReadStream(extraction.Files[0]);
extractionsContext.ScheduleOperations.Delete(schedule);
}
}
catch (TimeoutException ex)
{
throw (ex);
}

//Delete the extracted files, schedule, instrument list and report template. See the "Cleanup" example for
//the various steps involved with cleanup. NOTE: It is a good idea to clean up the extracted files (Report Extractions)
//once you have downloaded the results. If the schedule is not immediate (i.e. recurring), you want to keep the
//instrument list, report template and schedule around.
QuickStart.QuickStartExamples qse = new QuickStart.QuickStartExamples();
//qse.Cleanup(schedule, instrumentList, reportTemplate);
//QuickStart.QuickStartExamples.Cleanup(schedule, instrumentList, reportTemplate);
}








dss-rest-apidatascope-selectdsspricing
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

@vivek.arkalgud

Hi Vivek,

If you want the code in the initial question to create a schedule with "Last Updated" type, you can change the parameter of ScheduleTrigger.CreateImmediateTrigger() method to false. Below is the sample code.

//Schedule the extraction to run immediately
var schedule = new Schedule
{
Name = "ImmediateNonCustomized" + Suffix.New(),
TimeZone = TimeZoneInfo.Local.Id,
Recurrence = ScheduleRecurrence.CreateSingleRecurrence(DateTimeOffset.UtcNow, true),
Trigger = ScheduleTrigger.CreateImmediateTrigger(false),
ListId = instrumentList.ListId,
ReportTemplateId = retrievedTemplate.ReportTemplateId

};
extractionsContext.ScheduleOperations.Create(schedule);

According to DSS GUI User Guide, the Type can affect the value of Universal Close Price when today's validated end of day prices are not available. Below is the screenshot from the guide.


1572408537421.png (137.4 KiB)
1572408593471.png (221.5 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
11.3k 25 8 13

Hi @vivek.arkalgud,

The behavior of "Universal Closed Price" is related to the "Return Null Codes Values in Extraction Pricing Fields" and "Exclude Null Codes For Universal Close Price" options in the user preference. For example, if the "Return Null Codes Values in Extraction Pricing Fields" option is cleared, a blank field will appear when price is not available.

Anyway, these options affect every Schedule Extractions done by user who sets these options, so the GUI and your API code should return the same result. Were API and GUI extractions done with the same DSS User?


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
16 0 0 5

Thanks Veerapath.

Yes. I am using the same DSS user for both GUI and API. Interestingly if I use the following code instead of the code used above, I get 'Universal Close Price' :


var extractionsContext = ContextHelper.CreateExtractionsContext();

extractionsContext.Preferences.WaitSeconds = 5;

var extractionRequest = new EndOfDayPricingExtractionRequest

{

IdentifierList = SubjectIdentifierList.CreateInstrumentIdentifierList(instrumentIdentifiers, null, false),

ContentFieldNames = new[] { "RIC", "User Defined Identifier", "User Defined Identifier2", "User Defined Identifier3", "Exchange Code", "Exchange Description", "Asset SubType Description", "Asset Type Description", "Ask Price", "Bid Price", "Close Price", "Instrument ID Type", "Instrument ID", "Security Description", "Ticker", "Currency Code", "Currency Code Description", "Currency Code Scaled", "Currency Code Scaled Description", "Asset Status", "Trading Status", "Universal Close Price", "Universal Close Price Date", "Domicile", "Domicile Description" }

};

//Extract

extractionResult = extractionsContext.ExtractWithNotes(extractionRequest);



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.3k 25 8 13

Hi @vivek.arkalgud

According to your code in the initial question, the schedule is created with "limitReportToTodaysData" option = True. The option should be equivalent to the "Today Only" option on Web GUI.

Trigger = ScheduleTrigger.CreateImmediateTrigger(true), 

Could you verify whether the schedule created on Web GUI has the same "Today Only" option?

Below is the sample on Web GUI.


1571639886939.png (13.9 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
16 0 0 5

Hi Veerapath,


Thanks. I will check.

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
16 0 0 5

Hi Veerapath,


I checked web GUI. The Type is set to "Last Updated". Is there a way to set this "Type" in the code while executing this schedule?

Thanks


Vivek

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