Main Content

CurrencySwap

CurrencySwap instrument object

Since R2024a

Description

Create and price a CurrencySwap instrument object for one or more currency swap instruments using this workflow:

  1. Use fininstrument to create a CurrencySwap instrument object for one or more currency swap instruments.

  2. Use ratecurve to specify curve models for the CurrencySwap instrument object.

  3. Use finpricer to specify a FXDiscount pricing method.

For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available models and pricing methods for supported instruments, see Choose Instruments, Models, and Pricers.

Creation

Description

example

SwapInstrument = fininstrument(InstrumentType,Maturity=maturity_date,LegRate=leg_rate) creates a CurrencySwap object for one or more Currency Swap instruments by specifying InstrumentType and sets the properties for the required name-value arguments Maturity and LegRate.

The CurrencySwap object supports a Vanilla Currency Swap and a Forward Currency Swap.

Note

You can also use the Swap instrument for a single currency swap but not a cross-currency swap. For cross-currency swaps, use CurrencySwap. For more information on using a Swap instrument, see Vanilla Swap, Swap with Amortization, and Forward Swap.

example

SwapInstrument = fininstrument(___,Name=Value) sets optional properties using name-value arguments in addition to the required arguments in the previous syntax. For example, CurrencySwapInstrument = fininstrument("CurrencySwap",Maturity=datetime(2024,8,30),LegRate=[0.06 0.12],LegType=["fixed","fixed"],Basis=1,Notional=10000,StartDate=datetime(2023,11,30),DaycountAdjustedCashFlow=true,BusinessDayConvention="follow",ProjectionCurve=ratecurve,Name="currencyswap_instrument") creates a CurrencySwap option with a maturity of August 30, 2024. You can specify multiple name-value pair arguments.

Input Arguments

expand all

Instrument type, specified as a string with the value of "CurrencySwap", a character vector with the value of 'CurrencySwap', an NINST-by-1 string array with values of "CurrencySwap", or an NINST-by-1 cell array of character vectors with values of 'CurrencySwap'.

Data Types: char | cell | string

Name-Value Arguments

Specify required and optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: CurrencySwapInstrument = fininstrument("CurrencySwap",Maturity=datetime(2024,8,30),LegRate=[0.06 0.12],LegType=["fixed","fixed"],Basis=1,Notional=10000,StartDate=datetime(2023,11,30),DaycountAdjustedCashFlow=true,BusinessDayConvention="follow",ProjectionCurve=ratecurve,Name="currencyswap_instrument")

Required CurrencySwap Name-Value Arguments

expand all

Currency swap maturity date, specified a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

If you use date character vectors or strings, the format must be recognizable by datetime because the Maturity property is stored as a datetime.

Data Types: datetime | string | char

Currency swap Leg rate in decimal values, specified as a NINST-by-2 matrix. Each row can be defined as one of the following:

  • [CouponRate Spread] (fixed-float)

  • [Spread CouponRate] (float-fixed)

  • [CouponRate CouponRate] (fixed-fixed)

  • [Spread Spread] (float-float)

CouponRate is the decimal annual rate. Spread is the number of basis points in decimals over the reference rate. The first column represents the receiving leg, while the second column represents the paying leg.

Data Types: double

Optional CurrencySwap Name-Value Arguments

expand all

Currency swap leg type, specified as a cell array of character vectors or a string array with the supported values. The LegType defines the interpretation of the values entered in LegRate.

Data Types: cell | string

Rate curve for projecting floating cash flows, specified as a scalar ratecurve object or an NINST-by-1 vector of ratecurve objects. You must create this object using ratecurve.

Data Types: object

Offset in rate setting, specified as an NINST-by-2 matrix.

Data Types: double

Frequency of payments per year, specified as a scalar (or an NINST-by-2 matrix if Reset is different for each leg) with one of the following values: 0, 1, 2, 3, 4, 6, or 12.

Data Types: double

Day count basis representing the basis for each leg, specified as an NINST-by-1 matrix (or an NINST-by-2 matrix if Basis is different for each leg).

  • 0 — actual/actual

  • 1 — 30/360 (SIA)

  • 2 — actual/360

  • 3 — actual/365

  • 4 — 30/360 (PSA)

  • 5 — 30/360 (ISDA)

  • 6 — 30/360 (European)

  • 7 — actual/365 (Japanese)

  • 8 — actual/actual (ICMA)

  • 9 — actual/360 (ICMA)

  • 10 — actual/365 (ICMA)

  • 11 — 30/360E (ICMA)

  • 12 — actual/365 (ISDA)

  • 13 — BUS/252

