Lusid.CorporateAction.Source.Writer

Type

Read/write

Author

Availability

Data provider

Read

Finbourne

Provided with LUSID

The Lusid.CorporateAction.Source.Writer provider enables you to write a Luminesce SQL query that either creates or deletes corporate action sources in LUSID.

Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and interact with corporate action source data stored in LUSID. This should automatically be the case if you are the domain owner.

You must construct a valid table of data to write, one corporate action source per record. Lusid.CorporateAction.Source.Writer lists the fields (columns) available to populate with values for each record, and has a set of parameters to help you construct a valid table.

Your query can use the WriteAction field to perform one of the following operations:

  • Create a corporate action source. This is the default operation if you omit WriteAction.

  • Delete a corporate action source. Note this deletes any corporate actions uploaded to that source.

See also: Lusid.CorporateAction.Source

Basic usage

@table_of_data = <select-statement>;
select * from Lusid.CorporateAction.Source.Writer where toWrite = @table_of_data;

Query parameters

Lusid.CorporateAction.Source.Writer has parameters that help you construct a valid table of data to write.

Note: The toWrite parameter is mandatory and used to actually write the table of data into LUSID.

To list available parameters, their data types, default values, and an explanation for each, run the following query using a suitable tool:

select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Lusid.CorporateAction.Source.Writer' and FieldType = 'Parameter';

Data fields

Lusid.CorporateAction.Source.Writer lists the fields you can populate in your table of data to write.

Depending on the operation you want to perform, the following fields are mandatory to include in the table of data:

Operation

Specify using...

Mandatory fields

Notes

Create

'Insert' as WriteAction (or omit)

CorporateActionSourceScope

CorporateActionSourceCode

DisplayName

InstrumentScopes

Specify a single custom instrument scope if transaction portfolios you intend to register with this corporate action source resolve economic activity to instruments mastered in that scope. Omit this field if intended portfolios resolve to instruments in the default scope.

Delete

'Delete' as WriteAction

CorporateActionSourceScope

CorporateActionSourceCode

To list all available fields, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a suitable tool:

select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.CorporateAction.Source.Writer' and FieldType = 'Column';

Examples

Note: For more example Luminesce SQL queries, visit our Github repo.

Example 1: Create a corporate action source

In this example, the InstrumentScopes field is omitted, so transaction portfolios subsequently registered with this corporate action source must all resolve economic activity to instruments in the default scope.

@table_of_data = select 'Example-CAS-Scope' as CorporateActionSourceScope, 'Example-CAS-Code' as CorporateActionSourceCode,
'Example corporate action source' as DisplayName, 'This is an example corporate action source' as Description;
select * from Lusid.CorporateAction.Source.Writer where ToWrite = @table_of_data;

Example 2: Delete a corporate action source

@table_of_data = select 'Example-CAS-Scope' as CorporateActionSourceScope, 'Example-CAS-Code' as CorporateActionSourceCode, 'Delete' as WriteAction;
select * from Lusid.CorporateAction.Source.Writer where ToWrite = @table_of_data;