Skip to content

fix(@typedtrader/exchange): read Alpaca market data from the regular hosts in paper mode - #1374

Merged
bennycode merged 1 commit into
mainfrom
fix/alpaca-paper-market-data
Sep 19, 2026
Merged

bennycode merged 1 commit into
mainfrom
fix/alpaca-paper-market-data

Conversation

@bennycode

Copy link
Copy Markdown
Owner

In paper mode, AlpacaAPI read market data from data.sandbox.alpaca.markets and AlpacaStream connected to stream.data.sandbox.alpaca.markets. Those sandbox hosts are for Broker API partners. With a regular paper account:

Host Paper keys
data.sandbox.alpaca.markets 401 Authorization Required
data.alpaca.markets bars returned
stream.data.sandbox.alpaca.markets 402 auth failed
stream.data.alpaca.markets authenticated

So any paper session could neither fetch candles nor stream them. The hosts came in with #959, when the official SDK was replaced; the SDK used the regular data hosts for paper accounts.

Market data now always uses data.alpaca.markets and stream.data.alpaca.markets. The trading hosts still follow paper mode (paper-api.alpaca.markets). AlpacaStreamCredentials loses usePaperTrading, which only chose the host.

Checked against Alpaca with paper keys: AlpacaMarketData.getCandles returns daily MSFT candles and the market data stream authenticates. The new tests pin the hosts in both modes.

Needed by #1373, whose CLI warm-up runs on a paper account.

…hosts in paper mode

Paper mode sent market data requests to data.sandbox.alpaca.markets and
stream.data.sandbox.alpaca.markets. Those hosts are for Broker API partners:
paper keys get a 401 on the data API and fail auth on the stream. Paper and
live accounts share data.alpaca.markets and stream.data.alpaca.markets.
@bennycode
bennycode merged commit 304f340 into main Sep 19, 2026
7 checks passed
@bennycode
bennycode deleted the fix/alpaca-paper-market-data branch September 19, 2026 21:31
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