Type | Read/write | Author | Availability |
Write | FINBOURNE | Provided 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:
Operation | Specify using... | Mandatory fields | Notes |
Insert |
|
| The following fields are validated:
|
Delete |
|
|
|
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 WriteError
, WriteErrorCode
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 example0.01
to represent 1%.An amount to calculate the percentage from using the
CalculationBase
field, for example the entire fundGAV
. See 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;