Main Content

Create saccr Object and Compute Regulatory Values for Multiple Asset Classes with Netting Set, Collateral Set, and Collateral Positions

This example shows how to create a saccr object for trades from multiple asset classes with a netting set, collateral set, and collateral positions. The trades are:

  • Tr001 — Asset class (IR), 10 Year Interest Rate Swap in EUR

  • Tr002 — Asset class (FX), EUR/GBP Forward FX Swap (Trade Decomposition "1b")

  • Tr003 — Asset class (CR_SN), Single name CDS on Spain (Short Protection)

  • Tr004 — Asset class (CR_IX), CDS iTraxx Europe Crossover Index Receiver Option

  • Tr005 — Asset class (EQ_SN), Long Call Option on AAPL

  • Tr006 — Asset class (EQ_IX), Long Put Option on S&P500 Index

  • Tr007_SOpt — Asset class (CO), Long Put Option on CORN (sold option with premium paid)

These trades are in Portfolio 7. The portfolio uses the Standardized Approach for Counterparty Credit Risk (SA-CCR) framework and has one netting set (N001), one collateral set (CSA01), and three collateral positions (ColPos01, ColPos02, ColPos03).

Define Data

Define the foreign exchange (FX) spot currency exchange rate table.

format("default");
Base = ["EUR";"GBP";"GBP"];
Quote = ["USD";"USD";"EUR"];
SpotRate = [1.0543;1.2195;1.1567];
FXSpotTable = table(Base,Quote,SpotRate)
FXSpotTable=3×3 table
    Base     Quote    SpotRate
    _____    _____    ________

    "EUR"    "USD"     1.0543 
    "GBP"    "USD"     1.2195 
    "GBP"    "EUR"     1.1567 

Define the SA-CCR CRIF file

SACCRCRIF = "SACCR_CRIF_Port_7.csv";

Create saccr Object

Construct the saccr object from SACCRCRIF.

mySACCR = saccr(SACCRCRIF, DomesticCurrency="USD", FXSpot=FXSpotTable)
mySACCR = 
  saccr with properties:

                         CRIF: [22x19 table]
                NumPortfolios: 1
                 PortfolioIDs: "Port_007"
              CounterpartyIDs: ""
                   Portfolios: [1x1 saccr.Portfolio]
                   Regulation: "Basel_CRE52"
             DomesticCurrency: "USD"
                        Alpha: 1.4000
                  FXSpotRates: [3x3 table]
          TradeDecompositions: [5x2 table]
           CollateralHaircuts: [200x6 table]
        SupervisoryParameters: [19x7 table]
    MaturityBusinessDaysFloor: 10
          NumBusinessDaysYear: 250

Display the contents of the SA-CCR CRIF file.

