Skip to content

fix: reject Alpaca fills without executed quantity - #124

Closed
stefan-jansen wants to merge 6 commits into
mainfrom
fix/alpaca-fill-evidence
Closed

stefan-jansen wants to merge 6 commits into
mainfrom
fix/alpaca-fill-evidence

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

An Alpaca fill notification with zero or missing executed quantity is currently rewritten as a full fill. Reject that notification before changing the tracked order, removing pending state, or refreshing positions. Continue accepting a valid full fill.

Closes #119. Resolves the missing-fill-evidence part of #111, retaining the original #112 contribution by quantum-like/Cursor Agent.

Regression: uv run pytest -q tests/unit/test_alpaca_broker.py::test_registered_sdk_fill_preserves_order_when_quantity_is_missing.

  • Producing base 2ad36a8: zero and missing quantities fail the atomicity assertions because the returned pending order becomes FILLED. The valid-full-fill control passes.
  • Fix 16ef90a: all three unchanged SDK workflow cases pass, plus the original regression.
  • The workflow connects the public broker, submits an order, and invokes the callback registered with TradingStream using fully validated Alpaca Order and TradeUpdate models. Only external transports are replaced. It checks all returned fill fields remain unchanged and no position refresh occurs on rejected evidence.
  • Failing-base verification loads complete original producing source from git archive and runs the same regression. Ruff and commit hooks passed. Full stable and ecosystem qualification must pass in hosted CI before merge.

Depends on security baseline #109. A release needs matching fresh Alpaca provider evidence; no release or credentialed result is claimed here.

AI assistance: Cursor prepared the original repair; Codex reviewed it, added public-submission/registered-SDK callback coverage, and ran fail/pass checks.

dependabot Bot and others added 4 commits October 7, 2026 02:36
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.7.0...2.8.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.8.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
A fill event with a zero or missing filled_qty was rewritten to the full
order size. That recorded a complete fill the venue had not reported.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 14:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen stefan-jansen added type: bug Confirmed or reported incorrect behavior priority: normal Normal planned work status: accepted Accepted for implementation compatibility: affected Has Python, platform, dependency, or cross-library compatibility impact labels Oct 17, 2026
@stefan-jansen

Copy link
Copy Markdown
Contributor Author

Superseded by the combined maintainer-directed maintenance PR #121 to avoid qualifying and merging this queue separately. This PR head and its regression/documentation evidence are preserved in #121 and in a verified recovery archive. The accepted issue remains open until the combined fix lands; this closure does not claim the fix is merged. Follow-up work continues in #121.

@stefan-jansen
stefan-jansen deleted the fix/alpaca-fill-evidence branch October 18, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility: affected Has Python, platform, dependency, or cross-library compatibility impact priority: normal Normal planned work status: accepted Accepted for implementation type: bug Confirmed or reported incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject Alpaca fill notifications with no executed quantity atomically

3 participants