Fixed income kit
Yield and price maths for bonds, duration and convexity, accrued interest, the yield curve with spreads, the maturity ladder and the coupon timeline.
@unifin/chart-kit-bonds owns the fixed income maths and the painters a fixed income surface needs.
It has no runtime dependencies beyond the core peer.
import { bondPrice, bondYtm, macaulayDuration, modifiedDuration, accruedInterest } from '@unifin/chart-kit-bonds';
const terms = { face: 1000, couponRate: 0.06, frequency: 2, yearsToMaturity: 10 };
bondPrice(terms, 0.055); // clean price at a yield
bondYtm(terms, 1042.5); // yield to maturity at a price
macaulayDuration(terms, 0.055); // weighted average time of the cash flows
modifiedDuration(terms, 0.055); // rate sensitivity in yearsWhat the kit renders
| Figure | Function | Reads |
|---|---|---|
| Yield curve | yieldCurvePoints + paintYieldCurve | quoted points in years and percent; the curve is drawn on the numeric axis |
| Curve spread | curveSpread + paintCurveSpread | a base curve and a peer curve; the spread comes back in basis points with minimum, maximum and average |
| Maturity ladder | buildLadder + paintBondLadder | one bar per maturity bucket, with the weighted yield of the bucket |
| Coupon timeline | couponEvents + paintCouponTimeline | every coupon and the redemption on a year scale |
| Yield map | yieldMapModel + yieldMapIsolines + paintYieldMap | dated curves; cells are toned against the percentile domain inside every row, the isolines cross the equal levels |
| Shape formats | curveRidgelineModel, curveCompassModel, curveSurfaceModel, spreadRiverModel | the ridge of the history, the shapes of several curves, the dated 2.5D stack and parallel spread channels |
| Curve snapshot and fan | curveSnapshotModel, curveFanHistory | the muted dated curves behind the labelled hero line, and the quarterly fan with the alpha ramp of age |
| Spread strip and credit panel | spreadStripModel, creditSpreadPanel | the 10Y-2Y reading by month with the inversion zone, and the IG/HY corridors with the stress runs |
| Split and tone | yieldDecomposition, countryHeatmapModel, tenorPulseChips | the nominal split into real yield and breakeven, country values over a shared centre, key tenors with signed change |
Yield, price and spread labels are rounded by the caller: the kit returns numbers, the axis formats them.
Live curve, spread and ladder

The premium curve readings
The kit reads the history in four premium formats besides the curve itself: the snapshot puts the muted dated curves behind the labelled heroic line, the fan spreads the quarterly curves with the alpha ramp of age, the spread strip turns the 10Y-2Y reading into a monthly bar row with the inversion zone under zero and the pulse of the last print, and the credit panel follows the IG and HY corridors with the stress runs of HY marked and labelled in basis points. Every format is again a pure model plus a painter: the host owns the scale, the axes stay outside the kit. Each reading takes its own row at the full width of the section, and the pointer over a pane turns it live: a guide, a dot and a value capsule marking the nearest point of the model, with the same values in the caption line.

import {
curveSnapshotModel,
paintCurveSnapshot,
paintSpreadStrip,
spreadStripModel,
} from '@unifin/chart-kit-bonds';
const snapshot = curveSnapshotModel(series, { heroIndex: 5 }); // hero = the newest by default
paintCurveSnapshot(ctx, snapshot, input); // the muted history and the hero
const strip = spreadStripModel(history, { longYears: 10, shortYears: 2, label: '10Y-2Y' });
paintSpreadStrip(ctx, strip, input); // bars, the inversion zone and the last printThe morph race and the idea mode
Two dates of one window blended by the canon timing: the race steps the frames by 480 ms and a single
morph covers the gap in 320 ms, while prefers-reduced-motion lands on the target frame at once. The
idea mode freezes the last curve, aims a forecast ray from its final slope and pins a note onto it -
the freeze stops the clock, so the picture holds still while the desk argues. The panes take one row
each at the full width of the section, and the pointer reads the models live: the morph pane marks the
start and the target level with the current blend share, the idea pane reports the curve and the ray
end, the price pane returns both the yield and the clean price of the month under the cursor.

