279 Commits

Author SHA1 Message Date
S. Alexander Zaman
0ce24d80b1 DOC: fix pip3 install command (#878)
quote brackets in pip3 command
2023-01-15 12:37:16 +01:00
kernc
8c13d005a2 DOC: Fix Shields.io build status badge
Ref: https://github.com/badges/shields/issues/8671
2022-12-21 04:52:57 +01:00
Kernc
1c12381d66 BUG: Fix _Data.__repr__ to show current OHLC values 2022-12-13 14:55:47 +01:00
Syed Kawish Qayyum
dfba4615e8 REF: Fix pandas deprecation warning (#725)
* REF: Fix pandas deprecation warning

> FutureWarning: Passing method to Int64Index.getloc
> Use index.get_indexer([item], method=...) instead.

* Update backtesting/_plotting.py
2022-12-12 19:49:18 +01:00
Kernc
d5db8bed50 CI: Pin scikit-learn<=1.1.3 due to broken scikit-optimize 2022-12-12 19:29:25 +01:00
Kernc
04b2217a55 BUG: Fix sign in Kelly Criterion (fixup d47185f9e)
https://github.com/kernc/backtesting.py/pull/640#discussion_r1045165960
2022-12-12 19:08:51 +01:00
Kernc
e4b16f9a5a CI: Pin ruff==0.0.160 until it stabilizes 2022-12-12 18:56:02 +01:00
Kernc
39b57b9289 ENH: Add parameter Backtest.plot(plot_trades=)
Closes https://github.com/kernc/backtesting.py/issues/647
2022-12-12 01:09:08 +01:00
Kernc
d7eaa459f8 DOC: Mention that different lengths of indicators affect results
Closes https://github.com/kernc/backtesting.py/issues/674
2022-12-12 01:09:08 +01:00
Kernc
3bccbd9f19 BUG: Better is_arraylike check for indicators
Avoids computing argmax on an empty sequence.

Fixes https://github.com/kernc/backtesting.py/issues/789
2022-12-06 01:46:03 +01:00
Kernc
1e19f85fe7 REF: Fix typo 2022-12-05 20:31:55 +01:00
Andrew
592ea4122b Add Order.tag for tracking orders and trades (#200)
* Add tagging, object typing, fix pep8

* Fix final pep8 issue

* Change .tag docstrings

* Add Tag column to stats._trades

* Add unit test

Co-authored-by: qacollective <andrew.0421304901@gmail.com>
Co-authored-by: kernc <kerncece@gmail.com>
2022-12-05 19:47:55 +01:00
Kernc
ee324f6dca CI: Fix for ruff 0.160 2022-12-05 19:27:07 +01:00
Kernc
6ac0a215c2 MNT: Replace flake8 with ruff 2022-12-05 17:17:48 +01:00
Chuan
d47185f9e6 Remove flooring on ratios & add Kelly Criterion (#640)
* Remove flooring on ratios and adding Kelly Criterion

* fix build
2022-12-05 17:16:07 +01:00
Kernc
109c352308 BUG: Fix docs build broken link check bug 2022-11-28 23:33:29 +01:00
Kernc
dcda33e15a DOC: Replace spaces in URLs with urlencoded %20 2022-11-28 23:33:29 +01:00
Kernc
a4a6142edd CI: Make skopt tests pass
Disable prereleased numpy for the time being
2022-11-28 16:23:33 +01:00
Kernc
be1d8be66a CI: Refresh ci.yml 2022-11-27 06:09:48 +01:00
Kernc
57a9f32578 TYP: Fix mypy .991 bokeh errors 2022-11-27 04:35:54 +01:00
Kernc
57e52515e7 TYP: Fix mypy .991 errors 2022-11-27 04:33:38 +01:00
Kernc
a4016e53e8 DOC: Mention Position.close() more prominently 2022-11-25 05:56:51 +01:00
Kernc
eaf671ed65 REF: Bokeh 3.0 figure no longer takes x_range=None as fallback 2022-11-25 05:51:57 +01:00
Kernc
3fcb4ac526 REF: Fix multi-scale DatetimeTickFormatter deprecation in Bokeh 3.0
> BokehDeprecationWarning: Passing lists of formats for DatetimeTickFormatter scales was deprecated in Bokeh 3.0. Configure a single string format for each scale

Fixes https://github.com/kernc/backtesting.py/issues/807
2022-11-25 05:49:53 +01:00
Kernc
b8285d42bb DOC: Revise contributing/readme 2022-11-25 05:49:53 +01:00
Kernc
e2df305a88 DOC: Quick Start / Data: Mention yFinance and investpy 2022-07-30 02:09:01 +02:00
Kernc
6fd85d1968 DOC: Fix Google Colab badge
Can't do `<img src=SVG>`.
2022-06-16 00:00:49 +02:00
Kernc
65f54f6819 MNT: Fix doc build with jupytext==1.13.7 2022-03-28 01:39:16 +02:00
Kernc
4f5e06e47d DOC: Minor revise README 2022-03-28 01:33:30 +02:00
Kernc
94d20da85e REF: Fix mypy v0.920 issue
Ref: https://github.com/python/mypy/issues/9430
2021-12-19 00:12:51 +01:00
Kernc
0107d4afd7 MNT: Update CHANGELOG for v0.3.3 0.3.3 2021-12-13 02:32:56 +01:00
Kernc
e7981c7585 REF: Minor typing annotation fixes with new mypy 2021-12-12 18:57:32 +01:00
Kernc
8b36a6b8cf REF: Migrate plotting for Bokeh 3.0 2021-12-12 18:36:59 +01:00
Kernc
d1775dffcb REF: Bokeh 3.0 renaming FuncTickFormatter -> CustomJSTickFormatter
Refs: https://github.com/bokeh/bokeh/pull/11696
2021-12-12 18:07:08 +01:00
Kernc
267d99f0d4 MNT: Enable CI with Python 3.9, drop Python 3.6 2021-10-14 11:35:40 +02:00
Kernc
60bd8a7080 MNT: Move flake8 config into setup.cfg 2021-10-14 11:35:40 +02:00
Kernc
23761697fe TST: Fix TestOptimize.test_max_tries failure introduced in 8b83b3541a 2021-10-14 11:35:40 +02:00
Kernc
c7b565bfc2 REF: Fix pandas deprecation warning
> FutureWarning: casting datetime64[ns] values to int64
> with .astype(...) is deprecated and will raise in a future
> version. Use .view(...) instead.
2021-10-14 11:35:40 +02:00
Kernc
ae11c904f4 DOC: Add funny XKCD-1570 comic 2021-10-10 17:26:57 +02:00
Kernc
8b83b3541a BUG: Fix numpy.random generation in Backtest.optimize
Fixes https://github.com/kernc/backtesting.py/issues/500
2021-10-10 17:20:43 +02:00
Kernc
7671f044d5 DOC: Clarify what means for series to cross over
Closes https://github.com/kernc/backtesting.py/issues/386
2021-08-16 04:10:34 +02:00
Kernc
4f21a652d5 MNT: Update ChangeLog for 0.3.2 0.3.2 2021-08-03 03:58:07 +02:00
Kernc
e9cc36f821 DOC: Fix pdoc3-references in lib.compute_stats 2021-08-03 03:58:07 +02:00
crazy25000
77f4c46b82 ENH: Extract strategy performance method compute_stats (#281)
* ENH: Extract methods _compute_stats and _compute_drawdown_duration_peaks from Backtest

* ENH: Move compute stats methods to new file, _stats.py

* TST: Update unit tests for compute_drawdown_duration_peaks

* TST: Remove ignore type for CI test failure

* REF: Remove broker dependency from compute_stats, update sharpe ratio to use risk free rate

* REF: Update self._results to account for compute_stats change, fix typo

* Update backtesting/backtesting.py

Co-authored-by: kernc <kerncece@gmail.com>

* Update backtesting/backtesting.py

Co-authored-by: kernc <kerncece@gmail.com>

* REF: Add risk_free_rate to Sortino Ratio

* ENH: Add compute_stats to lib, provide public method

* REF: Extract params to reduce line length

* REF: Use strategy broker to calculate equity

* REF: Use example from test

* Update, make more idempotent, add doc, test

Co-authored-by: kernc <kerncece@gmail.com>
2021-08-03 02:59:59 +02:00
Sean Kernitsman
a0c65895ef PERF: Improve _MAX_CANDLES downsampling on large datasets (#329)
* Fixed __maybe_resample_data freq performance

* Fixed formatting

* Use more pandas
2021-08-03 01:35:00 +02:00
Kernc
7a6434bed6 DOC: Further improve .github/issue_template.md 2021-08-03 00:16:23 +02:00
Kernc
8fac46718d REF: Add note/TODO item 2021-08-03 00:16:23 +02:00
Kernc
c0d4291959 DOC: Clarify OHLCV_AGG docstring code example 2021-08-03 00:16:23 +02:00
Alexey Peschany
a27256eb83 ENH: Return plot object in Backtest.plot() (#415)
For amending / bokeh.io.export_png
2021-08-03 00:15:48 +02:00
Zeel Patel
0a76e9655f BUG: Fix price AssertionError while using TrailingStrategy (#322)
* AssertionError while using TrailingStrategy #316 

the code shouldn't be using atr[-1]. It should be using atr[index] where index = len(self.data)-1

* AssertionError while using TrailingStrategy  - Adding Unit Test kernc#316

* Adding AMZN test data file kernc#316

* Added AMZN data kernc#316

* Fix inconsistent tabs issue kernc#316

* Removed Tabs and used Spaces kernc#316

* Backing out additional test case kernc#316

* Delete AMZN.csv file kernc#316

* Remove AMZN data import kernc#316

* Add code comment for change kernc#316

* Update backtesting/lib.py

* Added extra line as lint was complaining kernc#316

* Added extra line as lint was complaining kernc#316

* Added extra line as lint was complaining kernc#316
2021-04-30 01:59:19 +02:00