---
name: alpaca-market-data-ingestion
description: "How to get Alpaca Market Data API data into a pandas DataFrame and Parquet: access, the request, the format, limits, quirks and terms."
---

# Load Alpaca historical stock bars into pandas and Parquet for personal use

Source entry: https://signal-lab-jet.vercel.app/datasets/alpaca-market-data
Provider: https://alpaca.markets/data
Checked against the provider's documentation: 2026-10-29

## Access
- An Alpaca account and API credentials are required. Put them in APCA_API_KEY_ID and APCA_API_SECRET_KEY.
- The standard terms limit content to personal, non-commercial purposes.

## Request
```bash
curl -H 'APCA-API-KEY-ID: '$APCA_API_KEY_ID -H 'APCA-API-SECRET-KEY: '$APCA_API_SECRET_KEY 'https://data.alpaca.markets/v2/stocks/AAPL/bars?timeframe=1Day&start=2026-10-01T00:00:00Z&limit=1000'
```

## Format
JSON: bars array plus symbol and next_page_token. Each bar has t, o, h, l, c, v, n and vw.

## Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
```python
"""Alpaca daily AAPL bars -> pandas -> Parquet. Personal, non-commercial use."""
import os
import requests
import pandas as pd

headers = {"APCA-API-KEY-ID": os.environ["APCA_API_KEY_ID"],
           "APCA-API-SECRET-KEY": os.environ["APCA_API_SECRET_KEY"]}
params = {"timeframe": "1Day", "start": "2026-10-01T00:00:00Z", "limit": 1000}
r = requests.get("https://data.alpaca.markets/v2/stocks/AAPL/bars",
                 headers=headers, params=params, timeout=30)
r.raise_for_status()
df = pd.DataFrame(r.json()["bars"]).rename(columns={"t": "timestamp"})
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
df.to_parquet("alpaca_aapl_daily.parquet", index=False)
print(len(df), "bars", df["timestamp"].min().date(), "to", df["timestamp"].max().date())
```
Needs a personal API key; not run.

## Limits
- Basic: 200 historical API calls per minute.
- Basic historical data excludes the latest 15 minutes.

## Quirks
- Follow next_page_token for longer queries.
- The free real-time stock feed is IEX only; specify the feed when that distinction matters.
- Timestamps are UTC RFC 3339 strings.

## Terms and attribution
- Services and content are for personal, non-commercial purposes under the standard terms.
- A user-facing application requires 30 days advance written notice and may be restricted.
- Terms page: https://files.alpaca.markets/disclosures/library/TermsAndConditions.pdf

## Sources
- https://docs.alpaca.markets/docs/about-market-data-api: "Historical API calls"
- https://docs.alpaca.markets/docs/about-market-data-api: "latest 15 minutes"
- https://files.alpaca.markets/disclosures/library/TermsAndConditions.pdf: "solely for your own personal and non-commercial purposes"

Information for educational purposes only. Free tiers, limits and licenses belong to the providers and may change; check the provider's own terms before using the data.
