Main Content

BlackKarasinski

Create BlackKarasinski model object for a Cap, FloorSwaption, Swap, FloatBond, FixedBond, FixedBondOption, FloatBondOption, OptionEmbeddedFixedBond, or OptionEmbeddedFloatBond instrument

Since R2020a

Description

Create and price a Cap, Floor, Swaption, Swap, FloatBond, FixedBond, FixedBondOption, FloatBondOption, OptionEmbeddedFixedBond, or OptionEmbeddedFloatBond instrument object with a BlackKarasinski model using this workflow:

  1. Use fininstrument to create a Cap, Floor, Swaption, Swap, FloatBond, FixedBond, FixedBondOption, FloatBondOption, OptionEmbeddedFixedBond, or OptionEmbeddedFloatBond instrument object.

  2. Use finmodel to specify a BlackKarasinski model object for the Cap, Floor, Swaption, Swap, FixedBond, FloatBond, FixedBondOption, FloatBondOption, OptionEmbeddedFixedBond, or OptionEmbeddedFloatBond instrument object.

  3. Use finpricer to specify a IRTree or IRMonteCarlo pricing method for the Cap, Floor, Swaption, SwapFixedBond, FloatBond, FixedBondOption or OptionEmbeddedFixedBond instrument object.

  4. Optionally, when using an OptionEmbeddedFixedBond with an IRTree pricing method and a BlackKarasinski model, you can calculate the option adjusted spread (OAS) using oas.

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 pricing methods for a Cap, FloorSwaption, Swap, FixedBond, FloatBond, FixedBondOption, FloatBondOption, OptionEmbeddedFixedBond, or OptionEmbeddedFloatBond instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

example

BlackKarasinskiModelObj = finmodel(ModelType,'Alpha',alpha_value,'Sigma',sigma_value) creates a BlackKarasinski model object by specifying ModelType and the required name-value pair arguments Alpha and Sigma to set the properties. For example, BlackKarasinskiModelObj = finmodel("BlackKarasinski",'Alpha',0.052,'Sigma',0.34) creates a BlackKarasinski model object.

Input Arguments

expand all

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

Data Types: char | 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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: BlackKarasinskiModelObj = finmodel("BlackKarasinski",'Alpha',0.052,'Sigma',0.34)

Mean reversion speed, specified as the comma-separated pair consisting of 'Alpha' and a scalar numeric value or timetable.

Alpha accepts a timetable, where the first column is dates and the second column is the associated Alpha value.

Data Types: double | timetable

Volatility, specified as the comma-separated pair consisting of 'Sigma' and a scalar numeric value or timetable.

Sigma accepts a timetable, where the first column is dates and the second column is the associated Sigma value.

Data Types: double | timetable

Properties

expand all

Mean reversion speed, returned as a scalar numeric value or timetable.

Data Types: double | timetable

Volatility, returned as a scalar numeric value or timetable.

Data Types: double | timetable

Examples

collapse all

This example shows the workflow to price a FixedBondOption instrument when you use a BlackKarasinski model and an IRTree pricing method.

Create FixedBond Instrument Object

Use fininstrument to create a FixedBond instrument object as the underlying bond.

BondInst = fininstrument("FixedBond",'Maturity',datetime(2029,9,15),'CouponRate',.024,'Principal',100,'Basis',1,'Period',1,'Name',"fixed_bond")
BondInst = 
  FixedBond with properties:

                  CouponRate: 0.0240
                      Period: 1
                       Basis: 1
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2029
                        Name: "fixed_bond"

Create FixedBondOption Instrument Object

Use fininstrument to create a FixedBondOption instrument object.

FixedBOption = fininstrument("FixedBondOption",'ExerciseDate',datetime(2025,9,15),'Strike',800,'Bond',BondInst,'OptionType',"put",'ExerciseStyle',"american",'Name',"fixed_bond_option")
FixedBOption = 
  FixedBondOption with properties:

       OptionType: "put"
    ExerciseStyle: "american"
     ExerciseDate: 15-Sep-2025
           Strike: 800
             Bond: [1x1 fininstrument.FixedBond]
             Name: "fixed_bond_option"

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2019,9,15);
Type = 'zero';
ZeroTimes = [calyears([1:10])]';
ZeroRates = [0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307 0.0310]';
ZeroDates = Settle + ZeroTimes;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates, 'Basis',5)
myRC = 
  ratecurve with properties:

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

Create BlackKarasinski Model Object

Use finmodel to create a BlackKarasinski model object.

BlackKarasinskiModel = finmodel("BlackKarasinski",'Alpha',0.02,'Sigma',0.34)
BlackKarasinskiModel = 
  BlackKarasinski with properties:

    Alpha: 0.0200
    Sigma: 0.3400

