Main Content

FXDiscount

Create FXDiscount pricer object for CurrencySwap object

Since R2024a

Description

Create and price a CurrencySwap instrument object with a ratecurve and a FXDiscount pricing method using this workflow:

  1. Use fininstrument to create a CurrencySwap instrument object.

  2. Create an interest-rate curve object using ratecurve.

  3. Use finpricer to specify a FXDiscount pricer object for the CurrencySwap instrument object.

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 instruments, models, and pricing methods for supported instruments, see Choose Instruments, Models, and Pricers.

Creation

Description

DiscountPricerObj = finpricer(PricerType,DiscountCurve=ratecurve_objects,FXRate=FX_rates) creates a FXDiscount pricer object by specifying PricerType and the required name-value arguments DiscountCurve and FXRate to set properties using name-value arguments. For example, FXDiscountPricerObj = finpricer("FXDiscount",DiscountCurve=[ZeroCurve_EUR ZeroCurve_USD],FXRate=[1 1.1]) creates a FXDiscount pricer object.

example

Input Arguments

expand all

Pricer type, specified as a string with the value of "FXDiscount" or a character vector with the value of 'FXDiscount'.

Data Types: char | string

Name-Value Arguments

Specify required 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: FXDiscountPricerObj = finpricer("FXDiscount",DiscountCurve=ratecurve_objects,FXRate=[1 1.1])

ratecurve objects for discounting cash flows, specified as a 1-by-2 array of ratecurve objects that are previously created using ratecurve objects.

Data Types: object

FX rate, specified as a scalar 1-by-2 numeric array.

Data Types: double

Properties

expand all

ratecurve object for discounting cash flows, returned as a 1-by-2 array of ratecurve objects.

Data Types: object

FX rate, returned as a scalar 1-by-2 numeric array.

Data Types: object

Object Functions

priceCompute price for CurrencySwap instrument with FXDiscount pricer

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: [11x1 datetime]
                Rates: [11x1 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: [10x1 datetime]
                Rates: [10x1 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: [0x0 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: [1x2 ratecurve]
           FXRate: [1 1.1000]

Price CurrencySwap Instrument

Use price to compute the price for the CurrencySwap instrument.

Price_FXSwap = price(myFXPricer,CurrencySwap,"all")
Price_FXSwap = 
-7.5751

Version History

Introduced in R2024a