---
title: "Handling instrument events for repurchase agreements (repos)"
slug: "handling-instrument-events-for-repurchase-agreements"
updated: 2026-06-12T08:48:59Z
published: 2026-06-12T08:48:59Z
canonical: "support.lusid.com/handling-instrument-events-for-repurchase-agreements"
---

> ## 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.

# Handling instrument events for repurchase agreements (repos)

You can model a repurchase agreement (“repo”) as a buyer or as a seller using the `FlexibleRepo` instrument type in LUSID. [See how to do this](/v1/docs/modelling-repurchase-agreements-in-lusid).

LUSID provides the following [instrument lifecycle events](/v1/docs/understanding-instrument-lifecycle-events-emitted-by-lusid) for a `FlexibleRepo`, which you can handle or trigger as required:

- `FlexibleRepoCashFlowEvent`. This event is automatically emitted on the maturity or closure date. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#handling-cash-transfer-on-the-instrument-maturity-date).
- `FlexibleRepoCollateralEvent`. This event is automatically emitted on the start date and again on the maturity or closure date, providing it is activated in the instrument definition. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#handling-collateral-transfer-on-instrument-start-and-maturity-dates).
- `FlexibleRepoInterestPaymentEvent`. This event is automatically emitted for an `OpenRepo` at the end of each interest payment window, and for every repo to transfer accrued interest on the maturity or closure date. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#handling-intermediate-interest-payments-for-an-open-repo).
- `FlexibleRepoPartialClosureEvent`. This event is **not automatically emitted** by LUSID, but can be manually loaded to trigger a partial closure. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#partially-closing-a-repo).
- `FlexibleRepoFullClosureEvent`. This event is **not automatically emitted** by LUSID, but can be manually loaded to close an `OpenRepo`. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#fully-closing-an-open-repo).
- `MaturityEvent`. This event is automatically emitted on the maturity or closure date. [More information](/v1/docs/handling-instrument-events-for-repurchase-agreements#handling-repo-maturity).

> **Note**: For an implementation using the Python SDK, see [this Jupyter Notebook](https://github.com/finbourne/finbourne-notebooks/blob/main/V3/features/instrument-events/flexiblerepo-and-instrument-events.ipynb).

## Mastering instruments and establishing positions

Imagine we have two portfolios in LUSID with holdings in the following instruments:

- Each has an indentical `FlexibleRepo` instrument of type `TermRepo` except one has a `repoType` of `Buyer` and the other `Seller`.
- Each has the same fixed-rate `Bond` collateral instrument (with monthly coupons) mastered separately and referenced as a `MasteredInstrument`.

[See how to set this scenario up](/v1/docs/modelling-repurchase-agreements-in-lusid). In summary, each portfolio contains:

| Instrument type | Positions |
| --- | --- |
| `FlexibleRepo` | Units: 1 Transaction/settlement date: 1 January 2025 Start date: 2 January 2025 Maturity date: 31 March 2025 Length of contract: 88 days Purchase price: £1,000,000 Repurchase price: £1,012,054.79 Bond collateral coupons: Seller keeps |
| `Bond` | Units: 3 Transaction/settlement date: 1 January 2025 Coupon date: 28th of each month Coupon amount: Approximately £20.80 per unit held |

## Handling cash transfer on transaction date

You must set up the `EnterRepo` (or similarly-named) transaction type you use to enter into a repurchase agreement for both buyer and seller in a particular way. [See how to do this](/v1/docs/modelling-repurchase-agreements-in-lusid#booking-a-transaction-to-establish-a-position).

When you do, LUSID transfers the purchase price from the buyer to the seller on the transaction date at the same time as establishing a `FlexibleRepo` position, so on 1 January 2025 in our example (click to enlarge):

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-8ZUP79OX.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-U8SKKTLZ.png) |

## Handling collateral transfer on instrument start and maturity dates

Providing a `FlexibleRepo` instrument definition is set up to [activate collateral transfer](/v1/docs/modelling-repurchase-agreements-in-lusid#mastering-a-flexiblerepo-instrument), LUSID emits `FlexibleRepoCollateralEvent` on the:

- Start date specified in the instrument definition to transfer collateral unit(s) from the buyer to the seller.
- Maturity or closure date to transfer collateral unit(s) from the seller to the buyer.

For more information on this event, start by calling the `GetTransactionTemplate` API to examine the [transaction template](/v1/docs/what-is-a-transaction-template).

> [!WARNING]
> **Important**: To handle this event, you must create a `FlexibleRepoCollateralTransfer` transaction type in the `default` source. [See our recommendation](/v1/docs/recommended-transaction-types-for-instrument-lifecycle-events#flexiblerepocollateralevent).

### Start date

With the `FlexibleRepoCollateralTransfer` transaction type in place, we can examine holdings for both portfolios on 2 January 2025 to see that LUSID has transferred one `Bond` collateral unit from the seller to the buyer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-6E6TR6XE.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-PEMNPBUA.png) |

We can examine the output transaction automatically generated by `FlexibleRepoCollateralEvent` in each portfolio to implement this transfer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-49BCCMKX.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-91YYNXMP.png) |

### Maturity date

On 31 March 2025 we examine holdings again to see that LUSID has transferred one `Bond` collateral unit from the buyer to the seller:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-RC2MQKSQ.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-VP1Q5TVS.png) |

We can examine the output transaction automatically generated by `FlexibleRepoCollateralEvent` in each portfolio to implement this transfer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-KQP9D5FM.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-K5FJ8ACM.png) |

