Skip to main content

事件驅動式的 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


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.dev4.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tbacktest-0.1.4.dev4-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file tbacktest-0.1.4.dev4.tar.gz.

File metadata

  • Download URL: tbacktest-0.1.4.dev4.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for tbacktest-0.1.4.dev4.tar.gz
Algorithm Hash digest
SHA256 5b530613bb87a5716dc2ef151d7313cdf7e90701c458595d18b35ec5f764dd5b
MD5 3aa2bab9a00f0248eaaeb75c8e59c2f6
BLAKE2b-256 e683ab8fac0deeb146724dbad79e7b528f7c1cffc9100fd276027b74c7c3ee45

See more details on using hashes here.

File details

Details for the file tbacktest-0.1.4.dev4-py3-none-any.whl.

File metadata

  • Download URL: tbacktest-0.1.4.dev4-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for tbacktest-0.1.4.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 350e781f1596a71151e1dd17dcc0afcc2d0556d40e207cfc2a8113b84dbaa783
MD5 6e02b8e633628e835f6f55d1ab199ddf
BLAKE2b-256 f276747a421d5ac1cfa51a7dfe7843fcfe520a49e9c7be9410192415306b7714

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page