Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

botterYosuke/BackcastPro

Repository files navigation

BackcastPro

tore-deinguZhan Lue notamenoPythonbatsukutesutoraiburari. ripureiXing shimiyure-ta-de, 1ba-zutsuShi Jian woJin menagarachiya-totoMai Mai woKe Shi Hua dekimasu.

insuto-ru(Windows)

PyPIkara(endoyu-za-Xiang ke)

python -m pip install BackcastPro

Kai Fa Yong insuto-ru

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

Shi Yong Fang Fa

Ji Ben De naShi iFang

from BackcastPro import Backtest
import pandas as pd

# de-taZhun Bei
df = pd.read_csv("AAPL.csv", index_col=0, parse_dates=True)
bt = Backtest(data={"AAPL": df}, cash=100000)

# Zhan Lue Guan Shu
def my_strategy(bt):
if bt.position == 0:
bt.buy(tag="entry")
elif bt.position > 0:
bt.sell(tag="exit")

# sutetsupuShi Xing
while not bt.is_finished:
my_strategy(bt)
bt.step()

# Jie Guo woQu De
results = bt.finalize()
print(results)

Yi Gua Shi Xing

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

marimoLian Xi (ripureiXing shimiyure-ta-)

import marimo as mo

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

state = bt.get_state_snapshot()
info = mo.md(f"Zi Chan : Y={state['equity']:,.0f} / Jin Bu : {state['progress'] * 100:.1f}%")

mo.vstack([slider, info])

dokiyumento

baguBao Gao / sapo-to

  • baguBao Gao yaYao Wang ha GitHub Issues he
  • Zhi Wen ha Discord komiyuniteihe(Zhao Dai rinku)
  • Shi iFang hadokiyumentowogoCan Zhao kudasai

About

Resources

Readme

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors