function calmarratio
calmarratio(
x: array,
frisk?: number,
t?: number,
dim?: 0 | 1,
): number

Calmar Ratio.

A risk-adjusted measure like Sharpe ratio that uses maximum drawdown instead of standard deviation for risk. Calmar Ratio = (Annualized Return - Risk Free Rate) / Maximum Drawdown

Examples

Single array of returns

import { assertEquals } 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];
assertEquals(calmarratio(x, 0, 12), 16.70104871897814);

Matrix of returns

import { assertEquals } 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];
assertEquals(calmarratio([x1, x2], 0, 12), [13.690375850324857, 25.379052966087876]);

Different risk-free rate

import { assertEquals } 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];

assertEquals(calmarratio(x, 0.02, 12), 15.272477290406712);

Parameters

Asset/portfolio returns

optional
frisk: number

Annual free-risk rate (def: 0)

optional
t: number

Frequency of data: 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (def: 252)

optional
dim: 0 | 1

Dimension 0: row, 1: column (def: 0)

Return Type

number

Calmar Ratio

Throws

If input arguments must be an array or matrix

calmarratio(
x: matrix,
frisk?: number,
t?: number,
dim?: 0 | 1,
): array | matrix

Calmar Ratio.

A risk-adjusted measure like Sharpe ratio that uses maximum drawdown instead of standard deviation for risk. Calmar Ratio = (Annualized Return - Risk Free Rate) / Maximum Drawdown

Examples

Single array of returns

import { assertEquals } 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];
assertEquals(calmarratio(x, 0, 12), 16.70104871897814);

Matrix of returns

import { assertEquals } 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];
assertEquals(calmarratio([x1, x2], 0, 12), [13.690375850324857, 25.379052966087876]);

Different risk-free rate

import { assertEquals } 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];

assertEquals(calmarratio(x, 0.02, 12), 15.272477290406712);

Parameters

Asset/portfolio returns

optional
frisk: number

Annual free-risk rate (def: 0)

optional
t: number

Frequency of data: 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (def: 252)

optional
dim: 0 | 1

Dimension 0: row, 1: column (def: 0)

Return Type

Calmar Ratio

Throws

If input arguments must be an array or matrix