Skip to main content

BackcastPro Logo BackcastPro

トレーディング戦略のためのPythonバックテストライブラリ。 リプレイ型シミュレーターで、1バーずつ時間を進めながらチャートと売買を可視化できます。

インストール(Windows)

PyPIから(エンドユーザー向け)

python -m pip install BackcastPro

開発用インストール

git clone <repository-url>
cd BackcastPro
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e .

使用方法

基本的な使い方

from BackcastPro import Backtest
import pandas as pd

# データ準備
df = pd.read_csv("AAPL.csv", index_col=0, parse_dates=True)
bt = Backtest(data={"AAPL": df}, cash=100000)

# 戦略関数
def my_strategy(bt):
    if bt.position == 0:
        bt.buy(tag="entry")
    elif bt.position > 0:
        bt.sell(tag="exit")

# ステップ実行
while not bt.is_finished:
    my_strategy(bt)
    bt.step()

# 結果を取得
results = bt.finalize()
print(results)

一括実行

bt = Backtest(data={"AAPL": df}, cash=100000)
bt.set_strategy(my_strategy)
results = bt.run()

marimo連携(リプレイ型シミュレーター)

import marimo as mo

slider = mo.ui.slider(start=1, stop=len(bt.index), value=1, label="時間")
bt.goto(slider.value, strategy=my_strategy)

state = bt.get_state_snapshot()
info = mo.md(f"資産: ¥{state['equity']:,.0f} / 進捗: {state['progress'] * 100:.1f}%")

mo.vstack([slider, info])

ドキュメント

バグ報告 / サポート

  • バグ報告や要望は GitHub Issues へ
  • 質問は Discord コミュニティへ(招待リンク)
  • 使い方はドキュメントをご参照ください

Metadata

Release files for BackcastPro 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BackcastPro 0.6.5
File Size Uploaded Provenance
backcastpro-0.6.5.tar.gz 408.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for BackcastPro 0.6.5
File Interpreter ABI Platform
backcastpro-0.6.5-py3-none-any.whl Python 3 none any Details

Total release size: 488.6 kB

Release files / backcastpro-0.6.5.tar.gz

Download URL backcastpro-0.6.5.tar.gz
Size 408.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b072221638058263bddb1915c415c98b94d619dbc57aac2d5a4fbc1225f125bb
BLAKE2b-256 checksum
How to use checksums
512bdb59e175330126ff754f7f02e89a677caeaa2c4dbcabc0f4fdb7407f6e69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / backcastpro-0.6.5-py3-none-any.whl

Download URL backcastpro-0.6.5-py3-none-any.whl
Size 80.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f01c6338aa374a19283210648af2621e64625c3240b73c54930ec9c06c17759
BLAKE2b-256 checksum
How to use checksums
bc348f16a48d09c4cf0d259ece85985adc8a1e21584ca8a4ecdbbe0ca8424142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for BackcastPro 0.6.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.6.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page