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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
16 2 3 7

Sample C# code that excludes deleted items when pulling data from DSS Corporate Actions table

We have 3 queries:

1) We are using CorporateActionsStandardExtractionRequest whereas I see that you are using CorporateActionsStandardReportTemplate – do you anticipate differences in behavior when using one class versus the other?

2) If you look at our setting of the condition, you will see that we set our IncludeInstrumentsWithNoEvents to false whereas you set it to null, and we set our ReportDateRangeType to a string (“Last”) whereas you set it to whatever the value behind ReportDateRangeType.Delta is. Could this be causing issues? Do we need to set any other flags?

newCorporateActionsStandardCondition{ExcludeDeletedEvents =
true,ReportDateRangeType =
ReportDateRangeType,IncludeInstrumentsWithNoEvents
= false,};

3) Can you confirm that the code below works (i.e. that if you try to run it against a sedol with the excludedeleted flag set to true, then no retired shares will be returned)

Your original solution/response was:

Here is the code for excluding deleted events in corp actions:

publicvoid CreateCorporateActionsStandardReportTemplate()
{
Status.Notify(ExtractionsContext, "ReportTemplateType", "GetContentFieldTypes", MethodType.Operation, Publish.Secondary);

//Retrieve the list of available fields. You can skip this step if you already know the list of fields to extract.
//The list of fields contains the code, name, format. Either the code or name can be used as the fieldName when
//adding content fields
var availableFields = ExtractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.CorporateActions);
Status.EndNotify(ExtractionsContext);
Status.Notify(ExtractionsContext, "CorporateActionsStandardReportTemplate", "Create",
MethodType.Operation, Publish.Primary);

//Create the new report template
var reportTemplate = new CorporateActionsStandardReportTemplate
{
Name = Guid.NewGuid().ToString(),
OutputFormat = ReportOutputFormat.CommaSeparatedValues,
Condition = newCorporateActionsStandardCondition
{
PreviousDays = 30,
ReportDateRangeType = ReportDateRangeType.Delta,
CorporateActionsCapitalChangeType = CorporateActionsCapitalChangeType.CapitalChangeExDate,
CorporateActionsDividendsType = CorporateActionsDividendsType.DividendPayDate,
CorporateActionsEarningsType = CorporateActionsEarningsType.PeriodEndDate,
CorporateActionsEquityOfferingsType = CorporateActionsEquityOfferingsType.AllPendingDeals,
CorporateActionsMergersAcquisitionsType = CorporateActionsMergersAcquisitionsType.DealAnnouncementDate,
CorporateActionsNominalValueType = CorporateActionsNominalValueType.NominalValueDate,
CorporateActionsSharesType = CorporateActionsSharesType.SharesAmountDate,
CorporateActionsStandardEventsType = CorporateActionsStandardEventsType.None,
CorporateActionsVotingRightsType = CorporateActionsVotingRightsType.VotingRightsDate,
QueryStartDate = null,
NextDays = null,
QueryEndDate = null,
PendingEventsHours = null,
PendingEventsMinutes = null,
IncludeInstrumentsWithNoEvents = null,
IncludeNullDates = null,
//
// EXCLUDE DELETED EVENTS
//
ExcludeDeletedEvents = true,
IncludeCapitalChangeEvents = true,
IncludeDividendEvents = true,
IncludeEarningsEvents = true,
IncludeMergersAndAcquisitionsEvents = true,
IncludeNominalValueEvents = true,
IncludePublicEquityOfferingsEvents = true,
IncludeSharesOutstandingEvents = true,
IncludeVotingRightsEvents = true
},
}; 
dss-rest-apidatascope-selectdssrest-api
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.

1 Answer

Upvotes
Accepted
13.7k 26 8 12

1) We are using CorporateActionsStandardExtractionRequest whereas I see that you are using CorporateActionsStandardReportTemplate – do you anticipate differences in behavior when using one class versus the other?

These are 2 different approaches to a similar goal. The choice depends on your use case.

CorporateActionsStandardExtractionRequest is used in the context of an On Demand (i.e. on the fly) extraction. The instrument list and report template are created dynamically, and are not saved on the DSS server. This is very easy to program and use. We have sample code for this, which you can find in the REST API Reference tree, under Extractions Context - Operations - Extract (select the scenario On Demand Extractions - Create - Standard Events (Corporate Actions)). Select tab C# full to see the entire code. You can also see and run the code in the C# example application, under On Demand Extractions - Create Standard Events (Corporate Actions). For detailed instructions on how to install and run it, see here.

CorporateActionsStandardReportTemplate is used to create a report template that is saved on the DSS server (you can check that using the DSS web GUI). That is useful if you want to create it once and for all, and reuse it later. We have sample code for this method, which you can find in the REST API Reference tree, under Extractions Context - Entities - Report Template (with Derived Entities) - Derived Entities - CorporateActionsStandardReportTemplate - Operations - Create (select the scenario Report Template Examples - Create - Standard Events (Corporate Actions).primary). Select tab C# full to see the entire code. You can also see and run the code in the C# example application, under Report Template Examples - Create Standard Events (Corporate Actions).

But this second method is not sufficient for an extraction. In this scenario you also need to create an instrument list on the DSS server, and a schedule for your extraction, after which you can retrieve the extracted data. This approach is similar to what you can do manually in the DSS GUI. For an explanation of the 2 approaches see here. For a complete code sample with all required steps using this 2nd approach (for EoD data, not Corax, but the idea is the same) see here.

2) If you look at our setting of the condition, you will see that we set our IncludeInstrumentsWithNoEvents to false whereas you set it to null, and we set our ReportDateRangeType to a string (“Last”) whereas you set it to whatever the value behind ReportDateRangeType.Delta is. Could this be causing issues? Do we need to set any other flags?

A) false vs null

Property IncludeInstrumentsWithNoEvents is a nullable boolean (type bool?). If you do not want to include instruments with no event data, then setting it to false is fine.

B) Last vs Delta

ReportDateRangeType is an enumerable that can have any of the following values: Delta, Init, Last, NoRange, Range. The difference between Delta and Last is the following:

  • Delta: Limit your extraction to only new and updated events that have occurred within a specified number of hours or days.
  • Last: Retrieve the most recent events available, regardless of when the data was last updated.

Depending on the chosen value, other properties must be set. For more info search for Delta in the DSS GUI help, then select Report Options for Corporate Actions.

C) Properties (flags) list

There are many more properties that can be set. The sample code mentioned in the answer to query 1 above illustrates them. If you need to set them or not depends on your use case. Defaults will be used for unset values.

3) Can you confirm that the code below works (i.e. that if you try to run it against a sedol with the excludedeleted flag set to true, then no retired shares will be returned)

The purpose of ExcludeDeletedEvents is to exclude deleted Corporate Actions.

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