Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6d8d2c4
fix: ensure exit_reason propagates
davison Feb 21, 2026
63417b5
chore: fix mypy errors
davison Feb 21, 2026
b7d8e09
feat: full reporting module
davison Feb 22, 2026
3ee2a4c
fix: typing
davison Feb 22, 2026
8dfa973
ci: use uv instead of pip
davison Feb 22, 2026
168dd83
fix: better exception cleanup
davison Feb 22, 2026
e52d92c
docs(examples): fixup example code
davison Feb 22, 2026
a203039
fix: IG credential exposure
davison Feb 22, 2026
03ac1ab
fix: None type incorrectly handled
davison Feb 23, 2026
3bf7b94
fix: additional None type error
davison Feb 23, 2026
ed7c15a
docs: update README and AGENTS
davison Feb 24, 2026
30bc110
fix; further defensive checks against null values
davison Feb 24, 2026
c8941c6
feat: add SessionReadyEvent lifecycle event
davison Feb 25, 2026
e5d6cc1
refactor: BaseStrategy subscribes to SessionStartedEvent for warmup
davison Feb 25, 2026
f53fbcc
feat: add BasePortfolio and Portfolio protocol
davison Feb 25, 2026
e12e72c
feat: add SimplePortfolio for single-strategy use cases
davison Feb 25, 2026
03a6415
refactor: ReconciliationManager lifecycle via events
davison Feb 25, 2026
7071f99
refactor: replace run_strategies() with run_portfolio()
davison Feb 25, 2026
3992503
refactor: backtest runner accepts portfolio_factory
davison Feb 25, 2026
6c124b8
feat(portfolio): add BasePortfolio/SimplePortfolio + run_portfolio() …
davison Feb 25, 2026
c7145ec
docs: update backtesting guide and example scripts to portfolio API
davison Feb 25, 2026
dacc5de
fix: only log margin status on OrderCompleted
davison Feb 25, 2026
b42e5c4
test: fix tests broken by commit a2030393
davison Feb 25, 2026
5199257
fix: edge case with position size not quantised
davison Feb 26, 2026
c5ed845
fix: relax tping for test purposes
davison Feb 26, 2026
0604e97
docs: remove reference to disused period
davison Feb 26, 2026
682f6b8
test: update test to match recent quant change
davison Feb 26, 2026
5213fdf
chore: fix typing issue
davison Feb 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
run: uv sync --extra dev

- name: Run mypy
run: mypy tradedesk
run: uv run mypy tradedesk

- name: Run ruff
run: ruff check tradedesk
run: uv run ruff check tradedesk

test:
name: Test Python ${{ matrix.python-version }}
Expand All @@ -39,20 +38,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Install dependencies
run: uv sync --extra dev

- name: Run tests with coverage
run: |
pytest \
uv run pytest \
--cov=tradedesk \
--cov-report=term-missing \
--cov-report=xml \
--cov-fail-under=80
--cov-fail-under=85
9 changes: 3 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.14"

- name: Install build dependencies
run: python -m pip install --upgrade build

- name: Build package
run: python -m build
run: uv build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
91 changes: 5 additions & 86 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
## Project Overview

**tradedesk** is the shared research and orchestration layer that underpins multiple trading implementations. It provides common abstractions for data handling, backtesting, portfolio orchestration, analytics, and experiment management.

This codebase is **not broker-specific**. It exists to:

* Enable fast, repeatable strategy research
* Provide realistic portfolio-level backtesting
* Act as the canonical home for shared logic and metrics

Downstream projects should depend on *tradedesk*; *tradedesk* should not depend on them.

---

## Primary Responsibilities

Agents should treat *tradedesk* as responsible for:

* Backtest orchestration and experiment flow
* Strategy-agnostic portfolio logic
* Trade recording, ledgers, and metrics
* Naming, configuration, and reproducibility conventions
* Research-grade correctness over execution convenience

If logic is reusable across brokers or execution environments, it likely belongs here.

---

## Current Objectives

Typical work includes:

* Closing meaningful unit test coverage gaps
* Hardening portfolio and analytics logic
* Simplifying or clarifying orchestration flows
* Removing legacy or leaked execution concerns
* Ensuring deterministic, explainable backtest results

Backward compatibility is **not required** unless explicitly stated.

---

## Preferred Way of Working

### Incremental and Focused
Expand All @@ -57,29 +15,22 @@ Backward compatibility is **not required** unless explicitly stated.
### Pragmatic Testing

* Tests should defend correctness, not chase coverage
* Prioritise:

* Portfolio aggregation logic
* Metrics and statistics
* Edge cases and boundary conditions
* Avoid brittle, over-specified tests
* Use `pytest` not `unittest`

### Communication Style

* Concise, technical, professional
* Minimal narration
* Challenge assumptions where appropriate
* Challenge assumptions - constructive dialog and pushback is expected

---

## Coding Expectations

* Use latest stable Python and dependencies
* Follow current documentation and APIs
* No `from __future__ import ...` unless warranted
* Prefer clarity and correctness over abstraction
* Avoid premature generalisation
* Code should meet `ruff check` and `mypy --strict` requirements
* Code should pass `ruff check` and `mypy --strict` requirements
* Create commit messages for git following "Conventional Commits" and the current style of the project's git log
* Do not add author lines to git commits
* Follow the intentions of the domain architecture encoded in `pyproject.toml`
Expand All @@ -89,37 +40,5 @@ Backward compatibility is **not required** unless explicitly stated.

When running code or commands:

* Use the `.venv` directory in the root of the relevant project

---

## Domain Assumptions

Agents are expected to understand:

* Backtesting mechanics and common biases
* Portfolio-level statistics and drawdown analysis
* Event-driven strategy evaluation
* The difference between research code and execution code

If a design choice trades realism for speed or simplicity, it should be explicit.

---

## What to Avoid

* Broker- or API-specific logic
* Leaking execution assumptions into research layers
* Over-engineering for hypothetical future needs
* Large rewrites without alignment

---

## Success Criteria

An agent is succeeding if it:

* Increases confidence in backtest results
* Improves clarity of portfolio and metrics logic
* Makes research workflows faster and safer
* Keeps the codebase cleanly reusable downstream
* Use `uv` instead of `pip`
* Always use the `.venv` directory in the root of the project
Loading