matching-engine 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. {matching_engine-0.1.0 → matching_engine-0.2.0}/.github/dependabot.yml +3 -0
  2. matching_engine-0.2.0/.github/workflows/ci.yml +25 -0
  3. {matching_engine-0.1.0 → matching_engine-0.2.0}/.github/workflows/release.yml +11 -4
  4. {matching_engine-0.1.0 → matching_engine-0.2.0}/CHANGELOG.md +43 -1
  5. {matching_engine-0.1.0 → matching_engine-0.2.0}/Dockerfile +2 -2
  6. matching_engine-0.2.0/LICENSE +662 -0
  7. matching_engine-0.1.0/README.md → matching_engine-0.2.0/PKG-INFO +51 -2
  8. matching_engine-0.1.0/PKG-INFO → matching_engine-0.2.0/README.md +20 -29
  9. matching_engine-0.2.0/docs/adr/0005-stop-orders-and-amend.md +40 -0
  10. {matching_engine-0.1.0 → matching_engine-0.2.0}/pyproject.toml +8 -2
  11. {matching_engine-0.1.0 → matching_engine-0.2.0}/requirements.txt +14 -11
  12. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/__init__.py +1 -1
  13. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/book.py +6 -0
  14. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/domain.py +25 -3
  15. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/engine.py +151 -13
  16. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/events.py +26 -2
  17. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/app.py +40 -6
  18. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/schemas.py +32 -3
  19. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/market.py +10 -2
  20. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/wal.py +34 -8
  21. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/helpers.py +5 -0
  22. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_gateway.py +34 -0
  23. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_market.py +3 -1
  24. matching_engine-0.2.0/tests/test_replace.py +77 -0
  25. matching_engine-0.2.0/tests/test_stop_orders.py +133 -0
  26. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_wal.py +6 -1
  27. matching_engine-0.2.0/uv.lock +1075 -0
  28. matching_engine-0.1.0/.github/workflows/ci.yml +0 -43
  29. matching_engine-0.1.0/LICENSE +0 -21
  30. matching_engine-0.1.0/uv.lock +0 -940
  31. {matching_engine-0.1.0 → matching_engine-0.2.0}/.dockerignore +0 -0
  32. {matching_engine-0.1.0 → matching_engine-0.2.0}/.gitattributes +0 -0
  33. {matching_engine-0.1.0 → matching_engine-0.2.0}/.gitignore +0 -0
  34. {matching_engine-0.1.0 → matching_engine-0.2.0}/.python-version +0 -0
  35. {matching_engine-0.1.0 → matching_engine-0.2.0}/CONTRIBUTING.md +0 -0
  36. {matching_engine-0.1.0 → matching_engine-0.2.0}/Makefile +0 -0
  37. {matching_engine-0.1.0 → matching_engine-0.2.0}/SECURITY.md +0 -0
  38. {matching_engine-0.1.0 → matching_engine-0.2.0}/bench/_common.py +0 -0
  39. {matching_engine-0.1.0 → matching_engine-0.2.0}/bench/bench_engine.py +0 -0
  40. {matching_engine-0.1.0 → matching_engine-0.2.0}/bench/bench_gateway.py +0 -0
  41. {matching_engine-0.1.0 → matching_engine-0.2.0}/bench/bench_recovery.py +0 -0
  42. {matching_engine-0.1.0 → matching_engine-0.2.0}/docker-compose.yml +0 -0
  43. {matching_engine-0.1.0 → matching_engine-0.2.0}/docs/adr/0001-single-threaded-engine-per-market.md +0 -0
  44. {matching_engine-0.1.0 → matching_engine-0.2.0}/docs/adr/0002-wal-format-and-fsync-policy.md +0 -0
  45. {matching_engine-0.1.0 → matching_engine-0.2.0}/docs/adr/0003-integer-ticks-and-lots.md +0 -0
  46. {matching_engine-0.1.0 → matching_engine-0.2.0}/docs/adr/0004-python-first-with-a-rust-path.md +0 -0
  47. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/__main__.py +0 -0
  48. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/cli.py +0 -0
  49. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/__init__.py +0 -0
  50. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/config.py +0 -0
  51. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/marketdata.py +0 -0
  52. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/gateway/worker.py +0 -0
  53. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/journal.py +0 -0
  54. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/py.typed +0 -0
  55. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/sequencer.py +0 -0
  56. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/snapshot.py +0 -0
  57. {matching_engine-0.1.0 → matching_engine-0.2.0}/src/matching_engine/workload.py +0 -0
  58. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/conftest.py +0 -0
  59. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/crash_writer.py +0 -0
  60. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/cancel_after_partial_fill.json +0 -0
  61. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/cancel_rejections.json +0 -0
  62. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/fok_reject_then_fill.json +0 -0
  63. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/ioc_partial_then_cancel.json +0 -0
  64. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/market_order_partial_then_cancel.json +0 -0
  65. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/partial_fill_rests_remainder.json +0 -0
  66. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/post_only_reject_and_rest.json +0 -0
  67. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/stp_cancel_both.json +0 -0
  68. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/stp_cancel_maker.json +0 -0
  69. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/stp_cancel_taker.json +0 -0
  70. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/sweep_levels_with_price_improvement.json +0 -0
  71. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/time_priority_at_one_price.json +0 -0
  72. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/golden/validation_rejects.json +0 -0
  73. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_book.py +0 -0
  74. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_cli.py +0 -0
  75. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_crash.py +0 -0
  76. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_domain.py +0 -0
  77. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_golden.py +0 -0
  78. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_marketdata.py +0 -0
  79. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_matching.py +0 -0
  80. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_properties.py +0 -0
  81. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_protections.py +0 -0
  82. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_recovery.py +0 -0
  83. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_sequencer.py +0 -0
  84. {matching_engine-0.1.0 → matching_engine-0.2.0}/tests/test_time_in_force.py +0 -0
