sigmaquant.performance.metrics.hit_rate#

sigmaquant.performance.metrics.hit_rate(returns)#

Compute the hit rate.

The hit rate is defined as the fraction of periods with strictly positive returns.

Parameters:

returns – Sequence of periodic returns or PnL values.

Returns:

Hit rate, i.e. the proportion of observations where the return (or PnL) is greater than zero.

Return type:

float

Notes

The hit rate is defined as:

\[\text{Hit Rate} = \frac{1}{T} \sum_{t=1}^T \mathbb{I}(r_t > 0)\]

where \(\mathbb{I}(\cdot)\) is the indicator function and \(r_t\) are the periodic returns or PnL values.

NaN values are ignored.