JSON Risk App released

JSON Risk App makes the features of the JSON Risk library available in a sleek web interface.

  • support for all JSON risk instruments and features
  • data backend with storage of market data, portfolios, scenarios, timeseries and more
  • support for ad-hoc calculations in the browser on client hardware
  • support for batch calculations on the server hardware
  • straightforward multi-tenant and cluster setup
  • simple identity and access management supporting passwordless login
  • flexible extension framework

Open demo instance Download View Code on github

A JSON / JavaScript financial risk and pricing library

Key reasons for a JavaScript financial risk and pricing library

Here are three reasons for using a financial risk and pricing library in JavaScript.

  • As one of the key technologies of the web, JavaScript is ubiquitous and heavily supported by the leading tech companies and by a large open source community.
  • Web applications required to have access to financial math logic both on the client and on the server side are largely bound to use JavaScript, as JavaScript is the only programming language natively supported in all major web browsers.
  • With JSON being a native subset of JavaScript, data interchange in JavaScript applications is almost as easy as calling the Javascript JSON.parse and JSON.stringify functions, making any parsing and serialization logic obsolete for most applications.

How to include in node.js:

    var JsonRisk=require('path/to/json_risk.js');

How to include in browser:

    <script src="path/to/json_risk.min.js"></script>

Exemplary use - present value of a bond

var bond= {
    maturity: new Date(2028,0,1),           //final maturity of the bond
    notional: 100.0,                        //notional
    fixed_rate: 0.05,                       //interest rate 5%
    tenor: 12,                              //yearly interest payments
    bdc: "following",                       //business day convention
    dcc: "act/act",                         //day count convention
    calendar: "TARGET"                      //holiday calendar

var discount_curve={
    labels: ["1Y", "2Y", "3Y", "10Y"],      //times encoded as labels
    zcs: [0.01, 0.02, 0.025, 0.1]           //zero-coupon rates act/365 annual compounding

var spread_curve={
    labels: ["1Y", "2Y", "3Y", "10Y"],      //times encoded as labels
    zcs: [0.01, 0.011, 0.012, 0.11]         //zero-coupon rates act/365 annual compounding

JsonRisk.valuation_date=new Date(2019,11,31);   //as-of date for calculation

var present_value=JsonRisk.pricer_bond(bond,discount_curve, spread_curve);

See the documentation for details and examples.

Library features

Supported instruments

JSON Risk supports the instrument types below:

  • Fixed income instruments
    • Fixed rate bonds
    • Floating rate bonds
    • Interest rate swaps
    • FX spot and forwards contracts
  • Callable fixed income instruments
    • Plain vanilla swaptions
    • Single callable and multicallable bond
  • Equity instruments
    • Equity

Callable bond pricing is implemented with a Linear Gauss Markov (or, equivalently, Hull-White) model in the spirit of Hagan, Patrick; EVALUATING AND HEDGING EXOTIC SWAP INSTRUMENTS VIA LGM (2019).


  • bullet repayment upon maturity
  • step-down amortization (regular repayments)
  • interest capitalization (allowing to define annuity-type profiles)

Schedule generation

  • long and short implicit stubs (e.g., forward and backward roll out)
  • explicit initial and final stubs
  • completely independent generation of
    • interest rate schedule
    • fixing schedule for floating rate instruments
    • repayment schedule for amortizing instruments

Day count conventions

JSON Risk supports the day count conventions

  • act/act according to the ISDA 2006 rules in section 4.16 (b), also recognized by JSON Risk as actual/actual or a/a
  • act/365 according to the ISDA 2006 rules in section 4.16 (d), also recognized by JSON Risk as actual/365, a/365, actual/365 (fixed) or act/365 (fixed)
  • act/360 according to the ISDA 2006 rules in section 4.16 (e), also recognized by JSON Risk as actual/360, a/360, or french
  • 30u/360 according to the ISDA 2006 rules in section 4.16 (f), also recognized by JSON Risk as 30/360, bond basis, or bond
  • 30e/360 according to the ISDA 2006 rules in section 4.16 (g), also recognized by JSON Risk as eurobond basis or eurobond
  • 30g/360 according to the ISDA 2006 rules in section 4.16 (h), also recognized by JSON Risk as 30e/360 (ISDA) or 30/360 German

JSON Risk is case insensitive when parsing day count conventions on instrument data.

Business day conventions

JSON Risk supports the business day conventions

  • unadjusted,
  • following,
  • modified following,
  • preceding.


JSON Risk supports one built-in calendar (TARGET) as of now.

Adding custom calendars is as simple as

var holidays = [
            new Date(2018,11,1), //javascript date object
            "2018/12/12",        //valid YYYY/MM/DD date string
            "2019-12-01",        //valid YYYY/MM/DD date string
            "01.12.2020"         //valid DD.MM.YYYY date string

JsonRisk.add_calendar("CUSTOM", holidays);

Saturdays and Sundays are considered holidays in all custom calendars.


  • The Instruments guide summarizes supported instruments and features
  • The Fields guide contains a complete list of JSON fields for describing instrument terms and conditions
  • The Data types guide explains the data types used in the JSON fields
  • The Parameters guide explains how to represent parameters for valuation, e.g., yield curves and surfaces.
  • The Schedule generation guide explains how JSON risk generates schedules for interest rate instruments.

Free and open source

JSON risk is published under the MIT License.

View code on GitHub (Library)

View code on GitHub (App)




Minified Library


App (.tar.gz)


App (.tar.bz2)


App (.zip)


This project is maintained by