@@ -19,6 +19,9 @@ updates:
19
19
  groups:
20
20
  python-minor:
21
21
  update-types: [minor, patch]
22
+ # pydantic pins pydantic-core exactly; it moves only when pydantic does.
23
+ ignore:
24
+ - dependency-name: pydantic-core
22
25
 
23
26
  - package-ecosystem: docker
24
27
  directory: "/"
@@ -0,0 +1,25 @@
1
+ # Runs the tests on a pull request into main — and on nothing else.
2
+ # The job lives once in CtrlAltDevelop/ci-workflows (python-test.yml).
3
+
4
+ name: CI
5
+
6
+ on:
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ permissions: {}
15
+
16
+ jobs:
17
+ test:
18
+ name: Test
19
+ uses: CtrlAltDevelop/ci-workflows/.github/workflows/python-test.yml@v1.2.0
20
+ permissions:
21
+ contents: read
22
+ with:
23
+ python-version: "3.14"
24
+ # The gateway extra carries fastapi, which the gateway tests import.
25
+ install: uv sync --locked --all-extras
@@ -3,8 +3,12 @@
3
3
  # =============================================================================
4
4
  # Runs on a version tag. No API token exists anywhere: PyPI trusts this
5
5
  # workflow's OIDC identity, configured once under the project's "Publishing"
6
- # settings (owner CtrlAltDevelop, repo matching-engine, workflow release.yml,
7
- # environment pypi).
6
+ # settings (owner CtrlAltDevelop, repo matching-engine, workflow
7
+ # release.yml, environment pypi).
8
+ #
9
+ # The publish job lives in this file, not in the shared reusable workflow
10
+ # (CtrlAltDevelop/ci-workflows python-publish.yml): PyPI rejected a publish
11
+ # from the reusable job with `invalid-publisher` in mdp-outbox, the same setup.
8
12
 
9
13
  name: Release
10
14
 
@@ -36,7 +40,7 @@ jobs:
36
40
  exit 1
37
41
  fi
38
42
  - run: uv build
39
- - uses: actions/upload-artifact@v5
43
+ - uses: actions/upload-artifact@v7
40
44
  with:
41
45
  name: dist
42
46
  path: dist/
@@ -53,8 +57,11 @@ jobs:
53
57
  permissions:
54
58
  id-token: write # the OIDC token PyPI exchanges for a short-lived upload credential
55
59
  steps:
