事件驅動式的 Python 金融投資工具回測套件
Project description
套件簡介
這是一個自製的 Python 套件,實作了 backtesting 功能。 參考OREILLY的Python演算法交易該書本中所描述,以事件觸發導向的交易策略回測。 此回測方法是這麼多種回測方法中,作者認為最為細緻且彈性與變化度最高的方法。
此套件結合finlab package,方便取得台股市場的相關資料數據,方便投資人回測。
安裝方式
pip install tbacktest
指令範例
動能突破策略,以ETF:00713為例
from tbacktest import BacktestLongOnly
clo713 = BacktestLongOnly(symbol='00713', start='20171001', newest_day='20250512',amount=1000000,
datasource='finlab',
finlab_password='finlab_api_token')
#將LongOnly類別實體化出clo713
clo713.run_break_high_strategy(Hday=10, Lday=10,SMA1=5,SMA2=10)
#執行該類別下的方法,及突破進場買進ETF,跌破平倉出場ETF。
clo713.plot_backtest()
#將策略結果圖示化
clo713.plot_data()
#將原本資料畫出來
clo713.show_backtest_all_information()
#顯示所有回測結果時間序列
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
tbacktest-0.1.4.dev5.tar.gz
(12.2 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 tbacktest-0.1.4.dev5.tar.gz.
File metadata
- Download URL: tbacktest-0.1.4.dev5.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8acbaad210a122f2dd7cbf35b623310984acb5be88fa6bab20a2daec78d721d5
|
|
| MD5 |
75c169d075ede54dd3a2dc9e897943e9
|
|
| BLAKE2b-256 |
1e60b6a7b54eb920f618642b72d25b6f4e332ce49d64458bd1e336f3426fa2ac
|
File details
Details for the file tbacktest-0.1.4.dev5-py3-none-any.whl.
File metadata
- Download URL: tbacktest-0.1.4.dev5-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5977348d659104e6ef14dfce4e330052ec6e69be47fd134340e34763a0afbe0
|
|
| MD5 |
afa9cad0e30ae2a78abe27d259356851
|
|
| BLAKE2b-256 |
2965fa4a073c7d01c985f197e979128bc8aec667097ad0c2bf90fe0e38cca809
|