price
Syntax
Description
[
computes the instrument price and related pricing information based on the pricing object
Price
,PriceResult
] = price(inpPricer
,inpInstrument
)inpPricer
and the instrument object
inpInstrument
.
[
adds an optional argument to specify sensitivities.Price
,PriceResult
] = price(___,inpSensitivity
)
Examples
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 for the CurrencySwap
instrument.
Price_FXSwap = price(myFXPricer,CurrencySwap,"all")
Price_FXSwap = -7.5751
Input Arguments
Pricer object, specified as a scalar FXDiscount
pricer object. Use finpricer
to create the FXDiscount
pricer object.
Data Types: object
Instrument object, specified as a scalar or vector for CurrencySwap
instrument objects. Use fininstrument
to create the
CurrencySwap
instrument objects.
Data Types: object
(Optional) List of sensitivities to compute, specified as a
NOUT
-by-1
or a
1
-by-NOUT
cell array of character vectors or
string array with possible values of 'Price'
and
'DV01'
.
inpSensitivity = {'All'}
or inpSensitivity =
["All"]
specifies that the output is Price
and
DV01
. This input is the same as specifying
inpSensitivity
to include each sensitivity.
The sensitivities supported depend on the
inpInstrument
.
inpInstrument | Supported Sensitivities |
---|---|
CurrencySwap | {'DV01','price'} |
Example: inpSensitivity = {'DV01','price'}
Data Types: cell
| string
Output Arguments
Instrument price, returned as a numeric.
Price result, returned as an object. The object has the following fields:
PriceResult.Results
— Table of results that includes sensitivities (if you specifyinpSensitivity
)PriceResult.PricerData
— Structure for pricer data
More About
A DV01 sensitivity is a measure for managing interest rate risk, as it quantifies how much the value of a bond or bond portfolio is expected to change with a slight move in interest rates.
DV01 quantifies the price change in monetary terms for a 1 basis point move in rates.
Version History
Introduced in R2024a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)