Add make docs commands for html build
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Risk Metrics
|
||||
|
||||
Time-series utilities for risk analysis and mean-reversion signals.
|
||||
Time-series utilities for risk analysis, mean-reversion detection, and bootstrapped P&L distributions.
|
||||
|
||||
## Quick Start
|
||||
## Quick start
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
@@ -10,17 +10,27 @@ from optimizr import (
|
||||
hurst_exponent_py,
|
||||
estimate_half_life_py,
|
||||
bootstrap_returns_py,
|
||||
compute_risk_metrics_py,
|
||||
)
|
||||
|
||||
returns = np.random.randn(2000) * 0.01
|
||||
print("Hurst:", hurst_exponent_py(returns))
|
||||
print("Half-life:", estimate_half_life_py(returns))
|
||||
|
||||
metrics = compute_risk_metrics_py(returns)
|
||||
print(metrics) # mean, std, skew, kurtosis, sharpe
|
||||
|
||||
bootstrapped = bootstrap_returns_py(returns, n_samples=1000)
|
||||
print("Bootstrap sample shape:", len(bootstrapped))
|
||||
print("Bootstrap samples:", len(bootstrapped))
|
||||
```
|
||||
|
||||
## Notes
|
||||
- Input arrays should be 1D NumPy arrays of returns.
|
||||
- Half-life is useful for calibrating mean-reversion strategies.
|
||||
- Bootstrap utilities help estimate drawdown and VaR distributions.
|
||||
## Rolling and integration helpers
|
||||
|
||||
- Use `rolling_hurst_exponent_py` and `rolling_half_life_py` (from `timeseries_utils`) for sliding-window diagnostics on trading pairs.
|
||||
- Combine with HMM: feed rolling statistics as features for regime detection.
|
||||
- Pair with DE/Grid search: optimize strategy thresholds while computing half-life inside the objective.
|
||||
|
||||
## Practical guidance
|
||||
- Input should be 1D NumPy arrays of returns; winsorize extreme tails before estimating Hurst/half-life for stability.
|
||||
- Half-life helps size holding periods for mean-reversion trades; revisit whenever volatility regime changes.
|
||||
- Bootstrap outputs can feed VaR/ES estimates; increase `n_samples` for tighter confidence bands.
|
||||
|
||||
Reference in New Issue
Block a user