Create IRTree Pricer Object

Use finpricer to create an IRTree pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

BKTreePricer = finpricer("IRTree",'Model',BlackKarasinskiModel,'DiscountCurve',myRC,'TreeDates',ZeroDates)
BKTreePricer = 
  HWBKTree with properties:

             Tree: [1x1 struct]
        TreeDates: [10x1 datetime]
            Model: [1x1 finmodel.BlackKarasinski]
    DiscountCurve: [1x1 ratecurve]

BKTreePricer.Tree
ans = struct with fields:
        tObs: [0 1 2 3 4 5 6 7 8 9]
        dObs: [15-Sep-2019    15-Sep-2020    15-Sep-2021    15-Sep-2022    15-Sep-2023    15-Sep-2024    15-Sep-2025    15-Sep-2026    15-Sep-2027    15-Sep-2028]
      CFlowT: {[10x1 double]  [9x1 double]  [8x1 double]  [7x1 double]  [6x1 double]  [5x1 double]  [4x1 double]  [3x1 double]  [2x1 double]  [10]}
       Probs: {[3x1 double]  [3x3 double]  [3x5 double]  [3x7 double]  [3x9 double]  [3x11 double]  [3x13 double]  [3x15 double]  [3x17 double]}
     Connect: {[2]  [2 3 4]  [2 3 4 5 6]  [2 3 4 5 6 7 8]  [2 3 4 5 6 7 8 9 10]  [2 3 4 5 6 7 8 9 10 11 12]  [2 3 4 5 6 7 8 9 10 11 12 13 14]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]  [2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18]}
     FwdTree: {1x10 cell}
    RateTree: {1x10 cell}

Price FixedBondOption Instrument

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

[Price, outPR] = price(BKTreePricer,FixedBOption,["all"])
Price = 705.2729
outPR = 
  priceresult with properties:

       Results: [1x4 table]
    PricerData: [1x1 struct]

outPR.Results
ans=1×4 table
    Price     Delta      Gamma        Vega    
    ______    ______    _______    ___________

    705.27    844.75    -8084.8    -1.1369e-09

This example shows the workflow to price a FixedBond instrument when using a BlackKarasinski model and an IRMonteCarlo pricing method.

Create FixedBond Instrument Object

Use fininstrument to create a FixedBond instrument object.

FixB = fininstrument("FixedBond",Maturity=datetime(2022,9,15),CouponRate=0.05,Name="fixed_bond")
FixB = 
  FixedBond with properties:

                  CouponRate: 0.0500
                      Period: 2
                       Basis: 0
                EndMonthRule: 1
                   Principal: 100
    DaycountAdjustedCashFlow: 0
       BusinessDayConvention: "actual"
                    Holidays: NaT
                   IssueDate: NaT
             FirstCouponDate: NaT
              LastCouponDate: NaT
                   StartDate: NaT
                    Maturity: 15-Sep-2022
                        Name: "fixed_bond"

Create BlackKarasinski Model Object

Use finmodel to create a BlackKarasinski model object.

BlackKarasinskiModel = finmodel("BlackKarasinski",'Alpha',0.02,'Sigma',0.34)
BlackKarasinskiModel = 
  BlackKarasinski with properties:

    Alpha: 0.0200
    Sigma: 0.3400

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2019,1,1);
Type = 'zero';
ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = Settle + ZeroTimes;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = 
  ratecurve with properties:

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

Create IRMonteCarlo Pricer Object

Use finpricer to create an IRMonteCarlo pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("IRMonteCarlo",Model=BlackKarasinskiModel,DiscountCurve=myRC,SimulationDates=datetime(2019,3,15)+calmonths(0:6:48)')
outPricer = 
  BKMonteCarlo with properties:

          NumTrials: 1000
      RandomNumbers: []
      DiscountCurve: [1×1 ratecurve]
    SimulationDates: [15-Mar-2019    15-Sep-2019    15-Mar-2020    15-Sep-2020    15-Mar-2021    15-Sep-2021    15-Mar-2022    15-Sep-2022    15-Mar-2023]
              Model: [1×1 finmodel.BlackKarasinski]

Price FixedBond Instrument

Use price to compute the price for the FixedBond instrument.

[Price,outPR] = price(outPricer,FixB,["all"])
Price = 113.3046
outPR = 
  priceresult with properties:

       Results: [1×4 table]
    PricerData: [1×1 struct]

outPR.Results
ans=1×4 table
    Price     Delta     Gamma      Vega 
    _____    _______    ______    ______

    113.3    -310.39    -26724    2.0305

More About

expand all

Version History

Introduced in R2020a