Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body:
attributes:
label: Contract versions
description: Include scenario, journal, diagnostic, and strategy versions that apply.
placeholder: scenario v4, journal v4, strategy v3
placeholder: scenario v1, journal v1, strategy v1
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/contract-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
id: versions
attributes:
label: Affected versions
placeholder: current v4; frozen v1-v3 unchanged
placeholder: current v1 and proposed change
validations:
required: true
- type: dropdown
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/cross-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ body:
id: contracts
attributes:
label: Contract versions
placeholder: scenario v3, journal v3, strategy v3
placeholder: scenario v1, journal v1, strategy v1
validations:
required: true
- type: dropdown
Expand Down
9 changes: 2 additions & 7 deletions .github/labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
{"category": "effort", "name": "effort: medium", "color": "fef2c0", "description": "Multi-file change with moderate design or testing work"},
{"category": "effort", "name": "effort: large", "color": "f9d0c4", "description": "Broad change that should be split into reviewed increments"},

{"category": "contract", "name": "contract: scenario-v1", "color": "5319e7", "description": "Frozen scenario and journal contract version 1"},
{"category": "contract", "name": "contract: scenario-v2", "color": "5319e7", "description": "Frozen scenario and journal contract version 2"},
{"category": "contract", "name": "contract: scenario-v3", "color": "5319e7", "description": "Transitional scenario and journal contract version 3"},
{"category": "contract", "name": "contract: scenario-v4", "color": "5319e7", "description": "Current scenario and journal contract version 4"},
{"category": "contract", "name": "contract: strategy-v1", "color": "7057ff", "description": "Historical external strategy protocol version 1"},
{"category": "contract", "name": "contract: strategy-v2", "color": "7057ff", "description": "Historical external strategy protocol version 2"},
{"category": "contract", "name": "contract: strategy-v3", "color": "7057ff", "description": "Current external strategy protocol version 3"},
{"category": "contract", "name": "contract: scenario-v1", "color": "5319e7", "description": "Current scenario and journal contract"},
{"category": "contract", "name": "contract: strategy-v1", "color": "7057ff", "description": "Current external strategy protocol"},

