Metadata-Version: 2.4
Name: BackcastPro
Version: 0.4.0
Summary: トレーディング戦略のためのPythonバックテストライブラリ
Project-URL: Homepage, https://github.com/botterYosuke/BackcastPro/
Project-URL: Issues, https://github.com/botterYosuke/BackcastPro/issues
Project-URL: Logo, https://raw.githubusercontent.com/botterYosuke/BackcastPro/main/docs/img/logo.drawio.svg
Author: botterYosuke
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Requires-Dist: anywidget>=0.9.21
Requires-Dist: duckdb>=0.9.0
Requires-Dist: matplotlib>=3.0.0
Requires-Dist: msgpack>=1.0.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: plotly>=5.0.0
Requires-Dist: python-dotenv>=0.19.0
Requires-Dist: requests>=2.25.0
Requires-Dist: scipy>=1.7.0
Provides-Extra: all
Requires-Dist: yfinance>=0.2.0; extra == 'all'
Provides-Extra: yfinance
Requires-Dist: yfinance>=0.2.0; extra == 'yfinance'
Description-Content-Type: text/markdown

# <img src="https://raw.githubusercontent.com/botterYosuke/BackcastPro/main/docs/img/logo.drawio.svg" alt="BackcastPro Logo" width="40" height="24"> BackcastPro

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

## インストール（Windows）

### PyPIから（エンドユーザー向け）

```powershell
python -m pip install BackcastPro
```

### 開発用インストール

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

## 使用方法

### 基本的な使い方

```python
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)
```

### 一括実行

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

### marimo連携（リプレイ型シミュレーター）

```python
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])
```

## ドキュメント

- [ドキュメント一覧](https://github.com/botterYosuke/BackcastPro/blob/main/docs/index.md)

## バグ報告 / サポート

- バグ報告や要望は GitHub Issues へ
- 質問は Discord コミュニティへ（[招待リンク](https://discord.gg/fzJTbpzE)）
- 使い方はドキュメントをご参照ください