mySACCR.CRIF
ans=22×19 table
    PortfolioID     TradeID      CounterpartyName    CounterpartyID    NettingSetNumber    RiskType     Category                Qualifier               Bucket       Label1       Label2        Amount      AmountCurrency    AmountUSD        Regulation        Model      ValuationDate    EndDate    Label3
    ___________    __________    ________________    ______________    ________________    ________    ___________    _____________________________    _________    _________    _________    __________    ______________    __________    ________________    ________    _____________    _______    ______

    "Port_007"     "ColPos01"       <missing>          <missing>         "N001_CSA01"      "COLL"      "VM"           <missing>                        <missing>    <missing>    "CASH"            2e+05      "USD"                2e+05    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "ColPos02"       <missing>          <missing>         "N001_CSA01"      "COLL"      "VM"           <missing>                        <missing>    <missing>    "CASH"          1.5e+05      "EUR"           1.5814e+05    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "ColPos03"       <missing>          <missing>         "N001_CSA01"      "COLL"      "IM"           "SOVEREIGN"                      "AAA"        <missing>    "BOND"            5e+05      "USD"                5e+05    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        1.5        NaN 
    "Port_007"     "CSA01"          <missing>          <missing>         "N001_CSA01"      "COLL"      "DIRECTION"    <missing>                        <missing>    "MUTUAL"     <missing>           NaN      <missing>              NaN    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "CSA01"          <missing>          <missing>         "N001_CSA01"      "COLL"      "MPOR"         <missing>                        <missing>    "10"         <missing>           NaN      <missing>              NaN    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "CSA01"          <missing>          <missing>         "N001_CSA01"      "COLL"      "MTA"          <missing>                        <missing>    <missing>    <missing>             0      "USD"                    0    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "CSA01"          <missing>          <missing>         "N001_CSA01"      "COLL"      "TA"           <missing>                        <missing>    <missing>    <missing>             0      "USD"                    0    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "Tr001"          <missing>          <missing>         "N001_CSA01"      "IR"        "EUR"          "EUR"                            <missing>    "0"          "10"         3.1478e+07      "EUR"           3.3187e+07    "Basel (CRE 52)"    "SA-CCR"     2023-10-16         10          1 
    "Port_007"     "Tr001"          <missing>          <missing>         "N001_CSA01"      "PV"        <missing>      <missing>                        <missing>    <missing>    <missing>       -5650.7      "EUR"              -5957.5    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "Tr002_01"       <missing>          <missing>         "N001_CSA01"      "FX"        "EURGBP"       "EURGBP"                         <missing>    "0.5"        "0.5"             1e+06      "EUR"           1.0543e+06    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        0.5         -1 
    "Port_007"     "Tr002_02"       <missing>          <missing>         "N001_CSA01"      "FX"        "EURGBP"       "EURGBP"                         <missing>    "0.5"        "1"               1e+06      "EUR"           1.0543e+06    "Basel (CRE 52)"    "SA-CCR"     2023-10-16          1          1 
    "Port_007"     "Tr002"          <missing>          <missing>         "N001_CSA01"      "PV"        <missing>      <missing>                        <missing>    <missing>    <missing>        1702.2      "GBP"               2075.9    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "Tr003"          <missing>          <missing>         "N001_CSA01"      "CR_SN"     "CREDIT"       "SPAIN"                          "A"          "0"          "5"           2.212e+07      "EUR"           2.3321e+07    "Basel (CRE 52)"    "SA-CCR"     2023-10-16          5         -1 
    "Port_007"     "Tr003"          <missing>          <missing>         "N001_CSA01"      "PV"        <missing>      <missing>                        <missing>    <missing>    <missing>        -62783      "EUR"               -66192    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_007"     "Tr004"          <missing>          <missing>         "N001_CSA01"      "CR_IX"     "CREDIT"       "CDS iTraxx Europe Crossover"    "SG"         "0.5"        "4.5"        3.5359e+07      "EUR"           3.7279e+07    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        4.5       -0.4 
    "Port_007"     "Tr004"          <missing>          <missing>         "N001_CSA01"      "PV"        <missing>      <missing>                        <missing>    <missing>    <missing>    5.2464e+05      "EUR"           5.5313e+05    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
      ⋮

Display Portfolio

Display the Portfolio object for Port_007.

mySACCR.Portfolios
ans = 
  Portfolio with properties:

                ID: "Port_007"
    CounterpartyID: ""
            Trades: [7x1 saccr.Trade]
       NettingSets: [1x1 saccr.NettingSet]
      AssetClasses: [7x1 string]

Display Netting Set

The NettingSet object for all trades is N001. Display the details for this netting set.

mySACCR.Portfolios(1).NettingSets
ans = 
  NettingSet with properties:

                ID: "N001"
    CollateralSets: [1x1 saccr.CollateralSet]

Display Collateral Set

The CollateralSet object for all trades is CSA01. Display the details for this collateral set.

mySACCR.Portfolios(1).NettingSets.CollateralSets
ans = 
  CollateralSet with properties:

                     ID: "CSA01"
           NettingSetID: "N001"
              Direction: "MUTUAL"
              Threshold: 0
      ThresholdCurrency: "USD"
                    MTA: 0
            MTACurrency: "USD"
                   MPOR: 10
                    STM: 0
    CollateralPositions: [3x1 saccr.CollateralPosition]

