fix(@typedtrader/exchange): read Alpaca market data from the regular hosts in paper mode - #1374
Merged
Merged
Conversation
…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.
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.
In paper mode,
AlpacaAPIread market data fromdata.sandbox.alpaca.marketsandAlpacaStreamconnected tostream.data.sandbox.alpaca.markets. Those sandbox hosts are for Broker API partners. With a regular paper account:data.sandbox.alpaca.marketsdata.alpaca.marketsstream.data.sandbox.alpaca.markets402 auth failedstream.data.alpaca.marketsSo 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.marketsandstream.data.alpaca.markets. The trading hosts still follow paper mode (paper-api.alpaca.markets).AlpacaStreamCredentialslosesusePaperTrading, which only chose the host.Checked against Alpaca with paper keys:
AlpacaMarketData.getCandlesreturns 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.