Chartsv26.10.18
Kits

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 years

What the kit renders

FigureFunctionReads
Yield curveyieldCurvePoints + paintYieldCurvequoted points in years and percent; the curve is drawn on the numeric axis
Curve spreadcurveSpread + paintCurveSpreada base curve and a peer curve; the spread comes back in basis points with minimum, maximum and average
Maturity ladderbuildLadder + paintBondLadderone bar per maturity bucket, with the weighted yield of the bucket
Coupon timelinecouponEvents + paintCouponTimelineevery coupon and the redemption on a year scale
Yield mapyieldMapModel + yieldMapIsolines + paintYieldMapdated curves; cells are toned against the percentile domain inside every row, the isolines cross the equal levels
Shape formatscurveRidgelineModel, curveCompassModel, curveSurfaceModel, spreadRiverModelthe ridge of the history, the shapes of several curves, the dated 2.5D stack and parallel spread channels
Curve snapshot and fancurveSnapshotModel, curveFanHistorythe muted dated curves behind the labelled hero line, and the quarterly fan with the alpha ramp of age
Spread strip and credit panelspreadStripModel, creditSpreadPanelthe 10Y-2Y reading by month with the inversion zone, and the IG/HY corridors with the stress runs
Split and toneyieldDecomposition, countryHeatmapModel, tenorPulseChipsthe 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

Fixed income kit - live panel
Theme
Fixed income - yield curve
Drag to pan, wheel to zoom, click a point to pin it

Yield curve with spreads and the maturity 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.

Theme
Curve snapshot: the muted history with the labelled hero curve on top
Curve fan: one line per quarter, the alpha fading with age up to the hero
Spread strip: the 10Y-2Y reading by month with the inversion zone and the pulse of the last print
Credit spreads: the IG and HY corridors with the stress run of HY

The premium curve readings: snapshot, fan, strip and credit

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 print

The 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.

Theme
Morph race: the first and the last quarter of the window with the blended frame between them
Idea mode: freeze the chart, aim the forecast ray and pin a note on it
Price and yield: the same dated series read as a yield, as a clean price to par, or together on two axes
Pick two issues
Market map: every issue against the curve, two of them joined by the spread connector

The morph race, the idea mode, the price reading and the market map

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 frame

Price, 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 two

The 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.

Theme
Topo map of rates: tenor against time, equal-level isolines with their levels chipped
Echo of curves: one band per quarter, the newest on top, the shares fading with age
Compass: US, DE and JP as shapes against each other on the shared scale
Ridge of time: the dated stack with the depth fog, the year chips and the floor mesh
Inversion river: three spread channels, the active one filled by the sign of its last reading
Nominal split: the real yield and the breakeven of every date, the shares labelled in the blocks
Globe of spreads: the premium to the US anchor by country, clustered by region
Tenor pulse: the yields of the key tenors with the signed change of the day

The yield map lab: eight formats of the bonds kit

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 chips

The 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.

Theme
Wheel zooms around the pointer, drag pans the plane, a click focuses an issue
Yield constellation: the benchmark curve with the gradient sea, the issues glowing with their rich/cheap verdict auras, a hover card with the details and the view window driven by the wheel, the drag and the focus click

The yield constellation with the glowing issues

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 row

The 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.

Theme
yaw 0.60 · pitch 0.90 · scale 1.00
The credit fan in three dimensions: four benchmarks in depth, every traded issue above its own curve, toned by the rich/cheap verdict of the market map. Hover reads code, benchmark, spread and verdict; a tap pins the benchmark.

The credit benchmark fan in 3D

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 benchmark

The 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.

Number locale moves the grouping and the decimal separator; the declared precision of every column stays.
Number locale
Fixed income screening6 rows
Headless rows of @unifin/chart-kit-bonds - click a header to sort, heat tones follow the visible extent, the chevron opens the tranches
RDGR.0432XS200000001612.35%96.87511.20%5.52032-04-14B+Corporate
KZGB.0329XS20000000117.93%100.3758.10%2.42029-03-01BBB-Government
Tranches of KZGB.0329 (XS2000000011)3
KZGB.0329 50%XS2000000011-T17.82%100.250BBB-
KZGB.0329 30%XS2000000011-T27.93%100.375BBB-
KZGB.0329 20%XS2000000011-T38.04%100.500BBB-
BAC.0431XS20000000137.04%97.1256.50%4.52031-04-02BB+Bank
AAPL.0527XS20000000125.61%98.5005.25%0.62027-05-15BBCorporate
KEGC.0829XS20000000145.02%99.2504.75%2.92029-08-20BBBUtility
AKMG.0630XS20000000153.58%100.6253.50%3.72030-06-09BBB-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.

Theme
yaw 0.60 · pitch 0.90 · scale 1.00
The coupon flows as a present value waterfall: dates along one axis, the -25/0/+25 bp scenarios along the other, the base scenario highlighted

The coupon flows as a present value waterfall

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

On this page