import { BOND_MORPH_DURATION_MS, morphCurveSeries } from '@unifin/chart-kit-bonds';
const frame = morphCurveSeries(january, december, 0.35); // one blended curve
paintAnalyticCurve(ctx, framePoints, input); // the hero of the framePrice, yield and the market map
The price mode reads the same dated series as a clean price to par (priceFromYieldSeries), and the
dual view keeps both readings honest on their own axes. The market map returns to the issues: pick
two bubbles and the kit joins them with the spread connector and its bp chip, while a hover card
reports the tenor, the yield and the verdict of every issue under the pointer.
import { marketMapModel, marketMapSpread, paintMarketMap } from '@unifin/chart-kit-bonds';
const map = marketMapModel(curve, issues, { fairBps: 8 }); // spread and verdict per issue
paintMarketMap(ctx, map, input, {}, { selected: ['BND-03', 'BND-11'] });
const spread = marketMapSpread(map.rows, 'BND-03', 'BND-11'); // bp between the twoThe yield map and the sibling formats
The S102 wave reads a whole history at once: the topo map of rates with equal-level isolines, the ridgeline echo of the curves, the shape compass, the dated surface with the depth fog and the year chips, the inversion river of spread channels, the split of the nominal into the real yield and the breakeven, the globe of country spreads and the tenor pulse. Every format is a pure model plus a painter, so the host owns the scale and the kit never touches the frame budget of the scene. The formats take one row each, and the pointer reads every one of them like a live chart: the cell of the topo map with its percentile, the band of the echo, the spoke of the compass, the dated row of the surface, the spread of a channel, the blocks of the split, the country tile and the day change of a tenor chip.

import { yieldMapIsolines, yieldMapModel, paintYieldMap } from '@unifin/chart-kit-bonds';
const map = yieldMapModel(history); // dates x tenors, deduped and thinned
const lines = yieldMapIsolines(map, [0.03, 0.04]); // strict crossings of the equal levels
paintYieldMap(ctx, map, input); // cells, isolines and the level chipsThe yield constellation
The decorated sibling of the market map lives in the
@unifin/chart-kit-bonds/formats subpath: the
benchmark curve is the floor of the frame with a double-gradient sea under it, and every traded
issue floats above as a star - a multi-layer radial aura toned by its rich/cheap verdict, a warn
ring on the extremes, a gradient yield label and a hover card with the details. The auras are radial
washes, not shadows, so a frame full of stars keeps the frame budget; breathing, hover and capture
states stay on the host side. The view reads any slice of the tenor/spread plane: the wheel zooms
around the pointer, a drag pans, the reset chip returns the full domain and a click focuses an
issue with a short tween (instant under prefers-reduced-motion). Painting and the pick share the
window through constellationWindowInput, so a reader after a zoom finds the same issue as before.

import {
clampConstellationWindow,
constellationWindowInput,
pickYieldConstellationPoint,
paintYieldConstellation,
yieldConstellationModel,
} from '@unifin/chart-kit-bonds/formats';
const stars = yieldConstellationModel(curve, issues, { fairBps: 5 });
const window = clampConstellationWindow(stars, { tenorFrom: 4, tenorTo: 14, spreadFrom: 0.03, spreadTo: 0.05 });
const view = constellationWindowInput(stars, input, window); // the visible slice on both axes
paintYieldConstellation(ctx, stars, view); // the sea, the auras and the labels
const hit = pickYieldConstellationPoint(stars, view, mouseX, mouseY); // the hover card rowThe benchmark fan in 3D
The credit fan lifts the market map into the scene engine
through the @unifin/chart-kit-bonds/fan3d subpath: the rating benchmarks step away from the
viewer in depth, every curve trails a gradient skirt down to the base plane, and each traded issue
floats above its own benchmark as a marker with a radial halo, a stem and the rich/cheap tone of
the market map, lifted by the size of its spread. The camera works as everywhere on this page:
drag, the wheel, the arrow keys, the two angle presets and the reset chip. Hover reads the code,
the benchmark, the spread in basis points and the verdict; a tap pins the benchmark and lights its
curve.

