Views:
TypeRead/writeAuthorAvailability
Data providerWriteFINBOURNEProvided with LUSID

Providing you have sufficient access control permissions, the Lusid.Fund.Fee.Writer provider enables you to write a Luminesce SQL query that either adds fees to, or removes fees from, a fund.

You must construct a valid table of data, one record per fee. Lusid.Fund.Fee.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:

  • Insert a fee. This is the default operation if you omit WriteAction.
  • Delete a fee.

See also: Lusid.Fund.Fee

Basic usage

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

Query parameters

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

Data fields

Lusid.Fund.Fee.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:

OperationSpecify using...Mandatory fieldsNotes
Insert'Insert' as WriteAction (or omit)FeeCode
FundScope
FundCode
FeeTypeScope
FeeTypeCode
DisplayName
AccrualCurrency
Treatment
PayableFrequency
BusinessDayConvention
StartDate

Either: TotalAnnualAccrualAmount or FeeRatePercentage and CalculationBase

The following fields are validated:
 

  • AccrualCurrency must resolve to a valid ISO 4217 currency code, for example USD.
  • Treatment must be Daily or Monthly.
  • PayableFrequency must be Annually, Quarterly or Monthly.
  • BusinessDayConvention must be one of the values in this table, for example Following.
Delete'Delete' as WriteActionFeeCode
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.Fee.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.Fee.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 fixed fee to a fund

Specify a fixed amount using the TotalAnnualAccrualAmount field.

@data_to_write = select 'FixedLegalFee' as FeeCode, 'Growth' as FundScope, 'Equities' as FundCode,
'MyFeeTypes' as FeeTypeScope, 'LegalFees' as FeeTypeCode, 'Fixed legal fee' as DisplayName,
'GBP' as AccrualCurrency, 'Daily' as Treatment, 'Quarterly' as PayableFrequency, 'ModifiedFollowing' as BusinessDayConvention,
#2024-01-01# as StartDate, 25000 as TotalAnnualAccrualAmount
;
select * from Lusid.Fund.Fee.Writer where ToWrite = @data_to_write;

Example 2: Add a percentage fee to a fund

Specify:

  • A percentage rate as a decimal using the FeeRatePercentage field, for example 0.01 to represent 1%.
  • An amount to calculate the percentage from using the CalculationBase field, for example the entire fund GAVSee how to first subtract other fees.
@data_to_write = select 'FixedLegalFee' as FeeCode, 'Growth' as FundScope, 'Equities' as FundCode,
'MyFeeTypes' as FeeTypeScope, 'LegalFees' as FeeTypeCode, 'Fixed legal fee' as DisplayName,
'GBP' as AccrualCurrency, 'Daily' as Treatment, 'Quarterly' as PayableFrequency, 'ModifiedFollowing' as BusinessDayConvention,
#2024-01-01# as StartDate, 0.01 as FeeRatePercentage, 'GAV' as CalculationBase
;
select * from Lusid.Fund.Fee.Writer where ToWrite = @data_to_write;

Example 3: Add the same fee to multiple funds

@funds = values
('Growth', 'Equities'),
('Retirement', 'FixedIncome')
;
@data_to_write = select 'FixedLegalFee' as FeeCode, column1 as FundScope, column2 as FundCode,
'MyFeeTypes' as FeeTypeScope, 'LegalFees' as FeeTypeCode, 'Fixed legal fee' as DisplayName,
'GBP' as AccrualCurrency, 'Daily' as Treatment, 'Quarterly' as PayableFrequency, 
'ModifiedFollowing' as BusinessDayConvention, #2024-01-01# as StartDate, 25000 as TotalAnnualAccrualAmount
from @funds
;
select * from Lusid.Fund.Fee.Writer where ToWrite = @data_to_write;

Example 4: Delete a fee

@data_to_write = select 'Growth' as FundScope, 'Equities' as FundCode, 'PercentageLegalFee' as FeeCode, 'Delete' as WriteAction;
select * from Lusid.Fund.Fee.Writer where ToWrite = @data_to_write;