perf_indexΒΆ

Defined in fynance.features.metrics

perf_index(X, base=100., axis=0, dtype=None)[source]

Compute performance of prices or index values along time axis.

Parameters:
Xnp.ndarray[dtype, ndim=1 or 2]

Time-series of prices or index values.

basefloat, optional

Initial value for measure the performance, default is 100.

axis{0, 1}, optional

Axis along wich the computation is done. Default is 0.

dtypenp.dtype, optional

The type of the output array. If dtype is not given, infer the data type from X input.

Returns:
np.ndarray[dtype, ndim=1 or 2]

Performances along time axis.

See also

perf_returns, perf_strat

Examples

>>> X = np.array([10., 12., 15., 14., 16., 18., 16.])
>>> perf_index(X, base=100.)
array([100., 120., 150., 140., 160., 180., 160.])