Repository navigation
fix: preserve Alpaca short direction when closing positions - #123
Closed
stefan-jansen wants to merge 6 commits into
Closed
stefan-jansen wants to merge 6 commits into
stefan-jansen wants to merge 6 commits into
Conversation
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>
Alpaca position snapshots report an unsigned share count and a separate long/short side. Treating qty as a signed quantity stored shorts as longs, so a later close sold more instead of buying to cover. Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An Alpaca short snapshot carries a separate side and an unsigned quantity. Treating that quantity as positive makes the portable broker see a long position and can sell more when asked to close it. Preserve the provider side when building portable positions so closing a short buys to cover.
Closes #118. Resolves the short-position part of #111, retaining the original #112 contribution by quantum-like/Cursor Agent.
Regression:
uv run pytest -q tests/unit/test_alpaca_broker.py::TestAlpacaBrokerSetup::test_connected_short_is_closed_with_a_buy_to_cover.Depends on security baseline #109. Alpaca provider evidence must be refreshed for a release because adapter behavior changes. No release or credentialed provider claim is included.
AI assistance: Cursor prepared the original repair; Codex reviewed it, added the SDK-to-public-close regression and ran failing-base/passing-fix verification.