Make Backtrader an optional extra
This commit is contained in:
@@ -26,6 +26,10 @@ uv run python cli.py portfolio eval --positions-path portfolio/eq_10m.pq --data-
|
|||||||
|
|
||||||
Add a runtime dep with `uv add <pkg>`, a dev/test dep with `uv add --dev <pkg>` (both update `pyproject.toml` + `uv.lock`).
|
Add a runtime dep with `uv add <pkg>`, a dev/test dep with `uv add --dev <pkg>` (both update `pyproject.toml` + `uv.lock`).
|
||||||
|
|
||||||
|
Backtrader is optional (`uv sync --extra backtrader`) and is not used by the
|
||||||
|
current pipeline. Keep `portfolio simulate` as the canonical backtest/execution
|
||||||
|
path unless an explicit future adapter is requested.
|
||||||
|
|
||||||
Note: `tests/test_downloader.py` hits the network (live baostock/akshare); `tests/test_alpha.py` and `tests/test_portfolio.py` are pure and fast.
|
Note: `tests/test_downloader.py` hits the network (live baostock/akshare); `tests/test_alpha.py` and `tests/test_portfolio.py` are pure and fast.
|
||||||
|
|
||||||
## Architecture: one decoupled pipeline
|
## Architecture: one decoupled pipeline
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ The env is managed with [uv](https://docs.astral.sh/uv/). `uv sync` builds `.ven
|
|||||||
uv sync
|
uv sync
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Backtrader is an optional dependency and is **not used by the current pipeline**.
|
||||||
|
Install it only for future experiments or adapter work:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv sync --extra backtrader
|
||||||
|
```
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -401,6 +408,9 @@ constructed positions, fills/costs, P&L, and target-weight research metrics.
|
|||||||
- [x] **Reference execution simulation** — next-open fills over constructed
|
- [x] **Reference execution simulation** — next-open fills over constructed
|
||||||
`position_shares`, with suspension, price-limit, volume-cap, transaction-cost,
|
`position_shares`, with suspension, price-limit, volume-cap, transaction-cost,
|
||||||
and slippage controls.
|
and slippage controls.
|
||||||
|
- [ ] **Optional Backtrader adapter** — Backtrader is available as the
|
||||||
|
`backtrader` extra for possible future event-driven/broker-style experiments,
|
||||||
|
but it is not part of the current canonical portfolio workflow.
|
||||||
- [ ] **Forward / paper trading** — run the same construction logic on live
|
- [ ] **Forward / paper trading** — run the same construction logic on live
|
||||||
daily data, track simulated fills and a running P&L without real capital.
|
daily data, track simulated fills and a running P&L without real capital.
|
||||||
- [ ] **Intraday / microstructure data** — bid/ask prices & sizes, mid-price,
|
- [ ] **Intraday / microstructure data** — bid/ask prices & sizes, mid-price,
|
||||||
|
|||||||
+5
-1
@@ -4,7 +4,6 @@ version = "0.1.0"
|
|||||||
description = "A modular Chinese A-share quant research framework (daily frequency)."
|
description = "A modular Chinese A-share quant research framework (daily frequency)."
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrader>=1.9.76.123",
|
|
||||||
"akshare>=1.14.0",
|
"akshare>=1.14.0",
|
||||||
"baostock>=0.8.8",
|
"baostock>=0.8.8",
|
||||||
"pandas>=2.0.0",
|
"pandas>=2.0.0",
|
||||||
@@ -13,6 +12,11 @@ dependencies = [
|
|||||||
"pyarrow>=14.0.0",
|
"pyarrow>=14.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
backtrader = [
|
||||||
|
"backtrader>=1.9.76.123",
|
||||||
|
]
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"pytest>=7.0.0",
|
"pytest>=7.0.0",
|
||||||
|
|||||||
@@ -284,7 +284,6 @@ version = "0.1.0"
|
|||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "akshare" },
|
{ name = "akshare" },
|
||||||
{ name = "backtrader" },
|
|
||||||
{ name = "baostock" },
|
{ name = "baostock" },
|
||||||
{ name = "click" },
|
{ name = "click" },
|
||||||
{ name = "matplotlib" },
|
{ name = "matplotlib" },
|
||||||
@@ -293,6 +292,11 @@ dependencies = [
|
|||||||
{ name = "pyarrow" },
|
{ name = "pyarrow" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[package.optional-dependencies]
|
||||||
|
backtrader = [
|
||||||
|
{ name = "backtrader" },
|
||||||
|
]
|
||||||
|
|
||||||
[package.dev-dependencies]
|
[package.dev-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
{ name = "pytest" },
|
{ name = "pytest" },
|
||||||
@@ -301,13 +305,14 @@ dev = [
|
|||||||
[package.metadata]
|
[package.metadata]
|
||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "akshare", specifier = ">=1.14.0" },
|
{ name = "akshare", specifier = ">=1.14.0" },
|
||||||
{ name = "backtrader", specifier = ">=1.9.76.123" },
|
{ name = "backtrader", marker = "extra == 'backtrader'", specifier = ">=1.9.76.123" },
|
||||||
{ name = "baostock", specifier = ">=0.8.8" },
|
{ name = "baostock", specifier = ">=0.8.8" },
|
||||||
{ name = "click", specifier = ">=8.0.0" },
|
{ name = "click", specifier = ">=8.0.0" },
|
||||||
{ name = "matplotlib", specifier = ">=3.7.0" },
|
{ name = "matplotlib", specifier = ">=3.7.0" },
|
||||||
{ name = "pandas", specifier = ">=2.0.0" },
|
{ name = "pandas", specifier = ">=2.0.0" },
|
||||||
{ name = "pyarrow", specifier = ">=14.0.0" },
|
{ name = "pyarrow", specifier = ">=14.0.0" },
|
||||||
]
|
]
|
||||||
|
provides-extras = ["backtrader"]
|
||||||
|
|
||||||
[package.metadata.requires-dev]
|
[package.metadata.requires-dev]
|
||||||
dev = [{ name = "pytest", specifier = ">=7.0.0" }]
|
dev = [{ name = "pytest", specifier = ">=7.0.0" }]
|
||||||
|
|||||||
Reference in New Issue
Block a user