Skip to content

feat(alpaca): add permission-gated single-leg options trading - #1470

Draft
luokerenx4 wants to merge 1 commit into
devfrom
codex/alpaca-options-trading
Draft

feat(alpaca): add permission-gated single-leg options trading#1470
luokerenx4 wants to merge 1 commit into
devfrom
codex/alpaca-options-trading

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Alpaca already exposes option contracts and snapshots, but the adapter rejected every option write and omitted OPT from account capabilities. This connects single-leg orders to the existing UTA staging/approval path, advertises OPT for approved accounts, refreshes venue permissions before entry/amendment, and validates whole contract quantities and supported order fields.

Partial closes now match the OCC native key rather than the underlying symbol and reject quantities exceeding the position. Position reads normalize Alpaca's signed short quantity into UTA's positive quantity plus side convention, avoiding double-signing on downstream recomputation. Multi-leg orders, exercise instructions and option history remain outside this change.

Validation:

  • Alpaca pack and UTA service typechecks passed; compiled Bun pack import smoke passed.
  • UTA owner suite: 58 files / 1055 tests passed, including call/put and long/short position-unit cases.
  • UTA integration: 15 tests passed.
  • Full hermetic baseline: 778 files, 6936 passed, 4 skipped; subsequent option-only validation and position normalization changes passed the UTA owner suite.
  • Isolated remote native runtime loaded the built pack. Actual alice-uta CLI discovered a tradable SPY option, staged/committed/submitted one paper limit order, listed the correct OCC identity and contract units, and cancelled it. Venue verification confirmed Cancelled, zero open orders and unchanged pre-existing position quantities. Test runtime stopped and copied credentials removed; main remote runtime remains unchanged and healthy in Pro mode.

Acceptance still pending; keep draft: the paper account reports approved/trading level 3, but the market was closed. Alpaca accepted the hanger and refused its replacement with 42210000: cannot replace order in accepted status; the full reason reached CLI. Successful replacement, fills, partial/full closes and the remaining applicable S1–S14 scenarios need a market-open pass before promotion. No remote production pack was replaced.

Order rules checked against https://docs.alpaca.markets/us/docs/options-trading (whole qty, no notional, DAY/GTC, market/limit/stop/stop_limit, no extended hours).

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openalice-demo Ready Ready Preview Sep 10, 2026 10:36am UTC

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant