activereturn(): number
Computes the active return.
Calculates the active return, which is the difference between the annualized return of an asset/portfolio and the annualized return of a benchmark.
Compute active return for a single portfolio and benchmark
Compute active return for a single portfolio and benchmark
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]; assertEquals(activereturn(x, y, 12), 0.0887245684020539);
Compute active return with simple mode
Compute active return with simple mode
import { assertEquals } from "jsr:@std/assert"; assertEquals(activereturn([0.05, 0.03, 0.08, -0.02], [0.04, 0.02, 0.06, -0.01], 12, "simple"), 0.09000000000000002);
Compute active return for matrix (row-wise)
Compute active return for matrix (row-wise)
import { assertEquals } from "jsr:@std/assert"; const matrix = [[0.01, 0.02], [0.03, -0.01], [0.05, 0.04]]; const benchmark = [0.005, 0.015, 0.025]; assertEquals(activereturn(matrix, benchmark, 12), [0.0002900781816017606, -0.07097748818797567, 0.500494477969688]);
activereturn(): array | matrix
Computes the active return.
Calculates the active return, which is the difference between the annualized return of an asset/portfolio and the annualized return of a benchmark.
Compute active return for a single portfolio and benchmark
Compute active return for a single portfolio and benchmark
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]; assertEquals(activereturn(x, y, 12), 0.0887245684020539);
Compute active return with simple mode
Compute active return with simple mode
import { assertEquals } from "jsr:@std/assert"; assertEquals(activereturn([0.05, 0.03, 0.08, -0.02], [0.04, 0.02, 0.06, -0.01], 12, "simple"), 0.09000000000000002);
Compute active return for matrix (row-wise)
Compute active return for matrix (row-wise)
import { assertEquals } from "jsr:@std/assert"; const matrix = [[0.01, 0.02], [0.03, -0.01], [0.05, 0.04]]; const benchmark = [0.005, 0.015, 0.025]; assertEquals(activereturn(matrix, benchmark, 12), [0.0002900781816017606, -0.07097748818797567, 0.500494477969688]);