QuantileResultΒΆ
Defined in fynance.metrics
- class QuantileResult(quantile_returns, spread, counts, n_quantiles)[source]
Bases:
objectPer-bar quantile-portfolio returns of a factor.
Returned by
quantile_returns. On each bar the valid assets are bucketed inton_quantilesequal-count quantiles by factor value (bucket0is the lowest factor value, bucketn_quantiles - 1the 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 thanQvalid assets are a full row ofnp.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 (0on invalid bars).- n_quantilesint
Number of quantiles
Q.