Skip to content
Ubiquev1.0.4
functionannadjsharpe
annadjsharpe(
x: array,
frisk?: number,
t?: number,
mode?: string,
dim?: 0 | 1
): number

Computes the Annualized Adjusted Sharpe Ratio.

The Adjusted Sharpe Ratio accounts for skewness and kurtosis with a penalty factor for negative skewness and excess kurtosis.

Formula: ASR = SR × [1 + (S / 6) × SR - ((K - 3) / 24) × SR²] where:

  • SR = Annualized Sharpe Ratio (Annualized Return / Annualized Risk)
  • S = Skewness
  • K = Kurtosis

Examples

Annualized adjusted Sharpe ratio for a single asset

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];
assertAlmostEquals(annadjsharpe(x, 0, 12), 3.735901391809159, 1e-13);

Annualized adjusted Sharpe with different parameters

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

assertAlmostEquals(annadjsharpe(x, 0.02, 12, 'simple'), 3.0015320352820116, 1e-13);

Annualized adjusted Sharpe for multiple assets (matrix)

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x1 = [0.003, 0.026, 0.015, -0.009, 0.014];
const x2 = [0.024, 0.015, 0.066, -0.014, 0.039];
const expected = [3.142808756232851, 5.030879310639453];
(annadjsharpe([x1, x2], 0, 12) as number[]).forEach((v, i) => assertAlmostEquals(v, expected[i], 1e-12));

Parameters

Asset/portfolio returns

optional
frisk: number

Annual risk-free rate

optional
t: number

Data frequency: 252 (daily), 52 (weekly), 12 (monthly), 4 (quarterly)

optional
mode: string

Return mode: 'geometric' or 'simple'

optional
dim: 0 | 1

Dimension to operate on (0: row-wise, 1: column-wise)

Return Type

number

The computed Annualized Adjusted Sharpe Ratio

Throws

If the input is invalid

annadjsharpe(
x: matrix,
frisk?: number,
t?: number,
mode?: string,
dim?: 0 | 1
): array | matrix

Computes the Annualized Adjusted Sharpe Ratio.

The Adjusted Sharpe Ratio accounts for skewness and kurtosis with a penalty factor for negative skewness and excess kurtosis.

Formula: ASR = SR × [1 + (S / 6) × SR - ((K - 3) / 24) × SR²] where:

  • SR = Annualized Sharpe Ratio (Annualized Return / Annualized Risk)
  • S = Skewness
  • K = Kurtosis

Examples

Annualized adjusted Sharpe ratio for a single asset

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];
assertAlmostEquals(annadjsharpe(x, 0, 12), 3.735901391809159, 1e-13);

Annualized adjusted Sharpe with different parameters

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

assertAlmostEquals(annadjsharpe(x, 0.02, 12, 'simple'), 3.0015320352820116, 1e-13);

Annualized adjusted Sharpe for multiple assets (matrix)

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

const x1 = [0.003, 0.026, 0.015, -0.009, 0.014];
const x2 = [0.024, 0.015, 0.066, -0.014, 0.039];
const expected = [3.142808756232851, 5.030879310639453];
(annadjsharpe([x1, x2], 0, 12) as number[]).forEach((v, i) => assertAlmostEquals(v, expected[i], 1e-12));

Parameters

Asset/portfolio returns

optional
frisk: number

Annual risk-free rate

optional
t: number

Data frequency: 252 (daily), 52 (weekly), 12 (monthly), 4 (quarterly)

optional
mode: string

Return mode: 'geometric' or 'simple'

optional
dim: 0 | 1

Dimension to operate on (0: row-wise, 1: column-wise)

Return Type

The computed Annualized Adjusted Sharpe Ratio

Throws

If the input is invalid