Skip to main content

事件驅動式的 Python 金融投資工具回測套件

Project description

套件簡介

這是一個自製的 Python 套件,實作了 backtesting 功能。 參考OREILLY的Python演算法交易該書本中所描述,以事件觸發導向的交易策略回測。 此回測方法是這麼多種回測方法中,作者認為最為細緻且彈性與變化度最高的方法。

安裝方式

pip install tbacktest

指令範例

動能突破策略,以ETF:00713為例

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.dev3.tar.gz (11.9 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.dev3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tbacktest-0.1.4.dev3.tar.gz
  • Upload date:
  • Size: 11.9 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.dev3.tar.gz
Algorithm Hash digest
SHA256 e4c03be811dc7009b1d1a480958c3856da72817bbf591b3eff60955c0b19ecf3
MD5 bfcd11f33d1cb2808d5b32dd9be629f4
BLAKE2b-256 acfe484ab66028181de6c5bec15ac5618b864020e52b21b8de8068e408204c27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tbacktest-0.1.4.dev3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 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.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 704836f55f1c097f8fa1d8a1d71447fe0676bef291ce3a3cb9a4ffd4d9aa8598
MD5 fb2b8f1a743af2fe2248e31c9ce64dda
BLAKE2b-256 4218f0a2c88c932eb4a62bb68ed0cb3d8532d886baf23a5c697638fa8cf95bd2

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