Skip to content

feat(@typedtrader/exchange): pick the Alpaca data feed from the account's subscription - #1375

Merged
bennycode merged 1 commit into
mainfrom
feat/alpaca-feed-by-subscription
Sep 19, 2026
Merged

bennycode merged 1 commit into
mainfrom
feat/alpaca-feed-by-subscription

Conversation

@bennycode

Copy link
Copy Markdown
Owner

AlpacaMarketData pinned feed=iex on every stock market data request and always streamed v2/iex.

Historical data was worse than the account allows

Alpaca serves the best feed the subscription allows when the feed parameter is omitted, and SIP history older than 15 minutes is available on the free plan too. Pinning IEX therefore replaced consolidated bars with one exchange's share of them. Same day, same account:

AAPL 2025-12-01 daily bar
default feed : close=283.1  volume=46,587,722
forced iex   : close=283.17 volume=1,647,255

Backtests and indicators ran on those IEX-only bars. The parameter is now omitted, so each account gets what it is entitled to.

The stream has to name a feed

A stream URL is either v2/iex or v2/sip, so there is nothing to omit. The entitlement is probed once per instance by asking a latest endpoint for SIP: it answers subscription does not permit querying recent SIP data without the Algo Trader Plus plan. SIP entitlement streams v2/sip, anything else falls back to v2/iex, which every account can stream.

Checks

Against Alpaca with a real key: the bar comparison above, and the probe returning 403 with that message on a free plan, so the stream stays on IEX. Unit tests cover the omitted feed and both probe outcomes; each fails when the old behavior is put back.

…nt's subscription

Market data requests pinned feed=iex, so historical bars came from a single
exchange even though every account may read consolidated SIP history older
than 15 minutes: AAPL on 2025-12-01 reports 46.6M shares on the default feed
against 1.6M on IEX. Omitting the parameter lets Alpaca serve the best feed
the subscription allows. A stream URL has to name a feed, so the entitlement
is probed once and falls back to IEX.
@bennycode
bennycode enabled auto-merge (squash) September 19, 2026 21:35
@bennycode
bennycode merged commit 3710cc5 into main Sep 19, 2026
7 checks passed
@bennycode
bennycode deleted the feat/alpaca-feed-by-subscription branch September 19, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant