OpenBI Docs Buy

QUANT.KEYRATE OpenBI

Where a bond's rate risk sits on the curve: its value change when each instrument's rate rises by a basis point.

Group: Quantitative finance. OpenBI’s own: DAX has no function of this name.

Syntax

QUANT.KEYRATE ( <table>, <kind>, <tenor>, <rate>, <asOf>, <maturity>, <coupon> [, <frequency>] [, <notional>] [, <calendar>] [, <settlementDays>] )
ParameterTypeDescription
tableTableThe instruments: one row each, such as the Rates table.
kindExpression
evaluated for each row
The row's kind of instrument: "deposit", "swap" or "zero".
tenorExpression
evaluated for each row
The row's tenor as text: "ON", "1W", "3M", "10Y".
rateExpression
evaluated for each row
The row's rate as a decimal: 0.0405 for 4.05 %. A row with a blank rate is left out.
asOfDateThe curve's date: today, for the rates given.
maturityDateThe bond's maturity; the curve's last instrument must reach it.
couponNumberThe bond's coupon rate a year, as a decimal.
frequencyWhole number
optional
Coupons a year: 1 (when left out), 2, 4 or 12.
notionalNumber
optional
The bond's nominal; 100 when left out, so the result is for each 100.
calendarText
optional
The holidays settlement and maturities keep to: "TARGET" (when left out), "Norway", "UnitedStates", "UnitedKingdom", "Sweden", "Denmark" or "None".
settlementDaysWhole number
optional
Business days from the curve's date to the instruments' start, 0 to 10; 2 when left out.

Returns

Table. Tenor, Kind, Rate, Years, DV01 and Share: a row for each instrument, its DV01 the change in the bond's value when that instrument alone is a basis point higher, and Share that change's part of all of them.

Remarks

  • The bond's coupons fall a period apart counting back from its maturity; each one after the curve's date, and the notional at maturity, is discounted on the curve. Then, one instrument at a time, its rate is raised by 0.0001 and the bond is valued on a curve built anew with that one change.
  • The DV01s are negative for a bond: a higher rate lowers its value. Their sum is close to the value change for every rate a basis point higher at once (the third example).
  • The ladder shows which maturities to hedge: a bond to April 2034 sits mostly on the 7-year and 10-year swaps around it. The shortest deposit moves it a little even though it ends before the first coupon: every other instrument starts two business days after the curve's date, and that deposit sets the curve there.
  • A maturity after the curve's last instrument is an error: the curve would have to be extended.
  • A deposit is a simple rate on the Actual/360 count. A swap pays a fixed rate once a year on 30/360 against a six-month floating rate. A zero rate is continuous on Actual/365; when every row is "zero", the rates are the curve as they are and nothing is bootstrapped.
  • Deposits and swaps can be mixed; zero rates cannot be mixed with them.
  • Between the instruments the discount factors are interpolated log-linearly, so the forward rate is flat from one instrument's maturity to the next.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

NOK 100 million of a 5 % bond to April 2034

Paid twice a year, valued on the NOK curve as the Brewery's planning page does.

EVALUATE
SELECTCOLUMNS (
    QUANT.KEYRATE (
        Rates, Rates[Kind], Rates[Tenor], Rates[Rate],
        DATE ( 2026, 10, 13 ), DATE ( 2034, 4, 13 ), 0.05, 2, 100000000, "Norway"
    ),
    "Tenor", [Tenor],
    "DV01", ROUND ( [DV01], 0 ),
    "Share", ROUND ( [Share], 4 )
)
TenorDV01Share
1M-600.0009
3M-10
6M-1110.0017
2Y-1690.0025
3Y-4290.0064
5Y-9900.0149
7Y-508340.7635
10Y-139830.21

A five-year bond on the same curve

A bond with annual coupons to October 2031: almost all of its risk is on the 5-year swap, whose dates its coupons share.

EVALUATE
SELECTCOLUMNS (
    QUANT.KEYRATE (
        Rates, Rates[Kind], Rates[Tenor], Rates[Rate],
        DATE ( 2026, 10, 13 ), DATE ( 2031, 10, 13 ), 0.04
    ),
    "Tenor", [Tenor],
    "Share", ROUND ( [Share], 4 )
)
TenorShare
1M0.0012
3M0
6M0.0002
2Y0.0011
3Y0.0037
5Y0.9937
7Y0
10Y0

The ladder adds up

The 2034 bond valued from the curve's monthly discount factors (its coupons fall on the 13th), with every rate a basis point higher, against the sum of its ladder.

EVALUATE
VAR AsOf = DATE ( 2026, 10, 13 )
VAR Maturity = DATE ( 2034, 4, 13 )
VAR Ladder =
    QUANT.KEYRATE ( Rates, Rates[Kind], Rates[Tenor], Rates[Rate], AsOf, Maturity, 0.05, 2, 100000000, "Norway" )
VAR Base = QUANT.CURVE ( Rates, Rates[Kind], Rates[Tenor], Rates[Rate], AsOf, "curve", "Norway" )
VAR Up = QUANT.CURVE ( Rates, Rates[Kind], Rates[Tenor], Rates[Rate] + 0.0001, AsOf, "curve", "Norway" )
VAR Value0 =
    SUMX (
        FILTER ( Base, [Date] > AsOf && [Date] <= Maturity && ( MONTH ( [Date] ) = 4 || MONTH ( [Date] ) = 10 ) ),
        ( 2500000 + IF ( [Date] = Maturity, 100000000 ) ) * [Discount]
    )
VAR Value1 =
    SUMX (
        FILTER ( Up, [Date] > AsOf && [Date] <= Maturity && ( MONTH ( [Date] ) = 4 || MONTH ( [Date] ) = 10 ) ),
        ( 2500000 + IF ( [Date] = Maturity, 100000000 ) ) * [Discount]
    )
RETURN
    ROW (
        "Value", ROUND ( Value0, 0 ),
        "All rates up 1 bp", ROUND ( Value1 - Value0, 0 ),
        "Sum of the ladder", ROUND ( SUMX ( Ladder, [DV01] ), 0 )
    )
ValueAll rates up 1 bpSum of the ladder
108055711-66551-66577

QUANT.CURVE, QUANT.BOND.DV01, QUANT.BOND.DURATION, VALUATION.

Last updated · OpenBI Studio 0.3.74