How does LUSID generate journal entry lines from economic activity?

When you request a trial balance for an ABOR between two points in time, LUSID automatically generates at least one journal entry line for each item of economic activity in the transaction portfolio(s) referenced by that ABOR.

A journal entry line is a debit or credit amount representing the financial impact of that economic activity. The posting rules you've chosen for the ABOR then post the amount to a specific general ledger account. The trial balance aggregates the debits and credits in each account and enables you to check that the overall balance of the ledger is zero.

LUSID generates journal entry lines in response to the following types of economic activity in a portfolio:

  • Transaction activity
    LUSID generates at least one journal entry line per output transaction. Note the following:

    • The number of journal entry lines is determined by the transaction type. Every movement belonging to that transaction type generates at least one journal entry line, while some movements generate multiple lines on trade and settlement dates. More about transaction types and movements.

    • The nature of a journal entry line depends on the economic bucket (for example NA_Cost or CA_Capital) into which it is categorised by LUSID, which itself depends on the movement type. The amount is reported in both local (transaction) and base (portfolio) currency.

    • It is your responsibility to use transaction types with movements that create pairs of journal entry lines categorised into appropriate economic buckets. For example, a transaction representing a subscription might have a FundsIn-style transaction type with two movements, one generating a NA_Cost journal entry line for a positive debit amount to be posted to an investments account (or similar), and the other generating an equal and opposite CA_Capital journal entry line for a negative credit amount to be posted to a cash account (or similar).

    • To ensure journal entry lines balance, LUSID may produce a balancing entry for an 'unknown P&L component' categorised into the PL_Other economic bucket. This can be mapped by posting rules to an appropriate account, or more commonly to an error account for easy diagnosis of possible configuration problems.

  • Valuation activity
    LUSID generates at least one pair of journal entry lines per holding impacted by the latest market data (prices and/or FX rates) detected in the LUSID Quote Store. Note the following:

    • The number of journal entry line pairs is determined by the type of underlying instrument and the impact of that market data on the valuation.

    • The nature of a journal entry line depends on the economic bucket into which it is categorised by LUSID. The amount is always reported in base currency, and for most buckets in local currency as well.

    • LUSID automatically balances journal entry lines for valuation activity, so for example a positive debit amount for unrealised share price gain/loss for posting to an investments account (or similar) is always paired with an equal and opposite negative credit amount for posting to a PnL account (or similar).

    • It is your responsibility to load market data suitable for valuing each holding on the start and end dates of a trial balance period. You do not need to load market data for intermediate dates. More about valuation and market data.

Example: A simple portfolio containing equities

Imagine we have a simple GBP-denominated portfolio containing equities. And an ABOR set up to reference that portfolio with the following four general ledger accounts in the underlying chart of accounts:

In this example we'll see how to configure LUSID to generate balanced pairs of journal entry lines representing a typical selection of portfolio economic activity for posting to these accounts.

Subscription transaction

On 1 July we seed the portfolio with $15,000 at a USD/GBP exchange rate of 0.75, using a FundsIn transaction type with two movements, Capital and CashAccrual. When the trade settles on 3 July, these movement types combine to generate a balanced pair of journal entry lines, so no further configuration is required.

LUSID generates the following journal entry lines for this transaction:

Transaction type

Movement(s)

Journal entry lines

Notes

Date

Economic bucket

Holding type

DR or CR

Local amount (USD)

Base amount (GBP)

FundsIn

Capital

1 July

CA_Capital

B

Credit

-15000

-11250

Balances the cash holding.

Subtotal

 

 

 

 

-15000

-11250

 

CashAccrual

1 July

NA_Cost

A

Debit

15000

11250

Receivable cash holding on the trade date.

3 July

NA_Cost

A

Credit

-15000

-11250

Reverses the receivable cash holding on the settlement date.

3 July

NA_Cost

B

Debit

15000

11250

Permanent cash holding.

Subtotal

15000

11250

 

Total

0

0

 

We can post the:

  • Debit amount (journal entry line with an economic bucket of NA_Cost and holding type of B) to the 2-Cash account.

  • Credit amount (economic bucket of CA_Capital) to the 3-Capital account.

Note: You can choose to post journal entry lines reflecting temporary receivable/payable cash holdings (holding types of A, C or R) to specific accounts on the trade date if you wish. For the purpose of simplicity in this example, these journal entry lines are ignored.

