Repository navigation
Add Alpaca multi-symbol stock requests, weekly and monthly bars, and asof - #155
Merged
Merged
Conversation
update-all asks up to today, which a free plan answers with HTTP 403 for the SIP feed, reported as an invalid API key. A SIP stock request now ends sip_delay_minutes (default 15) before now; 0 disables the cut. 401/403 errors carry Alpaca's own message.
fetch_batch_ohlcv sends up to chunk_size stock tickers per request to /v2/stocks/bars and returns one long frame in the canonical schema, each ticker validated alone. Tickers without bars are absent, which makes monthly bars a probe for which tickers traded, delisted ones included. Pagination moves into _paginate, shared with the single-symbol path.
Alpaca maps a ticker to the company holding it on asof, today by default: a renamed company's history appears under both tickers and the multi-symbol endpoint drops the old one. asof='-' returns the bars traded under each ticker, which keeps a store free of duplicate and missing histories; an InstrumentRegistry then joins renames.
stefan-jansen
marked this pull request as ready for review
November 24, 2026 20:16
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.
Closes #152. Depends on #153; that contributor history and its corrective follow-up are included without rewriting attribution. Merge #153 first, then refresh this branch against main and qualify the resulting head.
AlpacaDataProvider.fetch_batch_ohlcvfetches stocks in bounded symbol chunks and follows every shared pagination token. Weekly/1w and monthly/1mo aliases map to Alpaca's supported timeframes. Optionalasof="YYYY-MM-DD"or"-"is sent on stock requests; omittedasofpreserves existing behavior. Missing symbols are absent from the canonical long frame, including the all-missing empty result.Independent review added validation for malformed per-symbol responses, unexpected returned symbols and invalid chunk-size types. A clipped Basic-plan window ending before its start returns an empty frame without HTTP. Repeated pagination tokens fail instead of silently returning incomplete data. Per-symbol OHLC validation is preserved.
Verification at
9a2e25e8ab93370a81639e752547ded58efddc70:The provider guide documents batch behavior and ticker mapping. Its historical live-data table is contributor-supplied, not an independently reproduced live-provider benchmark. The maintainer used official API documentation and deterministic HTTP responses; no credentialed provider requests were made. The original submission disclosed Claude Code assistance; its author and commits remain preserved. Maintainer tests and repairs also used an AI coding agent.