percent_positive

Defined in fynance.features.metrics

percent_positive(X, axis=0)[source]

Fraction of strictly positive observations.

A simple robustness statistic: the share of periods with a positive return (the “hit rate” / percentage of winning periods).

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

Series of returns.

axis{0, 1}, optional

Axis of computation. Default 0.

Returns:
float or np.ndarray

Fraction in [0, 1] of strictly positive values.

Examples

>>> X = np.array([0.1, -0.2, 0.3, 0.0, 0.4])
>>> float(percent_positive(X))
0.6