Simple framework to test your strategies ideias with pandas
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pandasbt-0.2.0.win-amd64.zip
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pandasbt-0.2.0.win-amd64.zip.
File metadata
- Download URL: pandasbt-0.2.0.win-amd64.zip
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c7a0baeb9315cfc653f0dcd0ba38e6f706c8fc33e8a887801915f66ace5f564
|
|
| MD5 |
a6c33bb850f8ccf302d4c9788a49ba48
|
|
| BLAKE2b-256 |
4f232c048031f51300c8ed3404ef2587bca4319a5a8bcefcede9a91b16eefdae
|
File details
Details for the file pandasbt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pandasbt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b742e65efcd1d8301d3ad7164ee435e8e7bec2585a36e216fa946605e4eed7
|
|
| MD5 |
506c60fd3f2210c225118e39a9264e59
|
|
| BLAKE2b-256 |
79d793aee2201c6d3ecdb1b6bf52b8a32bbbcfa0042c1fca1b90de9c88e5d6e1
|