Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
160c6a9
Merge pull request #26 from cloudQuant/development
cloudQuant Aug 22, 2026
ab1ae15
docs(strategies): add bilingual strategy series covering all 1,152 ba…
cloudQuant Sep 2, 2026
d2d51d5
feat: add native cross-venue perpetual arbitrage support
cloudQuant Sep 8, 2026
9c05857
feat: add CTP cross-arbitrage examples and workspace checks
cloudQuant Sep 8, 2026
c26e2e2
feat(ctp): add mid-frequency SimNow simulation path
cloudQuant Sep 9, 2026
d4f5dd4
docs(ctp): complete iteration22 acceptance package
cloudQuant Sep 9, 2026
c3e09ef
feat(ctp): complete Iter22 SimNow validation
cloudQuant Sep 9, 2026
9375fa5
feat(trade-logger): add generic runtime reports
cloudQuant Sep 10, 2026
1ff2ea2
feat(ctp): harden Iter22 observation lifecycle
cloudQuant Sep 10, 2026
61ed267
feat(ctp): add barrier/cohort/option-commission framework layer and O…
cloudQuant Sep 12, 2026
f42bbc9
feat(examples): add CTP options low/mid/high-freq candidates and SimN…
cloudQuant Sep 12, 2026
da1d5c8
docs(iterations): add iteration 23-27 packages and iteration 26 recti…
cloudQuant Sep 12, 2026
58d2c51
docs(iter27): record first execution round (T0/T1/T2/T5/T10 done, T3/…
cloudQuant Sep 12, 2026
3a8936f
fix(examples): unblock mechanical cycle through scan/settlement/auth …
cloudQuant Sep 12, 2026
fabbe0c
docs(iter27): correct T4 diagnosis - environment attribution replaced…
cloudQuant Sep 12, 2026
edef5f0
style(ci): satisfy lint gate for iteration 23-27 framework changes
cloudQuant Sep 12, 2026
ef99946
fix(cerebro): scope runstop safely across threads
cloudQuant Sep 13, 2026
9603bc2
fix(simnow): fail closed for second-set strategy paths
cloudQuant Sep 13, 2026
d84aac1
fix(options): harden midfrequency timing admission
cloudQuant Sep 13, 2026
7f41b5c
fix(options): advance highfreq risk timing before cohort rejection
cloudQuant Sep 13, 2026
5d88d86
test(iter27): add independent fq3 acceptance runner
cloudQuant Sep 13, 2026
27e42af
fix(packaging): include account configuration template
cloudQuant Sep 13, 2026
6dd5b70
docs(iter27): record clean acceptance evidence and no-go
cloudQuant Sep 13, 2026
cf6f240
docs(iter27): record remaining gate evidence
cloudQuant Sep 13, 2026
2b5e6d7
test(iter23): add native-free closed-bar consumer chain
cloudQuant Sep 13, 2026
fe5ee7d
docs(iter23): record native-free consumer acceptance
cloudQuant Sep 13, 2026
0aa12d7
test(qa): isolate wall-clock gates from xdist
cloudQuant Sep 13, 2026
e8dfb1a
docs(iter27): record stable regression lanes
cloudQuant Sep 13, 2026
4b67ae9
fix(simnow): ignore stale contracts during bundle discovery
cloudQuant Sep 13, 2026
58adf7a
fix(simnow): fail close ungoverned mechanical execution
cloudQuant Sep 13, 2026
155cca7
fix(iter25): keep engineering smoke read only
cloudQuant Sep 13, 2026
14dc5fe
test(iter23): cover candidate entry at read-only broker boundary
cloudQuant Sep 13, 2026
e182ca1
fix(ctp): require fresh complete reconciliation evidence
cloudQuant Sep 13, 2026
0651c26
docs(acceptance): record local reconciliation boundaries
cloudQuant Sep 13, 2026
3817124
fix(iter21): fail close shadow observation probes
cloudQuant Sep 13, 2026
e947410
docs(iter27): record current acceptance boundaries
cloudQuant Sep 13, 2026
b522cec
fix(simnow): support direct operator entrypoint
cloudQuant Sep 13, 2026
a6e0075
docs(iter27): record current set2 external evidence
cloudQuant Sep 13, 2026
3c50d0b
docs(iter27): refresh current regression evidence
cloudQuant Sep 13, 2026
cd17f4a
docs(iter22): clarify current G3 gate status
cloudQuant Sep 13, 2026
2ff4324
fix(iter23-25): harden local admission guards
cloudQuant Sep 13, 2026
c48f056
docs(iter27): record local admission guard hardening
cloudQuant Sep 13, 2026
3e358d8
docs(iter27): refresh current regression evidence
cloudQuant Sep 13, 2026
acc9b74
fix(iter21-25): harden local acceptance chains
cloudQuant Sep 13, 2026
282bdea
test(iter23): cover local broker cancellation lifecycle
cloudQuant Sep 13, 2026
268d612
docs(iter27): refresh local chain acceptance evidence
cloudQuant Sep 13, 2026
a8fdad9
test(iter23): cover local complete entry broker chain
cloudQuant Sep 13, 2026
e2c848c
docs(iter27): record complete local regression evidence
cloudQuant Sep 13, 2026
163053a
docs(iter27): record current cross-repo artifact evidence
cloudQuant Sep 13, 2026
4952610
test(iter23): reject untrusted completion facts in full local chain
cloudQuant Sep 13, 2026
b5f4625
docs(iter23): record scoped completion rejection evidence
cloudQuant Sep 13, 2026
9926c4c
test(iter22): add set2 engineering observation acceptance
cloudQuant Sep 13, 2026
23fd203
docs(iter27): record crypto shadow source gates
cloudQuant Sep 13, 2026
cb13d07
fix(iter23): freeze broker notification metadata
cloudQuant Sep 13, 2026
594cbe6
docs(iter27): record cb13 acceptance evidence
cloudQuant Sep 13, 2026
d0b25f4
test(iter20): add public rule snapshot replay
cloudQuant Sep 13, 2026
30e470b
docs(iter27): record public rule replay
cloudQuant Sep 13, 2026
baa5090
fix(iter22): seal shadow observation evidence
cloudQuant Sep 14, 2026
1125fda
test(iter21): await close callback scheduling
cloudQuant Sep 14, 2026
fe89cc4
fix(iter23): discard stale feed decisions on reset
cloudQuant Sep 14, 2026
35256ca
test: stabilize store deadline assertions
cloudQuant Sep 14, 2026
bd16dec
docs(iter27): record third acceptance evidence
cloudQuant Sep 14, 2026
c57dba1
docs(iter27): record current set2 revalidation
cloudQuant Sep 14, 2026
21bcbeb
fix(acceptance): harden bounded strategy observations
cloudQuant Sep 14, 2026
4c398e2
docs(iter27): record fifth acceptance evidence
cloudQuant Sep 14, 2026
e22599a
feat(examples): SimNow Set-2 launchers, live trade-logger streaming, …
cloudQuant Sep 14, 2026
404383b
refactor(cerebro): split engine into _cerebro/ private mixin package …
cloudQuant Sep 14, 2026
8929776
release: prepare 1.4.0 iteration 28/29
cloudQuant Sep 15, 2026
1b6e2d2
ci: align locator imports with isort 9
cloudQuant Sep 15, 2026
311fa07
ci: bound SDK acceptance worker profile
cloudQuant Sep 15, 2026
95cecd1
docs: clarify SDK worker selection
cloudQuant Sep 15, 2026
9e83a52
docs: clarify SDK timeout rationale
cloudQuant Sep 15, 2026
ee156a9
test: isolate HFT timing baselines
cloudQuant Sep 15, 2026
0ed2b1c
refactor: remove unreachable runnext bindings
cloudQuant Sep 15, 2026
98ea2e0
build: remove tracked macOS metadata
cloudQuant Sep 15, 2026
e53f6b1
fix(logging): remove stale backend state
cloudQuant Sep 15, 2026
534f440
fix: harden logging and legacy CI compatibility
cloudQuant Sep 15, 2026
83f1863
fix: stabilize cross-platform release gates
cloudQuant Sep 15, 2026
022a6cf
test: stabilize release regression gates
cloudQuant Sep 15, 2026
f523db8
test: stabilize Windows CTP observation gates
cloudQuant Sep 15, 2026
8e17c45
fix: stabilize CI on Windows and platform-neutral SDK contracts
cloudQuant Sep 15, 2026
74fd618
fix: make demo trust-root fingerprint stable under repeated newline c…
cloudQuant Sep 15, 2026
409b347
ci: focus CodeQL on released product code
cloudQuant Sep 16, 2026
e15cecd
ci: inline CodeQL config (action expects YAML string, not a path)
cloudQuant Sep 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

# 引擎 / 策略 / 经纪商 / 数据源(R2)
/backtrader/cerebro.py @cloudQuant
/backtrader/_cerebro/ @cloudQuant
/backtrader/strategy.py @cloudQuant
/backtrader/broker.py @cloudQuant
/backtrader/brokers/ @cloudQuant
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
attributes:
label: 环境
description: Python 版本、操作系统、backtrader 版本、安装方式
placeholder: "Python 3.11, macOS, backtrader 1.3.0, pip install -e ."
placeholder: "Python 3.11, macOS, backtrader 1.4.0, pip install -e ."
validations:
required: true
- type: textarea
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CodeQL Security Analysis

on:
push:
branches: [dev, development, master]
pull_request:
branches: [dev, development, master]
schedule:
- cron: '30 5 * * 1'

permissions:
contents: read
security-events: write

jobs:
analyze:
name: Analyze Python
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
# Quality findings are owned by ruff/mypy/bandit; CodeQL focuses on
# security here. The inline config narrows the scan to released
# product code (backtrader/) and disables queries that conflict with
# the framework design: direct bt.Strategy subclasses deliberately
# never call super().__init__() (Strategy.__new__ already performs
# base initialization), so py/missing-super-init is a pure false
# positive across example strategies.
queries: security-extended
config: |
paths-ignore:
- docs
- examples
- tests
- tools
- studies
- scripts
- .joyincode
- conftest.py
disable:
queries:
- py/missing-super-init
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:python'
2 changes: 1 addition & 1 deletion .github/workflows/docs-auto-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Documentation CI Checks

on:
pull_request:
branches: [development, master]
branches: [dev, development, master]
paths:
- 'docs/**'
- 'backtrader/**/*.py'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master')
# The existing github-pages environment authorizes only development.
# Master releases still build both languages and retain the Pages artifact;
# publishing a different branch requires a separate environment-policy change.
if: github.event_name == 'push' && github.ref == 'refs/heads/development'
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
92 changes: 84 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff 'black==26.1.0' isort 'mypy==1.16.1' bandit pip-audit
pip install ruff 'black==26.1.0' 'isort==9.0.1' 'mypy==1.16.1' bandit pip-audit

- name: Run ruff
run: ruff check backtrader/
Expand All @@ -81,7 +81,8 @@ jobs:
# mypy==1.16.1 keeps the Python 3.8 target available; the current
# gate is fully clean and should fail on any new type error.
MYPY_THRESHOLD=0
mypy backtrader --config-file=pyproject.toml | tee mypy-report.txt || true
set -o pipefail
mypy backtrader --config-file=pyproject.toml | tee mypy-report.txt
count="$(grep -cE 'error:' mypy-report.txt || true)"
echo "mypy error count: ${count} (gate threshold ${MYPY_THRESHOLD})"
if [ "${count}" -gt "${MYPY_THRESHOLD}" ]; then
Expand Down Expand Up @@ -229,12 +230,87 @@ jobs:
# Choose tier by event: pull_request => fast gate; everything else => full suite.
if [ "${EVENT_NAME}" = "pull_request" ]; then
echo "=== PR fast gate: pytest -m 'not slow' ==="
pytest tests/ -m "not slow" -n auto --tb=short --timeout=300 -q
pytest tests/ -m "not slow and not performance" -n auto --tb=short --timeout=300 -q
else
echo "=== Full suite: pytest tests/ ==="
pytest tests/ -n auto --tb=short --timeout=300 -q
pytest tests/ -m "not performance" -n auto --tb=short --timeout=300 -q
fi

sdk:
name: Optional SDK Contracts
runs-on: ubuntu-latest
needs: lint
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install core and pinned SDK acceptance dependencies
run: python -m pip install -e ".[dev]" -r requirements-ci-sdk.txt
- name: Require SDK adapters and run complete functional suite
env:
PYTEST_ADDOPTS: ''
run: |
python -c "import bt_api_py, bt_api_base, bt_api_binance, bt_api_okx, bt_api_ctp, spdlog; print('All required SDK adapters present')"
# ``-n auto`` varies with runner CPU exposure. Eight workers are
# the release-validated SDK-contract profile and keep this job bounded.
python -m pytest tests -m 'not performance' -n 8 --tb=short --timeout=300 -q

performance:
name: Serial Performance
runs-on: ubuntu-latest
needs: lint
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: python -m pip install -e ".[dev]" -r requirements-ci-sdk.txt
- name: Run serial performance and isolated RSS contracts
env:
PYTEST_ADDOPTS: ''
run: make test-performance BT_CONDA_PYTHON=python

wheel-consumer:
name: Wheel Consumer
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Build and install isolated release artifacts
shell: bash
run: |
python -m pip install --upgrade pip setuptools wheel build twine
python -m pip install .
python -m build --outdir "$RUNNER_TEMP/dist"
python -m twine check "$RUNNER_TEMP"/dist/*
wheel_path=$(find "$RUNNER_TEMP/dist" -name '*.whl' -print -quit)
test -n "$wheel_path"
python -m pip install --no-deps --target "$RUNNER_TEMP/installed" "$wheel_path"
- name: Verify source identity and run consumer trades outside checkout
shell: bash
run: |
version=$(python -c "import runpy; print(runpy.run_path('backtrader/version.py')['__version__'])")
wheel_path=$(find "$RUNNER_TEMP/dist" -name '*.whl' -print -quit)
cd "$RUNNER_TEMP"
PYTHONPATH="$RUNNER_TEMP/installed" python "$GITHUB_WORKSPACE/scripts/ci/verify_release_wheel.py" \
--wheel "$wheel_path" --source-root "$GITHUB_WORKSPACE" \
--install-root "$RUNNER_TEMP/installed" --version "$version" \
--output "$RUNNER_TEMP/wheel-consumer.json"
- uses: actions/upload-artifact@v4
with:
name: wheel-consumer-evidence
path: ${{ runner.temp }}/wheel-consumer.json

coverage:
name: Coverage (non-strategy subset, non-blocking floor)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -269,13 +345,13 @@ jobs:
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: test
needs: [test, sdk, performance, wheel-consumer]
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" == "success" ]; then
echo "All matrix tests passed."
if [ "${{ needs.test.result }}" == "success" ] && [ "${{ needs.sdk.result }}" == "success" ] && [ "${{ needs.performance.result }}" == "success" ] && [ "${{ needs.wheel-consumer.result }}" == "success" ]; then
echo "All matrix tests, serial performance contracts and wheel consumers passed."
else
echo "At least one matrix test job failed"
exit 1
Expand Down Expand Up @@ -346,7 +422,7 @@ jobs:
- name: Run development R2/R3 strategy regression gate
if: github.base_ref == 'development'
shell: bash
run: make test-strategies
run: make test-strategies BT_CONDA_PYTHON=python

- name: Run original-baseline hotfix gate
if: github.base_ref == 'master'
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ backtrader_remove_metaprogramming_report_timing.json
performance_comparison.json
backtrader-master/*htmlcov/
docs/_internal/opts/requirements/迭代3-宏源期货完成穿透式认证/
examples/live_certification/hongyuan_penetration/reports/
examples/007_ctp/live_certification/hongyuan_penetration/reports/
examples/003_hft_notebook_examples/data/
examples/live_certification/simnow_penetration/reports/
examples/live_certification/hongyuan_penetration/*.docx
examples/007_ctp/live_certification/simnow_penetration/reports/
examples/007_ctp/live_certification/hongyuan_penetration/*.docx

# Generated visualizations and reports from runnable examples
/examples/output/
Expand Down
3 changes: 2 additions & 1 deletion .joyincode/joyin-project-skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"projectId": "0",
"managedEntries": [
"demo",
"未经授权禁止动已有代码",
"specx",
"opsx",
"devwiki",
"jcdb",
"markitdown",
"jccb",
"grill-with-docs"
]
}
93 changes: 0 additions & 93 deletions .joyincode/skills/devwiki/SKILL.md

This file was deleted.

24 changes: 0 additions & 24 deletions .joyincode/skills/devwiki/references/environment.md

This file was deleted.

Loading
Loading