Purchase transaction

On 3 July we buy 300 Microsoft shares @ $10 at a USD/GBP exchange rate of 0.7, using a Buy transaction type with two movements, StockMovement and CashCommitment. When the trade settles on 5 July, these movement types combine to generate a balanced pair of journal entry lines, so no further configuration is required. A holdings report on 5 July shows a position of 300 Microsoft shares and a USD cash balance of $12,000.

LUSID generates the following journal entry lines for this transaction:

Transaction type

Movement(s)

Journal entry lines

Notes

Date

Economic bucket

Holding type

DR or CR

Local amount (USD)

Base amount (GBP)

Buy

StockMovement

3 July

NA_Cost

P

Debit

3000

2100

Security (non-cash) holding.

Subtotal

 

 

 

 

3000

2100

 

CashCommitment

3 July

NA_Cost

C

Credit

-3000

-2100

Payable cash holding on the trade date.

5 July

NA_Cost

C

Debit

3000

2100

Reverses the payable cash holding on the settlement date.

5 July

NA_Cost

B

Credit

-3000

-2250

Permanent cash holding.

5 July

PL_RealFXGL

B

Debit

0

150

Currency gain/loss is only reported in the base (or portfolio) currency.

Subtotal

-3000

-2100

 

Total

0

0

 

We can post the:

  • Debit amount for the security (economic bucket of NA_Cost and holding type of P) to the 1-Investments account.

  • Credit amount for cash (economic bucket of NA_Cost and holding type of B) to the 2-Cash account.

  • Debit amount for realised currency gain/loss to the 4-PnL account. Note an equal and opposite amount of base currency has already been factored into the credit amount for cash.

Dividend transaction

On 5 July we load a dividend of 10 cents per share for our 300 Microsoft shares at a USD/GBP exchange rate of 0.77, using a Dividend transaction type with two movements, Carry and CashAccrual. When the trade settles on 7 July, these movement types combine to generate a balanced pair of journal entry lines, so no further configuration is required. A holdings report on 7 July shows a position of 300 Microsoft shares and a USD cash balance of $12,030.

LUSID generates the following journal entry lines for this transaction:

Transaction type

Movement(s)

Journal entry lines

Notes

Date

Economic bucket

Holding type

DR or CR

Local amount (USD)

Base amount (GBP)

Dividend

Carry

5 July

PL_Carry

P

Credit

-30

-23.10

Security (non-cash) holding.

Subtotal

 

 

 

 

-30

-23.10

 

CashAccrual

5 July

NA_Cost

A

Debit

30

23.10

Receivable cash holding on the trade date.

7 July

NA_Cost

A

Credit

-30

-23.10

Reverses the receivable cash holding on the settlement date.

7 July

NA_Cost

B

Debit

30

23.10

Permanent cash holding.

Subtotal

30

23.10

 

Total

0

0

 

We can post the:

  • Credit amount representing a flow of value out of the security (economic bucket of PL_Carry and holding type of P) to the 4-PnL account.

  • Debit amount for cash (economic bucket of NA_Cost and holding type of B) to the 2-Cash account.

Portfolio fee transaction

On 7 July we pay a portfolio fee of £50 using a PortfolioFee transaction type with two movements, Fee and CashCommitment. When the trade settles on 9 July, these movement types combine to generate a balanced pair of journal entry lines, so no further configuration is required. A holdings report on 9 July shows a position of 300 Microsoft shares, a USD cash balance of $12,030 and a GBP cash balance of -£50.

LUSID generates the following journal entry lines for this transaction:

Transaction type

Movement(s)

Journal entry lines

Notes

Date

Economic bucket

Holding type

DR or CR

Local amount (GBP)

Base amount (GBP)

PortfolioFee

Fee

7 July

PL_Fees

B

Debit

50

50

Balances the cash holding.

Subtotal

 

 

 

 

50

50

 

CashCommitment

7 July

NA_Cost

C

Credit

-50

-50

Payable cash holding on the trade date.

9 July

NA_Cost

C

Debit

50

50

Reverses the payable cash holding on the settlement date.

9 July

NA_Cost

B

Credit

-50

-50

Permanent cash holding.

Subtotal

-50

-50

 

Total

0

0

 

We can post the:

  • Credit amount (economic bucket of NA_Cost and holding type of B) to the 2-Cash account.

  • Debit amount (economic bucket of PL_Fees and holding type of B) to the 4-PnL account.

