npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svi-vol-surface

v1.0.0

Published

Gatheral SVI implied-volatility surface — raw/natural/jump-wings parametrizations, total variance, butterfly & calendar arbitrage checks, and smile calibration. Zero dependencies.

Readme

svi-vol-surface

Gatheral's SVI implied-volatility surface — the raw / natural / jump-wings parametrizations, total implied variance, butterfly & calendar arbitrage checks, and smile calibration. Zero dependencies.

npm install svi-vol-surface

Why

SVI is the standard parametric form for an equity implied-volatility smile, and the reason it's used is that its no-arbitrage conditions are known in closed form (Gatheral & Jacquier, 2014). npm had no SVI implementation at all. This one parametrizes a slice, converts between the three standard forms, checks both static (butterfly) and calendar arbitrage, and calibrates to market quotes.

import { totalVariance, checkButterfly, calibrateRaw } from "svi-vol-surface";

const slice = { a: 0.04, b: 0.1, rho: -0.3, m: 0, sigma: 0.2 };
totalVariance(slice, 0.1);        // w(k) = σ²·t at log-moneyness 0.1

checkButterfly(slice).arbitrageFree; // true — g(k) ≥ 0 everywhere

// Fit a slice to a market smile (total-variance quotes):
const fit = calibrateRaw(quotes);
fit.rmse; fit.butterflyFree;

API

Log-moneyness k = ln(K/F); a slice returns total implied variance w(k) = σ_BS(k)²·t.

  • totalVariance(raw, k)a + b(ρ(k−m) + √((k−m)² + σ²)); impliedVol(raw, k, t) = √(w/t).
  • dTotalVariance, d2TotalVariance — analytic w′(k), w″(k).
  • durrlemanG(raw, k) — Durrleman's butterfly function (≥ 0 everywhere ⇔ no static arbitrage).
  • checkButterfly(raw) — scans g(k) and the wing condition b(1+|ρ|) ≤ 4.
  • checkCalendar(near, far) — total variance non-decreasing in maturity.
  • rawToNatural / naturalToRaw / rawToJumpWings — the three parametrizations.
  • calibrateRaw(quotes, opts?) — least-squares fit (Nelder–Mead) of a raw slice; returns params + rmse + butterflyFree.

Invalid parameters (b < 0, |ρ| ≥ 1, σ ≤ 0) throw RangeError.

Correctness

The static-arbitrage check is validated against the Axel Vogt parameters from Gatheral & Jacquier (2014) — a published example that does contain butterfly arbitrage — which checkButterfly correctly flags (g(k) < 0), while a clean slice passes. Analytic derivatives are checked against finite differences, parametrization conversions round-trip, and calibration recovers known parameters from a synthetic smile.

Related

Pairs with hagan-sabr (the SABR smile model). Part of a quant/fixed-income toolkit: compounded-sofr · day-count · instrument-identifiers.

Author

Built by Moshe Malka — engineering leader in New York City. Studio work at Quentin.Code.

MIT © Moshe Malka