Record Class SaCcrTrade

java.lang.Object
java.lang.Record
com.quantfinlib.risk.SaCcrTrade
Record Components:
assetClass - the SA-CCR asset class
hedgingSet - currency (rates), currency pair (FX), entity name (credit, equity) or commodity type (commodity)
creditGrade - rating bucket for credit trades, else null
index - true for index credit or equity trades
commoditySet - commodity hedging set, else null
notional - trade notional (rates, credit) or adjusted notional (FX foreign leg, equity, commodity)
startYears - S_i, start of the referenced period (rates, credit), else 0
endYears - E_i, end of the referenced period (rates, credit), else 0
maturityYears - M_i, remaining maturity of the contract
delta - supervisory delta (|delta| ≤ 15, the CDO-tranche maximum)
marketValue - current market value of the trade
hedgingSetType - ordinary, basis or volatility hedging set (BCBS 279 paras 162-163); see asBasis() and asVolatility()

public record SaCcrTrade(SaCcr.AssetClass assetClass, String hedgingSet, SaCcr.CreditGrade creditGrade, boolean index, SaCcr.CommoditySet commoditySet, double notional, double startYears, double endYears, double maturityYears, double delta, double marketValue, SaCcr.HedgingSetType hedgingSetType) extends Record
One derivative as the SA-CCR sees it (BCBS 279, March 2014, Annex 4): the asset class, the hedging-set key, the inputs to the trade-level adjusted notional and the supervisory delta. Build trades with the per-asset-class factories; each fills the fields its class does not use with neutral values.

Units: notionals and market values in the reporting (domestic) currency; times in years from the reference date. delta is the supervisory delta of BCBS 279 paragraph 159: +1 long and -1 short in the primary risk factor, or the option and CDO-tranche formulas in SaCcr.optionDelta(boolean, boolean, double, double, double, double) and SaCcr.cdoTrancheDelta(double, double, boolean).

  • Constructor Details

    • SaCcrTrade

      public SaCcrTrade(SaCcr.AssetClass assetClass, String hedgingSet, SaCcr.CreditGrade creditGrade, boolean index, SaCcr.CommoditySet commoditySet, double notional, double startYears, double endYears, double maturityYears, double delta, double marketValue)
      The 2.1 constructor: an ordinary (non-basis, non-volatility) trade.
      Parameters:
      assetClass - the SA-CCR asset class
      hedgingSet - hedging-set key
      creditGrade - rating bucket for credit trades, else null
      index - true for index credit or equity trades
      commoditySet - commodity hedging set, else null
      notional - notional or adjusted notional
      startYears - S_i
      endYears - E_i
      maturityYears - M_i
      delta - supervisory delta
      marketValue - current market value
    • SaCcrTrade

      public SaCcrTrade(SaCcr.AssetClass assetClass, String hedgingSet, SaCcr.CreditGrade creditGrade, boolean index, SaCcr.CommoditySet commoditySet, double notional, double startYears, double endYears, double maturityYears, double delta, double marketValue, SaCcr.HedgingSetType hedgingSetType)
      Validates every field.
  • Method Details

    • interestRate

      public static SaCcrTrade interestRate(String currency, double notional, double startYears, double endYears, double maturityYears, double delta, double marketValue)
      Interest-rate derivative. The hedging set is the currency; the maturity bucket comes from endYears (under 1y, 1y to 5y, over 5y).
      Parameters:
      currency - hedging-set currency, e.g. "USD"
      notional - trade notional
      startYears - S_i (0 when the period has started)
      endYears - E_i
      maturityYears - M_i (for a physically settled swaption, the end of the underlying swap)
      delta - supervisory delta
      marketValue - current market value
      Returns:
      the trade
    • fx

      public static SaCcrTrade fx(String currencyPair, double foreignLegNotional, double maturityYears, double delta, double marketValue)
      FX derivative. The hedging set is the currency pair; the adjusted notional is the foreign leg converted to the domestic currency.
      Parameters:
      currencyPair - hedging set, e.g. "EURUSD"
      foreignLegNotional - foreign leg in domestic currency
      maturityYears - M_i
      delta - supervisory delta
      marketValue - current market value
      Returns:
      the trade
    • credit

      public static SaCcrTrade credit(String entity, SaCcr.CreditGrade grade, double notional, double startYears, double endYears, double maturityYears, double delta, double marketValue)
      Credit derivative on a single name or an index. Trades on the same entity name aggregate into one entity-level effective notional.
      Parameters:
      entity - reference entity or index name
      grade - rating bucket, or one of the two index grades
      notional - trade notional
      startYears - S_i
      endYears - E_i
      maturityYears - M_i
      delta - supervisory delta (+1 protection buyer)
      marketValue - current market value
      Returns:
      the trade
    • equity

      public static SaCcrTrade equity(String entity, boolean index, double adjustedNotional, double maturityYears, double delta, double marketValue)
      Equity derivative on a single name or an index.
      Parameters:
      entity - stock or index name
      index - true for an index
      adjustedNotional - price of one unit times number of units
      maturityYears - M_i
      delta - supervisory delta
      marketValue - current market value
      Returns:
      the trade
    • commodity

      public static SaCcrTrade commodity(SaCcr.CommoditySet set, String commodityType, double adjustedNotional, double maturityYears, double delta, double marketValue)
      Commodity derivative. The commodity type "Electricity" (any case) takes the 40% factor; every other type takes 18%.
      Parameters:
      set - commodity hedging set
      commodityType - type inside the set, e.g. "Crude Oil"
      adjustedNotional - price of one unit times number of units
      maturityYears - M_i
      delta - supervisory delta
      marketValue - current market value
      Returns:
      the trade
    • asBasis

      public SaCcrTrade asBasis()
      This trade as a basis transaction (para 162): a non-FX trade whose two floating legs reference risk factors of the same asset class in the same currency, such as 3m LIBOR against OIS. Basis trades on the same pair of risk factors form their own hedging set, keyed by hedgingSet() (name it after the pair, e.g. "USD 3M/OIS"), and take half the supervisory factor.
      Returns:
      a copy marked basis
    • asVolatility

      public SaCcrTrade asVolatility()
      This trade as a volatility transaction (para 163): the reference is a volatility or variance of a risk factor, such as a variance swap. Volatility trades form their own hedging sets and take five times the supervisory factor.
      Returns:
      a copy marked volatility
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • assetClass

      public SaCcr.AssetClass assetClass()
      Returns the value of the assetClass record component.
      Returns:
      the value of the assetClass record component
    • hedgingSet

      public String hedgingSet()
      Returns the value of the hedgingSet record component.
      Returns:
      the value of the hedgingSet record component
    • creditGrade

      public SaCcr.CreditGrade creditGrade()
      Returns the value of the creditGrade record component.
      Returns:
      the value of the creditGrade record component
    • index

      public boolean index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • commoditySet

      public SaCcr.CommoditySet commoditySet()
      Returns the value of the commoditySet record component.
      Returns:
      the value of the commoditySet record component
    • notional

      public double notional()
      Returns the value of the notional record component.
      Returns:
      the value of the notional record component
    • startYears

      public double startYears()
      Returns the value of the startYears record component.
      Returns:
      the value of the startYears record component
    • endYears

      public double endYears()
      Returns the value of the endYears record component.
      Returns:
      the value of the endYears record component
    • maturityYears

      public double maturityYears()
      Returns the value of the maturityYears record component.
      Returns:
      the value of the maturityYears record component
    • delta

      public double delta()
      Returns the value of the delta record component.
      Returns:
      the value of the delta record component
    • marketValue

      public double marketValue()
      Returns the value of the marketValue record component.
      Returns:
      the value of the marketValue record component
    • hedgingSetType

      public SaCcr.HedgingSetType hedgingSetType()
      Returns the value of the hedgingSetType record component.
      Returns:
      the value of the hedgingSetType record component