Sale transaction

On 9 July we sell 100 Microsoft shares @ $15 at a USD/GBP exchange rate of 0.8, using a Sell transaction type with movements, StockMovement and CashCommitment. When the trade settles on 11 July, these movement types combine to generate a balanced pair of journal entry lines, so no further configuration is required. A holdings report on 11 July shows a position of 200 Microsoft shares, a USD cash balance of $13,530 and a GBP cash balance of -£50.

LUSID generates the following journal entry lines for this transaction:

Transaction type

Movement(s)

Journal entry lines

Notes

Date

Economic bucket

Holding type

DR or CR

Local amount (USD)

Base amount (GBP)

Sell

StockMovement

9 July

NA_Cost

P

Credit

-1000

-700

Security (non-cash) holding.

9 July

PL_RealPriceGL

P

Credit

-500

-400

Realised gain/loss is a combination of price gain/loss and currency gain/loss. Currency gain/loss is only reported in the base (or portfolio) currency.

9 July

PL_RealFXGL

P

Credit

0

-100

Subtotal

 

-1500

-1200

 

CashCommitment

9 July

NA_Cost

C

Debit

1500

1200

Receivable cash holding on the trade date.

11 July

NA_Cost

C

Credit

-1500

-1200

Reverses the receivable cash holding on the settlement date.

11 July

NA_Cost

B

Debit

1500

1200

Permanent cash holding.

Subtotal

 

1500

1200

 

Total

 

0

0

 

We can post the:

  • Credit amount for the security (economic bucket of NA_Cost and holding type of P) to the 1-Investments account.

  • Debit amount for cash (economic bucket of NA_Cost and holding type of B) to the 2-Cash account.

  • Credit amounts for realised share price and currency gain/loss to the 4-PnL account. Note a combined equal and opposite amount has already been factored into the debit amount for cash.

Valuation

On 15 July we load the latest market data into the LUSID quote store: a MSFT share price of $20 and USD/GBP spot rate of 0.9. Our remaining 200 shares, which originally cost $2,000 or £1,400, are now worth $4,000 or £3,600, an unrealised gain of £2,200. Our cash balance of $13,530 which cost £10,223.10 is now worth £12,177, an unrealised gain of £1,953.90. 

There are no transaction types (and therefore no movements) associated with valuation activity, and LUSID automatically generates balanced pairs of journal entry lines, so no further configuration is required.

LUSID generates the following journal entry lines for the valuation:

Journal entry lines

Date

Economic bucket

Holding type

DR or CR

Local amount (USD)

Base amount (GBP)

Notes

15 July

NA_UnrealPriceGL

P

Debit

2000

1800

The PL* automatically balances the NA* unrealised price gain/loss for the security holding.

PL_UnrealPriceGL

P

Credit

-2000

-1800

NA_UnrealFXGL

P

Debit

0

400

The PL* automatically balances the NA* unrealised currency gain/loss for the security holding. Note this is only reported in the base (or portfolio) currency.

PL_UnrealFXGL

P

Credit

0

-400

NA_UnrealFXGL

B

Debit

0

1953.90

The PL* automatically balances the NA* unrealised currency gain/loss for the cash holding. Note this is only reported in the base (or portfolio) currency.

PL_UnrealFXGL

B

Credit

0

-1953.90

We can post the:

  • Debit amounts for unrealised share price gain/loss and currency gain/loss for the security (economic bucket starting with NA_ and holding type of P) to the 1-Investments account.

  • Debit amount for unrealised currency gain/loss for cash (economic bucket starting with NA_ and holding type of B) to the 2-Cash account.

  • Credit amounts (economic bucket starting with PL_) to the 4-PnL account.

Auditing journal entry lines

LUSID automatically generates journal entry lines in preparation for creating a trial balance, but you can view them directly for audit purposes if you wish. See how to do this.

The response for this example is as follows, transformed to a table and with some columns removed and others renamed for clarity. Note the following:

  • Journal entry lines representing transactions have a source_type of LusidTransaction. The source_id references the ID of the upserted transaction.

  • Journal entry lines representing valuations have a source_type of LusidValuation.

For reference, the posting rules used to post debit and credit amounts to accounts in this example are as follows:

{
  "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'"
    }
  ]
}

The trial balance for this example is as follows; we can see that the overall balance of the ledger is zero: