From f145bd22cc806379e730915ffcf0a170ce1b6cc8 Mon Sep 17 00:00:00 2001 From: albie Date: Fri, 7 Nov 2025 14:11:38 +0000 Subject: [PATCH 1/2] feat(examples): dynamically build README --- .pre-commit-config.yaml | 10 + examples/README.md | 2942 +++++++++++++++-- examples/{ => account}/current_account.json | 2 +- .../current_account_with_guarantee.json | 2 +- examples/{ => account}/overdraft_account.json | 2 +- .../{ => account}/pnl_interest_income.json | 2 +- .../{ => account}/pnl_salary_expenses.json | 2 +- examples/{ => account}/savings_account.json | 2 +- .../savings_account_with_30days_notice.json | 2 +- .../{ => account}/time_deposit_1year.json | 2 +- ..._1year_with_6_month_withdrawal_option.json | 2 +- .../{ => derivative}/bermudan_swaption.json | 2 +- examples/{ => derivative}/bond_future.json | 2 +- examples/{ => derivative}/bond_future2.json | 2 +- examples/{ => derivative}/cds_index.json | 2 +- .../{ => derivative}/cds_single_name.json | 4 +- .../commodity_asian_option.json | 2 +- .../{ => derivative}/commodity_option.json | 2 +- .../eq_index_basket_option.json | 2 +- examples/{ => derivative}/equity_option.json | 2 +- .../equity_total_return_swap.json | 2 +- examples/{ => derivative}/fra_6x12.json | 2 +- examples/{ => derivative}/fx_forward.json | 2 +- examples/{ => derivative}/fx_future.json | 2 +- examples/{ => derivative}/fx_option.json | 2 +- .../{ => derivative}/fx_option_long_call.json | 2 +- .../{ => derivative}/fx_option_long_put.json | 2 +- .../fx_option_short_call.json | 2 +- .../{ => derivative}/fx_option_short_put.json | 2 +- examples/{ => derivative}/fx_spot.json | 2 +- examples/{ => derivative}/fx_swap.json | 2 +- .../{ => derivative}/interest_rate_swap.json | 2 +- .../interest_rate_swap_amortising.json | 2 +- examples/{ => derivative}/ir_cap_floor.json | 2 +- .../{ => derivative}/ir_digital_floor.json | 2 +- examples/{ => derivative}/ir_future.json | 2 +- .../margined_netting_agreement.json | 2 +- .../unmargined_netting_agreement.json | 2 +- .../{ => derivative}/usd_payer_swaption.json | 2 +- examples/{ => derivative}/xccy_swap.json | 2 +- examples/{ => loan}/bbl_loans.json | 2 +- examples/{ => loan}/encumbered_loan.json | 2 +- .../{ => loan}/loan_with_2_customers.json | 2 +- .../{ => loan}/undrawn_committed_loan.json | 2 +- examples/{ => loan}/vostro_account.json | 2 +- .../{ => security}/bank_guarantee_issued.json | 2 +- examples/{ => security}/cash_on_hand.json | 2 +- examples/{ => security}/cash_payable.json | 2 +- examples/{ => security}/cash_receivable.json | 2 +- examples/{ => security}/cet_1_capital.json | 2 +- ...eral_independent_amount_bond_received.json | 2 +- ...collateral_initial_margin_bond_posted.json | 2 +- ...llateral_variation_margin_cash_posted.json | 2 +- ...ateral_variation_margin_cash_received.json | 2 +- .../{ => security}/dividend_from_equity.json | 2 +- examples/{ => security}/encumbrance_set.json | 2 +- .../outright_debt_security.json | 2 +- examples/{ => security}/repo.json | 2 +- examples/{ => security}/rev_repo.json | 2 +- ...urity_collateral_posted_ccp_non_deriv.json | 2 +- .../{ => security}/subordinated_debt.json | 2 +- scripts/build_examples_readme.py | 104 + tests/test_build_examples_readme.py | 17 + 63 files changed, 2909 insertions(+), 284 deletions(-) create mode 100644 .pre-commit-config.yaml rename examples/{ => account}/current_account.json (88%) rename examples/{ => account}/current_account_with_guarantee.json (87%) rename examples/{ => account}/overdraft_account.json (86%) rename examples/{ => account}/pnl_interest_income.json (83%) rename examples/{ => account}/pnl_salary_expenses.json (82%) rename examples/{ => account}/savings_account.json (90%) rename examples/{ => account}/savings_account_with_30days_notice.json (87%) rename examples/{ => account}/time_deposit_1year.json (86%) rename examples/{ => account}/time_deposit_1year_with_6_month_withdrawal_option.json (87%) rename examples/{ => derivative}/bermudan_swaption.json (87%) rename examples/{ => derivative}/bond_future.json (86%) rename examples/{ => derivative}/bond_future2.json (86%) rename examples/{ => derivative}/cds_index.json (92%) rename examples/{ => derivative}/cds_single_name.json (91%) rename examples/{ => derivative}/commodity_asian_option.json (89%) rename examples/{ => derivative}/commodity_option.json (90%) rename examples/{ => derivative}/eq_index_basket_option.json (96%) rename examples/{ => derivative}/equity_option.json (92%) rename examples/{ => derivative}/equity_total_return_swap.json (93%) rename examples/{ => derivative}/fra_6x12.json (89%) rename examples/{ => derivative}/fx_forward.json (93%) rename examples/{ => derivative}/fx_future.json (88%) rename examples/{ => derivative}/fx_option.json (88%) rename examples/{ => derivative}/fx_option_long_call.json (89%) rename examples/{ => derivative}/fx_option_long_put.json (90%) rename examples/{ => derivative}/fx_option_short_call.json (89%) rename examples/{ => derivative}/fx_option_short_put.json (90%) rename examples/{ => derivative}/fx_spot.json (92%) rename examples/{ => derivative}/fx_swap.json (92%) rename examples/{ => derivative}/interest_rate_swap.json (92%) rename examples/{ => derivative}/interest_rate_swap_amortising.json (97%) rename examples/{ => derivative}/ir_cap_floor.json (97%) rename examples/{ => derivative}/ir_digital_floor.json (97%) rename examples/{ => derivative}/ir_future.json (90%) rename examples/{ => derivative}/margined_netting_agreement.json (94%) rename examples/{ => derivative}/unmargined_netting_agreement.json (91%) rename examples/{ => derivative}/usd_payer_swaption.json (90%) rename examples/{ => derivative}/xccy_swap.json (97%) rename examples/{ => loan}/bbl_loans.json (93%) rename examples/{ => loan}/encumbered_loan.json (89%) rename examples/{ => loan}/loan_with_2_customers.json (84%) rename examples/{ => loan}/undrawn_committed_loan.json (86%) rename examples/{ => loan}/vostro_account.json (81%) rename examples/{ => security}/bank_guarantee_issued.json (80%) rename examples/{ => security}/cash_on_hand.json (78%) rename examples/{ => security}/cash_payable.json (82%) rename examples/{ => security}/cash_receivable.json (82%) rename examples/{ => security}/cet_1_capital.json (84%) rename examples/{ => security}/collateral_independent_amount_bond_received.json (94%) rename examples/{ => security}/collateral_initial_margin_bond_posted.json (96%) rename examples/{ => security}/collateral_variation_margin_cash_posted.json (93%) rename examples/{ => security}/collateral_variation_margin_cash_received.json (93%) rename examples/{ => security}/dividend_from_equity.json (89%) rename examples/{ => security}/encumbrance_set.json (96%) rename examples/{ => security}/outright_debt_security.json (91%) rename examples/{ => security}/repo.json (92%) rename examples/{ => security}/rev_repo.json (91%) rename examples/{ => security}/security_collateral_posted_ccp_non_deriv.json (91%) rename examples/{ => security}/subordinated_debt.json (90%) create mode 100644 scripts/build_examples_readme.py create mode 100644 tests/test_build_examples_readme.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..6993c8a6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: local + hooks: + - id: build-examples-readme + name: Build examples/README.md from directory structure + entry: python3 scripts/build_examples_readme.py && git add examples/README.md + language: system + pass_filenames: false + stages: [commit] + files: ^examples/ diff --git a/examples/README.md b/examples/README.md index add2769a..707ffe6e 100644 --- a/examples/README.md +++ b/examples/README.md @@ -3,333 +3,2827 @@ layout: readme title: FIRE data examples --- -The following are a few examples of common financial trades. - -- [Individual element examples](#individual-element-examples) - - [Account examples](#account-examples) - - [Current account](#current-account) - - [Current account with guarantee](#current-account-with-guarantee) - - [Savings account](#savings-account) - - [Savings account with notice](#savings-account-with-notice) - - [1-year time deposit](#1-year-time-deposit) - - [1-year time deposit with 6-month withdrawal option](#1-year-time-deposit-with-6-month-withdrawal-option) - - [PNL interest income](#pnl-interest-income) - - [PNL salary expenses](#pnl-salary-expenses) - - [Loan examples](#loan-examples) - - [BBL/CBIL](#bblcbil) - - [Nostro account](#nostro-account) - - [Loan with two customers](#loan-with-two-customers) - - [Derivative examples](#derivative-examples) - - [Bermudan swaption](#bermudan-swaption) - - [Bond future](#bond-future) - - [Cross-currency swap](#cross-currency-swap) - - [Commodity option](#commodity-option) - - [Credit default swap - Index](#credit-default-swap----index) - - [Credit default swap - Single name](#credit-default-swap---single-name) - - [Equity option](#equity-option) - - [Equity total return swap](#equity-total-return-swap) - - [Forward rate agreement](#forward-rate-agreement) - - [FX forward](#fx-forward) - - [FX future](#fx-future) - - [FX option](#fx-option) - - [FX spot](#fx-spot) - - [FX swap](#fx-swap) - - [Interest rate cap floor](#interest-rate-cap-floor) - - [Interest rate digital floor](#interest-rate-digital-floor) - - [Interest rate future](#interest-rate-future) - - [Interest rate swap](#interest-rate-swap) - - [Interest rate swap amortising](#interest-rate-swap-amortising) - - [Margined netting agreement](#margined-netting-agreement) - - [USD Payer Swaption](#usd_payer_swaption) - - [Unmargined netting agreement](#unmargined-netting-agreement) - - [Security examples](#security-examples) - - [Bank guarantee issued](#bank-guarantee-issued) - - [Core equity tier-1 capital](#core-equity-tier-1-capital) - - [Cash on-hand](#cash-on-hand) - - [Cash receivable](#cash-receivable) - - [Cash payable](#cash-payable) - - [Collateral posted to ccp on non-derivatives](#collateral-posted-to-ccp-on-non-derivatives) - - [Initial margin posted](#initial-margin-posted) - - [Independent amount received](#independent-amount-received) - - [Reverse repo](#reverse-repo) - - [Repo](#repo) - - [Variation margin cash posted](#variation-margin-cash-posted) - - [Variation margin cash received](#variation-margin-cash-received) -## Individual element examples -### Account examples -#### Current account +This README is generated from files in the `examples/` directory. + + +## Contents + +- [Account](#account) + - [Current Account](#current-account) + - [Current Account With Guarantee](#current-account-with-guarantee) + - [Overdraft Account](#overdraft-account) + - [Pnl Interest Income](#pnl-interest-income) + - [Pnl Salary Expenses](#pnl-salary-expenses) + - [Savings Account](#savings-account) + - [Savings Account With 30Days Notice](#savings-account-with-30days-notice) + - [Time Deposit 1Year](#time-deposit-1year) + - [Time Deposit 1Year With 6 Month Withdrawal Option](#time-deposit-1year-with-6-month-withdrawal-option) +- [Derivative](#derivative) + - [Bermudan Swaption](#bermudan-swaption) + - [Bond Future](#bond-future) + - [Bond Future2](#bond-future2) + - [Cds Index](#cds-index) + - [Cds Single Name](#cds-single-name) + - [Commodity Asian Option](#commodity-asian-option) + - [Commodity Option](#commodity-option) + - [Eq Index Basket Option](#eq-index-basket-option) + - [Equity Option](#equity-option) + - [Equity Total Return Swap](#equity-total-return-swap) + - [Fra 6X12](#fra-6x12) + - [Fx Forward](#fx-forward) + - [Fx Future](#fx-future) + - [Fx Option](#fx-option) + - [Fx Option Long Call](#fx-option-long-call) + - [Fx Option Long Put](#fx-option-long-put) + - [Fx Option Short Call](#fx-option-short-call) + - [Fx Option Short Put](#fx-option-short-put) + - [Fx Spot](#fx-spot) + - [Fx Swap](#fx-swap) + - [Interest Rate Swap](#interest-rate-swap) + - [Interest Rate Swap Amortising](#interest-rate-swap-amortising) + - [Ir Cap Floor](#ir-cap-floor) + - [Ir Digital Floor](#ir-digital-floor) + - [Ir Future](#ir-future) + - [Margined Netting Agreement](#margined-netting-agreement) + - [Unmargined Netting Agreement](#unmargined-netting-agreement) + - [Usd Payer Swaption](#usd-payer-swaption) + - [Xccy Swap](#xccy-swap) +- [Loan](#loan) + - [Bbl Loans](#bbl-loans) + - [Encumbered Loan](#encumbered-loan) + - [Loan With 2 Customers](#loan-with-2-customers) + - [Undrawn Committed Loan](#undrawn-committed-loan) + - [Vostro Account](#vostro-account) +- [Security](#security) + - [Bank Guarantee Issued](#bank-guarantee-issued) + - [Cash On Hand](#cash-on-hand) + - [Cash Payable](#cash-payable) + - [Cash Receivable](#cash-receivable) + - [Cet 1 Capital](#cet-1-capital) + - [Collateral Independent Amount Bond Received](#collateral-independent-amount-bond-received) + - [Collateral Initial Margin Bond Posted](#collateral-initial-margin-bond-posted) + - [Collateral Variation Margin Cash Posted](#collateral-variation-margin-cash-posted) + - [Collateral Variation Margin Cash Received](#collateral-variation-margin-cash-received) + - [Dividend From Equity](#dividend-from-equity) + - [Encumbrance Set](#encumbrance-set) + - [Outright Debt Security](#outright-debt-security) + - [Repo](#repo) + - [Rev Repo](#rev-repo) + - [Security Collateral Posted Ccp Non Deriv](#security-collateral-posted-ccp-non-deriv) + - [Subordinated Debt](#subordinated-debt) + +## Account + +#### Current Account + +Active GBP current account with accrued interest. + +```json +{ + "account": [ + { + "id": "current_account", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "type": "current", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +#### Current Account With Guarantee + +GBP current account protected by GB FSCS guarantee up to 8,500 GBP. + +```json +{ + "account": [ + { + "id": "current_account_with_guarantee", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "guarantee_scheme": "gb_fscs", + "guarantee_amount": 8500, + "type": "current", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +#### Overdraft Account + +Overdrawn current account showing negative balance and associated customer record. + +```json +{ + "account": [ + { + "date": "2022-04-20T00:00:00", + "id": "overdraft", + "accrued_interest": -50, + "asset_liability": "asset", + "balance": -1000, + "customer_id": "overdraft_customer", + "on_balance_sheet": true, + "start_date": "2022-04-20T00:00:00", + "status": "active", + "trade_date": "2022-04-20T00:00:00", + "type": "current" + } + ], + "customer": [ + { + "date": "2022-04-20T00:00:00", + "id": "overdraft_customer", + "country_code": "GB", + "type": "natural_person" + } + ] +} +``` + +#### Pnl Interest Income + +P&L income line item representing GBP interest earned. + +```json +{ + "account": [ + { + "id": "interest_income", + "date": "2017-06-30T14:03:12Z", + "currency_code": "GBP", + "balance": 30000, + "type": "income", + "asset_liability": "pnl", + "purpose": "interest", + "customer_id": "C123456" + } + ] +} +``` + +#### Pnl Salary Expenses + +P&L expense line item for GBP regular wage payments. + ```json -{{#include current_account.json:5:}} +{ + "account": [ + { + "id": "salary_expenses", + "date": "2017-06-30T14:03:12Z", + "currency_code": "GBP", + "balance": 30000, + "type": "expense", + "asset_liability": "pnl", + "purpose": "regular_wages" + } + ] +} +``` + +#### Savings Account + +Active GBP savings account with accrued interest. + +```json +{ + "account": [ + { + "id": "savings_account", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "type": "savings", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +#### Savings Account With 30Days Notice + +GBP savings account that requires 30 days' notice before withdrawal. + +```json +{ + "account": [ + { + "id": "savings_account_with_30days_notice", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "next_withdrawal_date": "2017-07-30T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "type": "savings", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +#### Time Deposit 1Year + +One-year GBP time deposit maturing on 2018-06-30 with accrued interest. + +```json +{ + "account": [ + { + "id": "time_deposit_1year", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "end_date": "2018-06-30T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "type": "time_deposit", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +#### Time Deposit 1Year With 6 Month Withdrawal Option + +One-year GBP time deposit with optional withdrawal available after six months. + +```json +{ + "account": [ + { + "id": "time_deposit_1year_with_6_month_withdrawal_option", + "date": "2017-06-30T14:03:12Z", + "trade_date": "2012-02-06T09:30:00Z", + "start_date": "2012-02-07T00:00:00Z", + "next_withdrawal_date": "2017-12-31T00:00:00Z", + "end_date": "2018-06-30T00:00:00Z", + "currency_code": "GBP", + "balance": 30000, + "accrued_interest": 2500, + "type": "time_deposit", + "status": "active", + "on_balance_sheet": true, + "asset_liability": "liability", + "customer_id": "C123456" + } + ] +} +``` + +## Derivative + +#### Bermudan Swaption + +Short USD Bermudan swaption on 6M LIBOR with 10,000 notional and physical settlement. + +```json +{ + "derivative": [ + { + "date": "2019-01-01T00:00:00", + "id": "usd_bermudan_swaption", + "asset_class": "ir", + "type": "swaption", + "leg_type": "put", + "position": "short", + "currency_code": "USD", + "notional_amount": 10000, + "strike": 0.02, + "underlying_index": "USD_LIBOR", + "underlying_index_tenor": "6m", + "start_date": "2019-01-01T00:00:00", + "end_date": "2020-01-01T00:00:00", + "last_payment_date": "2030-01-01T00:00:00", + "next_exercise_date": "2020-01-01T00:00:00", + "underlying_price": 0.02, + "settlement_type": "physical", + "mtm_dirty": -5 + } + ] +} +``` + +#### Bond Future + +EUR Bund futures contract with 10,000 notional settling physically in May 2019. + +```json +{ + "derivative": [ + { + "id": "Bund June IMM future", + "date": "2019-04-30T00:00:00", + "asset_class": "ir", + "type": "future", + "leg_type": "indexed", + "currency_code": "EUR", + "notional_amount": 10000, + "rate": 125.5, + "underlying_index": "BUND0829", + "trade_date": "2019-04-01T00:00:00", + "start_date": "2019-05-02T00:00:00", + "end_date": "2019-05-04T00:00:00", + "last_payment_date": "2029-08-15T00:00:00", + "settlement_type": "physical", + "mtm_dirty": -25 + } + ] +} ``` -#### Current account with guarantee + +#### Bond Future2 + +USD Treasury bond future expiring March 2021 with long-dated underlying. + ```json -{{#include current_account_with_guarantee.json:5:}} +{ + "derivative": [ + { + "id": "T-Bond Mar21 future", + "date": "2019-04-30T00:00:00", + "asset_class": "ir", + "type": "future", + "leg_type": "indexed", + "currency_code": "USD", + "notional_amount": 100, + "trade_date": "2019-04-01T00:00:00", + "start_date": "2019-05-02T00:00:00", + "end_date": "2021-03-15T00:00:00", + "last_payment_date": "2041-03-15T00:00:00", + "underlying_index": "T-bondMar41", + "settlement_type": "physical" + } + ] +} ``` -#### Savings account + +#### Cds Index + +Short USD CDX investment-grade index CDS position. + ```json -{{#include savings_account.json:5:}} +{ + "derivative": [ + { + "id": "corp_cds_5y", + "date": "2019-01-01T00:00:00", + "asset_class": "cr_index", + "type": "cds", + "underlying_security_id": "cdx_na_ig", + "leg_type": "indexed", + "position": "short", + "delta": -1, + "currency_code": "USD", + "notional_amount": 100, + "trade_date": "2018-07-01T00:00:00", + "start_date": "2018-07-03T00:00:00", + "end_date": "2023-07-03T00:00:00", + "rate": 0.005, + "settlement_type": "cash" + } + ], + "security": [ + { + "id": "cdx_na_ig", + "date": "2019-01-01T00:00:00", + "type": "index", + "currency_code": "USD", + "cqs_standardised": 3 + } + ] +} ``` -#### Savings account with notice + +#### Cds Single Name + +Short single-name USD corporate CDS referencing a 2028 bond. + ```json -{{#include savings_account_with_notice.json:5:}} +{ + "derivative": [ + { + "id": "corp_cds_5y", + "date": "2019-01-01T00:00:00", + "asset_class": "cr_single", + "type": "cds", + "underlying_security_id": "Corp_Jul28", + "leg_type": "indexed", + "position": "short", + "delta": -1, + "currency_code": "USD", + "notional_amount": 100, + "trade_date": "2018-07-01T00:00:00", + "start_date": "2018-07-03T00:00:00", + "end_date": "2023-07-03T00:00:00", + "rate": 0.005, + "settlement_type": "cash" + } + ], + "security": [ + { + "id": "Corp_Jul28", + "date": "2019-01-01T00:00:00", + "type": "bond", + "underlying_issuer_id": "us_corp", + "isin_code": "XS1234567890", + "currency_code": "USD", + "issue_date": "2018-07-01 00:00:00", + "maturity_date": "2028-07-01 00:00:00", + "cqs_standardised": 3 + } + ], + "issuer": [ + { + "id": "us_corp", + "date": "2019-01-01T00:00:00", + "type": "corporate", + "country_code": "US", + "snp_lt": "a_plus", + "moodys_lt": "a1" + } + ] +} ``` -#### 1-year time deposit + +#### Commodity Asian Option + +Long USD Asian-style copper put option referencing averaged prices. + ```json -{{#include time_deposit_1year.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "1", + "asset_class": "metals", + "type": "option", + "leg_type": "put", + "position": "long", + "currency_code": "USD", + "underlying_quantity": 100, + "strike": 9829, + "underlying_index": "copper average", + "underlying_price": 9829, + "supervisory_price": 9766, + "trade_date": "2020-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2021-06-02T00:00:00", + "last_exercise_date": "2020-12-05T00:00:00", + "settlement_type": "physical", + "mtm_dirty": 80 + } + ] +} ``` -#### 1-year time deposit with 6-month withdrawal option + +#### Commodity Option + +Long USD copper put option with physical settlement. + ```json -{{#include time_deposit_1year_with_6_month_withdrawal_option.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "1", + "asset_class": "metals", + "type": "option", + "leg_type": "put", + "position": "long", + "currency_code": "USD", + "underlying_quantity": 100, + "strike": 9829, + "underlying_index": "copper", + "underlying_price": 9829, + "trade_date": "2020-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2021-06-02T00:00:00", + "last_exercise_date": "2020-12-05T00:00:00", + "settlement_type": "physical", + "mtm_dirty": 193 + } + ] +} ``` -#### PNL interest income + +#### Eq Index Basket Option + +Equity index basket collar with long and short option legs on a custom index. + ```json -{{#include pnl_interest_income.json:5:}} +{ + "derivative": [ + { + "id": "1", + "date": "2021-03-31T00:00:00", + "asset_class": "eq_index", + "position": "long", + "type": "option", + "leg_type": "call", + "currency_code": "USD", + "strike": 100, + "underlying_security_id": "my_index_basket", + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "end_date": "2022-03-31T00:00:00", + "settlement_type": "cash", + "underlying_price": 100, + "mtm_dirty": 10, + "delta": 1.41, + "vega": 0.021, + "gamma": 0.014, + "notional_amount": 1000000 + }, + { + "id": "2", + "date": "2021-03-31T00:00:00", + "asset_class": "eq_index", + "position": "short", + "type": "option", + "leg_type": "call", + "currency_code": "USD", + "strike": 131, + "underlying_security_id": "my_index_basket", + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "end_date": "2022-03-31T00:00:00", + "settlement_type": "cash", + "underlying_price": 100, + "mtm_dirty": 0, + "delta": 0.05, + "vega": 0.001, + "gamma": 0.004, + "notional_amount": 1000000 + }, + { + "id": "3", + "date": "2021-03-31T00:00:00", + "asset_class": "eq_index", + "position": "short", + "type": "option", + "leg_type": "put", + "currency_code": "USD", + "strike": 85, + "underlying_security_id": "my_index_basket", + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "end_date": "2022-03-31T00:00:00", + "settlement_type": "cash", + "underlying_price": 100, + "mtm_dirty": 0, + "delta": 0.05, + "vega": 0.001, + "gamma": 0.004, + "notional_amount": 1000000 + } + ], + "security": [ + { + "id": "my_index_basket", + "date": "2021-03-31T00:00:00", + "type": "index", + "currency_code": "USD", + "start_date": "2021-03-31T00:00:00", + "end_date": "", + "purpose": "reference", + "mtm": 100, + "index_composition": [ + { + "reference_id": "SX5E", + "weight": 0.25 + }, + { + "reference_id": "FTSE100", + "weight": 0.25 + }, + { + "reference_id": "TOPIX", + "weight": 0.25 + }, + { + "reference_id": "SMI", + "weight": 0.25 + } + ] + } + ] +} ``` -#### PNL salary expenses + +#### Equity Option + +Long USD call option on single equity reference EquityABC. + ```json -{{#include pnl_salary_expenses.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "1", + "deal_id": "2", + "asset_class": "eq_single", + "type": "option", + "leg_type": "call", + "position": "long", + "currency_code": "USD", + "underlying_quantity": 100.0, + "strike": 40.0, + "underlying_security_id": "EquityABC", + "underlying_price": 25.0, + "trade_date": "2020-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2021-02-27T00:00:00", + "last_exercise_date": "2020-12-05T00:00:00", + "settlement_type": "cash", + "mtm_dirty": 10 + } + ], + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "EquityABC", + "type": "equity", + "currency_code": "USD", + "start_date": "2017-01-01T00:00:00", + "purpose": "reference" + } + ] +} ``` -### Loan examples -#### BBL/CBIL -These loans can be represented as a combination of two independent loans. -The first loan is a 25K GBP payable quarterly during 1 year (From Aug 1st, 2020 to Aug 1st, 2021). +#### Equity Total Return Swap + +EUR equity total return swap exchanging equity performance for floating EURIBOR. + ```json { - "id": "BBL1", - "date": "2020-08-08T00:00:00+00:00", - "balance": 2500000, - "currency_code": "GBP", - "end_date": "2021-08-01T00:00:00+00:00", - "interest_repayment_frequency": "quarterly", - "repayment_frequency": "at_maturity", - "repayment_type": "interest_only", - "start_date": "2020-08-01T00:00:00+00:00", - "trade_date": "2020-05-11T00:00:00+00:00" + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "eur_equity_trs:equity_leg", + "deal_id": "eur_equity_trs", + "asset_class": "eq", + "type": "vanilla_swap", + "leg_type": "indexed", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "underlying_security_id": "EquityABC", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2024-02-27T00:00:00", + "mtm_dirty": 140 + }, + { + "date": "2020-03-31T00:00:00", + "id": "eur_equity_trs:floating_leg", + "deal_id": "long_eur_equity_trs", + "asset_class": "eq", + "type": "vanilla_swap", + "leg_type": "floating", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "rate": 0.0225, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2024-02-27T00:00:00" + } + ], + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "EquityABC", + "type": "equity", + "currency_code": "USD", + "start_date": "2020-03-31T00:00:00", + "issue_date": "2017-03-01T00:00:00", + "purpose": "reference" + } + ] } ``` -The second loan is a 25K GBP payable monthly during 5 years (From Aug 1st, 2021 to Aug 1st, 2026). + +#### Fra 6X12 + +Short USD 6x12 forward rate agreement referencing 6M LIBOR. + ```json { - "id": "BBL2", - "date": "2020-08-08T00:00:00+00:00", - "balance": 2500000, - "currency_code": "GBP", - "end_date": "2026-08-01T00:00:00+00:00", - "repayment_frequency": "monthly", - "repayment_type": "repayment", - "start_date": "2021-08-01T00:00:00+00:00", - "trade_date": "2020-05-11T00:00:00+00:00" + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "6x12-fra", + "asset_class": "ir", + "type": "fra", + "leg_type": "indexed", + "position": "short", + "currency_code": "USD", + "notional_amount": 10000, + "underlying_index": "USD_LIBOR", + "underlying_index_tenor": "6m", + "trade_date": "2019-11-25T00:00:00", + "start_date": "2020-05-27T00:00:00", + "end_date": "2020-11-27T00:00:00", + "settlement_type": "cash", + "rate": 0.005, + "mtm_dirty": -25 + } + ] } ``` -BBL_1 will create an inflow of 25K GBP, and BBL_2 will create an outflow of 25K GBP on Aug 1st, 2021. -If you are working with reports that separates inflows from outflows, you will get an excess on the inflow and an excess of the outflow. +#### Fx Forward + +AUD/USD FX forward with short AUD leg and long USD leg. -To eliminate this excess, we can introduce a third loan. ```json { - "id": "BBL_netting", - "date": "2020-08-08T00:00:00+00:00", - "balance": -2500000, - "currency_code": "GBP", - "end_date": "2021-08-01T00:00:00+00:00", - "repayment_frequency": "at_maturity", - "repayment_type": "repayment", - "start_date": "2021-08-01T00:00:00+00:00" + "derivative": [ + { + "date": "2019-04-30T00:00:00", + "id": "audusd_swap:aud", + "deal_id": "audusd_fx_fwd", + "asset_class": "fx", + "type": "forward", + "leg_type": "fixed", + "position": "short", + "currency_code": "AUD", + "notional_amount": 10000, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "mtm_dirty": -2 + }, + { + "date": "2019-04-30T00:00:00", + "id": "audusd_swap:usd", + "deal_id": "audusd_fx_fwd", + "asset_class": "fx", + "type": "forward", + "leg_type": "fixed", + "position": "long", + "currency_code": "USD", + "notional_amount": 10275, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00" + } + ] } ``` -**Please download the complete [examples](bbl_loans.json)** -#### Nostro account -Nostro account, of 1000 GBP, held at another credit institution + +#### Fx Future + +Long EUR/CAD FX future with 100 notional and physical delivery. + ```json -{{#include nostro_account.json:5:}} +{ + "derivative": [ + { + "date": "2019-04-01T00:00:00", + "id": "eur_cad_future", + "asset_class": "fx", + "type": "future", + "leg_type": "indexed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 100, + "underlying_currency_code": "CAD", + "trade_date": "2019-04-01T00:00:00", + "start_date": "2019-06-15T00:00:00", + "end_date": "2019-09-15T00:00:00", + "rate": 1.4, + "underlying_price": 1.38, + "settlement_type": "physical", + "mtm_dirty": -2 + } + ] +} ``` -#### Loan with two customers -A loan example showing what the json looks like for loans with two customers + +#### Fx Option + +Short USD/JPY call option struck at 130 with March 2020 expiry. + ```json -{{#include_loan_with_2_customers.json:5:}} +{ + "derivative": [ + { + "date": "2019-12-31T00:00:00", + "id": "USDJPY call 130", + "asset_class": "fx", + "type": "option", + "leg_type": "call", + "position": "short", + "currency_code": "USD", + "notional_amount": 100, + "underlying_currency_code": "JPY", + "strike": 130, + "trade_date": "2019-12-01T00:00:00", + "start_date": "2019-12-05T00:00:00", + "end_date": "2020-03-05T00:00:00", + "last_exercise_date": "2020-03-03T00:00:00", + "underlying_price": 130, + "mtm_dirty": -2 + } + ] +} ``` -### Derivative examples -#### Bermudan swaption -Short USD 1y into 10y receiver swaption exercisable annually with physical settlement + +#### Fx Option Long Call + +Long USD/JPY call option illustrating positive delta exposure. + ```json -{{#include bermudan_swaption.json:5:}} +{ + "derivative": [ + { + "date": "2019-12-31T00:00:00", + "id": "longcall", + "asset_class": "fx", + "type": "option", + "leg_type": "call", + "position": "long", + "delta": 1, + "currency_code": "USD", + "notional_amount": 100, + "underlying_currency_code": "JPY", + "strike": 130, + "trade_date": "2019-12-01T00:00:00", + "start_date": "2019-12-05T00:00:00", + "end_date": "2020-03-05T00:00:00", + "last_exercise_date": "2020-03-03T00:00:00", + "underlying_price": 130, + "mtm_dirty": -2 + } + ] +} ``` -#### Bond future -June IMM Bund future (underlying index is the expected CTD on the reporting date) + +#### Fx Option Long Put + +Long USD/JPY put option providing downside protection. + ```json -{{#include bond_future.json:5:}} +{ + "derivative": [ + { + "date": "2019-12-31T00:00:00", + "id": "longput", + "asset_class": "fx", + "type": "option", + "leg_type": "put", + "position": "long", + "delta": -1, + "currency_code": "USD", + "notional_amount": 100, + "underlying_currency_code": "JPY", + "strike": 130, + "trade_date": "2019-12-01T00:00:00", + "start_date": "2019-12-05T00:00:00", + "end_date": "2020-03-05T00:00:00", + "last_exercise_date": "2020-03-03T00:00:00", + "underlying_price": 130, + "mtm_dirty": -2 + } + ] +} ``` -Futures on 20-year treasury bond that matures in 2 years + +#### Fx Option Short Call + +Short USD/JPY call option illustrating negative delta exposure. + ```json -{{#include bond_future2.json:5:}} +{ + "derivative": [ + { + "date": "2019-12-31T00:00:00", + "id": "shortcall", + "asset_class": "fx", + "type": "option", + "leg_type": "call", + "position": "short", + "delta": -1, + "currency_code": "USD", + "notional_amount": 100, + "underlying_currency_code": "JPY", + "strike": 130, + "trade_date": "2019-12-01T00:00:00", + "start_date": "2019-12-05T00:00:00", + "end_date": "2020-03-05T00:00:00", + "last_exercise_date": "2020-03-03T00:00:00", + "underlying_price": 130, + "mtm_dirty": -2 + } + ] +} ``` -#### Cross-currency swap -Long 10-year forward_starting AUD/EUR cross-currency swap + +#### Fx Option Short Put + +Short USD/JPY put option generating positive delta exposure. + ```json -{{#include xccy_swap.json:5:}} +{ + "derivative": [ + { + "date": "2019-12-31T00:00:00", + "id": "shortput", + "asset_class": "fx", + "type": "option", + "leg_type": "put", + "position": "short", + "delta": 1, + "currency_code": "USD", + "notional_amount": 100, + "underlying_currency_code": "JPY", + "strike": 130, + "trade_date": "2019-12-01T00:00:00", + "start_date": "2019-12-05T00:00:00", + "end_date": "2020-03-05T00:00:00", + "last_exercise_date": "2020-03-03T00:00:00", + "underlying_price": 130, + "mtm_dirty": -2 + } + ] +} ``` -#### Commodity option -Long 100 June21 at-the-money copper put + +#### Fx Spot + +EUR/CAD FX spot trade with offsetting legs settling T+2. + ```json -{{#include commodity_option.json:5:}} +{ + "derivative": [ + { + "date": "2019-04-30T00:00:00", + "id": "eurcad_spot:eur", + "deal_id": "eurcad_spot", + "asset_class": "fx", + "type": "spot", + "leg_type": "fixed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "trade_date": "2019-04-30T00:00:00", + "start_date": "2019-05-02T00:00:00", + "end_date": "2019-05-02T00:00:00", + "mtm_dirty": -2 + }, + { + "date": "2019-04-30T00:00:00", + "id": "eurcad_spot:cad", + "deal_id": "eurcad_spot", + "asset_class": "fx", + "type": "spot", + "leg_type": "fixed", + "position": "short", + "currency_code": "CAD", + "notional_amount": 14000, + "trade_date": "2019-04-30T00:00:00", + "start_date": "2019-05-02T00:00:00", + "end_date": "2019-05-02T00:00:00" + } + ] +} ``` -#### Credit default swap - Index -Index CDS; CDS on the cdx_na_ig index + +#### Fx Swap + +Legacy AUD/USD FX swap example with fixed legs on both currencies. + ```json -{{#include cds_index.json:5:}} +{ + "derivative": [ + { + "date": "2019-04-30T00:00:00", + "id": "audusd_swap:aud", + "deal_id": "audusd_swap", + "asset_class": "fx", + "type": "vanilla_swap", + "leg_type": "fixed", + "position": "short", + "currency_code": "AUD", + "notional_amount": 10000, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "mtm_dirty": -2 + }, + { + "date": "2019-04-30T00:00:00", + "id": "audusd_swap:aud", + "deal_id": "audusd_swap", + "asset_class": "fx", + "type": "vanilla_swap", + "leg_type": "fixed", + "position": "long", + "currency_code": "USD", + "notional_amount": 10275, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00" + } + ] +} ``` -#### Credit default swap - Single name -Single name CDS; reference obligation US corporate bond with July 2028 maturity + +#### Interest Rate Swap + +EUR vanilla interest rate swap receiving fixed and paying floating EURIBOR. + ```json -{{#include cds_single_name.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_fixed", + "deal_id": "eur_10y_irs", + "asset_class": "ir", + "type": "vanilla_swap", + "currency_code": "EUR", + "leg_type": "fixed", + "position": "long", + "notional_amount": 10000, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00", + "rate": 0.01, + "mtm_dirty": 70 + }, + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_floating", + "deal_id": "long_eur_10y_irs", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "floating", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "rate": 0.0025, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00" + } + ] +} ``` -#### Equity option -Long 100 1-year 40 call on EquityABC. + +#### Interest Rate Swap Amortising + +Amortising EUR interest rate swap with detailed scheduled cash flows. + ```json -{{#include equity_option.json:5:}} +{ + "derivative": [ + { + "id": "eur_10y_irs_fixed", + "deal_id": "eur_10y_irs", + "date": "2020-03-31T00:00:00", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "fixed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "trade_date": "2020-01-29T00:00:00", + "start_date": "2020-01-31T00:00:00", + "end_date": "2022-01-31T00:00:00", + "rate": 0.01, + "mtm_dirty": 70 + }, + { + "id": "eur_10y_irs_floating", + "deal_id": "long_eur_10y_irs", + "date": "2020-03-31T00:00:00", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "floating", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "trade_date": "2020-01-29T00:00:00", + "start_date": "2020-01-31T00:00:00", + "end_date": "2022-01-31T00:00:00", + "underlying_index": "EURIBOR", + "underlying_index_tenor": "6m", + "rate": 0.0025 + } + ], + "derivative_cash_flow": [ + { + "id": "eur_10y_irs_fixed_1", + "derivative_id": "eur_10y_irs_fixed", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 10000, + "reset_date": "2020-01-31T00:00:00", + "payment_date": "2021-01-31T00:00:00" + }, + { + "id": "eur_10y_irs_fixed_2", + "derivative_id": "eur_10y_irs_fixed", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 5000, + "reset_date": "2021-01-31T00:00:00", + "payment_date": "2022-01-31T00:00:00" + }, + { + "id": "eur_10y_irs_floating_1", + "derivative_id": "eur_10y_irs_floating", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 10000, + "reset_date": "2021-01-31T00:00:00", + "payment_date": "2021_07_31T00:00:00", + "forward_rate": 0.0075 + }, + { + "id": "eur_10y_irs_floating_2", + "derivative_id": "eur_10y_irs_floating", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 10000, + "reset_date": "2021-07-31T00:00:00", + "payment_date": "2022-01-31T00:00:00", + "forward_rate": 0.0125 + }, + { + "id": "eur_10y_irs_floating_3", + "derivative_id": "eur_10y_irs_floating", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 5000, + "reset_date": "2022-01-31T00:00:00", + "payment_date": "2022-07-31T00:00:00", + "forward_rate": 0.0175 + }, + { + "id": "eur_10y_irs_floating_4", + "derivative_id": "eur_10y_irs_floating", + "date": "2020-03-31T00:00:00", + "currency_code": "EUR", + "notional_amount": 5000, + "reset_date": "2022-07-31T00:00:00", + "payment_date": "2023-01-31T00:00:00", + "forward_rate": 0.0225 + } + ] +} ``` -#### Equity total return swap -Short 5y EUR total return swap on EquityABC + +#### Ir Cap Floor + +EUR interest rate collar combining a short cap and long floor on 3M EURIBOR. + ```json -{{#include equity_total_return_swap.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:short_cap", + "deal_id": "short_eur_1y_collar", + "asset_class": "ir", + "type": "cap_floor", + "leg_type": "call", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "next_exercise_date": "2019-05-25T00:00:00", + "strike": 0.015, + "underlying_price": 0.01, + "mtm_dirty": -40 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:long_floor", + "deal_id": "short_eur_1y_collar", + "asset_class": "ir", + "type": "cap_floor", + "leg_type": "put", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "next_exercise_date": "2019-05-25T00:00:00", + "strike": 0.005, + "underlying_price": 0.01, + "mtm_dirty": 110 + } + ], + "derivative_cash_flow": [ + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:short_cap 2", + "derivative_id": "short_eur_1y_collar:short_cap", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "pay", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-05-27T00:00:00", + "payment_date": "2019-08-27T00:00:00", + "forward_rate": 0.005 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:short_cap 3", + "derivative_id": "short_eur_1y_collar:short_cap", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "pay", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-08-27T00:00:00", + "payment_date": "2019-11-27T00:00:00", + "forward_rate": 0.01 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:short_cap 4", + "derivative_id": "short_eur_1y_collar:short_cap", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "pay", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-11-27T00:00:00", + "payment_date": "2020-02-27T00:00:00", + "forward_rate": 0.015 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:long_floor 2", + "derivative_id": "short_eur_1y_collar:long_floor", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "receive", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-05-27T00:00:00", + "payment_date": "2019-08-27T00:00:00", + "forward_rate": 0.005 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:long_floor 3", + "derivative_id": "short_eur_1y_collar:long_floor", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "receive", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-08-27T00:00:00", + "payment_date": "2019-11-27T00:00:00", + "forward_rate": 0.01 + }, + { + "date": "2020-03-31T00:00:00", + "id": "short_eur_1y_collar:long_floor 4", + "derivative_id": "short_eur_1y_collar:long_floor", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "leg": "receive", + "currency_code": "EUR", + "notional_amount": 10000, + "balance": 0, + "reset_date": "2019-11-27T00:00:00", + "payment_date": "2020-02-27T00:00:00", + "forward_rate": 0.015 + } + ] +} ``` -#### Forward rate agreement -Short 6x12 USD FRA + +#### Ir Digital Floor + +EUR digital floor structure with offsetting long and short legs. + ```json -{{#include fra_6x12.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "1y digital floor:long floor", + "deal_id": "1y digital floor", + "asset_class": "ir", + "type": "cap_floor", + "leg_type": "put", + "position": "long", + "currency_code": "EUR", + "notional_amount": 100000, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "last_exercise_date": "2019-05-25T00:00:00", + "strike": 0.0005, + "mtm_dirty": -40 + }, + { + "date": "2020-03-31T00:00:00", + "id": "1y digital floor:short floor", + "deal_id": "1y digital floor", + "asset_class": "ir", + "type": "cap_floor", + "leg_type": "put", + "position": "short", + "currency_code": "EUR", + "notional_amount": 100000, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2019-02-27T00:00:00", + "end_date": "2020-02-27T00:00:00", + "last_exercise_date": "2019-05-25T00:00:00", + "strike": -0.0005 + } + ], + "derivative_cash_flow": [ + { + "id": "1y digital floor:long floor_1", + "derivative_id": "1y digital floor:long floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-05-27T00:00:00", + "payment_date": "2019-08-27T00:00:00", + "forward_rate": 0.0025 + }, + { + "id": "1y digital floor:long floor_2", + "derivative_id": "1y digital floor:long floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-08-27T00:00:00", + "payment_date": "2019-11-27T00:00:00", + "forward_rate": 0.005 + }, + { + "id": "1y digital floor:long floor_3", + "derivative_id": "1y digital floor:long floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-11-27T00:00:00", + "payment_date": "2020-02-27T00:00:00", + "forward_rate": 0.0075 + }, + { + "id": "1y digital floor:short floor_1", + "derivative_id": "1y digital floor:short floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-05-27T00:00:00", + "payment_date": "2019-08-27T00:00:00", + "forward_rate": 0.0025 + }, + { + "id": "1y digital floor:short floor_2", + "derivative_id": "1y digital floor:short floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-08-27T00:00:00", + "payment_date": "2019-11-27T00:00:00", + "forward_rate": 0.005 + }, + { + "id": "1y digital floor:short floor_3", + "derivative_id": "1y digital floor:short floor", + "date": "2020-03-31T00:00:00", + "trade_date": "2019-02-25T00:00:00", + "asset_class": "ir", + "currency_code": "EUR", + "notional_amount": 100000, + "reset_date": "2019-11-27T00:00:00", + "payment_date": "2020-02-27T00:00:00", + "forward_rate": 0.0075 + } + ] +} ``` -#### FX forward -Short AUDUSD forward + +#### Ir Future + +Long Eurodollar interest rate future settled in cash. + ```json -{{#include fx_forward.json:5:}} +{ + "derivative": [ + { + "date": "2019-04-30T00:00:00", + "id": "june_eurodollar_future", + "asset_class": "ir", + "type": "future", + "leg_type": "indexed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 100, + "underlying_currency_code": "USD", + "trade_date": "2018-04-01T00:00:00", + "start_date": "2019-05-02T00:00:00", + "end_date": "2019-05-04T00:00:00", + "last_payment_date": "2019-08-02T00:00:00", + "mtm_dirty": -2, + "settlement_type": "cash" + } + ] +} ``` -#### FX future -Long June EURCAD future + +#### Margined Netting Agreement + +Margined IRS under ISDA and CSA including variation and initial margin collateral. + ```json -{{#include fx_future.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_fixed", + "deal_id": "eur_10y_irs", + "customer_id": "ccp_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "fixed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00", + "rate": 0.01, + "mtm_dirty": 70 + }, + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_floating", + "deal_id": "long_eur_10y_irs", + "customer_id": "counterparty_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "floating", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "rate": 0.0025, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "ccp_1", + "type": "ccp", + "currency_code": "GBP", + "country_code": "GB" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "isda_master_agreement", + "type": "isda", + "base_currency_code": "GBP", + "incurred_cva": 0, + "country_code": "GB" + }, + { + "date": "2020-03-31T00:00:00", + "id": "csa_daily_margined", + "type": "isda", + "base_currency_code": "EUR", + "credit_support_type": "scsa_isda_2013", + "margin_frequency": "daily", + "threshold": 10, + "minimum_transfer_amount": 5, + "country_code": "GB" + } + ], + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "vm_eur_received", + "customer_id": "ccp_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "type": "cash", + "purpose": "variation_margin", + "asset_liability": "liability", + "currency_code": "EUR", + "notional_amount": 55, + "balance": 55, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00" + }, + { + "date": "2020-03-31T00:00:00", + "id": "im_bond_posted", + "customer_id": "ccp_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "type": "bond", + "issuer_id": "French Republic", + "isin_code": "XS1234567890", + "issue_date": "2018-07-01 00:00:00", + "maturity_date": "2028-07-01 00:00:00", + "purpose": "independent_collateral_amount", + "asset_liability": "asset", + "currency_code": "EUR", + "notional_amount": 8, + "mtm_dirty": -10, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "cqs_standardised": 1 + } + ], + "issuer": [ + { + "date": "2020-03-31T00:00:00", + "id": "French Republic", + "lei_code": "9695006J0AWHMYNZAL19", + "type": "central_govt", + "country_code": "FR", + "snp_lt": "aa_plus", + "moodys_lt": "aa1" + } + ] +} ``` -#### FX option -Short USD call YEN put FX option, exercise on Match 2020 + +#### Unmargined Netting Agreement + +IRS under ISDA netting set without CSA, showing independent collateral posting. + ```json -{{#include fx_option.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_fixed", + "deal_id": "eur_10y_irs", + "customer_id": "ccp_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "fixed", + "position": "long", + "currency_code": "EUR", + "notional_amount": 10000, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00", + "rate": 0.01, + "mtm_dirty": 70 + }, + { + "date": "2020-03-31T00:00:00", + "id": "eur_10y_irs_floating", + "deal_id": "long_eur_10y_irs", + "customer_id": "counterparty_1", + "mna_id": "isda_master_agreement", + "csa_id": "csa_daily_margined", + "asset_class": "ir", + "type": "vanilla_swap", + "leg_type": "floating", + "position": "short", + "currency_code": "EUR", + "notional_amount": 10000, + "rate": 0.0025, + "underlying_index": "EURIBOR", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2029-02-27T00:00:00" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "ccp_1", + "type": "ccp", + "currency_code": "GBP", + "country_code": "GB" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "isda_master_agreement", + "type": "isda", + "base_currency_code": "GBP", + "incurred_cva": 0, + "country_code": "GB" + } + ], + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "im_bond_posted", + "customer_id": "ccp_1", + "mna_id": "isda_master_agreement", + "type": "bond", + "issuer_id": "French Republic", + "isin_code": "XS1234567890", + "issue_date": "2018-07-01 00:00:00", + "maturity_date": "2028-07-01 00:00:00", + "purpose": "independent_collateral_amount", + "asset_liability": "asset", + "currency_code": "EUR", + "notional_amount": 8, + "mtm_dirty": -10, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "cqs_standardised": 1 + } + ], + "issuer": [ + { + "date": "2020-03-31T00:00:00", + "id": "French Republic", + "lei_code": "9695006J0AWHMYNZAL19", + "type": "central_govt", + "country_code": "FR", + "snp_lt": "aa_plus", + "moodys_lt": "aa1" + } + ] +} ``` -#### FX spot -Long EURCAD spot (100 EUR for 140 CAD spot trade) + +#### Usd Payer Swaption + +Short USD payer swaption on 6M LIBOR with physical settlement. + ```json -{{#include fx_spot.json:5:}} +{ + "derivative": [ + { + "date": "2019-01-01T00:00:00", + "id": "usd_payer_swaption", + "asset_class": "ir", + "type": "swaption", + "leg_type": "call", + "position": "short", + "currency_code": "USD", + "notional_amount": 10000, + "strike": 0.02, + "underlying_index": "USD_LIBOR", + "underlying_index_tenor": "6m", + "start_date": "2019-01-01T00:00:00", + "end_date": "2020-01-01T00:00:00", + "last_payment_date": "2030-01-01T00:00:00", + "last_exercise_date": "2020-01-01T00:00:00", + "underlying_price": 0.02, + "settlement_type": "physical", + "mtm_dirty": -5 + } + ] +} ``` -#### FX swap -Short 1-year AUDUSD fx swap. The notional amounts are used to calculate the spot rate (occuring on the start date). + +#### Xccy Swap + +AUD/USD cross-currency swap with fixed AUD leg, floating USD leg, and principal exchanges. + ```json -{{#include fx_swap.json:5:}} +{ + "derivative": [ + { + "date": "2020-03-31T00:00:00", + "id": "AUDUSD_xccy:AUD", + "deal_id": "AUDUSD_xccy", + "asset_class": "fx", + "type": "xccy", + "leg_type": "fixed", + "position": "long", + "currency_code": "AUD", + "notional_amount": 14000, + "rate": 0.01, + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2030-02-27T00:00:00", + "mtm_dirty": 1140 + }, + { + "date": "2020-03-31T00:00:00", + "id": "AUDUSD_xccy:USD", + "deal_id": "AUDUSD_xccy", + "asset_class": "fx", + "type": "xccy", + "position": "short", + "leg_type": "floating", + "currency_code": "USD", + "notional_amount": 10000, + "underlying_index": "USD_LIBOR_BBA", + "underlying_index_tenor": "3m", + "trade_date": "2019-02-25T00:00:00", + "start_date": "2020-02-27T00:00:00", + "end_date": "2030-02-27T00:00:00" + } + ], + "derivative_cash_flow": [ + { + "id": "1", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:AUD", + "currency_code": "AUD", + "notional_amount": 14000, + "reset_date": "2019-02-27T00:00:00", + "payment_date": "2019-02-27T00:00:00", + "balance": -14000, + "purpose": "principal" + }, + { + "id": "2", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:AUD", + "currency_code": "AUD", + "notional_amount": 14000, + "reset_date": "2029-02-27T00:00:00", + "payment_date": "2029-02-27T00:00:00", + "balance": 14000, + "purpose": "principal" + }, + { + "id": "3", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:USD", + "currency_code": "USD", + "notional_amount": 10000, + "reset_date": "2019-02-27T00:00:00", + "payment_date": "2019-02-27T00:00:00", + "balance": 10000, + "purpose": "principal" + }, + { + "id": "4", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:USD", + "currency_code": "USD", + "notional_amount": 10000, + "reset_date": "2029-02-27T00:00:00", + "payment_date": "2029-02-27T00:00:00", + "balance": -10000, + "purpose": "principal" + }, + { + "id": "5", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:AUD", + "currency_code": "USD", + "reset_date": "2020-02-27T00:00:00", + "payment_date": "2021-02-27T00:00:00", + "notional_amount": 14000, + "balance": 140, + "purpose": "interest" + }, + { + "id": "6", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:AUD", + "currency_code": "USD", + "reset_date": "2028-02-27T00:00:00", + "payment_date": "2029-02-27T00:00:00", + "notional_amount": 14000, + "balance": 140, + "purpose": "interest" + }, + { + "id": "7", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:USD", + "currency_code": "USD", + "reset_date": "2020-02-27T00:00:00", + "payment_date": "2020-05-27T00:00:00", + "notional_amount": 10000, + "forward_rate": 0.01, + "balance": -2466, + "purpose": "interest" + }, + { + "id": "8", + "date": "2020-03-31T00:00:00", + "derivative_id": "AUDUSD_xccy:USD", + "currency_code": "USD", + "reset_date": "2028-11-27T00:00:00", + "payment_date": "2029-02-27T00:00:00", + "notional_amount": 10000, + "forward_rate": 0.02, + "balance": -5042, + "purpose": "interest" + } + ] +} ``` -#### Interest rate cap floor -Short 1y collar vs Euribor 3M + +## Loan + +#### Bbl Loans + +Portfolio of GBP Bounce Back Loan exposures including netting, interest-only, and amortising positions. + ```json -{{#include ir_cap_floor.json:5:}} +{ + "loan": [ + { + "date": "2020-08-08T00:00:00+00:00", + "id": "BBL_netting", + "asset_liability": "asset", + "balance": -2500000, + "currency_code": "GBP", + "end_date": "2021-08-01T00:00:00+00:00", + "on_balance_sheet": true, + "purpose": "other", + "rate": 10.0, + "repayment_frequency": "at_maturity", + "repayment_type": "repayment", + "start_date": "2021-08-01T00:00:00+00:00", + "trade_date": "2020-05-11T00:00:00+00:00", + "type": "commercial" + }, + { + "date": "2020-08-08T00:00:00+00:00", + "id": "BBL1", + "asset_liability": "asset", + "balance": 2500000, + "currency_code": "GBP", + "end_date": "2021-08-01T00:00:00+00:00", + "interest_repayment_frequency": "quarterly", + "on_balance_sheet": true, + "purpose": "other", + "rate": 10.0, + "repayment_frequency": "at_maturity", + "repayment_type": "interest_only", + "start_date": "2020-08-01T00:00:00+00:00", + "trade_date": "2020-05-11T00:00:00+00:00", + "type": "commercial" + }, + { + "date": "2020-08-08T00:00:00+00:00", + "id": "BBL2", + "asset_liability": "asset", + "balance": 2500000, + "currency_code": "GBP", + "end_date": "2026-08-01T00:00:00+00:00", + "on_balance_sheet": true, + "purpose": "other", + "rate": 10.0, + "repayment_frequency": "monthly", + "repayment_type": "repayment", + "start_date": "2021-08-01T00:00:00+00:00", + "trade_date": "2020-05-11T00:00:00+00:00", + "type": "commercial" + } + ] +} ``` -#### Interest rate digital floor -Long EUR 1y 0% digital floor vs Euribor 3M + +#### Encumbered Loan + +Mortgage loan partially encumbered by 50,000 GBP until 2022-10-20. + ```json -{{#include ir_digital_floor.json:5:}} +{ + "loan": [ + { + "id": "encumbered_loan", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "balance": 150000, + "currency_code": "GBP", + "customer_id": "encumbered_loan_customer", + "encumbrance_amount": 50000, + "encumbrance_end_date": "2022-10-20T00:00:00Z", + "end_date": "2023-04-20T00:00:00Z", + "on_balance_sheet": true, + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "mortgage" + } + ], + "customer": [ + { + "id": "encumbered_loan_customer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "natural_person" + } + ] +} ``` -#### Interest rate future -June three-month cash-settled interest rate future. + +#### Loan With 2 Customers + +Loan shared by two customers who each provide income information. + ```json -{{#include ir_future.json:5:}} +{ + "loan": [ + { + "id": "loan_with_2_customers", + "date": "2021-09-30", + "balance": 10000, + "customers": [ + { + "id": "CUST123", + "income_amount": 5000000 + }, + { + "id": "CUST234", + "income_amount": 5000000 + } + ], + "repayment_frequency": "monthly" + } + ] +} ``` -#### Interest rate swap -Long 10y EUR irs vs Euribor 3M, bullet + +#### Undrawn Committed Loan + +Off-balance-sheet committed personal loan limit of 100 GBP for a natural person customer. + ```json -{{#include interest_rate_swap.json:5:}} +{ + "loan": [ + { + "date": "2022-04-20T00:00:00+00:00", + "id": "undrawn_committed_loan", + "accrued_interest_balance": 0, + "asset_liability": "liability", + "balance": 100, + "currency_code": "GBP", + "customer_id": "undrawn_loan_customer", + "on_balance_sheet": false, + "purpose": "other", + "start_date": "2022-04-20T00:00:00+00:00", + "status": "committed", + "trade_date": "2021-04-20T00:00:00+00:00", + "type": "personal" + } + ], + "customer": [ + { + "date": "2022-04-20T00:00:00+00:00", + "id": "undrawn_loan_customer", + "country_code": "GB", + "type": "natural_person" + } + ] +} ``` -#### Interest rate swap amortising -Long 2y EUR irs vs Euribor 6M, amortising annually + +#### Vostro Account + +Vostro account capturing another bank's cash held as our asset. + ```json -{{#include interest_rate_swap_amortising.json:5:}} +{ + "account": [ + { + "id": "Vostro account at your bank", + "date": "2017-06-30T14:03:12Z", + "currency_code": "GBP", + "balance": 100000, + "type": "vostro", + "asset_liability": "asset", + "customer_id": "bank_123_id", + "on_balance_sheet": true + } + ] +} ``` -#### Margined netting agreement -Margined netting agreement, collateralised with initial collateral amount and variation margin + +## Security + +#### Bank Guarantee Issued + +Off-balance-sheet financial guarantee issued for a corporate client in GBP. + ```json -{{#include margined_netting_agreement.json:5:}} +{ + "security": [ + { + "id": "bank_guarantee", + "date": "2019-01-01T00:00:00", + "balance": 100000, + "currency_code": "GBP", + "asset_liability": "liability", + "on_balance_sheet": false, + "type": "financial_guarantee", + "customer_id": "corp_123_id" + } + ] +} ``` -#### Swaption -Short USD 1y into 10y payer swaptionwith physical settlement + +#### Cash On Hand + +On-balance-sheet GBP cash holding classified as an asset. + ```json -{{#include usd_payer_swaption.json:5:}} +{ + "security": [ + { + "id": "cash_on_hand", + "date": "2019-01-01T00:00:00", + "balance": 100000, + "currency_code": "GBP", + "asset_liability": "asset", + "type": "cash" + } + ] +} ``` -#### Unmargined netting agreement -Unmargined netting agreement, collateralised with initial collateral amount + +#### Cash Payable + +Short-term GBP cash payable liability settling on 2020-08-01. + ```json -{{#include unmargined_netting_agreement.json:5:}} +{ + "security": [ + { + "id": "cash_payable", + "date": "2020-07-30T00:00:00", + "balance": 100000, + "currency_code": "GBP", + "asset_liability": "liability", + "type": "cash", + "end_date": "2020-08-01T00:00:00+00:00", + "isin_code": "DUMMYISIN123" + } + ] +} ``` -### Security examples -#### Bank guarantee issued -Guarantee of 1000 GBP issued by the bank for a customer + +#### Cash Receivable + +Short-term GBP cash receivable asset settling on 2020-08-01. + ```json -{{#include bank_guarantee_issued.json:5:}} +{ + "security": [ + { + "id": "cash_receivable", + "date": "2020-07-30T00:00:00", + "balance": -100000, + "currency_code": "GBP", + "asset_liability": "asset", + "type": "cash", + "end_date": "2020-08-01T00:00:00+00:00", + "isin_code": "DUMMYISIN123" + } + ] +} ``` -#### Core equity tier-1 capital -Core equity tier 1 capital of 1000 GBP + +#### Cet 1 Capital + +Core Equity Tier 1 share capital that is fully paid up. + ```json -{{#include cet_1_capital.json:5:}} +{ + "security": [ + { + "id": "Core Equity Tier one capital", + "date": "2019-01-01T00:00:00", + "balance": 100000, + "currency_code": "GBP", + "asset_liability": "equity", + "type": "share", + "capital_tier": "ce_tier_1", + "purpose": "share_capital", + "status": "paid_up" + } + ] +} ``` -#### Cash on-hand -Cash balance representing 1000 GBP. + +#### Collateral Independent Amount Bond Received + +NZD bond received as independent amount collateral under an ISDA agreement. + ```json -{{#include cash_on_hand.json:5:}} +{ + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "independent_amount", + "customer_id": "corporate", + "mna_id": "master_agreement", + "type": "bond", + "issuer_id": "Asian Development Bank", + "isin_code": "NZADBDT007C4", + "issue_date": "2017-05-30T00:00:00", + "maturity_date": "2024-05-30T00:00:00", + "purpose": "independent_collateral_amount", + "asset_liability": "liability", + "currency_code": "NZD", + "notional_amount": 100, + "mtm_dirty": 17, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "cqs_standardised": 1 + } + ], + "issuer": [ + { + "date": "2020-03-31T00:00:00", + "id": "Asian Development Bank", + "lei_code": "549300X0MVH42CY8Q105", + "type": "mdb", + "country_code": "PH", + "snp_lt": "aaa", + "moodys_lt": "aaa" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "corporate", + "type": "corporate", + "currency_code": "SGD", + "country_code": "SG" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "master_agreement", + "type": "isda", + "base_currency_code": "SGD", + "netting_restriction": "restrictive_covenant", + "incurred_cva": 10, + "country_code": "SG" + } + ] +} ``` -#### Cash receivable -Cash receivable representing a 1000 GBP claim expiring on August 1st 2020 on a security with isin 'DUMMYISIN123'. + +#### Collateral Initial Margin Bond Posted + +EUR sovereign bond posted as initial margin under a CSA. + ```json -{{#include cash_receivable.json:5:}} +{ + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "im_posted_bond", + "customer_id": "credit_insitution", + "mna_id": "isda_master_agreement", + "csa_id": "csa_agreement", + "type": "bond", + "issuer_id": "French Republic", + "isin_code": "FR0000571218", + "issue_date": "1998-03-12T00:00:00", + "maturity_date": "2025-04-29T00:00:00", + "purpose": "independent_collateral_amount", + "asset_liability": "asset", + "currency_code": "EUR", + "notional_amount": 100, + "mtm_dirty": -145, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00", + "cqs_standardised": 1 + } + ], + "issuer": [ + { + "date": "2020-03-31T00:00:00", + "id": "French Republic", + "lei_code": "9695006J0AWHMYNZAL19", + "type": "central_govt", + "country_code": "FR", + "snp_lt": "aa_plus", + "moodys_lt": "aa1" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "credit_insitution", + "type": "credit_institution", + "currency_code": "GBP", + "country_code": "GB" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "isda_master_agreement", + "type": "isda", + "base_currency_code": "GBP", + "country_code": "GB" + }, + { + "date": "2020-03-31T00:00:00", + "id": "csa_agreement", + "type": "isda", + "base_currency_code": "EUR", + "credit_support_type": "scsa_isda_2013", + "margin_frequency": "daily", + "threshold": 10, + "minimum_transfer_amount": 5, + "country_code": "GB" + } + ] +} ``` -#### Cash payable -Cash payable representing a 1000 GBP claim expiring on August 1st 2020 on a -security with isin 'DUMMYISIN123'. + +#### Collateral Variation Margin Cash Posted + +USD variation margin cash posted to a QCCP under the margin agreement. + ```json -{{#include cash_payable.json:5:}} +{ + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "vm_cash_posted", + "customer_id": "qccp", + "mna_id": "ccp_master_agreement", + "csa_id": "ccp_margin_agreement", + "type": "cash", + "purpose": "variation_margin", + "asset_liability": "asset", + "currency_code": "USD", + "notional_amount": 25, + "balance": -25, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "qccp", + "type": "qccp", + "currency_code": "GBP", + "country_code": "GB" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "ccp_master_agreement", + "type": "isda", + "base_currency_code": "GBP", + "incurred_cva": 0, + "country_code": "GB" + }, + { + "date": "2020-03-31T00:00:00", + "id": "ccp_margin_agreement", + "type": "isda", + "base_currency_code": "GBP", + "credit_support_type": "csa_isda_1995", + "margin_frequency": "daily_settled", + "country_code": "GB" + } + ] +} ``` -#### Collateral posted to ccp on non-derivatives -Non-derivatives IM posted to a CCP (e.g. RepoClear) -> Security has "purpose" = "collateral" which signals it is not linked to derivative transactions. + +#### Collateral Variation Margin Cash Received + +EUR variation margin cash received from a QCCP under the margin agreement. + ```json -{{#include security_collateral_posted_ccp_non_deriv.json:5:}} +{ + "security": [ + { + "date": "2020-03-31T00:00:00", + "id": "vm_cash_received", + "customer_id": "qccp", + "mna_id": "ccp_master_agreement", + "csa_id": "ccp_margin_agreement", + "type": "cash", + "purpose": "variation_margin", + "asset_liability": "liability", + "currency_code": "EUR", + "notional_amount": 100, + "balance": 100, + "trade_date": "2020-03-31T00:00:00", + "start_date": "2020-03-31T00:00:00" + } + ], + "customer": [ + { + "date": "2020-03-31T00:00:00", + "id": "qccp", + "type": "qccp", + "currency_code": "GBP", + "country_code": "GB" + } + ], + "agreement": [ + { + "date": "2020-03-31T00:00:00", + "id": "ccp_master_agreement", + "type": "isda", + "base_currency_code": "GBP", + "incurred_cva": 0, + "country_code": "GB" + }, + { + "date": "2020-03-31T00:00:00", + "id": "ccp_margin_agreement", + "type": "isda", + "base_currency_code": "GBP", + "credit_support_type": "csa_isda_1995", + "margin_frequency": "daily_settled", + "country_code": "GB" + } + ] +} ``` -#### Initial margin posted -Bond collateral used as initial margin posted + +#### Dividend From Equity + +GBP dividend receivable from an equity position recorded in the trading book. + ```json -{{#include collateral_initial_margin_bond_posted.json:5:}} +{ + "security": [ + { + "date": "2022-12-31T00:00:00+00:00", + "id": "dividend_from_equity", + "asset_liability": "asset", + "balance": 100000, + "currency_code": "GBP", + "hqla_class": "ineligible", + "isin_code": "123456789012", + "issuer_id": "equity_issuer", + "on_balance_sheet": true, + "product_name": "dividend", + "regulatory_book": "trading_book", + "reporting_id": "equity_reporter", + "reporting_entity_name": "equity_entity", + "start_date": "2022-12-31T00:00:00+00:00", + "type": "dividend", + "next_payment_date": "2023-01-25T00:00:00+00:00", + "trade_date": "2016-01-25T00:00:00+00:00" + } + ] +} ``` -#### Independent amount received -Bond collateral used as independent amount received + +#### Encumbrance Set + +Linked bond, repo, reverse repo, and margin trades illustrating an encumbrance chain. + ```json -{{#include collateral_independent_amount_bond_received.json:5:}} +{ + "security": [ + { + "id": "outright_debt_security", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "balance": 10000, + "currency_code": "GBP", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "issuer_id": "debt_security_issuer", + "mtm_dirty": 10000, + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + }, + { + "id": "repo_cash", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "liability", + "balance": 8500, + "currency_code": "GBP", + "customer_id": "repo_customer", + "deal_id": "repo_deal", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "movement": "cash", + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "sft_type": "repo", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + }, + { + "id": "repo_collateral", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "currency_code": "GBP", + "customer_id": "repo_customer", + "deal_id": "repo_deal", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "issuer_id": "debt_security_issuer", + "movement": "asset", + "mtm_dirty": -9000, + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "sft_type": "repo", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + }, + { + "id": "reverse_repo_cash", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "balance": -9500, + "currency_code": "GBP", + "customer_id": "reverse_repo_customer", + "deal_id": "reverse_repo_deal", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "movement": "cash", + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "sft_type": "rev_repo", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + }, + { + "id": "reverse_repo_collateral", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "liability", + "currency_code": "GBP", + "customer_id": "reverse_repo_customer", + "deal_id": "repo_deal", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "issuer_id": "debt_security_issuer", + "movement": "asset", + "mtm_dirty": 10000, + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "sft_type": "rev_repo", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + }, + { + "id": "initial_margin_posted", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "csa_id": "csa_agreement", + "currency_code": "GBP", + "customer_id": "derivative_customer", + "deal_id": "derivative_deal", + "end_date": "2022-05-20T00:00:00Z", + "isin_code": "123456789XYZ", + "issuer_id": "debt_security_issuer", + "mna_id": "isda_master_agreement", + "movement": "asset", + "mtm_dirty": -9000, + "purpose": "independent_collateral_amount", + "regulatory_book": "trading_book", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + } + ], + "issuer": [ + { + "id": "debt_security_issuer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "central_govt" + } + ], + "customer": [ + { + "id": "repo_customer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "credit_institution" + }, + { + "id": "reverse_repo_customer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "credit_institution" + }, + { + "id": "derivative_customer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "investment_firm" + } + ], + "agreement": [ + { + "id": "isda_master_agreement", + "date": "2022-04-20T00:00:00Z", + "base_currency_code": "GBP", + "country_code": "GB", + "type": "isda" + }, + { + "id": "csa_agreement", + "date": "2022-04-20T00:00:00Z", + "base_currency_code": "EUR", + "country_code": "GB", + "credit_support_type": "scsa_isda_2013", + "marging_frequency": "daily", + "minimum_transfer_amount": 50, + "threshold": 10 + } + ] +} ``` -#### Reverse repo -Reverse repo transaction with a cash leg of 150 GBP, and a security leg of 140 -GBP, starting on June 1st, 2021 and ending on July 1st, 2021. The maturity date -on the security leg refers to the maturity of the bond received as collateral. + +#### Outright Debt Security + +GBP trading book bond position held on balance sheet. + ```json -{{#include rev_repo.json:5:}} +{ + "security": [ + { + "id": "outright_debt_security", + "date": "2022-04-20T00:00:00Z", + "accounting_treatment": "amortised_cost", + "asset_liability": "asset", + "balance": 10000, + "currency_code": "GBP", + "end_date": "2022-05-20T00:00:00Z", + "issuer_id": "debt_security_issuer", + "mtm_dirty": 10000, + "on_balance_sheet": true, + "regulatory_book": "trading_book", + "start_date": "2021-04-20T00:00:00Z", + "trade_date": "2021-04-20T00:00:00Z", + "type": "bond" + } + ], + "issuer": [ + { + "id": "debt_security_issuer", + "date": "2022-04-20T00:00:00Z", + "country_code": "GB", + "type": "credit_institution" + } + ] +} ``` + #### Repo -Repo transaction with a cash leg of 150 GBP, and a security leg of 140 -GBP, starting on June 1st, 2021 and ending on July 1st, 2021. The maturity date -on the security leg refers to the maturity of the bond posted as collateral. + +GBP repo transaction with a cash liability leg and encumbered bond asset. + ```json -{{#include repo.json:5:}} +{ + "security": [ + { + "id": "repo_cash_leg", + "date": "2021-06-15T00:00:00", + "currency_code": "GBP", + "end_date": "2021-07-01T00:00:00Z", + "balance": 15000, + "cqs_standardised": 1, + "hqla_class": "i", + "issuer_id": "uk_central_government_id", + "movement": "cash", + "sft_type": "repo", + "start_date": "2021-06-01T00:00:00Z", + "type": "bond", + "trade_date": "2021-06-01T00:00:00Z", + "asset_liability": "liability" + }, + { + "id": "repo_asset_leg", + "date": "2021-06-15T00:00:00", + "currency_code": "GBP", + "end_date": "2021-07-01T00:00:00Z", + "cqs_standardised": 1, + "hqla_class": "i", + "mtm_dirty": -14000, + "movement": "asset", + "sft_type": "repo", + "start_date": "2021-06-01T00:00:00Z", + "type": "bond", + "trade_date": "2021-06-01T00:00:00Z", + "asset_liability": "asset", + "issuer_id": "uk_central_government_id", + "maturity_date": "2030-01-01T00:00:00Z" + } + ] +} ``` -#### Variation margin cash posted -Cash collateral used as variation margin posted + +#### Rev Repo + +GBP reverse repo transaction with a cash asset leg and bond collateral liability. + ```json -{{#include collateral_variation_margin_cash_posted.json:5:}} +{ + "security": [ + { + "id": "rev_repo_cash_leg", + "date": "2021-06-15T00:00:00", + "currency_code": "GBP", + "end_date": "2021-07-01T00:00:00Z", + "cqs_standardised": 1, + "hqla_class": "i", + "issuer_id": "uk_central_government_id", + "balance": -15000, + "movement": "cash", + "sft_type": "rev_repo", + "start_date": "2021-06-01T00:00:00Z", + "type": "bond", + "trade_date": "2021-06-01T00:00:00Z", + "asset_liability": "asset" + }, + { + "id": "rev_repo_asset_leg", + "date": "2021-06-15T00:00:00", + "currency_code": "GBP", + "end_date": "2021-07-01T00:00:00Z", + "cqs_standardised": 1, + "hqla_class": "i", + "mtm_dirty": 14000, + "movement": "asset", + "sft_type": "rev_repo", + "start_date": "2021-06-01T00:00:00Z", + "type": "bond", + "trade_date": "2021-06-01T00:00:00Z", + "asset_liability": "liability", + "issuer_id": "uk_central_government_id", + "maturity_date": "2030-01-01T00:00:00Z" + } + ] +} ``` -#### Variation margin cash received -Cash collateral used as variation margin received + +#### Security Collateral Posted Ccp Non Deriv + +GBP bond collateral posted to a CCP against non-derivative exposure. + ```json -{{#include collateral_variation_margin_cash_received.json:5:}} +{ + "agreement": [ + { + "id": "MNA1", + "date": "2018-12-31 00:00:00", + "start_date": "2017-01-31 00:00:00", + "country_code": "GB", + "type": "isda" + } + ], + "customer": [ + { + "id": "customer_ccp", + "date": "2018-12-31 00:00:00", + "type": "ccp", + "country_code": "GB" + } + ], + "security": [ + { + "id": "collat_cash_posted_50", + "date": "2018-12-31 00:00:00", + "trade_date": "2018-12-31 00:00:00", + "start_date": "2018-12-31 00:00:00", + "asset_liability": "asset", + "currency_code": "GBP", + "balance": 5000, + "mtm_dirty": 5000, + "type": "bond", + "purpose": "collateral", + "mna_id": "MNA1", + "customer_id": "customer_ccp" + } + ] +} +``` + +#### Subordinated Debt + +Tier 2 subordinated debt issuance of 1,000,000 GBP with quarterly coupons. + +```json +{ + "security": [ + { + "date": "2022-04-20T00:00:00+00:00", + "id": "subordinated_debt", + "accounting_treatment": "fv_oci", + "asset_liability": "liability", + "balance": 1000000, + "capital_tier": "tier_2", + "currency_code": "GBP", + "end_date": "2027-04-20T00:00:00+00:00", + "interest_repayment_frequency": "quarterly", + "issuer_id": "subordinated_debt_issuer", + "movement": "issuance", + "notional_amount": 1000000, + "rate": 10, + "seniority": "subordinated_unsecured", + "start_date": "2022-04-20T00:00:00+00:00", + "type": "equity", + "trade_date": "2022-04-20T00:00:00+00:00" + } + ], + "issuer": [ + { + "date": "2022-04-20T00:00:00+00:00", + "id": "subordianted_debt_issuer", + "country_code": "GB", + "type": "credit_institution" + } + ] +} ``` ---- diff --git a/examples/current_account.json b/examples/account/current_account.json similarity index 88% rename from examples/current_account.json rename to examples/account/current_account.json index 23eee914..41f72fc2 100644 --- a/examples/current_account.json +++ b/examples/account/current_account.json @@ -1,6 +1,6 @@ { "title": "current_account", - "comment": "current_account", + "comment": "Active GBP current account with accrued interest.", "data": { "account": [ { diff --git a/examples/current_account_with_guarantee.json b/examples/account/current_account_with_guarantee.json similarity index 87% rename from examples/current_account_with_guarantee.json rename to examples/account/current_account_with_guarantee.json index 65be37af..33a69b2a 100644 --- a/examples/current_account_with_guarantee.json +++ b/examples/account/current_account_with_guarantee.json @@ -1,6 +1,6 @@ { "title": "current_account_with_guarantee", - "comment": "current_account_with_guarantee", + "comment": "GBP current account protected by GB FSCS guarantee up to 8,500 GBP.", "data": { "account": [ { diff --git a/examples/overdraft_account.json b/examples/account/overdraft_account.json similarity index 86% rename from examples/overdraft_account.json rename to examples/account/overdraft_account.json index 95e423a4..af0608e5 100644 --- a/examples/overdraft_account.json +++ b/examples/account/overdraft_account.json @@ -1,6 +1,6 @@ { "title": "overdraft_account", - "comment": "Overdrafts should have a negative balance, and asset_liability as asset", + "comment": "Overdrawn current account showing negative balance and associated customer record.", "data": { "account": [ { diff --git a/examples/pnl_interest_income.json b/examples/account/pnl_interest_income.json similarity index 83% rename from examples/pnl_interest_income.json rename to examples/account/pnl_interest_income.json index b3889a6c..027ce3f3 100644 --- a/examples/pnl_interest_income.json +++ b/examples/account/pnl_interest_income.json @@ -1,6 +1,6 @@ { "title": "pnl_interest_income", - "comment": "interest_income", + "comment": "P&L income line item representing GBP interest earned.", "data": { "account": [ { diff --git a/examples/pnl_salary_expenses.json b/examples/account/pnl_salary_expenses.json similarity index 82% rename from examples/pnl_salary_expenses.json rename to examples/account/pnl_salary_expenses.json index dce4c83d..6654483c 100644 --- a/examples/pnl_salary_expenses.json +++ b/examples/account/pnl_salary_expenses.json @@ -1,6 +1,6 @@ { "title": "pnl_salary_expenses", - "comment": "salary_expenses", + "comment": "P&L expense line item for GBP regular wage payments.", "data": { "account": [ { diff --git a/examples/savings_account.json b/examples/account/savings_account.json similarity index 90% rename from examples/savings_account.json rename to examples/account/savings_account.json index d78c7897..b8416d44 100644 --- a/examples/savings_account.json +++ b/examples/account/savings_account.json @@ -1,6 +1,6 @@ { "title": "savings_account", - "comment": "savings_account", + "comment": "Active GBP savings account with accrued interest.", "data": { "account": [ { diff --git a/examples/savings_account_with_30days_notice.json b/examples/account/savings_account_with_30days_notice.json similarity index 87% rename from examples/savings_account_with_30days_notice.json rename to examples/account/savings_account_with_30days_notice.json index dd178302..d6583a9b 100644 --- a/examples/savings_account_with_30days_notice.json +++ b/examples/account/savings_account_with_30days_notice.json @@ -1,6 +1,6 @@ { "title": "savings_account_with_30days_notice", - "comment": "savings_account_with_30days_notice", + "comment": "GBP savings account that requires 30 days' notice before withdrawal.", "data": { "account": [ { diff --git a/examples/time_deposit_1year.json b/examples/account/time_deposit_1year.json similarity index 86% rename from examples/time_deposit_1year.json rename to examples/account/time_deposit_1year.json index 64ac2b0f..bd0c72c4 100644 --- a/examples/time_deposit_1year.json +++ b/examples/account/time_deposit_1year.json @@ -1,6 +1,6 @@ { "title": "time_deposit_1year", - "comment": "time_deposit_1year", + "comment": "One-year GBP time deposit maturing on 2018-06-30 with accrued interest.", "data": { "account": [ { diff --git a/examples/time_deposit_1year_with_6_month_withdrawal_option.json b/examples/account/time_deposit_1year_with_6_month_withdrawal_option.json similarity index 87% rename from examples/time_deposit_1year_with_6_month_withdrawal_option.json rename to examples/account/time_deposit_1year_with_6_month_withdrawal_option.json index 120cf6b1..190819e8 100644 --- a/examples/time_deposit_1year_with_6_month_withdrawal_option.json +++ b/examples/account/time_deposit_1year_with_6_month_withdrawal_option.json @@ -1,6 +1,6 @@ { "title": "time_deposit_1year_with_6_month_withdrawal_option", - "comment": "time_deposit_1year_with_6_month_withdrawal_option", + "comment": "One-year GBP time deposit with optional withdrawal available after six months.", "data": { "account": [ { diff --git a/examples/bermudan_swaption.json b/examples/derivative/bermudan_swaption.json similarity index 87% rename from examples/bermudan_swaption.json rename to examples/derivative/bermudan_swaption.json index 8018ce93..4015dde6 100644 --- a/examples/bermudan_swaption.json +++ b/examples/derivative/bermudan_swaption.json @@ -1,6 +1,6 @@ { "title": "bermudan_swaption", - "comment": "usd_bermudan_swaption", + "comment": "Short USD Bermudan swaption on 6M LIBOR with 10,000 notional and physical settlement.", "data": { "derivative": [ { diff --git a/examples/bond_future.json b/examples/derivative/bond_future.json similarity index 86% rename from examples/bond_future.json rename to examples/derivative/bond_future.json index d920d368..a11fdb2e 100644 --- a/examples/bond_future.json +++ b/examples/derivative/bond_future.json @@ -1,6 +1,6 @@ { "title": "bond_future", - "comment": "Bund June IMM future", + "comment": "EUR Bund futures contract with 10,000 notional settling physically in May 2019.", "data": { "derivative": [ { diff --git a/examples/bond_future2.json b/examples/derivative/bond_future2.json similarity index 86% rename from examples/bond_future2.json rename to examples/derivative/bond_future2.json index 218c48b9..33a81ded 100644 --- a/examples/bond_future2.json +++ b/examples/derivative/bond_future2.json @@ -1,6 +1,6 @@ { "title": "bond_future2", - "comment": "T-Bond Mar21 future", + "comment": "USD Treasury bond future expiring March 2021 with long-dated underlying.", "data": { "derivative": [ { diff --git a/examples/cds_index.json b/examples/derivative/cds_index.json similarity index 92% rename from examples/cds_index.json rename to examples/derivative/cds_index.json index f0cf7613..3b5de33a 100644 --- a/examples/cds_index.json +++ b/examples/derivative/cds_index.json @@ -1,6 +1,6 @@ { "title": "cds_index", - "comment": "cds_index", + "comment": "Short USD CDX investment-grade index CDS position.", "data": { "derivative": [ { diff --git a/examples/cds_single_name.json b/examples/derivative/cds_single_name.json similarity index 91% rename from examples/cds_single_name.json rename to examples/derivative/cds_single_name.json index b3206861..6d72016c 100644 --- a/examples/cds_single_name.json +++ b/examples/derivative/cds_single_name.json @@ -1,6 +1,6 @@ { - "title": "cds_single_name", - "comment": "cds_single_name", + "title": "CDS_single_name", + "comment": "Short single-name USD corporate CDS referencing a 2028 bond.", "data": { "derivative": [ { diff --git a/examples/commodity_asian_option.json b/examples/derivative/commodity_asian_option.json similarity index 89% rename from examples/commodity_asian_option.json rename to examples/derivative/commodity_asian_option.json index bd85f234..87dc3d56 100644 --- a/examples/commodity_asian_option.json +++ b/examples/derivative/commodity_asian_option.json @@ -1,6 +1,6 @@ { "title": "commodity_asian_option", - "comment": "Commodity Asian Option", + "comment": "Long USD Asian-style copper put option referencing averaged prices.", "data": { "derivative": [ { diff --git a/examples/commodity_option.json b/examples/derivative/commodity_option.json similarity index 90% rename from examples/commodity_option.json rename to examples/derivative/commodity_option.json index d9675dc6..ccac52bf 100644 --- a/examples/commodity_option.json +++ b/examples/derivative/commodity_option.json @@ -1,6 +1,6 @@ { "title": "commodity_option", - "comment": "Commodity Option", + "comment": "Long USD copper put option with physical settlement.", "data": { "derivative": [ { diff --git a/examples/eq_index_basket_option.json b/examples/derivative/eq_index_basket_option.json similarity index 96% rename from examples/eq_index_basket_option.json rename to examples/derivative/eq_index_basket_option.json index f7f792e7..937e4072 100644 --- a/examples/eq_index_basket_option.json +++ b/examples/derivative/eq_index_basket_option.json @@ -1,6 +1,6 @@ { "title": "eq_index_basket_option", - "comment": "2Y call option on a basket of stock indices.", + "comment": "Equity index basket collar with long and short option legs on a custom index.", "data": { "derivative": [ { diff --git a/examples/equity_option.json b/examples/derivative/equity_option.json similarity index 92% rename from examples/equity_option.json rename to examples/derivative/equity_option.json index 31f448e7..8fb81f98 100644 --- a/examples/equity_option.json +++ b/examples/derivative/equity_option.json @@ -1,6 +1,6 @@ { "title": "equity_option", - "comment": "equity_option", + "comment": "Long USD call option on single equity reference EquityABC.", "data": { "derivative": [ { diff --git a/examples/equity_total_return_swap.json b/examples/derivative/equity_total_return_swap.json similarity index 93% rename from examples/equity_total_return_swap.json rename to examples/derivative/equity_total_return_swap.json index f9b3db99..1b6c87f2 100644 --- a/examples/equity_total_return_swap.json +++ b/examples/derivative/equity_total_return_swap.json @@ -1,6 +1,6 @@ { "title": "equity_total_return_swap", - "comment": "equity_total_return_swap", + "comment": "EUR equity total return swap exchanging equity performance for floating EURIBOR.", "data": { "derivative": [ { diff --git a/examples/fra_6x12.json b/examples/derivative/fra_6x12.json similarity index 89% rename from examples/fra_6x12.json rename to examples/derivative/fra_6x12.json index a1f84d2c..edbbd30d 100644 --- a/examples/fra_6x12.json +++ b/examples/derivative/fra_6x12.json @@ -1,6 +1,6 @@ { "title": "fra_6x12", - "comment": "6x12-fra", + "comment": "Short USD 6x12 forward rate agreement referencing 6M LIBOR.", "data": { "derivative": [ { diff --git a/examples/fx_forward.json b/examples/derivative/fx_forward.json similarity index 93% rename from examples/fx_forward.json rename to examples/derivative/fx_forward.json index 7f16d09c..1cf366e4 100644 --- a/examples/fx_forward.json +++ b/examples/derivative/fx_forward.json @@ -1,6 +1,6 @@ { "title": "fx_forward", - "comment": "fx_forward", + "comment": "AUD/USD FX forward with short AUD leg and long USD leg.", "data": { "derivative": [ { diff --git a/examples/fx_future.json b/examples/derivative/fx_future.json similarity index 88% rename from examples/fx_future.json rename to examples/derivative/fx_future.json index e108f33d..966c39e4 100644 --- a/examples/fx_future.json +++ b/examples/derivative/fx_future.json @@ -1,6 +1,6 @@ { "title": "fx_future", - "comment": "EUR CAD Future", + "comment": "Long EUR/CAD FX future with 100 notional and physical delivery.", "data": { "derivative": [ { diff --git a/examples/fx_option.json b/examples/derivative/fx_option.json similarity index 88% rename from examples/fx_option.json rename to examples/derivative/fx_option.json index b154d732..af6494ce 100644 --- a/examples/fx_option.json +++ b/examples/derivative/fx_option.json @@ -1,6 +1,6 @@ { "title": "fx_option", - "comment": "USD-JPY call 130", + "comment": "Short USD/JPY call option struck at 130 with March 2020 expiry.", "data": { "derivative": [ { diff --git a/examples/fx_option_long_call.json b/examples/derivative/fx_option_long_call.json similarity index 89% rename from examples/fx_option_long_call.json rename to examples/derivative/fx_option_long_call.json index a720b0d8..fd6e7502 100644 --- a/examples/fx_option_long_call.json +++ b/examples/derivative/fx_option_long_call.json @@ -1,6 +1,6 @@ { "title": "fx_option_long_call", - "comment": "Long call (+ve)", + "comment": "Long USD/JPY call option illustrating positive delta exposure.", "data": { "derivative": [ { diff --git a/examples/fx_option_long_put.json b/examples/derivative/fx_option_long_put.json similarity index 90% rename from examples/fx_option_long_put.json rename to examples/derivative/fx_option_long_put.json index 22176ef3..da26f4bd 100644 --- a/examples/fx_option_long_put.json +++ b/examples/derivative/fx_option_long_put.json @@ -1,6 +1,6 @@ { "title": "fx_option_long_put", - "comment": "Long put (-ve)", + "comment": "Long USD/JPY put option providing downside protection.", "data": { "derivative": [ { diff --git a/examples/fx_option_short_call.json b/examples/derivative/fx_option_short_call.json similarity index 89% rename from examples/fx_option_short_call.json rename to examples/derivative/fx_option_short_call.json index 2eb692e2..0a09f775 100644 --- a/examples/fx_option_short_call.json +++ b/examples/derivative/fx_option_short_call.json @@ -1,6 +1,6 @@ { "title": "fx_option_short_call", - "comment": "Short call (-ve)", + "comment": "Short USD/JPY call option illustrating negative delta exposure.", "data": { "derivative": [ { diff --git a/examples/fx_option_short_put.json b/examples/derivative/fx_option_short_put.json similarity index 90% rename from examples/fx_option_short_put.json rename to examples/derivative/fx_option_short_put.json index c4394bb8..debc8559 100644 --- a/examples/fx_option_short_put.json +++ b/examples/derivative/fx_option_short_put.json @@ -1,6 +1,6 @@ { "title": "fx_option_short_put", - "comment": "Short put (+ve)", + "comment": "Short USD/JPY put option generating positive delta exposure.", "data": { "derivative": [ { diff --git a/examples/fx_spot.json b/examples/derivative/fx_spot.json similarity index 92% rename from examples/fx_spot.json rename to examples/derivative/fx_spot.json index 07933cc3..65303395 100644 --- a/examples/fx_spot.json +++ b/examples/derivative/fx_spot.json @@ -1,6 +1,6 @@ { "title": "fx_spot", - "comment": "fx_spot", + "comment": "EUR/CAD FX spot trade with offsetting legs settling T+2.", "data": { "derivative": [ { diff --git a/examples/fx_swap.json b/examples/derivative/fx_swap.json similarity index 92% rename from examples/fx_swap.json rename to examples/derivative/fx_swap.json index 5eb26844..6f716ad9 100644 --- a/examples/fx_swap.json +++ b/examples/derivative/fx_swap.json @@ -1,6 +1,6 @@ { "title": "fx_swap", - "comment": "fx_swap: this is a legacy mapping. Please refer to fx_foward.", + "comment": "Legacy AUD/USD FX swap example with fixed legs on both currencies.", "data": { "derivative": [ { diff --git a/examples/interest_rate_swap.json b/examples/derivative/interest_rate_swap.json similarity index 92% rename from examples/interest_rate_swap.json rename to examples/derivative/interest_rate_swap.json index 87ac8749..30882f45 100644 --- a/examples/interest_rate_swap.json +++ b/examples/derivative/interest_rate_swap.json @@ -1,6 +1,6 @@ { "title": "interest_rate_swap", - "comment": "interest_rate_swap", + "comment": "EUR vanilla interest rate swap receiving fixed and paying floating EURIBOR.", "data": { "derivative": [ { diff --git a/examples/interest_rate_swap_amortising.json b/examples/derivative/interest_rate_swap_amortising.json similarity index 97% rename from examples/interest_rate_swap_amortising.json rename to examples/derivative/interest_rate_swap_amortising.json index d3fcae6b..562d706c 100644 --- a/examples/interest_rate_swap_amortising.json +++ b/examples/derivative/interest_rate_swap_amortising.json @@ -1,6 +1,6 @@ { "title": "interest_rate_swap_amortising", - "comment": "Interest Rate Swap Amortising", + "comment": "Amortising EUR interest rate swap with detailed scheduled cash flows.", "data": { "derivative": [ { diff --git a/examples/ir_cap_floor.json b/examples/derivative/ir_cap_floor.json similarity index 97% rename from examples/ir_cap_floor.json rename to examples/derivative/ir_cap_floor.json index c6ab0599..9d218db3 100644 --- a/examples/ir_cap_floor.json +++ b/examples/derivative/ir_cap_floor.json @@ -1,6 +1,6 @@ { "title": "ir_cap_floor", - "comment": "IR Cap Floor", + "comment": "EUR interest rate collar combining a short cap and long floor on 3M EURIBOR.", "data": { "derivative": [ { diff --git a/examples/ir_digital_floor.json b/examples/derivative/ir_digital_floor.json similarity index 97% rename from examples/ir_digital_floor.json rename to examples/derivative/ir_digital_floor.json index 11205968..51dbe5d8 100644 --- a/examples/ir_digital_floor.json +++ b/examples/derivative/ir_digital_floor.json @@ -1,6 +1,6 @@ { "title": "ir_digital_floor", - "comment": "IR Digital Floor", + "comment": "EUR digital floor structure with offsetting long and short legs.", "data": { "derivative": [ { diff --git a/examples/ir_future.json b/examples/derivative/ir_future.json similarity index 90% rename from examples/ir_future.json rename to examples/derivative/ir_future.json index 5e094f17..9f490802 100644 --- a/examples/ir_future.json +++ b/examples/derivative/ir_future.json @@ -1,6 +1,6 @@ { "title": "ir_future", - "comment": "ir_future", + "comment": "Long Eurodollar interest rate future settled in cash.", "data": { "derivative": [ { diff --git a/examples/margined_netting_agreement.json b/examples/derivative/margined_netting_agreement.json similarity index 94% rename from examples/margined_netting_agreement.json rename to examples/derivative/margined_netting_agreement.json index 401bf973..42a5cd1f 100644 --- a/examples/margined_netting_agreement.json +++ b/examples/derivative/margined_netting_agreement.json @@ -1,6 +1,6 @@ { "title": "margined_netting_agreement", - "comment": "Margined Netting Set with collateral. Example trade is an IRS. Agreement schemas contain an MNA (representing the netting set) and a CSA (representing margined status - exchanges of collateral)", + "comment": "Margined IRS under ISDA and CSA including variation and initial margin collateral.", "data": { "derivative": [ { diff --git a/examples/unmargined_netting_agreement.json b/examples/derivative/unmargined_netting_agreement.json similarity index 91% rename from examples/unmargined_netting_agreement.json rename to examples/derivative/unmargined_netting_agreement.json index af4289d6..8a92bea0 100644 --- a/examples/unmargined_netting_agreement.json +++ b/examples/derivative/unmargined_netting_agreement.json @@ -1,6 +1,6 @@ { "title": "unmargined_netting_agreement", - "comment": "Unmargined netting set with collateral. Example trade is an IRS. Agreement schemas contain an MNA (representing the netting set). There is no CSA, therefore there is no margining. However, one can still post Independent Collateral (security schema)", + "comment": "IRS under ISDA netting set without CSA, showing independent collateral posting.", "data": { "derivative": [ { diff --git a/examples/usd_payer_swaption.json b/examples/derivative/usd_payer_swaption.json similarity index 90% rename from examples/usd_payer_swaption.json rename to examples/derivative/usd_payer_swaption.json index 9b5e1589..b3c39ec8 100644 --- a/examples/usd_payer_swaption.json +++ b/examples/derivative/usd_payer_swaption.json @@ -1,6 +1,6 @@ { "title": "usd_payer_swaption", - "comment": "usd_payer_swaption", + "comment": "Short USD payer swaption on 6M LIBOR with physical settlement.", "data": { "derivative": [ { diff --git a/examples/xccy_swap.json b/examples/derivative/xccy_swap.json similarity index 97% rename from examples/xccy_swap.json rename to examples/derivative/xccy_swap.json index 41bd69b3..0a059dab 100644 --- a/examples/xccy_swap.json +++ b/examples/derivative/xccy_swap.json @@ -1,6 +1,6 @@ { "title": "xccy_swap", - "comment": "USD-AUD xccy", + "comment": "AUD/USD cross-currency swap with fixed AUD leg, floating USD leg, and principal exchanges.", "data": { "derivative": [ { diff --git a/examples/bbl_loans.json b/examples/loan/bbl_loans.json similarity index 93% rename from examples/bbl_loans.json rename to examples/loan/bbl_loans.json index 69221c5f..32fa6573 100644 --- a/examples/bbl_loans.json +++ b/examples/loan/bbl_loans.json @@ -1,6 +1,6 @@ { "title": "bbl_loans", - "comment": "bbl_loans", + "comment": "Portfolio of GBP Bounce Back Loan exposures including netting, interest-only, and amortising positions.", "data": { "loan": [ { diff --git a/examples/encumbered_loan.json b/examples/loan/encumbered_loan.json similarity index 89% rename from examples/encumbered_loan.json rename to examples/loan/encumbered_loan.json index 2a5159c1..96f0d556 100644 --- a/examples/encumbered_loan.json +++ b/examples/loan/encumbered_loan.json @@ -1,6 +1,6 @@ { "title": "encumbered_loan", - "comment": "A loan that is partially encumbered", + "comment": "Mortgage loan partially encumbered by 50,000 GBP until 2022-10-20.", "data": { "loan": [ { diff --git a/examples/loan_with_2_customers.json b/examples/loan/loan_with_2_customers.json similarity index 84% rename from examples/loan_with_2_customers.json rename to examples/loan/loan_with_2_customers.json index bae8a14c..8637c8df 100644 --- a/examples/loan_with_2_customers.json +++ b/examples/loan/loan_with_2_customers.json @@ -1,6 +1,6 @@ { "title": "loan_with_2_customers", - "comment": "loan_with_2_customers", + "comment": "Loan shared by two customers who each provide income information.", "data": { "loan": [ { diff --git a/examples/undrawn_committed_loan.json b/examples/loan/undrawn_committed_loan.json similarity index 86% rename from examples/undrawn_committed_loan.json rename to examples/loan/undrawn_committed_loan.json index b715c0be..0bfdedb6 100644 --- a/examples/undrawn_committed_loan.json +++ b/examples/loan/undrawn_committed_loan.json @@ -1,6 +1,6 @@ { "title": "undrawn_committed_loan", - "comment": "Mapped as off balance sheet and committed", + "comment": "Off-balance-sheet committed personal loan limit of 100 GBP for a natural person customer.", "data": { "loan": [ { diff --git a/examples/vostro_account.json b/examples/loan/vostro_account.json similarity index 81% rename from examples/vostro_account.json rename to examples/loan/vostro_account.json index 50d78476..2e06e5a1 100644 --- a/examples/vostro_account.json +++ b/examples/loan/vostro_account.json @@ -1,6 +1,6 @@ { "title": "vostro_account", - "comment": "A bank's nostro account at your bank", + "comment": "Vostro account capturing another bank's cash held as our asset.", "data": { "account": [ { diff --git a/examples/bank_guarantee_issued.json b/examples/security/bank_guarantee_issued.json similarity index 80% rename from examples/bank_guarantee_issued.json rename to examples/security/bank_guarantee_issued.json index 12d65db3..05af5fb1 100644 --- a/examples/bank_guarantee_issued.json +++ b/examples/security/bank_guarantee_issued.json @@ -1,6 +1,6 @@ { "title": "bank_guarantee_issued", - "comment": "bank_guarantee", + "comment": "Off-balance-sheet financial guarantee issued for a corporate client in GBP.", "data": { "security": [ { diff --git a/examples/cash_on_hand.json b/examples/security/cash_on_hand.json similarity index 78% rename from examples/cash_on_hand.json rename to examples/security/cash_on_hand.json index c58ef2b4..3c7a5ec1 100644 --- a/examples/cash_on_hand.json +++ b/examples/security/cash_on_hand.json @@ -1,6 +1,6 @@ { "title": "cash_on_hand", - "comment": "cash_on_hand", + "comment": "On-balance-sheet GBP cash holding classified as an asset.", "data": { "security": [ { diff --git a/examples/cash_payable.json b/examples/security/cash_payable.json similarity index 82% rename from examples/cash_payable.json rename to examples/security/cash_payable.json index 587f669c..29ed86bf 100644 --- a/examples/cash_payable.json +++ b/examples/security/cash_payable.json @@ -1,6 +1,6 @@ { "title": "cash_payable", - "comment": "cash_payable", + "comment": "Short-term GBP cash payable liability settling on 2020-08-01.", "data": { "security": [ { diff --git a/examples/cash_receivable.json b/examples/security/cash_receivable.json similarity index 82% rename from examples/cash_receivable.json rename to examples/security/cash_receivable.json index c9306308..7868d8bd 100644 --- a/examples/cash_receivable.json +++ b/examples/security/cash_receivable.json @@ -1,6 +1,6 @@ { "title": "cash_receivable", - "comment": "cash_receivable", + "comment": "Short-term GBP cash receivable asset settling on 2020-08-01.", "data": { "security": [ { diff --git a/examples/cet_1_capital.json b/examples/security/cet_1_capital.json similarity index 84% rename from examples/cet_1_capital.json rename to examples/security/cet_1_capital.json index 9ddcb0c2..4b140590 100644 --- a/examples/cet_1_capital.json +++ b/examples/security/cet_1_capital.json @@ -1,6 +1,6 @@ { "title": "cet_1_capital", - "comment": "Core Equity Tier one capital", + "comment": "Core Equity Tier 1 share capital that is fully paid up.", "data": { "security": [ { diff --git a/examples/collateral_independent_amount_bond_received.json b/examples/security/collateral_independent_amount_bond_received.json similarity index 94% rename from examples/collateral_independent_amount_bond_received.json rename to examples/security/collateral_independent_amount_bond_received.json index 9bc865be..8af69e90 100644 --- a/examples/collateral_independent_amount_bond_received.json +++ b/examples/security/collateral_independent_amount_bond_received.json @@ -1,6 +1,6 @@ { "title": "collateral_independent_amount_bond_received", - "comment": "Collateral Independent Amount Bond Received", + "comment": "NZD bond received as independent amount collateral under an ISDA agreement.", "data": { "security": [ { diff --git a/examples/collateral_initial_margin_bond_posted.json b/examples/security/collateral_initial_margin_bond_posted.json similarity index 96% rename from examples/collateral_initial_margin_bond_posted.json rename to examples/security/collateral_initial_margin_bond_posted.json index f8b43b78..4778aa93 100644 --- a/examples/collateral_initial_margin_bond_posted.json +++ b/examples/security/collateral_initial_margin_bond_posted.json @@ -1,6 +1,6 @@ { "title": "collateral_initial_margin_bond_posted", - "comment": "Collateral Initial Margin Bond Posted", + "comment": "EUR sovereign bond posted as initial margin under a CSA.", "data": { "security": [ { diff --git a/examples/collateral_variation_margin_cash_posted.json b/examples/security/collateral_variation_margin_cash_posted.json similarity index 93% rename from examples/collateral_variation_margin_cash_posted.json rename to examples/security/collateral_variation_margin_cash_posted.json index f00389ff..4f7decf9 100644 --- a/examples/collateral_variation_margin_cash_posted.json +++ b/examples/security/collateral_variation_margin_cash_posted.json @@ -1,6 +1,6 @@ { "title": "collateral_variation_margin_cash_posted", - "comment": "Collateral Variation Margin Cash Posted", + "comment": "USD variation margin cash posted to a QCCP under the margin agreement.", "data": { "security": [ { diff --git a/examples/collateral_variation_margin_cash_received.json b/examples/security/collateral_variation_margin_cash_received.json similarity index 93% rename from examples/collateral_variation_margin_cash_received.json rename to examples/security/collateral_variation_margin_cash_received.json index 8d6db854..ba75ae03 100644 --- a/examples/collateral_variation_margin_cash_received.json +++ b/examples/security/collateral_variation_margin_cash_received.json @@ -1,6 +1,6 @@ { "title": "collateral_variation_margin_cash_received", - "comment": "Collateral Variation Margin Cash Received", + "comment": "EUR variation margin cash received from a QCCP under the margin agreement.", "data": { "security": [ { diff --git a/examples/dividend_from_equity.json b/examples/security/dividend_from_equity.json similarity index 89% rename from examples/dividend_from_equity.json rename to examples/security/dividend_from_equity.json index 9236fc1c..0661a436 100644 --- a/examples/dividend_from_equity.json +++ b/examples/security/dividend_from_equity.json @@ -1,6 +1,6 @@ { "title": "dividend_from_equity", - "comment": "dividend_from_equity", + "comment": "GBP dividend receivable from an equity position recorded in the trading book.", "data": { "security": [ { diff --git a/examples/encumbrance_set.json b/examples/security/encumbrance_set.json similarity index 96% rename from examples/encumbrance_set.json rename to examples/security/encumbrance_set.json index d215969e..baa2607e 100644 --- a/examples/encumbrance_set.json +++ b/examples/security/encumbrance_set.json @@ -1,6 +1,6 @@ { "title": "encumbrance_set", - "comment": "A set of related transactions representing an encumbrance position, the initial bond purchase is encumbered in a repo transaction. The unencumbered position is £1000", + "comment": "Linked bond, repo, reverse repo, and margin trades illustrating an encumbrance chain.", "data": { "security": [ { diff --git a/examples/outright_debt_security.json b/examples/security/outright_debt_security.json similarity index 91% rename from examples/outright_debt_security.json rename to examples/security/outright_debt_security.json index ab72e843..c8ba51d6 100644 --- a/examples/outright_debt_security.json +++ b/examples/security/outright_debt_security.json @@ -1,6 +1,6 @@ { "title": "outright_debt_security", - "comment": "Outright debt security held", + "comment": "GBP trading book bond position held on balance sheet.", "data": { "security": [ { diff --git a/examples/repo.json b/examples/security/repo.json similarity index 92% rename from examples/repo.json rename to examples/security/repo.json index 9bf19d40..adc0d015 100644 --- a/examples/repo.json +++ b/examples/security/repo.json @@ -1,6 +1,6 @@ { "title": "repo", - "comment": "repo", + "comment": "GBP repo transaction with a cash liability leg and encumbered bond asset.", "data": { "security": [ { diff --git a/examples/rev_repo.json b/examples/security/rev_repo.json similarity index 91% rename from examples/rev_repo.json rename to examples/security/rev_repo.json index 206ee8ec..70ba0f4f 100644 --- a/examples/rev_repo.json +++ b/examples/security/rev_repo.json @@ -1,6 +1,6 @@ { "title": "rev_repo", - "comment": "rev_repo", + "comment": "GBP reverse repo transaction with a cash asset leg and bond collateral liability.", "data": { "security": [ { diff --git a/examples/security_collateral_posted_ccp_non_deriv.json b/examples/security/security_collateral_posted_ccp_non_deriv.json similarity index 91% rename from examples/security_collateral_posted_ccp_non_deriv.json rename to examples/security/security_collateral_posted_ccp_non_deriv.json index 80eadaa6..cbc76dd4 100644 --- a/examples/security_collateral_posted_ccp_non_deriv.json +++ b/examples/security/security_collateral_posted_ccp_non_deriv.json @@ -1,6 +1,6 @@ { "title": "security_collateral_posted_ccp_non_deriv", - "comment": "security_collateral_posted_ccp_non_deriv", + "comment": "GBP bond collateral posted to a CCP against non-derivative exposure.", "data": { "agreement": [ { diff --git a/examples/subordinated_debt.json b/examples/security/subordinated_debt.json similarity index 90% rename from examples/subordinated_debt.json rename to examples/security/subordinated_debt.json index 926cee93..fced9a4b 100644 --- a/examples/subordinated_debt.json +++ b/examples/security/subordinated_debt.json @@ -1,6 +1,6 @@ { "title": "subordinated_debt", - "comment": "Movement should be mapped as issuance", + "comment": "Tier 2 subordinated debt issuance of 1,000,000 GBP with quarterly coupons.", "data": { "security": [ { diff --git a/scripts/build_examples_readme.py b/scripts/build_examples_readme.py new file mode 100644 index 00000000..eb579039 --- /dev/null +++ b/scripts/build_examples_readme.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +import json +import pathlib +from typing import Dict, List, Tuple + + +def load_example(file_path: pathlib.Path) -> Tuple[str, str, str]: + """Return (title, comment, data_json) from an example JSON file. + Falls back sensibly if keys are missing. + """ + text = file_path.read_text(encoding="utf-8") + title = file_path.stem + comment = "" + data_str = text + try: + obj = json.loads(text) + if isinstance(obj, dict): + title = obj.get("title", title) + comment = obj.get("comment", "") + data = obj.get("data", obj) + data_str = json.dumps(data, indent=2, ensure_ascii=False) + except Exception: + # Keep raw content + pass + return title, comment, data_str + + +def collect_examples(examples_dir: pathlib.Path) -> Dict[str, List[pathlib.Path]]: + """Group example files by relative subdirectory. + Returns mapping: section_name -> list of file paths + The root directory is grouped under 'General'. + """ + groups: Dict[str, List[pathlib.Path]] = {} + for path in sorted(examples_dir.rglob("*.json")): + # Ignore README.json or other non-example files if any naming convention exists; none specified, so include all + if path.name.lower() == "package.json": + continue + rel = path.relative_to(examples_dir) + section = rel.parent.as_posix() if rel.parent != pathlib.Path(".") else "General" + groups.setdefault(section, []).append(path) + return dict(sorted(groups.items(), key=lambda kv: kv[0].lower())) + + +def build_readme_content(examples_dir: pathlib.Path) -> str: + header = ( + "---\n" + "layout: readme\n" + "title: FIRE data examples\n" + "---\n\n" + "This README is generated from files in the `examples/` directory.\n\n" + ) + + groups = collect_examples(examples_dir) + lines: List[str] = [header] + + # Build contents section + lines.append("## Contents\n") + contents_lines: List[str] = [] + for section, files in groups.items(): + section_anchor = section.lower().replace(" ", "-") + contents_lines.append(f"- [{section.title()}](#{section_anchor})") + for fp in sorted(files, key=lambda p: p.name.lower()): + title, _, _ = load_example(fp) + entry_anchor = title.lower().replace("_", "-").replace(" ", "-") + contents_lines.append(f" - [{title.replace('_', ' ').title()}](#{entry_anchor})") + lines.extend(contents_lines) + lines.append("") + + for section, files in groups.items(): + # Section heading + lines.append(f"## {section.title()}\n") + for fp in sorted(files, key=lambda p: p.name.lower()): + title, comment, data_str = load_example(fp) + # Block heading + lines.append(f"#### {title.replace('_', ' ').title()}\n") + if comment: + lines.append(f"{comment}\n") + # Inline JSON data block + lines.append("```json") + lines.append(data_str) + lines.append("```") + lines.append("") + + return "\n".join(lines).rstrip() + "\n" + + +def main() -> int: + repo_root = pathlib.Path(__file__).resolve().parents[1] + examples_dir = repo_root / "examples" + out_file = examples_dir / "README.md" + + content = build_readme_content(examples_dir) + if not out_file.exists() or out_file.read_text(encoding="utf-8") != content: + out_file.write_text(content, encoding="utf-8") + print(f"Wrote {out_file}") + return 1 + print("No changes needed") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) + + diff --git a/tests/test_build_examples_readme.py b/tests/test_build_examples_readme.py new file mode 100644 index 00000000..b2b4078b --- /dev/null +++ b/tests/test_build_examples_readme.py @@ -0,0 +1,17 @@ +import pathlib +import subprocess + + +def test_examples_readme_is_generated_and_up_to_date(): + repo_root = pathlib.Path(__file__).resolve().parents[1] + script = repo_root / "scripts" / "build_examples_readme.py" + readme = repo_root / "examples" / "README.md" + + result = subprocess.run(["python3", str(script)], capture_output=True, text=True) + assert result.returncode in (0, 1) + assert readme.exists(), "examples/README.md not found after generation" + assert ( + result.returncode == 0 + ), f"examples/README.md is outdated. Run the builder and commit changes. Output: {result.stdout}\n{result.stderr}" + + From 40dd5779c9ced4fd0f22e62f1b5619894a9b16cc Mon Sep 17 00:00:00 2001 From: albie Date: Fri, 7 Nov 2025 14:18:28 +0000 Subject: [PATCH 2/2] lint: black example builder --- scripts/build_examples_readme.py | 10 ++++++---- tests/test_build_examples_readme.py | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build_examples_readme.py b/scripts/build_examples_readme.py index eb579039..9ee9a082 100644 --- a/scripts/build_examples_readme.py +++ b/scripts/build_examples_readme.py @@ -36,7 +36,9 @@ def collect_examples(examples_dir: pathlib.Path) -> Dict[str, List[pathlib.Path] if path.name.lower() == "package.json": continue rel = path.relative_to(examples_dir) - section = rel.parent.as_posix() if rel.parent != pathlib.Path(".") else "General" + section = ( + rel.parent.as_posix() if rel.parent != pathlib.Path(".") else "General" + ) groups.setdefault(section, []).append(path) return dict(sorted(groups.items(), key=lambda kv: kv[0].lower())) @@ -62,7 +64,9 @@ def build_readme_content(examples_dir: pathlib.Path) -> str: for fp in sorted(files, key=lambda p: p.name.lower()): title, _, _ = load_example(fp) entry_anchor = title.lower().replace("_", "-").replace(" ", "-") - contents_lines.append(f" - [{title.replace('_', ' ').title()}](#{entry_anchor})") + contents_lines.append( + f" - [{title.replace('_', ' ').title()}](#{entry_anchor})" + ) lines.extend(contents_lines) lines.append("") @@ -100,5 +104,3 @@ def main() -> int: if __name__ == "__main__": raise SystemExit(main()) - - diff --git a/tests/test_build_examples_readme.py b/tests/test_build_examples_readme.py index b2b4078b..a315c119 100644 --- a/tests/test_build_examples_readme.py +++ b/tests/test_build_examples_readme.py @@ -13,5 +13,3 @@ def test_examples_readme_is_generated_and_up_to_date(): assert ( result.returncode == 0 ), f"examples/README.md is outdated. Run the builder and commit changes. Output: {result.stdout}\n{result.stderr}" - -