56
- - uses: actions/download-artifact@v6
60
+ - uses: actions/download-artifact@v8
57
61
  with:
58
62
  name: dist
59
63
  path: dist/
60
64
  - uses: pypa/gh-action-pypi-publish@release/v1
65
+ with:
66
+ # Don't fail on a re-run: files PyPI already has are skipped.
67
+ skip-existing: true
@@ -8,6 +8,46 @@ cannot read the previous release's files is a major version.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.2.0] — 2026-11-26
12
+
13
+ ### Added
14
+
15
+ - Amend: `PATCH /markets/{symbol}/orders/{order_id}?account=` with a new price
16
+ and total remaining quantity. Lowering size at the same price keeps queue
17
+ position; any other change re-queues at the back and matches if it crosses.
18
+ New `ReplaceOrder` command and `order_replaced` event.
19
+ - Stop and stop-limit orders: set `stop_price` on a new order. It is parked
20
+ off the book until the last trade price reaches it (buy: at or above, sell:
21
+ at or below), then submitted in arrival order, cascading within the same
22
+ command. New `order_triggered` event and `pending` order status; parked
23
+ stops can be cancelled. See ADR 5.
24
+ - ADR 5, recording the stop trigger and amend decisions.
25
+
26
+ ### Changed
27
+
28
+ - WAL: replace is record kind 3 and a stop order is kind 4. Existing logs
29
+ replay unchanged. Snapshots gain `last_trade_price` and `stops`, both
30
+ defaulted, so existing snapshots load. The engine state hash now covers
31
+ them, so hashes differ from 0.1.x.
32
+ - Dependencies: the python-minor group (14 updates); Docker base image
33
+ python 3.15-slim.
34
+
35
+ ## [0.1.1] — 2026-10-15
36
+
37
+ ### Fixed
38
+
39
+ - Prices and quantities with more digits than the decimal context holds were
40
+ silently rounded onto the grid; they are now refused. A huge exponent
41
+ (`1e999999`) returned a 500 instead of a 422.
42
+ - A WebSocket feed cancelled by server shutdown left its pump and hang-up
43
+ tasks running, and a send error on a dead socket was logged as an
44
+ unretrieved task exception.
45
+
46
+ ### Changed
47
+
48
+ - Dependencies: fastapi 0.143.1, starlette 1.8.0, pydantic 2.14.1,
49
+ httptools 0.9.0, ruff 0.17.0.
50
+
11
51
  ## [0.1.0] — 2026-09-29
12
52
 
13
53
  ### Added
@@ -35,5 +75,7 @@ cannot read the previous release's files is a major version.
35
75
  - Golden, property-based, replay, crash (killed subprocess) and gateway tests;
36
76
  engine, recovery and end-to-end benchmarks.
37
77
 
38
- [Unreleased]: https://github.com/CtrlAltDevelop/matching-engine/compare/v0.1.0...HEAD
78
+ [Unreleased]: https://github.com/CtrlAltDevelop/matching-engine/compare/v0.2.0...HEAD
79
+ [0.2.0]: https://github.com/CtrlAltDevelop/matching-engine/compare/v0.1.1...v0.2.0
80
+ [0.1.1]: https://github.com/CtrlAltDevelop/matching-engine/compare/v0.1.0...v0.1.1
39
81
  [0.1.0]: https://github.com/CtrlAltDevelop/matching-engine/releases/tag/v0.1.0
@@ -1,5 +1,5 @@
1
1
  # syntax=docker/dockerfile:1
2
- FROM python:3.14-slim AS build
2
+ FROM python:3.15-slim AS build
3
3
  COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /usr/local/bin/uv
4
4
  WORKDIR /app
5
5
  ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
@@ -9,7 +9,7 @@ RUN uv sync --frozen --no-dev --extra gateway --no-install-project
9
9
  COPY src ./src
10
10
  RUN uv sync --frozen --no-dev --extra gateway --no-editable
11
11
 
12
- FROM python:3.14-slim
12
+ FROM python:3.15-slim
13
13
  RUN useradd --system --uid 10001 --home-dir /nonexistent engine \
14
14
  && mkdir /data && chown engine /data
15
15
  COPY --from=build /app/.venv /app/.venv