import { benchmarkFan3dModel, paintBenchmarkFan3d } from '@unifin/chart-kit-bonds/fan3d';
import { createProjection, scene3dCamera } from '@unifin/chart-core/scene3d';
const fan = benchmarkFan3dModel(benchmarks, issues, { fairBps: 10 });
const projection = createProjection(scene3dCamera(), { width, height });
paintBenchmarkFan3d(ctx, fan, projection, { theme }, { highlight: 'aa' }); // the pinned benchmarkThe fan is listed in the Bonds kit API entry; the curve and marker painters are part of the core API.
The screener
The fixed income screener is the kit rows in a working surface: sortable columns, heat toned yields, a row filter and the tranches behind every issue. The number locale switch reformats the cells the way a trading desk expects - grouping and the decimal separator follow the locale, while the precision of every column stays as the kit declares it.
| RDGR.0432 | XS2000000016 | 12.35% | 96.875 | 11.20% | 5.5 | 2032-04-14 | B+ | Corporate | |||||||||||||||||
| KZGB.0329 | XS2000000011 | 7.93% | 100.375 | 8.10% | 2.4 | 2029-03-01 | BBB- | Government | |||||||||||||||||
| |||||||||||||||||||||||||
| BAC.0431 | XS2000000013 | 7.04% | 97.125 | 6.50% | 4.5 | 2031-04-02 | BB+ | Bank | |||||||||||||||||
| AAPL.0527 | XS2000000012 | 5.61% | 98.500 | 5.25% | 0.6 | 2027-05-15 | BB | Corporate | |||||||||||||||||
| KEGC.0829 | XS2000000014 | 5.02% | 99.250 | 4.75% | 2.9 | 2029-08-20 | BBB | Utility | |||||||||||||||||
| AKMG.0630 | XS2000000015 | 3.58% | 100.625 | 3.50% | 3.7 | 2030-06-09 | BBB- | Municipal | |||||||||||||||||
import { BOND_SCREENER_COLUMNS, buildBondScreenerRows } from '@unifin/chart-kit-bonds';
import { formatTableCell, sortTableRows } from '@unifin/chart-core';
const rows = buildBondScreenerRows(entries, '2026-10-04'); // years to maturity included
const sorted = sortTableRows(rows, BOND_SCREENER_COLUMNS, { key: 'ytw', direction: 'desc' });
const cell = formatTableCell(sorted[0]!.ytw, BOND_SCREENER_COLUMNS[2]!, 'de-DE'); // '7,93%'The coupon flows as a 3D waterfall
The coupon schedule of a bond also reads as a waterfall: the payment dates walk one axis, the rate scenarios of the DV01 step the other, and every bar is the present value of one flow under the kit discount maths. Drag, the wheel and the arrow keys steer the camera; the reset button and the two angle presets restore the canonical views, and the base scenario stays highlighted.

import { couponFlows, paintPvWaterfall3d, pvWaterfall3dModel } from '@unifin/chart-kit-bonds';
import { scene3dCamera } from '@unifin/chart-core/scene3d';
const flows = couponFlows({ face: 1000, couponRate: 0.0625, frequency: 2, yearsToMaturity: 5 });
const waterfall = pvWaterfall3dModel({ flows, ytm: 0.055, frequency: 2, rateShiftsBp: [-25, 0, 25] });
paintPvWaterfall3d(ctx, waterfall, { width, height, theme, camera: scene3dCamera() });The waterfall is listed in the Bonds kit API entry; the camera is part of the core API.
See also
- Bonds kit API - every exported symbol.
- Table kit - the widget and the figure cells a screener row can carry.
- Analytics kits - all four kits and the table kit.
Analytics kits
Four domain kits and the table kit - fixed income, portfolio, swaps and options maths with the tables and figures that render them, each on its own page.
Portfolio kit
Return and risk metrics of a book, the benchmark and underwater curves, allocation views, the monthly heatmap and the four risk figures.
