quantlab.acquisition.alpaca#
Download US stock bars, quotes and trades from Alpaca Market Data.
AlpacaAcquisition is the Alpaca-specific part of the acquisition layer.
It builds one HTTP request per page against Alpaca’s historical stock
endpoints and hands each page to the shared SymbolBatchAcquisition base class, which
handles pagination, resuming, concurrency, per-batch failures and writing the
raw parquet files (shards). Besides daily and minute bars (open, high,
low, close and volume per interval), Alpaca serves tick data: every
individual quote (best bid and ask) and trade.
Two data-quality terms matter here. Survivorship bias is the distortion that comes from studying only companies that still exist today; a point-in-time symbol list avoids it by naming each ticker as it was on each date, including tickers later delisted. The module takes care never to let Alpaca silently swap a delisted ticker for whatever company holds that ticker today.
Credentials are read from APCA_API_KEY_ID and APCA_API_SECRET_KEY in
the environment and are never stored on a config or written to a log.
ALPACA_SOURCE at the bottom of the module registers the vendor with
quantlab.acquisition.registry.
Classes
Download Alpaca Market Data through the shared |