Raxx · internal docs

internal · gated ↑ index

Alpaca integration — scoped to market data + optional live-broker handoff

Status: Draft (reframed) Owner: software-architect Last updated: 2026-04-22 Parent epic: #183 Supersedes: prior version of this doc (PR #184). Prior version's premise — per-user Alpaca OAuth for everything — has been replaced by the MBT-native paper engine. See mbt-paper-trading-engine.md for the replacement. Related ADRs: 0002, 0013, 0014, 0008 (Superseded), 0009 (Superseded), 0010 (Superseded), 0011 (Superseded)


1. Context + the reframe

The prior version of this doc (committed in PR #184 on the design/multi-tenant-alpaca branch) pointed every user at Alpaca OAuth for both paper and live trading. That premise is now obsolete: Raxx runs its own paper-trading engine (MBT). Alpaca's role in the architecture narrows to two deliberate surfaces:

  1. Market Data API — one server-side Alpaca account, one key, shared across all users. Source of quotes, bars, options chains, and end-of-day settles for MBT.
  2. Live-broker handoff — per-user Alpaca OAuth, only when a Pro+ user graduates from paper and explicitly connects a live broker. Minority of users; many will never touch it.

Everything else the old doc specified — per-user OAuth, per-user trade-update streams, mass-revocation as a headline invariant — applies only to the live-handoff subset. The "no stored credentials" invariant is restored for the majority of users (free + most Pro), because without a live broker connection there is no broker token to store.

This doc is now short by design. MBT is the big story (mbt-paper-trading-engine.md). This doc only covers how Alpaca slots in around it.

2. Invariants that apply

Unchanged from docs/architecture/auth.md §2. Specific to this surface:

3. Market Data API (shared, server-side)

Shape

Consumers

Tier gating

Per docs/marketing/pricing.md:

Enforcement is at the MarketDataHub service boundary, not Antlers. A Free user who calls the raw API gets the delayed path.

Cost + capacity flags

4. Live-broker handoff (Pro+ opt-in)

This is the only surface where per-user Alpaca OAuth still exists. Full treatment in ADR 0014.

Who + when

Flow

Not included

5. What changed from PR #184

For reviewers familiar with the prior version:

Concern PR #184 approach New approach
Where paper trading runs Alpaca paper (per-user OAuth) MBT (our simulator)
OAuth tokens stored For every user Only for Pro+ users who enroll live-handoff
Invariant #1 compliance Documented exception for all users (ADR 0009) Restored for most users; exception narrows to live-handoff subset (ADR 0014)
Market data Per-user OAuth (+ shared hub sketched for scale) One shared server-side key; no user OAuth for data
Premium tier compute Fargate + Firecracker per strategy against user's live Alpaca (ADR 0011) Deferred; re-scoped as "dedicated compute running MQ-A strategies against MBT + shared market data" — not against user's broker. New ADR when premium-tier spec is written.
Retention of paper history Alpaca's retention policy Our policy — per tier, our DB (Free 90d / Pro 3yr / Pro+ unlimited)
Regulatory posture Flagged Advisers Act + BD-via-Broker-API Same flags; MBT stays in user-directed-simulation lane more cleanly

ADRs 0008, 0009, 0010, 0011 are being marked Superseded by ADRs 0013 + 0014 (see each ADR's updated Status header).

PR #184 will be closed with a redirect to the new PR (design/mbt-paper-trading-engine).

6. Regulatory posture (unchanged from prior, reframed lane)

Flags for securities counsel; do not assume any of these are resolved. The MBT reframe makes the safest-lane story cleaner:

v1 stays in the safest lane deliberately. Flags for counsel remain:

7. Security considerations (Alpaca surface only)

8. Open questions

  1. Market-data tier. SIP vs IEX? Drives cost + user expectation. Product + finance call.
  2. Account capacity ceiling. At what user count does one Alpaca data account become insufficient (WebSocket concurrency, entitlement counts)? Alpaca-partnerships inquiry.
  3. Handoff broker beyond Alpaca. Pro tier promises "Alpaca live + 1 other." Which broker (IBKR? tastytrade?), and does that broker's OAuth posture match Alpaca's? Flag for follow-up ADR.
  4. Options chain archive source for Pro+ historical chains — Alpaca's options history is thin. ORATS / Polygon / CBOE DataShop candidates. Blocks Pro+ GA, not MBT v1.
  5. Backup paper account. Do we keep an Alpaca paper registration alive as a disaster-recovery path (e.g. if MBT's simulator has a bug, route users temporarily back to Alpaca paper)? Operational judgment call.

End of doc. See mbt-paper-trading-engine.md for the primary engine design, ADR 0013 for the reframe decision, and ADR 0014 for the re-scoped Alpaca posture.