For more information, see Basis.

Data Types: double

Notional value for each leg, specified as a scalar 1-by-2 numeric array.

Data Types: double

Latest floating rate for float legs, specified as a scalar numeric or an NINST-by-1 numeric vector.

LatestFloatingRate is an NINST-by-1 matrix (or an NINST-by-2 matrix if LatestFloatingRate is different for each leg).

Data Types: double

Flag to adjust cash flows based on day count convention, specified as an NINST-by-1 matrix (or an NINST-by-2 matrix if AdjustCashFlowsBasis is different for each leg) of logicals with values of true or false.

Data Types: logical

Business day conventions for cash flow dates, specified as a string (or an NINST-by-2 string array if BusinessDayConvention is different for each leg) or a character vector (or an NINST-by-2 cell array of character vectors if BusinessDayConvention is different for each leg). The selection for business day convention determines how nonbusiness days are treated. Nonbusiness days are defined as weekends plus any other date that businesses are not open (for example, statutory holidays). Values are:

  • "actual" — Nonbusiness days are effectively ignored. Cash flows that fall on nonbusiness days are assumed to be distributed on the actual date.

  • "follow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day.

  • "modifiedfollow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day. However, if the following business day is in a different month, the previous business day is adopted instead.

  • "previous" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day.

  • "modifiedprevious" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day. However, if the previous business day is in a different month, the following business day is adopted instead.

Data Types: char | cell | string

Holidays used in computing business days, specified as dates using an NINST-by-1 vector of datetimes, cell array of date character vectors, or date string array. For example:

H = holidays(datetime('today'),datetime(2025,12,15));
Swap = fininstrument("CurrencySwap",'Maturity',datetime(2025,12,15),'LegRate',[0.06 20],'Holidays',H)

Data Types: datetime | string | char

End-of-month rule flag for generating dates when Maturity is an end-of-month date for a month with 30 or fewer days, specified as a logical value of true or false using an NINST-by-1 matrix (or an NINST-by-2 matrix if EndMonthRule is different for each leg).

  • If you set EndMonthRule to false, the software ignores the rule, meaning that a payment date is always the same numerical day of the month.

  • If you set EndMonthRule to true, the software sets the rule on, meaning that a payment date is always the last actual day of the month.

Data Types: logical

Forward starting date of payments, specified as a scalar or an NINST-by-1 vector using a datetime array, string array, or date character vectors.

If you use date character vectors or strings, the format must be recognizable by datetime because the StartDate property is stored as a datetime.

Data Types: datetime | char | string | cell

Indicator whether the currency swap exchanges principal at Settle, specified as a scalar logical value of true or false or an NINST-by-1 matrix.

Data Types: logical

Indicator whether the currency swap exchanges principal at Maturity, specified as a scalar logical value of true or false or an NINST-by-1 matrix.

Data Types: logical

User-defined name for the instrument, specified as a scalar string or character vector or an NINST-by-1 cell array of character vectors or string array.

Data Types: char | cell | string

Properties

expand all

Currency swap maturity date, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Currency swap leg rate, returned as an NINST-by-2 matrix of decimal values, with each row defined as one of the following:

  • [CouponRate Spread] (fixed-float)

  • [Spread CouponRate] (float-fixed)

  • [CouponRate CouponRate] (fixed-fixed)

  • [Spread Spread] (float-float)

Data Types: double

Currency swap leg type, returned as a string array with the values ["fixed","fixed"], ["fixed","float"], ["float","fixed"], or ["float","float"].

Data Types: string

Rate curve used in projecting the future cash flows, returned as a ratecurve object or an NINST-by-1 vector of ratecurve objects.

Data Types: object

Offset in rate setting, returned as an NINST-by-2 matrix.

Data Types: double

Frequency of payments per year, returned as a scalar or an NINST-by-2 matrix.

Data Types: double

Day count basis, returned as an NINST-by-1 or an NINST-by-2 matrix.

Data Types: double

Notional value for each leg, returned as a scalar 1-by-2 numeric array.

Data Types: double

Latest floating rate for float legs, returned as a scalar numeric or an NINST-by-1 numeric vector or an NINST-by-2 if LatestFloatingRate is different for each leg.

Data Types: double

Flag to adjust cash flows based on day count convention, returned as an NINST-by-1 matrix (or an NINST-by-2 matrix if AdjustCashFlowsBasis is different for each leg) of logicals with values of true or false.

Data Types: logical

Business day conventions for cash flow dates, returned as a string or an NINST-by-2 string array if BusinessDayConvention is different for each leg.

Data Types: char | cell | string

Holidays used in computing business days, returned as an NINST-by-1 vector of datetimes.

Data Types: datetime

End-of-month rule flag for generating dates when Maturity is an end-of-month date for a month with 30 or fewer days, returned as an NINST-by-1 matrix (or an NINST-by-2 matrix if EndMonthRule is different for each leg).

Data Types: logical

Forward starting date of payments, returned as a scalar datetime or an NINST-by-1 vector of datetimes.

Data Types: datetime

Indicator whether the currency swap exchanges principal at Settle, returned as a scalar logical value of true or false or an NINST-by-1 matrix.

Data Types: logical

Indicator whether the currency swap exchanges principal at Maturity, returned as a scalar logical value of true or false or an NINST-by-1 matrix.

Data Types: logical

User-defined name for the instrument, returned as a scalar string or an NINST-by-1 string array.

Data Types: string

Examples

collapse all

This example shows the workflow to price a CurrencySwap instrument by using two ratecurve objects for two zero rates for different currencies and then use a FXDiscount pricing method.

Create ratecurve Objects

Create two ratecurve objects using ratecurve for the discounting cash flows for the CurrencySwap instrument. The ZeroCurve_USD zero curve is for US currency and the EUR_Zero zero curve is for Euro currency.

Settle = datetime(2023,9,15);

% US Currency
USD_Dates = datemnth(Settle,[1 3 6 12*[1 2 3 5 7 10 20 30]]');
USD_Zero = [0.03 0.06 0.08 0.13 0.36 0.76 1.63 2.29 2.88 3.64 3.89]'/100;
ZeroCurve_USD = ratecurve("zero",Settle,USD_Dates,USD_Zero,Compounding=1)
ZeroCurve_USD = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 1
                Basis: 0
                Dates: [11×1 datetime]
                Rates: [11×1 double]
               Settle: 15-Sep-2023
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

% Euro currency
EUR_Dates = datemnth(Settle,[3 6 12*[1 2 3 5 7 10 20 30]]');
EUR_Zero = [0.017 0.033 0.088 .27 .512 1.056 1.573 2.183 2.898 2.797]'/100;
ZeroCurve_EUR = ratecurve("zero",Settle,EUR_Dates,EUR_Zero,Compounding=1)
ZeroCurve_EUR = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 1
                Basis: 0
                Dates: [10×1 datetime]
                Rates: [10×1 double]
               Settle: 15-Sep-2023
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create CurrencySwap Instrument Object

Use fininstrument to create a CurrencySwap instrument object.

% Cross-Currency Swap Data
Maturity_FXSwap = Settle + calyears(10);
LegRate_FXSwap = [2.5 4]/100;
LegType_FXSwap = ["fixed" "fixed"];
LegReset_FXSwap = [2 2];
Notional_FXSwap = [100 100/1.1];

CurrencySwap = fininstrument("CurrencySwap",Maturity=Maturity_FXSwap,LegRate=LegRate_FXSwap,LegType=LegType_FXSwap,Reset=LegReset_FXSwap,Notional=Notional_FXSwap,Name="currencyswap_instrument")
CurrencySwap = 
  CurrencySwap with properties:

                     LegRate: [0.0250 0.0400]
                     LegType: ["fixed"    "fixed"]
                       Reset: [2 2]
                       Basis: [0 0]
                    Notional: [100 90.9091]
          LatestFloatingRate: [NaN NaN]
                 ResetOffset: [0 0]
    DaycountAdjustedCashFlow: [0 0]
             ProjectionCurve: [0×0 ratecurve]
       BusinessDayConvention: ["actual"    "actual"]
                    Holidays: NaT
                EndMonthRule: [1 1]
     ExchangeInitialNotional: 1
    ExchangeMaturityNotional: 1
                   StartDate: NaT
                    Maturity: 15-Sep-2033
                        Name: "currencyswap_instrument"

Create FXDiscount Pricer Object

Use finpricer to create a FXDiscount pricer object and use the two ratecurve objects for the DiscountCurve name-value argument.

FXRate = [1 1.1];
myFXPricer = finpricer("FXDiscount",DiscountCurve=[ZeroCurve_EUR ZeroCurve_USD],FXRate=FXRate)
myFXPricer = 
  FXDiscount with properties:

    DiscountCurve: [1×2 ratecurve]
           FXRate: [1 1.1000]

Price CurrencySwap Instrument

Use price to compute the price and sensitivities for the CurrencySwap instrument.

[Price_FXSwap,outPR] = price(myFXPricer,CurrencySwap,"all")
Price_FXSwap = -7.5751
outPR = 
  priceresult with properties:

       Results: [1×2 table]
    PricerData: []

outPR.Results
ans=1×2 table
     Price       DV01   
    _______    _________

    -7.5751    0.0019076

This example shows the workflow to price multiple CurrencySwap instruments by using two ratecurve objects for two zero rates for different currencies and then use a FXDiscount pricing method.

Create ratecurve Objects

Create two ratecurve objects using ratecurve for the discounting cash flows for the CurrencySwap instrument. The ZeroCurve_USD zero curve is for US currency and the EUR_Zero zero curve is for Euro currency.

Settle = datetime(2023,9,15);

% US Currency
USD_Dates = datemnth(Settle,[1 3 6 12*[1 2 3 5 7 10 20 30]]');
USD_Zero = [0.03 0.06 0.08 0.13 0.36 0.76 1.63 2.29 2.88 3.64 3.89]'/100;
ZeroCurve_USD = ratecurve("zero",Settle,USD_Dates,USD_Zero,Compounding=1)
ZeroCurve_USD = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 1
                Basis: 0
                Dates: [11×1 datetime]
                Rates: [11×1 double]
               Settle: 15-Sep-2023
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

% Euro currency
EUR_Dates = datemnth(Settle,[3 6 12*[1 2 3 5 7 10 20 30]]');
EUR_Zero = [0.017 0.033 0.088 .27 .512 1.056 1.573 2.183 2.898 2.797]'/100;
ZeroCurve_EUR = ratecurve("zero",Settle,EUR_Dates,EUR_Zero,Compounding=1)
ZeroCurve_EUR = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 1
                Basis: 0
                Dates: [10×1 datetime]
                Rates: [10×1 double]
               Settle: 15-Sep-2023
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create CurrencySwap Instrument Object

Use fininstrument to create a CurrencySwap instrument object with three Currency Swap instruments.

% Cross-Currency Swap Data
LegRate_FXSwap = [2.5 4]/100;
LegType_FXSwap = ["fixed" "fixed"];
LegReset_FXSwap = [2 2];
Notional_FXSwap = [100 100/1.1];

CurrencySwap = fininstrument("CurrencySwap",Maturity=datetime([2024,9,15 ; 2025,9,15 ; 2026,9,15]),LegRate=LegRate_FXSwap,LegType=LegType_FXSwap,Reset=LegReset_FXSwap,Notional=Notional_FXSwap,Name="currencyswap_instrument")

Create FXDiscount Pricer Object

Use finpricer to create a FXDiscount pricer object and use the two ratecurve objects for the DiscountCurve name-value argument.

FXRate = [1 1.1];
myFXPricer = finpricer("FXDiscount",DiscountCurve=[ZeroCurve_EUR ZeroCurve_USD],FXRate=FXRate)
myFXPricer = 
  FXDiscount with properties:

    DiscountCurve: [1×2 ratecurve]
           FXRate: [1 1.1000]

Price CurrencySwap Instruments

Use price to compute the price and sensitivities for the three CurrencySwap instruments.

[Price_FXSwap,outPR] = price(myFXPricer,CurrencySwap,"all")
Price_FXSwap = 3×1

   -1.4560
   -2.8083
   -3.7209

outPR.Results
ans=1×2 table
    Price        DV01   
    ______    __________

    -1.456    0.00082253

ans=1×2 table
     Price       DV01  
    _______    ________

    -2.8083    0.001519

ans=1×2 table
     Price       DV01   
    _______    _________

    -3.7209    0.0020789

More About

expand all

Version History

Introduced in R2024a