Main Content

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

This example shows how to create a saccr object for trades from multiple asset classes with a netting set and collateral set. 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 6. The portfolio uses the Standardized Approach for Counterparty Credit Risk (SA-CCR) framework and has one netting set (N001), one collateral set (CSA01), and no collateral positions.

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_6.csv";

Create saccr Object

Construct the saccr object from SACCRCRIF.

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

                         CRIF: [19x19 table]
                NumPortfolios: 1
                 PortfolioIDs: "Port_006"
              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=19×19 table
    PortfolioID     TradeID      CounterpartyName    CounterpartyID    NettingSetNumber    RiskType     Category                Qualifier               Bucket       Label1       Label2        Amount      AmountCurrency    AmountUSD        Regulation        Model      ValuationDate    EndDate    Label3
    ___________    __________    ________________    ______________    ________________    ________    ___________    _____________________________    _________    _________    _________    __________    ______________    __________    ________________    ________    _____________    _______    ______

    "Port_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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_006"     "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 
    "Port_006"     "Tr005"          <missing>          <missing>         "N001_CSA01"      "EQ_SN"     "EQUITY"       "AAPL"                           <missing>    "0"          "2.5"             1e+07      "USD"                1e+07    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        2.5       0.23 
    "Port_006"     "Tr005"          <missing>          <missing>         "N001_CSA01"      "PV"        <missing>      <missing>                        <missing>    <missing>    <missing>         34350      "USD"                34350    "Basel (CRE 52)"    "SA-CCR"     2023-10-16        NaN        NaN 
    "Port_006"     "Tr006"          <missing>          <missing>         "N001_CSA01"      "EQ_IX"     "EQUITY"       "S&P500"                         <missing>    "0"          "3"               1e+07      "USD"                1e+07    "Basel (CRE 52)"    "SA-CCR"     2023-10-16          3      -0.27 
      ⋮

Display Portfolio

Display the Portfolio object for Port_006.

mySACCR.Portfolios
ans = 
  Portfolio with properties:

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

Display Netting Set

The NettingSet object or 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: [0x1 saccr.CollateralPosition]

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_006"
       CounterpartyIDs: ""
            Regulation: "Basel_CRE52"
      DomesticCurrency: "USD"
    RCUncollateralized: 6.8972e+05
      RCCollateralized: 6.8972e+05

Compute Add-On Component

Compute add-on component results using addOn.

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

                        NumPortfolios: 1
                         PortfolioIDs: "Port_006"
                      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_006"
               CounterpartyIDs: ""
                    Regulation: "Basel_CRE52"
              DomesticCurrency: "USD"
           PFEUncollateralized: 1.1177e+06
             PFECollateralized: 3.3218e+05
    MultiplierUncollateralized: 1
      MultiplierCollateralized: 1
                  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_006"
     CounterpartyIDs: ""
          Regulation: "Basel_CRE52"
    DomesticCurrency: "USD"
                 EAD: 1.4307e+06
               Alpha: 1.4000
                  RC: 6.8972e+05
                 PFE: 3.3218e+05
          Multiplier: 1
      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_006"           ""           "Basel_CRE52"         "USD"          1.4307e+06     1.4     6.8972e+05    3.3218e+05        1           3.3218e+05       49780        0        65013     2.1536e+05    2028.6         true              true      

See Also

| | | | | | | |

Related Examples

More About