### Understanding cashflow ownership for collateral transferred

In our example, coupons for the `Bond` collateral during the lifetime of the `FlexibleRepo` are due on the following dates: 28 January, 28 February, 28 March.

Providing LUSID is [set up to handle](/v1/docs/handling-bond-coupon-principal-and-maturity-instrument-lifecycle-events) `BondCouponEvent`, a coupon for approximately £20.80 per bond collateral unit held is automatically generated, so for example on 28 January:

- In the buyer portfolio with four units held, LUSID generates a coupon for £83.33.
- In the seller portfolio with two units held, LUSID generates a coupon for £41.67.

However, since the `FlexibleRepo` instrument is set up for the seller to keep bond coupon payments, LUSID automatically handles refunding the seller the coupon for the transferred unit.

If we examine holdings on 28 January we see equal bond coupon cash of £62.50, despite the `Bond` collateral units held being different:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-PEPICTFD.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-HHKSSPWJ.png) |

We can examine the output transaction generated in each portfolio to implement this refund (note the `Manufactured` tag in the transaction ID):

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-L5YZM7IW.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-K8GOQPWK.png) |

## Handling intermediate interest payments for an open repo

If the `repoType` is `OpenRepo`, LUSID emits `FlexibleRepoInterestPaymentEvent` at the end of each interest payment window to transfer accrued interest from the seller to the buyer. For more information on this event, start by calling the `GetTransactionTemplate` API to examine the transaction template.

> [!WARNING]
> **Important**: To handle this event, you must create a `FlexibleRepoInterestPayment` transaction type in the `default` source. [See our recommendation](/v1/docs/recommended-transaction-types-for-instrument-lifecycle-events#flexiblerepointerestpaymentevent).

For example, if the `startDate` is 2 January 2025 and `openRepoRollingPeriod` is set to `1W` (signalling weekly interest payment windows), then LUSID emits `FlexibleRepoInterestPaymentEvent` on 9 January, 16 January, 23 January and so on until the repo is [fully closed](/v1/docs/handling-instrument-events-for-repurchase-agreements#fully-closing-an-open-repo).

If we examine holdings on 9 January we see an accrued interest payment of £958.90 has been credited to the buyer’s cash balance, and debited from the seller’s:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-5TSU28D6.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-J2AGKQQN.png) |

We can examine the output transaction generated by `FlexibleRepoInterestPaymentEvent` in each portfolio to implement this transfer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-A9WFP0HL.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-UKBC7T0L.png) |

## Handling cash transfer on the instrument maturity date

On the maturity or closure date, LUSID emits:

1. `FlexibleRepoCashFlowEvent` to transfer the repurchase price (minus accrued interest) from the seller to the buyer.

