Skip to content

feat: QuantStats parity 지표 추가#5

Merged
mingi3314 merged 1 commit into
mainfrom
feat/quantstats-parity-metrics
May 12, 2026
Merged

feat: QuantStats parity 지표 추가#5
mingi3314 merged 1 commit into
mainfrom
feat/quantstats-parity-metrics

Conversation

@mingi3314

@mingi3314 mingi3314 commented May 11, 2026

Copy link
Copy Markdown
Collaborator

리뷰어가 작업내용을 이해하기 쉽도록 아래내용을 상세히 작성해주세요.

Changes

  • 미구현 지표들을 alphastats.stats에 추가했습니다.
  • 이제 아래의 모든 지표를 지원합니다
- [x] Risk-Free Rate
- [x] Time in Market
- [x] Cumulative Return
- [x] CAGR﹪
- [x] Sharpe
- [x] Prob. Sharpe Ratio
- [x] Smart Sharpe
- [x] Sortino
- [x] Smart Sortino
- [x] Sortino/√2
- [x] Smart Sortino/√2
- [x] Omega
- [x] Max Drawdown
- [x] Longest DD Days
- [x] Volatility (ann.)
- [x] R^2
- [x] Information Ratio
- [x] Calmar
- [x] Skew
- [x] Kurtosis
- [x] Expected Daily
- [x] Expected Monthly
- [x] Expected Yearly
- [x] Kelly Criterion
- [x] Risk of Ruin
- [x] Daily Value-at-Risk
- [x] Expected Shortfall (cVaR)
- [x] Max Consecutive Wins
- [x] Max Consecutive Losses
- [x] Gain/Pain Ratio
- [x] Gain/Pain (1M)
- [x] Payoff Ratio
- [x] Profit Factor
- [x] Common Sense Ratio
- [x] CPC Index
- [x] Tail Ratio
- [x] Outlier Win Ratio
- [x] Outlier Loss Ratio
- [x] MTD
- [x] 3M
- [x] 6M
- [x] YTD
- [x] 1Y
- [x] 3Y (ann.)
- [x] 5Y (ann.)
- [x] 10Y (ann.)
- [x] All-time (ann.)
- [x] Best Day
- [x] Worst Day
- [x] Best Month
- [x] Worst Month
- [x] Best Year
- [x] Worst Year
- [x] Avg. Drawdown
- [x] Avg. Drawdown Days
- [x] Recovery Factor
- [x] Ulcer Index
- [x] Serenity Index
- [x] Avg. Up Month
- [x] Avg. Down Month
- [x] Win Days
- [x] Win Month
- [x] Win Quarter
- [x] Win Year
- [x] Beta
- [x] Alpha
- [x] Correlation
- [x] Treynor Ratio
  • QuantStats에 존재하는 지표는 QuantStats의 public API와 기본 동작을 우선하도록 맞췄습니다.
    • probabilistic_sharpe_ratio/psr는 QuantStats와 같은 rf, periods, annualize, smart 인터페이스로 변경했습니다.
    • information_ratio는 QuantStats와 동일하게 기본값을 비연율화 결과로 맞췄습니다.
    • cagr, calmar, skew, kurtosis, cpc_index 등 parity 과정에서 발견된 계산 차이를 QuantStats 기준으로 보정했습니다.
  • quantstats>=0.0.81을 dev dependency로 추가했습니다.
  • tests/test_quantstats_parity.py를 추가해 가능한 지표들을 QuantStats 결과와 직접 비교하도록 했습니다.

Test

💡 진행한 테스트에 대해서 구체적으로 작성해주세요.

  • uv run pytest -q
    • 167 passed
  • uv run ruff check .
    • 통과
  • uv run mypy alphastats tests
    • 통과
  • pre-commit hook
    • ruff, ruff-format, mypy, commit message validation 통과

Task Link

💡 관련 페이지 링크를 작성해주세요.

  • 없음

@mingi3314
mingi3314 force-pushed the feat/quantstats-parity-metrics branch from 28884a4 to fa33f29 Compare May 12, 2026 00:23
@mingi3314
mingi3314 requested a review from chado13 May 12, 2026 00:27
@mingi3314 mingi3314 self-assigned this May 12, 2026
@alphaprime-dev-discord

Copy link
Copy Markdown

@mingi3314
mingi3314 merged commit f295748 into main May 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants