---
title: "Lusid.Fund.Fee.Writer"
slug: "lusidfundfeewriter"
updated: 2025-05-13T07:45:14Z
published: 2025-05-13T07:45:14Z
canonical: "support.lusid.com/lusidfundfeewriter"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lusid.Fund.Fee.Writer

| **Type** | **Read/write** | **Author** | **Availability** |
| --- | --- | --- | --- |
| [Data provider](/v1/docs/what-are-a-data-provider-and-a-direct-provider) | Write | FINBOURNE | Provided with LUSID |

You can use the `Lusid.Fund.Fee.Writer` provider to write a [Luminesce SQL query](/v1/docs/understanding-the-luminesce-sql-query-syntax) that either adds fees to, or removes fees from, a fund. [More on fund fees](/v1/docs/how-do-i-add-a-fee-to-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](/v1/docs/lusidfundfee)

## Basic usage

```sql
@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](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
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 | `'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](https://en.wikipedia.org/wiki/ISO_4217), 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](/v1/docs/roll-conventions-and-business-day-conventions#business-day-conventions), for example `Following`. |
| Delete | `'Delete' as WriteAction` | `FeeCode` `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](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
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](https://github.com/finbourne/luminesce-examples/tree/master/examples/lusid/abor).

### Example 1: Add a fixed fee to a fund

Specify a fixed amount using the `TotalAnnualAccrualAmount` field.

```sql
@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 `GAV`. [More information](/v1/docs/how-do-i-add-a-fee-to-a-fund#specifying-a-calculation-base-for-a-percentage-fee).

```sql
@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

```sql
@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

```sql
@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;
```
