PandasBT
Simples Framework to Backtest Strategies using pandas
Installation
pip install pandasbt
Calculation a factor zscore
import pandasbt as pbt
df_test = pd.DataFrame([
{"close": 25}, {"close": 15}, {"close": 41}, {"close": 7},
{"close": 5}, {"close": 115}, {"close": 45}, {"close": 32},
])
pbt.zscore(df_test, period=20)
or you can specify the column
pbt.zscore(df_test, 20, "close")
Calculation Buy and Sell signals
That mean add a signal column into dataframe.
0 - means nothing
-1 - means sell
1 - means buy
import pandasbt as pbt
df_test = pd.DataFrame([
{"close": 25}, {"close": 15}, {"close": 41}, {"close": 7},
{"close": 5}, {"close": 115}, {"close": 45}, {"close": 32},
])
pbt.calc_signal(df_test, buy_query="close > 20", sell_query="close < 10")
Release files for pandasbt 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pandasbt-0.2.0.win-amd64.zip | 10.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandasbt-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / pandasbt-0.2.0.win-amd64.zip
| Download URL | pandasbt-0.2.0.win-amd64.zip |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c7a0baeb9315cfc653f0dcd0ba38e6f706c8fc33e8a887801915f66ace5f564
|
|
BLAKE2b-256 checksum How to use checksums |
4f232c048031f51300c8ed3404ef2587bca4319a5a8bcefcede9a91b16eefdae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Release files / pandasbt-0.2.0-py3-none-any.whl
| Download URL | pandasbt-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49b742e65efcd1d8301d3ad7164ee435e8e7bec2585a36e216fa946605e4eed7
|
|
BLAKE2b-256 checksum How to use checksums |
79d793aee2201c6d3ecdb1b6bf52b8a32bbbcfa0042c1fca1b90de9c88e5d6e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|