fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Sharpe, Sortino, and Information Ratio Intuition

Install and import#

bash
npm install fintech-algorithms
ts
import { sharpeSortinoAndInformationRatioIntuition } from "fintech-algorithms/foundations/financial-risk-and-performance-statistics/sharpe-sortino-and-information-ratio-intuition";

Signature#

sharpeSortinoAndInformationRatioIntuition(input)

Computes three reward-per-unit-of-risk ratios from the same series, each dividing an average by a different notion of risk.

Parameters#

NameTypeNotes
inputD00InputReads returns and benchmark, two aligned non-empty lists of finite periodic returns, frequency, the number of periods per year, riskFree, the per-period risk-free rate, target, the level below which downside is measured, and confidence, used when the loss series is prepared.

Returns#

D00Output

sharpe is the mean excess return over its own sample standard deviation, sortino swaps that denominator for the downside deviation around target, and informationRatio divides the mean active return against the benchmark by the sample standard deviation of that active series.

Errors#

  • When returns or benchmark is absent, empty, or holds a non-finite number — throws RangeError
  • When returns and benchmark differ in length, or hold fewer than two observations — throws RangeError
  • When frequency is zero or negative — throws RangeError
  • When the excess-return volatility, the downside deviation, or the active volatility is zero — throws RangeError
  • When confidence is absent, or outside the range zero to one — the engine reads it for every topic from A04 onward, including those that never use it — throws RangeError

Complexity: time O(n log n), space O(n).

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

input
{
  "returns": [0.01, -0.02, 0.015, -0.01, 0.03],
  "benchmark": [0.008, -0.01, 0.012, -0.006, 0.02],
  "frequency": 252,
  "target": 0,
  "confidence": 0.8,
  "riskFree": 0.0001,
  "weights": [0.6, 0.4],
  "covarianceMatrix": [
    [0.04, 0.01],
    [0.01, 0.09]
  ]
}

Call#

sharpeSortinoAndInformationRatioIntuition(input)

Returns#

object with 2 fields: sharpe, sortino

{
  "sharpe": 0.245,
  "sortino": 0.49
}

Diagrams#

Sharpe, Sortino, and Information Ratio Intuition — article hero
Sharpe, Sortino, and Information Ratio Intuition — calculation ledger
Sharpe, Sortino, and Information Ratio Intuition — concept anatomy
Sharpe, Sortino, and Information Ratio Intuition — failure boundary
Sharpe, Sortino, and Information Ratio Intuition — method map
Sharpe, Sortino, and Information Ratio Intuition — scenario contrast

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Financial Risk and Performance Statistics family#