{"category": "dependency", "name": "dependency: persistra", "color": "006b75", "description": "Requires coordinated behavior or validation in Persistra"},
{"category": "dependency", "name": "dependency: upstream", "color": "006b75", "description": "Depends on an external project or toolchain"},
Expand Down
2 changes: 1 addition & 1 deletion .github/repository.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Deterministic event-driven OCaml execution engine with versioned replay contracts and causal audit journals",
"description": "Deterministic OCaml trading replay engine",
"homepage": "https://fallblu.github.io/trading-engine/",
"topics": [
"backtesting",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PERSISTRA_COMPAT_REVISION: ade8c05e435c56d8df8eba88fed1284652fd731b
PERSISTRA_COMPAT_REVISION: 6874e175098519eef9904edf0bb9f27b244982e4
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
- working-directory: persistra
env:
PERSISTRA_TRADING_ENGINE_BINARY: ${{ github.workspace }}/trading-engine/_build/default/bin/main.exe
PERSISTRA_TRADING_ENGINE_CONTRACT_DIR: ${{ github.workspace }}/trading-engine/contracts/v3
PERSISTRA_TRADING_ENGINE_CONTRACT_DIR: ${{ github.workspace }}/trading-engine/contracts/v1
run: uv run pytest --no-cov tests/integration/test_trading_engine.py

persistra-latest-head:
Expand Down Expand Up @@ -182,5 +182,5 @@ jobs:
- working-directory: persistra
env:
PERSISTRA_TRADING_ENGINE_BINARY: ${{ github.workspace }}/trading-engine/_build/default/bin/main.exe
PERSISTRA_TRADING_ENGINE_CONTRACT_DIR: ${{ github.workspace }}/trading-engine/contracts/v3
PERSISTRA_TRADING_ENGINE_CONTRACT_DIR: ${{ github.workspace }}/trading-engine/contracts/v1
run: uv run pytest --no-cov tests/integration/test_trading_engine.py
94 changes: 9 additions & 85 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,11 @@
# Changelog

## Unreleased

- Add versioned machine-readable CLI success results and JSON failure diagnostics, plus bounded
JSON Lines standard-input spooling and unambiguous completed-journal standard-output pipelines.
- Publish scenario/journal contract v16 and strategy protocol v14 with typed, dimensioned strategy
metrics while retaining string-only metric compatibility through v15 and protocol v13.

- Add bounded level-two order-book replay with fresh snapshots, contiguous absolute updates,
multi-level marketable depth, deterministic passive queue position, and locked-book support.
- Publish scenario/journal contract v15 and external strategy protocol v13 while preserving v14
and protocol v12 as frozen compatibility contracts.
- Add causal quote/trade replay with displayed-liquidity capacity, aggressor-qualified passive
fills, maker/taker fee attribution, and economic event timestamps.
- Publish scenario/journal contract v14 and external strategy protocol v12 while preserving v13
and protocol v11 as frozen compatibility contracts.
- Add conservative next-open and adverse-touch completed-bar execution models with strict fixed
spread and linear participation-impact configuration, explicit missing-volume policy,
tick-aligned prices, and separate price-component audit attribution.
- Publish scenario/journal contract v13 and external strategy protocol v11 while preserving v12
and protocol v10 as frozen compatibility contracts.

- Add exact stock-dividend, rights, and spin-off distributions with explicit basis allocation,
fractional rejection or cash-in-lieu policy, destination currency validation, target adjustment,
and complete journal attribution.
- Add stable-identity instrument lifecycle state for halt, resume, identifier/provider remapping,
expiration, and delisting with deterministic order cancellation and explicit terminal hold or
cash-out policy.
- Publish scenario/journal contract v12 and external strategy protocol v10 while preserving v11
and protocol v9 as frozen compatibility contracts.
- Add deterministic trade-date and settlement-date accounting, versioned business-date settlement
calendars, settled and unsettled cash and position attribution, explicit settlement buying-power
policies, and auditable settlement completion and failure events.
- Publish scenario/journal contract v11 and external strategy protocol v9 while preserving v10 and
protocol v8 as frozen compatibility contracts.
- Add effective-time borrow availability, signed rates, locate clipping or rejection, recalls,
deterministic close-outs, and explicit missing-data behavior.
- Add effective-time currency credit/debit rates with Actual/365 or Actual/360 day count, simple or
daily compounding, deterministic cash-ledger entries, and realized P&L attribution.
- Publish scenario/journal contract v10 and external strategy protocol v8 while preserving v9 and
protocol v7 as frozen compatibility contracts.
- Added instrument-aware, composable fee schedules with named fixed, notional, and per-unit
components; explicit rounding; maker/taker applicability; per-fill minimums and caps; rebates;
and deterministic multi-currency conversion.
- Added signed fee-component attribution to fills, positions, valuations, journals, and external
strategy events in scenario/journal contract v9 and strategy protocol v7.
- Preserved completed-bar configuration v1, scenario/journal v8, and strategy protocol v6 as
compatibility contracts.

- Add explicit GTC, IOC, FOK, DAY, and GTD order lifetimes plus completed-bar stop and stop-limit
activation in scenario contract v8 and external strategy protocol v6.

- Add contract v7 exact per-instrument risk policies, versioned overlapping exposure groups,
reservation-aware admission and fill clipping, group diagnostics, and strategy protocol v5.

- Add contract v6 explicit initial portfolio snapshots with signed cash and positions, accounting
history, initial marks and FX, strict risk validation, initial-state auditing, and strategy
protocol v4 initialization.
- Publish strict versioned configuration and machine-readable capabilities for each compiled
execution model.
- Add contract v5 venue calendars with explicit venue and calendar identities, regular and
extended trading phases, holidays, early closes, and reducer-independent clock resolution.
- Protect `main` with required integration checks and a no-bypass review policy, and make rebase
merging the only supported repository merge mode.
- Establish a security baseline with private reporting guidance, grouped dependency proposals,
dependency review, and CodeQL analysis for workflows and Python tooling.
- Add structured issue and pull-request intake, reviewed planning-label and repository metadata,
explicit compatibility guarantees, a pinned required Persistra baseline, and a manual
nonrequired latest-head signal.
- Verify exact canonical journal bytes across locked, dependency-bound, and operating-system CI
cells, with safe concurrency cancellation and documented required versus informational gates.
- Publish one strict documentation site for architecture, versioned contracts, and generated OCaml
APIs, with offline topology checks and bounded external-link validation.
- Define a reproducible release-candidate artifact set with install verification, checksums, SPDX
inventory, SLSA provenance, and a manual tag-only signing boundary.

## 1.0.0 — 2026-08-21

- Release the deterministic completed-bar execution engine with exact checked arithmetic,
causal audit journals, and versioned JSON and JSON Lines contracts.
- Support portfolio targets, direct orders, partial fills, fees, multi-currency accounting,
corporate actions, borrow costs, margin controls, and deterministic liquidation.
- Add synchronous external strategies through protocol v3 with current-slice callback state and
strategy responses applied before matching continues.
- Provide strict schemas, conformance fixtures, replay validation, and Persistra compatibility
checks.
## [1.1.0] - 2026-08-26

- Reset the scenario, journal, strategy, execution-configuration, CLI, and diagnostic contracts to
one authoritative v1 surface.
- Remove historical schemas, compatibility dispatch, deprecated constructors, frozen fixtures,
and obsolete compatibility tests.
- Require explicit initial portfolios, current risk and fee policies, complete market slices, and
current strategy initialization.
- Simplify repository and contract documentation around the current engine boundary.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ position. Do not encode delivery commitments in labels. The reviewed label defin
repository metadata live under `.github/` and must agree with the GitHub settings.

For reciprocal Persistra compatibility guarantees and the pin-advancement procedure, read
[Persistra integration](docs/persistra.md#compatibility-guarantees).
[Persistra integration](docs/persistra.md#compatibility-gate).
Loading
Loading