quantstats
Advanced tools
+10
-0
| Changelog | ||
| =========== | ||
| 0.0.79 | ||
| ------ | ||
| **Hotfix Release** | ||
| - Fixed critical circular import error that broke `import quantstats` (#499): | ||
| - Root cause: `utils.py` imported `stats` at module level, creating circular dependency | ||
| - Fix: Deferred `stats` import inside `to_prices()` and `group_returns()` functions | ||
| - Import now works correctly on fresh installations | ||
| 0.0.78 | ||
@@ -5,0 +15,0 @@ ------ |
+32
-11
| Metadata-Version: 2.4 | ||
| Name: quantstats | ||
| Version: 0.0.78 | ||
| Version: 0.0.79 | ||
| Summary: Portfolio analytics for quants | ||
@@ -49,6 +49,7 @@ Project-URL: Homepage, https://github.com/ranaroussi/quantstats | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://deepwiki.com/ranaroussi/quantstats) | ||
| [](https://github.com/ranaroussi/quantstats) | ||
@@ -249,2 +250,22 @@ [](https://twitter.com/aroussi) | ||
| ### Important: Period-Based vs Trade-Based Metrics | ||
| QuantStats analyzes **return series** (daily, weekly, monthly returns), not discrete trade data. This means: | ||
| - **Win Rate** = percentage of periods with positive returns | ||
| - **Consecutive Wins/Losses** = consecutive positive/negative return periods | ||
| - **Payoff Ratio** = average winning period return / average losing period return | ||
| - **Profit Factor** = sum of positive returns / sum of negative returns | ||
| These metrics are **valid and useful** for: | ||
| - Systematic/algorithmic strategies with regular rebalancing | ||
| - Analyzing return-series behavior over time | ||
| - Comparing strategies on a period-by-period basis | ||
| For **discretionary traders** with multi-day trades, these period-based metrics may differ from trade-level statistics. A single 5-day trade might span 3 positive days and 2 negative days - QuantStats would count these as 3 "wins" and 2 "losses" at the daily level. | ||
| This is consistent with how all return-based analytics work (Sharpe ratio, Sortino ratio, drawdown analysis, etc.) - they operate on return periods, not discrete trade entries/exits. | ||
| --- | ||
| In the meantime, you can get insights as to optional parameters for each method, by using Python's `help` method: | ||
@@ -280,11 +301,11 @@ | ||
| * [Python](https://www.python.org) >= 3.5+ | ||
| * [pandas](https://github.com/pydata/pandas) (tested to work with >=0.24.0) | ||
| * [numpy](http://www.numpy.org) >= 1.15.0 | ||
| * [scipy](https://www.scipy.org) >= 1.2.0 | ||
| * [matplotlib](https://matplotlib.org) >= 3.0.0 | ||
| * [seaborn](https://seaborn.pydata.org) >= 0.9.0 | ||
| * [tabulate](https://bitbucket.org/astanin/python-tabulate) >= 0.8.0 | ||
| * [yfinance](https://github.com/ranaroussi/yfinance) >= 0.1.38 | ||
| * [plotly](https://plot.ly/) >= 3.4.1 (optional, for using `plots.to_plotly()`) | ||
| * [Python](https://www.python.org) >= 3.10 | ||
| * [pandas](https://github.com/pydata/pandas) >= 1.5.0 | ||
| * [numpy](http://www.numpy.org) >= 1.24.0 | ||
| * [scipy](https://www.scipy.org) >= 1.11.0 | ||
| * [matplotlib](https://matplotlib.org) >= 3.7.0 | ||
| * [seaborn](https://seaborn.pydata.org) >= 0.13.0 | ||
| * [tabulate](https://bitbucket.org/astanin/python-tabulate) >= 0.9.0 | ||
| * [yfinance](https://github.com/ranaroussi/yfinance) >= 0.2.40 | ||
| * [plotly](https://plot.ly/) >= 5.0.0 (optional, for using `plots.to_plotly()`) | ||
@@ -291,0 +312,0 @@ ## Questions? |
@@ -24,3 +24,2 @@ #!/usr/bin/env python | ||
| from ._compat import safe_yfinance_download | ||
| from . import stats as _stats | ||
| from ._compat import safe_concat, safe_resample | ||
@@ -317,2 +316,4 @@ import inspect | ||
| """ | ||
| from . import stats as _stats # deferred import to avoid circular dependency | ||
| # Clean returns data by filling NaN and replacing infinite values | ||
@@ -436,2 +437,4 @@ returns = returns.copy().fillna(0).replace([_np.inf, -_np.inf], float("NaN")) | ||
| if compounded: | ||
| from . import stats as _stats # deferred import to avoid circular dependency | ||
| # Use compounded returns calculation | ||
@@ -438,0 +441,0 @@ return returns.groupby(groupby).apply(_stats.comp) |
@@ -1,1 +0,1 @@ | ||
| version = "0.0.78" | ||
| version = "0.0.79" |
+31
-10
@@ -1,5 +0,6 @@ | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://pypi.python.org/pypi/quantstats) | ||
| [](https://deepwiki.com/ranaroussi/quantstats) | ||
| [](https://github.com/ranaroussi/quantstats) | ||
@@ -200,2 +201,22 @@ [](https://twitter.com/aroussi) | ||
| ### Important: Period-Based vs Trade-Based Metrics | ||
| QuantStats analyzes **return series** (daily, weekly, monthly returns), not discrete trade data. This means: | ||
| - **Win Rate** = percentage of periods with positive returns | ||
| - **Consecutive Wins/Losses** = consecutive positive/negative return periods | ||
| - **Payoff Ratio** = average winning period return / average losing period return | ||
| - **Profit Factor** = sum of positive returns / sum of negative returns | ||
| These metrics are **valid and useful** for: | ||
| - Systematic/algorithmic strategies with regular rebalancing | ||
| - Analyzing return-series behavior over time | ||
| - Comparing strategies on a period-by-period basis | ||
| For **discretionary traders** with multi-day trades, these period-based metrics may differ from trade-level statistics. A single 5-day trade might span 3 positive days and 2 negative days - QuantStats would count these as 3 "wins" and 2 "losses" at the daily level. | ||
| This is consistent with how all return-based analytics work (Sharpe ratio, Sortino ratio, drawdown analysis, etc.) - they operate on return periods, not discrete trade entries/exits. | ||
| --- | ||
| In the meantime, you can get insights as to optional parameters for each method, by using Python's `help` method: | ||
@@ -231,11 +252,11 @@ | ||
| * [Python](https://www.python.org) >= 3.5+ | ||
| * [pandas](https://github.com/pydata/pandas) (tested to work with >=0.24.0) | ||
| * [numpy](http://www.numpy.org) >= 1.15.0 | ||
| * [scipy](https://www.scipy.org) >= 1.2.0 | ||
| * [matplotlib](https://matplotlib.org) >= 3.0.0 | ||
| * [seaborn](https://seaborn.pydata.org) >= 0.9.0 | ||
| * [tabulate](https://bitbucket.org/astanin/python-tabulate) >= 0.8.0 | ||
| * [yfinance](https://github.com/ranaroussi/yfinance) >= 0.1.38 | ||
| * [plotly](https://plot.ly/) >= 3.4.1 (optional, for using `plots.to_plotly()`) | ||
| * [Python](https://www.python.org) >= 3.10 | ||
| * [pandas](https://github.com/pydata/pandas) >= 1.5.0 | ||
| * [numpy](http://www.numpy.org) >= 1.24.0 | ||
| * [scipy](https://www.scipy.org) >= 1.11.0 | ||
| * [matplotlib](https://matplotlib.org) >= 3.7.0 | ||
| * [seaborn](https://seaborn.pydata.org) >= 0.13.0 | ||
| * [tabulate](https://bitbucket.org/astanin/python-tabulate) >= 0.9.0 | ||
| * [yfinance](https://github.com/ranaroussi/yfinance) >= 0.2.40 | ||
| * [plotly](https://plot.ly/) >= 5.0.0 (optional, for using `plots.to_plotly()`) | ||
@@ -242,0 +263,0 @@ ## Questions? |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
341459
0.84%7729
0.01%