exposure_summary¶
Defined in fynance.metrics
- exposure_summary(W, period=252)[source]
One-shot summary of a book’s turnover and exposure.
Combines
annual_turnover,gross_exposureandnet_exposureinto the small set of numbers that describe how a book trades (churn) and sits (leverage, long/short bias) — the position -level analogue offynance.metrics.summary.summaryfor an equity curve.- Parameters:
- Warray_like
Weights held at each step, shape
(T,)or(T, N). A 1-D input is reshaped to(T, 1).- periodint, optional
Annualization factor (bars per year, 252 for daily). Default 252.
- Returns:
- dict
{'annual_turnover', 'mean_gross', 'max_gross', 'mean_net', 'min_net', 'max_net', 'pct_long', 'pct_short', 'pct_flat'}; thepct_*entries are the percentage of bars with net exposure> 0,< 0and== 0respectively (they sum to 100).
See also
annual_turnoverthe churn entry alone.
gross_exposurethe per-bar gross exposure series.
net_exposurethe per-bar net exposure series.
Examples
>>> import numpy as np >>> W = np.array([[1.0, 0.0], [0.5, -0.5], [-1.0, -1.0], [0.0, 0.0]]) >>> out = exposure_summary(W, period=252) >>> out['annual_turnover'], out['mean_gross'], out['mean_net'] (378.0, 1.0, -0.25) >>> out['pct_long'], out['pct_short'], out['pct_flat'] (25.0, 25.0, 50.0)