From e21a384af9d755094b71343c8f28dbd1a478293e Mon Sep 17 00:00:00 2001 From: Matteo Manzi <33622899+matteoettam09@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:57:03 +0200 Subject: [PATCH 01/13] fix(requirements): freeze quantstats to 0.0.59 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 51b95ce..9cf7b62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ numpy pandas py_expression_eval pyarrow -quantstats +quantstats==0.0.59 requests tqdm yfinance From c8a576fea46949fe37b0896f090e72f1897021ec Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Mon, 4 Sep 2023 21:55:09 +0000 Subject: [PATCH 02/13] fix: quantstats v --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9cf7b62..1c1787e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ numpy pandas py_expression_eval pyarrow -quantstats==0.0.59 +quantstats==0.0.62 requests tqdm yfinance From 5fbf02a4115b1c5046798c88195755b86ea6fa59 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Mon, 4 Sep 2023 22:06:57 +0000 Subject: [PATCH 03/13] fix: quantstat version --- backtest/export/quants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backtest/export/quants.py b/backtest/export/quants.py index a7e979f..8fb0158 100644 --- a/backtest/export/quants.py +++ b/backtest/export/quants.py @@ -110,6 +110,6 @@ def finalize(self) -> None: if self.html_output_file is not None: if self.auto_override or not os.path.exists(self.html_output_file): - quantstats.reports.html(returns, benchmark=benchmark, output=True, download_filename=self.html_output_file) + quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file) else: - print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) + print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) \ No newline at end of file From 882db88cce2b8d86ba3f0d1155a5357231dc7d25 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Mon, 4 Sep 2023 22:41:46 +0000 Subject: [PATCH 04/13] fix: ipyth not in quantstats --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1c1787e..9e35e63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ yfinance pytest python-dotenv colorama +ipython==8.15.0 \ No newline at end of file From ab750d62b255794639f696247f885477fd6b137c Mon Sep 17 00:00:00 2001 From: Matteo Manzi <33622899+matteoettam09@users.noreply.github.com> Date: Tue, 5 Sep 2023 00:57:12 +0200 Subject: [PATCH 05/13] Quantstats update fix (#12) * fix(requirements): upgrade quantstats * fix: quantstats function call * fix(requirements): add missing `ipython` required by quantstats --- backtest/export/quants.py | 4 ++-- requirements.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backtest/export/quants.py b/backtest/export/quants.py index a7e979f..8fb0158 100644 --- a/backtest/export/quants.py +++ b/backtest/export/quants.py @@ -110,6 +110,6 @@ def finalize(self) -> None: if self.html_output_file is not None: if self.auto_override or not os.path.exists(self.html_output_file): - quantstats.reports.html(returns, benchmark=benchmark, output=True, download_filename=self.html_output_file) + quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file) else: - print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) + print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9cf7b62..9e35e63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,10 +5,11 @@ numpy pandas py_expression_eval pyarrow -quantstats==0.0.59 +quantstats==0.0.62 requests tqdm yfinance pytest python-dotenv colorama +ipython==8.15.0 \ No newline at end of file From 2f3cf07579d70b26883a3807436363bd3ca86f9c Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 5 Sep 2023 17:30:38 +0000 Subject: [PATCH 06/13] fix: no active return dump --- backtest/export/quants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backtest/export/quants.py b/backtest/export/quants.py index 8fb0158..7c843df 100644 --- a/backtest/export/quants.py +++ b/backtest/export/quants.py @@ -110,6 +110,6 @@ def finalize(self) -> None: if self.html_output_file is not None: if self.auto_override or not os.path.exists(self.html_output_file): - quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file) + quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file, active_returns=False) else: print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) \ No newline at end of file From 900ae9f2d71b37aef339c03f588e4e7bd84306ea Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 09:25:35 +0000 Subject: [PATCH 07/13] fix: setup and requirements --- requirements.txt | 27 +++++++++++++-------------- setup.py | 8 ++++---- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9e35e63..0f56a54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,14 @@ -click -python-dateutil -influxdb -numpy -pandas -py_expression_eval -pyarrow +click >= 8.0, <8.1.2 +pandas >=1.5, <2.1 +python-dateutil >=2.8.2, <2.8.3 +tqdm = >=4.48.0, <4.65.0 +influxdb >=5.2.2, <5.3.1 +numpy >=1.23.0, <1.25.0 +py_expression_eval >=0.3.9, <0.3.14 +pyarrow >=10.0.1, <12.0.1 quantstats==0.0.62 -requests -tqdm -yfinance -pytest -python-dotenv -colorama -ipython==8.15.0 \ No newline at end of file +pytest >=7.1.0, <7.3.0 +yfinance >=0.3.9, <0.3.14 +python-dotenv >=0.20, <1.0.0 +colorama >=0.4.4, <0.4.6 +ipython==8.15.0 diff --git a/setup.py b/setup.py index 8650b05..c1cf6c0 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,9 @@ setup( name='crunchdao-backtest', version='1.0.1', - description='Simple backtester', - author='Enzo CACERES', - author_email='caceresenzo1502@gmail.com', + description='CrunchDAO backtester', + author='Enzo Caceres, CrunchDAO', + author_email='enzo.caceres@crunchdao.com', packages=find_packages(), install_requires=requirements, -) +) \ No newline at end of file From 3ecd069e913229d82b1654dcdd1797fd74d3da54 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 09:27:30 +0000 Subject: [PATCH 08/13] fix: typo --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0f56a54..28ac373 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ click >= 8.0, <8.1.2 pandas >=1.5, <2.1 python-dateutil >=2.8.2, <2.8.3 -tqdm = >=4.48.0, <4.65.0 +tqdm >=4.48.0, <4.65.0 influxdb >=5.2.2, <5.3.1 numpy >=1.23.0, <1.25.0 py_expression_eval >=0.3.9, <0.3.14 From 9d83a01b76c1d9ce735bb08b20c53154652cdf10 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 09:32:02 +0000 Subject: [PATCH 09/13] fix: seaborn quantstats deprecation fix. https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751 --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 28ac373..8c2648d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,8 @@ py_expression_eval >=0.3.9, <0.3.14 pyarrow >=10.0.1, <12.0.1 quantstats==0.0.62 pytest >=7.1.0, <7.3.0 -yfinance >=0.3.9, <0.3.14 +yfinance >=0.2.24, <0.2.27 python-dotenv >=0.20, <1.0.0 colorama >=0.4.4, <0.4.6 ipython==8.15.0 +seaborn>=0.9.0, <0.11.0 \ No newline at end of file From 8627980c8d7ebbdee41bf3c6d463f60166d943a6 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 09:51:41 +0000 Subject: [PATCH 10/13] fix: seaborn deprecated --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8c2648d..1ff0ae0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,4 @@ yfinance >=0.2.24, <0.2.27 python-dotenv >=0.20, <1.0.0 colorama >=0.4.4, <0.4.6 ipython==8.15.0 -seaborn>=0.9.0, <0.11.0 \ No newline at end of file +seaborn>=0.11.0, <0.12.0 \ No newline at end of file From 14086f383c15b2d62e6a03c6350fad2adc7cb9fb Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 10:10:26 +0000 Subject: [PATCH 11/13] fix: pandas cross-compatibility https://appdividend.com/2023/07/31/attributeerror-dataframe-object-has-no-attribute-iteritems/ --- backtest/export/quants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backtest/export/quants.py b/backtest/export/quants.py index 7c843df..3588d63 100644 --- a/backtest/export/quants.py +++ b/backtest/export/quants.py @@ -110,6 +110,7 @@ def finalize(self) -> None: if self.html_output_file is not None: if self.auto_override or not os.path.exists(self.html_output_file): + returns.iteritems = returns.items quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file, active_returns=False) else: print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) \ No newline at end of file From 6de302172aef66d0cd3d3d18c884e0f4354317a8 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 10:25:26 +0000 Subject: [PATCH 12/13] fix: quantstats incompatible with pandas 2 --- backtest/export/quants.py | 1 - requirements.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/backtest/export/quants.py b/backtest/export/quants.py index 3588d63..7c843df 100644 --- a/backtest/export/quants.py +++ b/backtest/export/quants.py @@ -110,7 +110,6 @@ def finalize(self) -> None: if self.html_output_file is not None: if self.auto_override or not os.path.exists(self.html_output_file): - returns.iteritems = returns.items quantstats.reports.html(returns, benchmark=benchmark, output=self.html_output_file, active_returns=False) else: print(f"[warning] {self.html_output_file} already exists", file=sys.stderr) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1ff0ae0..c4dfa63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ click >= 8.0, <8.1.2 -pandas >=1.5, <2.1 +pandas >=1.5, <2.0.0 python-dateutil >=2.8.2, <2.8.3 tqdm >=4.48.0, <4.65.0 influxdb >=5.2.2, <5.3.1 From 46ddf162678fe60c5a6504e3eae726d0b0f21838 Mon Sep 17 00:00:00 2001 From: matteoettam09 Date: Tue, 12 Sep 2023 10:35:41 +0000 Subject: [PATCH 13/13] fix: review requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c4dfa63..06fe716 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ tqdm >=4.48.0, <4.65.0 influxdb >=5.2.2, <5.3.1 numpy >=1.23.0, <1.25.0 py_expression_eval >=0.3.9, <0.3.14 -pyarrow >=10.0.1, <12.0.1 +pyarrow >=11.0, <12.0 quantstats==0.0.62 pytest >=7.1.0, <7.3.0 yfinance >=0.2.24, <0.2.27