Lusid.Fund.ValuationPoint.Writer

Type

Read/write

Author

Availability

Data provider

Write

FINBOURNE

Provided with LUSID

Providing you have sufficient access control permissions, the Lusid.Fund.ValuationPoint.Writer provider enables you to write a Luminesce SQL query that creates, updates or deletes accounting diary entries of type ValuationPoint.

Note: By default, Lusid.Fund.ValuationPoint.Writer cannot add properties to diary entries. To do this, you must first configure Lusid.Fund.ValuationPoint.Writer to 'inline' properties from the DiaryEntry domain. See how to do this.

You must construct a valid table of data to write, one valuation point per record. Lusid.Fund.ValuationPoint.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:

  • Upsert a valuation point; that is, create one with a status of Estimate if it does not exist, and update it if it does and is still an Estimate. Note you cannot update a valuation point whose status has moved to Candidate or Final. This is the default operation if you omit WriteAction.

  • Delete a valuation point (of any status).

Once you have created a valuation point, you can use it to value a fund at a specific point in time, and persist the underlying data.

See also: Lusid.Fund.ValuationPoint, Lusid.Fund.ValuationPointData

Basic usage

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

Query parameters

Lusid.Fund.ValuationPoint.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.Fund.ValuationPoint.Writer' and FieldType = 'Parameter';

Data fields

Lusid.Fund.ValuationPoint.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

Upsert

'Upsert' as WriteAction (or omit)

DiaryEntryCode

FundScope

FundCode

DisplayName

EndDate

Delete

'Delete' as WriteAction

DiaryEntryCode

FundScope

FundCode

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.Fund.ValuationPoint.Writer' and FieldType = 'Column';

Write errors

We recommend examining the results of every write query using one or more of the WriteErrorWriteErrorCode and WriteErrorDetail fields.

For each record in the table of data to write, Lusid.Fund.ValuationPoint.Writer returns an error code. If the operation is successful, the error code is 0. If unsuccessful, a positive error code and explanation help you discover why LUSID considers the operation invalid.

Examples

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

Example 1: Add a valuation point to a fund

@data_to_write = select 'Growth' as FundScope, 'Equities' as FundCode, '2024-06-20-5pm' as DiaryEntryCode,
'2024-06-20-5pm' as DisplayName, #2024-06-20 17:00:00# as EndDate;
select * from Lusid.Fund.ValuationPoint.Writer where ToWrite = @data_to_write;

Example 2: Add the same valuation point to different funds

@funds = values
('Growth', 'Equities'),
('Retirement', 'FixedIncome')
;
@data_to_write = select column1 as FundScope, column2 as FundCode, '2024-06-20-5pm' as DiaryEntryCode,
'2024-06-20-5pm' as DisplayName, #2024-06-20 17:00:00# as EndDate from @funds
;
select * from Lusid.Fund.ValuationPoint.Writer where ToWrite = @data_to_write;

Example 3: Delete a valuation point

@data_to_write = select 'Growth' as FundScope, 'Equities' as FundCode, '2024-06-20-5pm' as DiaryEntryCode, 'Delete' as WriteAction;
select * from Lusid.Fund.ValuationPoint.Writer where ToWrite = @data_to_write;