style: format all files with prettier

This commit is contained in:
Seth Hobson
2026-01-19 17:07:03 -05:00
parent 8d37048deb
commit 56848874a2
355 changed files with 15215 additions and 10241 deletions

View File

@@ -7,6 +7,7 @@ model: inherit
You are a quantitative analyst specializing in algorithmic trading and financial modeling.
## Focus Areas
- Trading strategy development and backtesting
- Risk metrics (VaR, Sharpe ratio, max drawdown)
- Portfolio optimization (Markowitz, Black-Litterman)
@@ -15,6 +16,7 @@ You are a quantitative analyst specializing in algorithmic trading and financial
- Statistical arbitrage and pairs trading
## Approach
1. Data quality first - clean and validate all inputs
2. Robust backtesting with transaction costs and slippage
3. Risk-adjusted returns over absolute returns
@@ -22,6 +24,7 @@ You are a quantitative analyst specializing in algorithmic trading and financial
5. Clear separation of research and production code
## Output
- Strategy implementation with vectorized operations
- Backtest results with performance metrics
- Risk analysis and exposure reports

View File

@@ -20,13 +20,13 @@ Build robust, production-grade backtesting systems that avoid common pitfalls an
### 1. Backtesting Biases
| Bias | Description | Mitigation |
|------|-------------|------------|
| **Look-ahead** | Using future information | Point-in-time data |
| Bias | Description | Mitigation |
| ---------------- | ------------------------- | ----------------------- |
| **Look-ahead** | Using future information | Point-in-time data |
| **Survivorship** | Only testing on survivors | Use delisted securities |
| **Overfitting** | Curve-fitting to history | Out-of-sample testing |
| **Selection** | Cherry-picking strategies | Pre-registration |
| **Transaction** | Ignoring trading costs | Realistic cost models |
| **Overfitting** | Curve-fitting to history | Out-of-sample testing |
| **Selection** | Cherry-picking strategies | Pre-registration |
| **Transaction** | Ignoring trading costs | Realistic cost models |
### 2. Proper Backtest Structure
@@ -641,6 +641,7 @@ def calculate_metrics(returns: pd.Series, rf_rate: float = 0.02) -> Dict[str, fl
## Best Practices
### Do's
- **Use point-in-time data** - Avoid look-ahead bias
- **Include transaction costs** - Realistic estimates
- **Test out-of-sample** - Always reserve data
@@ -648,6 +649,7 @@ def calculate_metrics(returns: pd.Series, rf_rate: float = 0.02) -> Dict[str, fl
- **Monte Carlo analysis** - Understand uncertainty
### Don'ts
- **Don't overfit** - Limit parameters
- **Don't ignore survivorship** - Include delisted
- **Don't use adjusted data carelessly** - Understand adjustments

View File

@@ -20,12 +20,12 @@ Comprehensive risk measurement toolkit for portfolio management, including Value
### 1. Risk Metric Categories
| Category | Metrics | Use Case |
|----------|---------|----------|
| **Volatility** | Std Dev, Beta | General risk |
| **Tail Risk** | VaR, CVaR | Extreme losses |
| **Drawdown** | Max DD, Calmar | Capital preservation |
| **Risk-Adjusted** | Sharpe, Sortino | Performance |
| Category | Metrics | Use Case |
| ----------------- | --------------- | -------------------- |
| **Volatility** | Std Dev, Beta | General risk |
| **Tail Risk** | VaR, CVaR | Extreme losses |
| **Drawdown** | Max DD, Calmar | Capital preservation |
| **Risk-Adjusted** | Sharpe, Sortino | Performance |
### 2. Time Horizons
@@ -535,6 +535,7 @@ for metric, value in summary.items():
## Best Practices
### Do's
- **Use multiple metrics** - No single metric captures all risk
- **Consider tail risk** - VaR isn't enough, use CVaR
- **Rolling analysis** - Risk changes over time
@@ -542,6 +543,7 @@ for metric, value in summary.items():
- **Document assumptions** - Distribution, lookback, etc.
### Don'ts
- **Don't rely on VaR alone** - Underestimates tail risk
- **Don't assume normality** - Returns are fat-tailed
- **Don't ignore correlation** - Increases in stress