Index future simple stat and time-series backtest module
Project description
Index Futures Simple Backtest Module (Personal Usage)
Chang Sun Email
Install
pip install --upgrade sc-backtest
Simple Test
- Check for factor validity
- Statistical:
- CDF
- Markout
- Hist
- Time-Series:
- Sign-Trade
- Value-Trade
- Threshold-Trade
- Statistical:
# x: factors
# y: asset's future ret
import pandas as pd
import numpy as np
from sc_backtest import simpletest
data = pd.read_csv('.\factor_and_ret.csv', index_col=0, header=0)
x = data.loc[:, 'factor']
y = data.loc[:, 'ret']
st = simpletest(is_day=True)
st.plot_cdf(x, y)
Technical Analysis
Variou moving average function
- SMA
- EMA
- WMA
- MMA
- QMA
- ...
import pandas as pd
import numpy as np
from sc_backtest import technical_analysis
wma = technical_analysis.wma(pd.Series(np.random.rand(100)), window=5)
Example
Input your factor and uderlying asset's future return series with index type as DatetimeIndex and get the composite stat and time-series plots.
# x: factors
# y: asset's future ret
import pandas as pd
import numpy as np
from sc_backtest import simpletest
data = pd.read_csv('.\factor_and_ret.csv', index_col=0, header=0)
x = data.loc[:, 'factor']
y = data.loc[:, 'ret']
st = simpletest(is_day=True)
st.plot_composite(x, y, markout_periods=30, cdf_period2=5)
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
sc-backtest-0.0.5.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for sc_backtest-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a47bd5a9e2fef87724cab392db7b8c0d790e407d9c11d4de6573fb57df10f38 |
|
MD5 | 4d1d1c69a935ebe62f8f89fe4ef27dc3 |
|
BLAKE2b-256 | 0671abea98161e2d055b48d4933a2f7185dc4fbd426252484d85eba983dd5427 |