QuantileResultΒΆ

Defined in fynance.metrics

class QuantileResult(quantile_returns, spread, counts, n_quantiles)[source]

Bases: object

Per-bar quantile-portfolio returns of a factor.

Returned by quantile_returns. On each bar the valid assets are bucketed into n_quantiles equal-count quantiles by factor value (bucket 0 is the lowest factor value, bucket n_quantiles - 1 the highest) and the equal-weighted mean forward return of each bucket is recorded.

Attributes:
quantile_returnsnp.ndarray[np.float64, ndim=2]

Shape (T, Q). Mean forward return per per-bar factor quantile. Bars with fewer than Q valid assets are a full row of np.nan.

spreadnp.ndarray[np.float64, ndim=1]

Shape (T,). Top-minus-bottom quantile return (quantile_returns[:, -1] - quantile_returns[:, 0]), the long-short return of the factor.

countsnp.ndarray[np.int64, ndim=2]

Shape (T, Q). Number of assets in each bucket (0 on invalid bars).

n_quantilesint

Number of quantiles Q.