BackcastPro 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of BackcastPro might be problematic. Click here for more details.
- BackcastPro/__init__.py +90 -0
- BackcastPro/_plotting.py +785 -0
- BackcastPro/_stats.py +212 -0
- BackcastPro/_util.py +337 -0
- BackcastPro/backtesting.py +1763 -0
- BackcastPro/lib.py +646 -0
- BackcastPro/test/__init__.py +29 -0
- BackcastPro/test/__main__.py +7 -0
- BackcastPro/test/_test.py +1174 -0
- backcastpro-0.0.2.dist-info/METADATA +53 -0
- backcastpro-0.0.2.dist-info/RECORD +13 -0
- BackcastPro/example.py +0 -2
- backcastpro-0.0.1.dist-info/METADATA +0 -18
- backcastpro-0.0.1.dist-info/RECORD +0 -6
- {backcastpro-0.0.1.dist-info → backcastpro-0.0.2.dist-info}/WHEEL +0 -0
- {backcastpro-0.0.1.dist-info → backcastpro-0.0.2.dist-info}/top_level.txt +0 -0
BackcastPro/__init__.py
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
{: height=263}
|
|
4
|
+
|
|
5
|
+
## Manuals
|
|
6
|
+
|
|
7
|
+
* [**Quick Start User Guide**](../examples/Quick Start User Guide.html)
|
|
8
|
+
|
|
9
|
+
## Tutorials
|
|
10
|
+
|
|
11
|
+
The tutorials encompass most framework features, so it's important
|
|
12
|
+
and advisable to go through all of them. They are short.
|
|
13
|
+
|
|
14
|
+
* [Library of Utilities and Composable Base Strategies](../examples/Strategies Library.html)
|
|
15
|
+
* [Multiple Time Frames](../examples/Multiple Time Frames.html)
|
|
16
|
+
* [**Parameter Heatmap & Optimization**](../examples/Parameter Heatmap & Optimization.html)
|
|
17
|
+
* [Trading with Machine Learning](../examples/Trading with Machine Learning.html)
|
|
18
|
+
|
|
19
|
+
These tutorials are also available as live Jupyter notebooks:
|
|
20
|
+
[][binder]
|
|
21
|
+
[][colab]
|
|
22
|
+
<br>In Colab, you might have to `!pip install backtesting`.
|
|
23
|
+
|
|
24
|
+
[binder]: \
|
|
25
|
+
https://mybinder.org/v2/gh/kernc/backtesting.py/master?\
|
|
26
|
+
urlpath=lab%2Ftree%2Fdoc%2Fexamples%2FQuick%20Start%20User%20Guide.ipynb
|
|
27
|
+
[colab]: https://colab.research.google.com/github/kernc/backtesting.py/
|
|
28
|
+
|
|
29
|
+
## Video Tutorials
|
|
30
|
+
|
|
31
|
+
* Some [**coverage on YouTube**](https://github.com/kernc/backtesting.py/discussions/677).
|
|
32
|
+
* [YouTube search](https://www.youtube.com/results?q=%22backtesting.py%22)
|
|
33
|
+
|
|
34
|
+
## Example Strategies
|
|
35
|
+
|
|
36
|
+
* (contributions welcome)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
.. tip::
|
|
40
|
+
For an overview of recent changes, see
|
|
41
|
+
[What's New, i.e. the **Change Log**](https://github.com/kernc/backtesting.py/blob/master/CHANGELOG.md).
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## FAQ
|
|
45
|
+
|
|
46
|
+
Some answers to frequent and popular questions can be found on the
|
|
47
|
+
[issue tracker](https://github.com/kernc/backtesting.py/issues?q=label%3Aquestion+-label%3Ainvalid)
|
|
48
|
+
or on the [discussion forum](https://github.com/kernc/backtesting.py/discussions) on GitHub.
|
|
49
|
+
Please use the search!
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
This software is licensed under the terms of [AGPL 3.0]{: rel=license},
|
|
54
|
+
meaning you can use it for any reasonable purpose and remain in
|
|
55
|
+
complete ownership of all the excellent trading strategies you produce,
|
|
56
|
+
but you are also encouraged to make sure any upgrades to _Backtesting.py_
|
|
57
|
+
itself find their way back to the community.
|
|
58
|
+
|
|
59
|
+
[AGPL 3.0]: https://www.gnu.org/licenses/agpl-3.0.html
|
|
60
|
+
|
|
61
|
+
# API Reference Documentation
|
|
62
|
+
"""
|
|
63
|
+
try:
|
|
64
|
+
from ._version import version as __version__
|
|
65
|
+
except ImportError:
|
|
66
|
+
__version__ = '?.?.?' # Package not installed
|
|
67
|
+
|
|
68
|
+
from . import lib # noqa: F401
|
|
69
|
+
from ._plotting import set_bokeh_output # noqa: F401
|
|
70
|
+
from .backtesting import Backtest, Strategy # noqa: F401
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# Add overridable backtesting.Pool used for parallel optimization
|
|
74
|
+
def Pool(processes=None, initializer=None, initargs=()):
|
|
75
|
+
import multiprocessing as mp
|
|
76
|
+
if mp.get_start_method() == 'spawn':
|
|
77
|
+
import warnings
|
|
78
|
+
warnings.warn(
|
|
79
|
+
"If you want to use multi-process optimization with "
|
|
80
|
+
"`multiprocessing.get_start_method() == 'spawn'` (e.g. on Windows),"
|
|
81
|
+
"set `backtesting.Pool = multiprocessing.Pool` (or of the desired context) "
|
|
82
|
+
"and hide `bt.optimize()` call behind a `if __name__ == '__main__'` guard. "
|
|
83
|
+
"Currently using thread-based paralellism, "
|
|
84
|
+
"which might be slightly slower for non-numpy / non-GIL-releasing code. "
|
|
85
|
+
"See https://github.com/kernc/backtesting.py/issues/1256",
|
|
86
|
+
category=RuntimeWarning, stacklevel=3)
|
|
87
|
+
from multiprocessing.dummy import Pool
|
|
88
|
+
return Pool(processes, initializer, initargs)
|
|
89
|
+
else:
|
|
90
|
+
return mp.Pool(processes, initializer, initargs)
|