function upsidepot
upsidepot(
x: array,
mar?: number,
dim?: 0 | 1,
): number

Upside Potential.

Average of positive returns, higher than a target return (MAR)

Examples

Upside potential for a single asset

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(upsidepot(x), 0.025249999999999998);

Upside potential with custom MAR

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

assertEquals(upsidepot([0.05, 0.03, 0.08, -0.02], 0.04), 0.065);

Upside potential for matrix (row-wise)

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];

const y = [-0.005, 0.081, 0.04, -0.037, -0.061, 0.058, -0.049, -0.021, 0.062, 0.058];
const matrix = [x, y];
assertEquals(upsidepot(matrix, 0, 0), [0.025249999999999998, 0.0598]);

Parameters

array of values

optional
mar: number

minimum acceptable return (def: 0)

optional
dim: 0 | 1

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

Return Type

number

Upside Potential

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

Upside Potential.

Average of positive returns, higher than a target return (MAR)

Examples

Upside potential for a single asset

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(upsidepot(x), 0.025249999999999998);

Upside potential with custom MAR

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

assertEquals(upsidepot([0.05, 0.03, 0.08, -0.02], 0.04), 0.065);

Upside potential for matrix (row-wise)

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];

const y = [-0.005, 0.081, 0.04, -0.037, -0.061, 0.058, -0.049, -0.021, 0.062, 0.058];
const matrix = [x, y];
assertEquals(upsidepot(matrix, 0, 0), [0.025249999999999998, 0.0598]);

Parameters

array of values

optional
mar: number

minimum acceptable return (def: 0)

optional
dim: 0 | 1

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

Return Type

Upside Potential