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 hashes)