Skip to content
Ubiquev1.0.4
functionomegaratio
omegaratio(
x: array,
mar?: number,
dim?: 0 | 1
): number

Omega Ratio.

The Omega ratio is a measure of risk-return performance that divides the upside potential (gains) by the downside risk (losses) relative to a minimum acceptable return threshold.

Examples

Omega 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(omegaratio(x), 8.782608695652174, 4.391304347826087e-12);

Omega ratio with custom threshold

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

assertAlmostEquals(omegaratio([0.05, 0.03, 0.08, -0.02], 0.02), 2.5, 1.25e-12);

Omega ratio with negative threshold

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(omegaratio(x, -0.01), 70.75, 3.5375e-11);

Parameters

asset/portfolio returns

optional
mar: number

minimum acceptable return (def: 0)

optional
dim: 0 | 1

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

Return Type

number

Omega Ratio

omegaratio(
x: matrix,
mar?: number,
dim?: 0 | 1
): array | matrix

Omega Ratio.

The Omega ratio is a measure of risk-return performance that divides the upside potential (gains) by the downside risk (losses) relative to a minimum acceptable return threshold.

Examples

Omega 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(omegaratio(x), 8.782608695652174, 4.391304347826087e-12);

Omega ratio with custom threshold

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

assertAlmostEquals(omegaratio([0.05, 0.03, 0.08, -0.02], 0.02), 2.5, 1.25e-12);

Omega ratio with negative threshold

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(omegaratio(x, -0.01), 70.75, 3.5375e-11);

Parameters

asset/portfolio returns

optional
mar: number

minimum acceptable return (def: 0)

optional
dim: 0 | 1

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

Return Type

Omega Ratio