A posting module assigns journal entry lines generated by LUSID to represent economic activity in portfolios to general ledger accounts. See how to create a posting module.
A posting module contains posting rules in a specific order. A posting rule assigns debit or credit amounts for journal entry lines matching a set of criteria to a specific account. Syntax of a posting rule.
For each journal entry line, LUSID applies the first matching posting rule found in the posting module. Unmatched journal entry lines remain unassigned. The goal of a posting module is to create a waterfall of logic that ensures all economic activity is assigned.
Consider the following example, of a posting module with five rules:
{
"values": [
{
"ruleId": "rule_01",
"account": "3-Capital",
"ruleFilter": "EconomicBucket startswith 'CA'"
},
{
"ruleId": "rule_02",
"account": "1-Investments",
"ruleFilter": "HoldType eq 'P' and EconomicBucket startswith 'NA'"
},
{
"ruleId": "rule_03",
"account": "4-PnL",
"ruleFilter": "EconomicBucket startswith 'PL'"
},
{
"ruleId": "rule_04",
"account": "2-Cash",
"ruleFilter": "HoldType neq 'P' and EconomicBucket startswith 'NA'"
},
{
"ruleId": "rule_05",
"account": "Error",
"ruleFilter": "True"
}
]
}
For each generated journal entry line, LUSID automatically:
Assigns the amount to the
3-Capital
account if the economic bucket starts withCA
.If not, assigns the amount to the
1-Investments
account if the economic bucket starts withNA
and the holding type code isP
(position, signifying a non-currency holding).If not, assigns the amount to the
4-PnL
account if the economic bucket starts withPL
.If not, assigns the amount to the
2-Cash
account if the economic bucket starts withNA
and the holding type code is not equal toP
(that is, currency holdings).If not, assigns the amount to an
Error
account for manual remediation.
In this example, rule 5 is a 'catch all' rule that assigns unmatched journal entry lines to a general-purpose account. You could omit rule 5, in which case any journal entry lines failing to match rules 1, 2, 3 and 4 remain unassigned.
Syntax of a posting rule
A posting rule consists of:
A
ruleId
that uniquely identifies the posting rule in the posting module.An
account
that is the code of an account in the parent chart of accounts (CoA).A
ruleFilter
expression that describes criteria for matching journal entry lines to the account.
The syntax of a ruleFilter
expression is:
<attribute> <operator> <value>
...where:
<attribute>
and<value>
are explained in the table below.<operator>
is one of the LUSID filter operators.
| Data type | Example expression | Explanation/origin of | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String |
| Either | ||||||||||||
| DateTime |
| For a transaction, this is the trade date. For a valuation, this is the date of the latest detected change to market data. | ||||||||||||
| String |
| LUSID automatically categorises every journal entry line into a broad economic bucket. More information. | ||||||||||||
| String |
| For a transaction, this is the unique identifier in the portfolio ( | ||||||||||||
| String |
| For a transaction, if the underlying instrument is a currency and the trade is settled (holding type of | ||||||||||||
| Decimal |
| The amount in the transaction currency. | ||||||||||||
| Decimal |
| The amount in the portfolio base currency. | ||||||||||||
| String |
| The currency of the underlying instrument, if specified. | ||||||||||||
| String |
| The instrument scope in which the underlying instrument is mastered. | ||||||||||||
| String |
| The LUID (globally unique ID) of the underlying instrument. | ||||||||||||
| String |
| One of the LUSID holding type codes. | ||||||||||||
| String |
| For a transaction, this is the name of the movement in the transaction type to which the transaction belongs. If the movement does not have a name (and note its For a valuation, this is always | ||||||||||||
| String |
| Either | ||||||||||||
| String |
| Either
| ||||||||||||
A sub-holding key on the portfolio | User-defined |
| Under-the-hood, a SHK is defined as a custom property with a 3-stage key in the | ||||||||||||
A portfolio field | System-defined |
| This can be any of the stored fields for a portfolio except the | ||||||||||||
A portfolio property | User-defined |
| This can be any property with a 3-stage key in the Portfolio domain. | ||||||||||||
An instrument field (see also a transaction instrument field, below) | System-defined |
| This can be any of the stored fields for an instrument except the | ||||||||||||
An instrument property (see also a transaction instrument property, below) | User-defined |
| This can be any property with a 3-stage key in the | ||||||||||||
A transaction field | System-defined |
| This can be any of the stored fields for a transaction, prefixed by | ||||||||||||
A transaction property | User-defined |
| This can be any property with a 3-stage key in the | ||||||||||||
An instrument field on a transaction | System-defined |
| If a journal entry line is generated in response to a currency movement, then the instrument of the line itself is a currency. The instrument of the original transaction, however, may be (for example) an equity. This gives you access to the instrument fields and properties of the equity. The available fields and properties are the same as those for the instrument of the line itself, above. | ||||||||||||
An instrument property on a transaction | User-defined |
| |||||||||||||
An account field | System-defined |
| This can be any of the stored fields for an account, prefixed by | ||||||||||||
An account property | User-defined |
| This can be any property with a 3-stage key in the | ||||||||||||
An ABOR property | User-defined |
| This can be any property with a 3-stage key in the |
Note the following:
A
ruleFilter
expression is case-insensitive.A string
value
must be enclosed in single straight quote marks (the%27
UTF-8 encoding).You can concatenate expressions using the
and
andor
operators, for example:MovementName eq 'Side1' and subholdingkeys[Transaction/Ibor/Strategy] eq 'Income'
If you use both, standard boolean operator precedence applies:
InstrumentScope startswith 'Custom' or (LocalAmount lte 1000 and HoldType eq 'P')