Display Collateral Positions

Display the CollateralPositions objects (ColPos01, ColPos02, ColPos03) for the collateral set (CSA01).

mySACCR.Portfolios(1).NettingSets.CollateralSets.CollateralPositions(1)
ans = 
  CollateralPosition with properties:

                  ID: "ColPos01"
        NettingSetID: "N001"
     CollateralSetID: "CSA01"
          MarginType: "VM"
            Currency: "USD"
            Notional: 200000
         NotionalUSD: 200000
        MaturityTime: NaN
          Segregated: 0
              Rating: <missing>
           AssetType: "CASH"
             SubType: <missing>
    ResidualMaturity: [0x0 string]

mySACCR.Portfolios(1).NettingSets.CollateralSets.CollateralPositions(2)
ans = 
  CollateralPosition with properties:

                  ID: "ColPos02"
        NettingSetID: "N001"
     CollateralSetID: "CSA01"
          MarginType: "VM"
            Currency: "EUR"
            Notional: 150000
         NotionalUSD: 158145
        MaturityTime: NaN
          Segregated: 0
              Rating: <missing>
           AssetType: "CASH"
             SubType: <missing>
    ResidualMaturity: [0x0 string]

mySACCR.Portfolios(1).NettingSets.CollateralSets.CollateralPositions(3)
ans = 
  CollateralPosition with properties:

                  ID: "ColPos03"
        NettingSetID: "N001"
     CollateralSetID: "CSA01"
          MarginType: "IM"
            Currency: "USD"
            Notional: 500000
         NotionalUSD: 500000
        MaturityTime: 1.5000
          Segregated: 0
              Rating: "AAA"
           AssetType: "BOND"
             SubType: "SOVEREIGN"
    ResidualMaturity: "> 1Y, <= 3Y"

Display Trades

Display the Trade objects for Tr001, Tr004, and Tr007_SOpt.

mySACCR.Portfolios.Trades(1)
ans = 
  Trade with properties:

                                ID: "Tr001"
                      NettingSetID: "N001"
                   CollateralSetID: "CSA01"
                        AssetClass: "IR"
                          SubClass: <missing>
                        HedgingSet: "EUR"
                         Qualifier: "EUR"
                  AdjustedNotional: 3.1478e+07
          AdjustedNotionalCurrency: "EUR"
               AdjustedNotionalUSD: 3.3187e+07
                                PV: -5.6507e+03
                        PVCurrency: "EUR"
                             PVUSD: -5.9575e+03
                         StartTime: 0
                           EndTime: 10
                      MaturityTime: 10
                  SupervisoryDelta: 1
                      InputVariant: "1a"
                        SoldOption: 0
    MaturityFactorUncollateralized: 1
      MaturityFactorCollateralized: 0.3000
                    MaturityBucket: "B3: > 5Y"

mySACCR.Portfolios.Trades(4)
ans = 
  Trade with properties:

                                ID: "Tr004"
                      NettingSetID: "N001"
                   CollateralSetID: "CSA01"
                        AssetClass: "CR_IX"
                          SubClass: "SG"
                        HedgingSet: "CREDIT"
                         Qualifier: "CDS iTraxx Europe Crossover"
                  AdjustedNotional: 3.5359e+07
          AdjustedNotionalCurrency: "EUR"
               AdjustedNotionalUSD: 3.7279e+07
                                PV: 5.2464e+05
                        PVCurrency: "EUR"
                             PVUSD: 5.5313e+05
                         StartTime: 0.5000
                           EndTime: 4.5000
                      MaturityTime: 4.5000
                  SupervisoryDelta: -0.4000
                      InputVariant: "1a"
                        SoldOption: 0
    MaturityFactorUncollateralized: 1
      MaturityFactorCollateralized: 0.3000
                    MaturityBucket: [0x1 string]

mySACCR.Portfolios.Trades(7)
ans = 
  Trade with properties:

                                ID: "Tr007_SOpt"
                      NettingSetID: "N001"
                   CollateralSetID: "CSA01"
                        AssetClass: "CO"
                          SubClass: "AGRICULTURAL"
                        HedgingSet: "AGRI"
                         Qualifier: "CORN"
                  AdjustedNotional: 1.0435e+05
          AdjustedNotionalCurrency: "USD"
               AdjustedNotionalUSD: 1.0435e+05
                                PV: -9.7215e+03
                        PVCurrency: "USD"
                             PVUSD: -9.7215e+03
                         StartTime: 0
                           EndTime: 0.5000
                      MaturityTime: 0.5000
                  SupervisoryDelta: -0.3600
                      InputVariant: "1a"
                        SoldOption: 1
    MaturityFactorUncollateralized: 0.7071
      MaturityFactorCollateralized: 0.3000
                    MaturityBucket: [0x1 string]

Compute Replacement Cost

Compute replacement cost (RC) component results using rc.

RCResults = rc(mySACCR)
RCResults = 
  RCResults with properties:

         NumPortfolios: 1
          PortfolioIDs: "Port_007"
       CounterpartyIDs: ""
            Regulation: "Basel_CRE52"
      DomesticCurrency: "USD"
    RCUncollateralized: 2.3972e+05
      RCCollateralized: 0

Compute Add-On Component

Compute add-on component results using addOn.

AddOnResults = addOn(mySACCR)
AddOnResults = 
  AddOnResults with properties:

                        NumPortfolios: 1
                         PortfolioIDs: "Port_007"
                      CounterpartyIDs: ""
                           Regulation: "Basel_CRE52"
                     DomesticCurrency: "USD"
       AddOnAggregateUncollateralized: 1.1177e+06
         AddOnAggregateCollateralized: 3.3218e+05
    AddOnAssetClassesUncollateralized: [1x1 saccr.AddOnAssetClassResults]
      AddOnAssetClassesCollateralized: [1x1 saccr.AddOnAssetClassResults]

Compute PFE

Compute potential future exposure (PFE) component results using pfe.

PFEResults = pfe(mySACCR)
PFEResults = 
  PFEResults with properties:

                 NumPortfolios: 1
                  PortfolioIDs: "Port_007"
               CounterpartyIDs: ""
                    Regulation: "Basel_CRE52"
              DomesticCurrency: "USD"
           PFEUncollateralized: 1.1177e+06
             PFECollateralized: 2.6710e+05
    MultiplierUncollateralized: 1
      MultiplierCollateralized: 0.8041
                  AddOnResults: [1x1 saccr.AddOnResults]

Compute EAD and Display Results

Compute exposure at default (EAD) results using ead and show the results table.

EADResults = ead(mySACCR)
EADResults = 
  EADResults with properties:

       NumPortfolios: 1
        PortfolioIDs: "Port_007"
     CounterpartyIDs: ""
          Regulation: "Basel_CRE52"
    DomesticCurrency: "USD"
                 EAD: 3.7394e+05
               Alpha: 1.4000
                  RC: 0
                 PFE: 2.6710e+05
          Multiplier: 0.8041
      AddOnAggregate: 3.3218e+05
           RCResults: [1x1 saccr.RCResults]
          PFEResults: [1x1 saccr.PFEResults]
        ResultsTable: [1x17 table]

EADResults.ResultsTable
ans=1×17 table
    PortfolioIDs    CounterpartyIDs     Regulation      DomesticCurrency       EAD        Alpha    RC       PFE       Multiplier    AddOnAggregate    AddOnIR    AddOnFX    AddOnCR     AddOnEQ      AddOnCO    Collateralized    UsedCollateral
    ____________    _______________    _____________    ________________    __________    _____    __    _________    __________    ______________    _______    _______    _______    __________    _______    ______________    ______________

     "Port_007"           ""           "Basel_CRE52"         "USD"          3.7394e+05     1.4     0     2.671e+05     0.80408        3.3218e+05       49780        0        65013     2.1536e+05    2028.6         true              true      

See Also

| | | | | | | |

Related Examples

More About