> [!WARNING]
> **Important**: To handle this event, you must create a `FlexibleRepoCashTransfer` transaction type in the `default` source. [See our recommendation](/v1/docs/recommended-transaction-types-for-instrument-lifecycle-events#flexiblerepocashflowevent).
2. `FlexibleRepoInterestPaymentEvent` to transfer the accrued interest component from the seller to the buyer; this is transferred separately in order to yield the correct accounting treatment.

> [!WARNING]
> **Important**: To handle this event, if not already, you must create a `FlexibleRepoInterestPayment` transaction type in the `default` source. [See our recommendation](/v1/docs/recommended-transaction-types-for-instrument-lifecycle-events#flexiblerepointerestpaymentevent).

For more information on these events, start by calling the `GetTransactionTemplate` API to examine their respective transaction templates.

On 31 March 2025 we examine holdings again to see that LUSID has transferred £1,012,054.79 in total from the seller to the buyer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-6023LXHP.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-FBEM91YT.png) |

We can examine the output transactions automatically generated by these events in each portfolio to implement this transfer:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-XNSQLGOF.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-HIDA7QW0.png) |

## Handling repo maturity

LUSID emits `MaturityEvent` on the maturity date specified in the instrument definition. This is a generic event designed to reduce an instrument position in a portfolio down to zero, so it drops out of holding and valuation reports.

> **Note**: LUSID always emits `FlexibleRepoCashFlowEvent`, `FlexibleRepoInterestPayment` and, if activated in the instrument definition, `FlexibleRepoCollateralEvent` before `MaturityEvent`.

For more information on this event, start by calling the `GetTransactionTemplate` API to examine the transaction template.

> [!WARNING]
> **Important**: To handle this event, you must create a `Maturity` transaction type in the `default` source. [See our recommendation](/v1/docs/recommended-transaction-types-for-instrument-lifecycle-events#maturityevent).

If we examine holdings on 31 March 2025 we see there is no longer a position in the `FlexibleRepo` instrument in either portfolio:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-XX3C1W8E.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-ZJ9J0QXP.png) |

We can examine the output transaction automatically generated by `MaturityEvent` in each portfolio to reduce the number of units held down to zero:

| Buyer portfolio | Seller portfolio |
| --- | --- |
| ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-YIV1N6E4.png) | ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-P00BD8K6.png) |

## Appendix: Triggering a partial or full closure

### Partially closing a repo

*More information coming soon.*

### Fully closing an open repo

If the `repoType` is `OpenRepo`, you can close a `FlexibleRepo` on a particular date by manually loading a `FlexibleRepoFullClosureEvent` into LUSID. To do this:

1. Create a corporate action source and subscribe all portfolios with a holding in the `FlexibleRepo` to that source. [See how to do this](/v1/docs/handling-a-cash-dividend-corporate-action-event#creating-a-corporate-action-source).
2. Load the `FlexibleRepoFullClosureEvent` into the corporate action source. See [this article](/v1/docs/how-do-i-upload-corporate-actions-to-a-corporate-action-source) for general information, and also the example below.

For example, to fully close on 25 January 2025 we could call the [UpsertInstrumentEvents](https://www.lusid.com/docs/api/lusid/endpoints/corporate-action-sources/UpsertInstrumentEvents) API as follows:

```json
curl -X POST 'https://<your-domain>.lusid.com/api/api/corporateactionsources/Example-CAS-scope/Example-CAS-code/instrumentevents'
 -H 'Content-Type: application/json-patch+json'
 -H 'Authorization: Bearer <your-API-access-token>'
 -d '[
  {
    "instrumentEventId": "CloseFlexRepo-25-01-2025",
    "instrumentIdentifiers": {"Instrument/default/ClientInternal": "Buyer-OpenFlexRepo"},
    "description": "Close open FlexibleRepo on 25 January 2025",
    "instrumentEvent": {
      "instrumentEventType": "FlexibleRepoFullClosureEvent",
      "entitlementDate": "2025-01-25T00:00:00.0000000+00:00",
      "settlementDate": "2025-01-25T00:00:00.0000000+00:00",
    }
  }
]'
```

Note that LUSID emits the following events on the closure date in the specified order:

1. `FlexibleRepoCashFlowEvent`
2. `FlexibleRepoCollateralEvent` (if activated in the instrument definition)
3. `FlexibleRepoInterestPayment`
4. `MaturityEvent`
