# US Stock Price Scraper (`crawlerbros/us-stock-price-scraper`) Actor

Download historical stock price data (OHLCV) for US stocks, ETFs, and indices from Yahoo Finance. Get open, high, low, close prices, trading volume, dividends, and stock splits for any ticker at any timeframe from 1 minute to 1 month.

- **URL**: https://apify.com/crawlerbros/us-stock-price-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Other, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 15 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## US Stock Market Price Scraper

Download historical stock price data (OHLCV) for US stocks, ETFs, and indices from Yahoo Finance. Get open, high, low, close prices, trading volume, dividends, and stock splits for any ticker — at any timeframe from 1 minute to 1 month.

### What does US Stock Market Price Scraper do?

This actor downloads historical OHLCV (Open, High, Low, Close, Volume) price data from Yahoo Finance. It supports all US-listed stocks, ETFs, mutual funds, and major market indices across multiple timeframes, making it ideal for financial analysis, algorithmic trading, and portfolio research.

Use it to:

- Download historical stock price data for any US-listed ticker (AAPL, MSFT, TSLA, NVDA, etc.)
- Get candlestick OHLCV data at any timeframe from 1 minute to 1 month
- Scrape ETF price history (SPY, QQQ, VOO, VTI, ARKK, etc.)
- Track major index performance (S&P 500, Dow Jones, Nasdaq, Russell 2000)
- Build datasets for backtesting trading strategies
- Capture dividend payments and stock split history
- Scrape price data for crypto-adjacent stocks (COIN, MSTR, RIOT, MARA)
- Download commodity ETF prices (GLD, SLV, USO) and bond ETF prices (TLT, AGG, BND)

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `symbols` | Array of strings | Yes | Stock ticker symbols in uppercase (e.g. `AAPL`, `MSFT`, `SPY`, `^GSPC`) |
| `interval` | String | No | Candle interval: `1m`, `5m`, `15m`, `30m`, `1h`, `1d`, `1wk`, `1mo`. Defaults to `1d` |
| `startDate` | String | Yes | Start date in `YYYY-MM-DD` format |
| `endDate` | String | No | End date in `YYYY-MM-DD` format. **This date is exclusive** — data up to but not including this date is returned. Defaults to today |
| `proxy` | Object | No | Proxy configuration (recommended for datacenter IPs to avoid rate limiting) |

#### Input example

```json
{
    "symbols": ["AAPL", "MSFT", "TSLA"],
    "interval": "1d",
    "startDate": "2025-01-01",
    "endDate": "2025-04-01"
}
````

### Output

Each record in the output dataset represents one price candle. All 9 fields are always present.

| Field | Type | Description |
|-------|------|-------------|
| `symbol` | String | Ticker symbol (e.g. `AAPL`) |
| `date` | String | `YYYY-MM-DD` for daily/weekly/monthly intervals; ISO 8601 datetime (e.g. `2025-01-02T09:30:00Z`) for intraday intervals |
| `open` | Number | Opening price |
| `high` | Number | Highest price during the period |
| `low` | Number | Lowest price during the period |
| `close` | Number | Closing price |
| `volume` | Integer | Number of shares traded |
| `dividends` | Number | Dividend amount paid (0 if none) |
| `stockSplits` | Number | Stock split ratio (0 if none) |

#### Output example

```json
{
    "symbol": "AAPL",
    "date": "2025-03-10",
    "open": 227.5,
    "high": 230.1,
    "low": 226.8,
    "close": 229.45,
    "volume": 54321000,
    "dividends": 0,
    "stockSplits": 0
}
```

### Supported tickers

All tickers listed on Yahoo Finance are supported, including:

- **US Tech stocks**: AAPL, MSFT, GOOGL, AMZN, META, NVDA, TSLA, AMD, INTC, ORCL
- **Finance stocks**: JPM, BAC, GS, V, MA, WFC, C
- **Healthcare stocks**: JNJ, UNH, PFE, ABBV, LLY, MRK
- **Broad market ETFs**: SPY, QQQ, VOO, VTI, IWM, DIA, ARKK
- **Sector ETFs**: XLF (financials), XLE (energy), XLK (tech), XLV (healthcare), XLY (consumer)
- **Bond ETFs**: TLT, AGG, BND, HYG, LQD
- **Commodity ETFs**: GLD, SLV, USO, GDX
- **US Indices**: ^GSPC (S\&P 500), ^DJI (Dow Jones), ^IXIC (Nasdaq Composite), ^RUT (Russell 2000)
- **Crypto-adjacent stocks**: COIN, MSTR, RIOT, MARA

### How much does it cost?

This actor uses Yahoo Finance as its data source, which is free. You only pay for Apify platform compute time. A typical run fetching daily data for multiple stocks over a year completes in under a minute.

### Limitations

- **Intraday data availability**: 1-minute data is available for the **last 7 days** only. 5m, 15m, 30m, and 1h intervals are available for the **last 60 days** only.
- **Market hours only**: Intraday data covers regular trading hours only (9:30 AM – 4:00 PM ET). Pre-market and after-hours trading data is not included.
- **End date is exclusive**: If you set `endDate` to `2025-03-15`, the last record returned will be March 14. To include March 15, set `endDate` to `2025-03-16`.
- **Weekend and holiday dates**: If `startDate` falls on a weekend or holiday, data starts from the next trading day automatically.
- **Historical depth**: Daily, weekly, and monthly data is available for decades on major tickers. Availability varies for smaller or newer stocks.
- **Delisted tickers**: Tickers that have been delisted may return no data or partial data depending on when they were removed.

### FAQ

#### What timeframes are available?

`1m`, `5m`, `15m`, `30m`, `1h`, `1d`, `1wk`, `1mo`. The default is `1d` (daily).

#### How far back does historical data go?

Daily, weekly, and monthly data goes back decades for major US stocks. Intraday intervals have limits: 1-minute data is only available for the **last 7 days**; 5m–1h data is available for the **last 60 days**.

#### Why does my result start later than my startDate?

If `startDate` falls on a weekend, public holiday, or before a stock's IPO date, the first record will be from the next available trading day.

#### Why does my result not include my endDate?

The `endDate` is exclusive — it is not included in the results. To include a specific date, set `endDate` to the following calendar day.

#### Is this real-time data?

No. This actor downloads historical data. Intraday prices are typically delayed by at least 15–20 minutes from real-time. For the most recent trading day, data may not be available until after market close.

#### Can I use this for backtesting trading strategies?

Yes. The OHLCV output format is compatible with most backtesting frameworks (Backtrader, Zipline, VectorBT, etc.) and financial analysis libraries (pandas, TA-Lib).

#### Does it include pre-market and after-hours data?

No. Only regular trading hours (9:30 AM – 4:00 PM ET for US markets) are included in intraday intervals.

#### What happens if I request an invalid ticker?

The actor pushes an error record to the dataset for that ticker and continues processing the remaining symbols. The run does not fail.

#### Can I scrape multiple stocks in one run?

Yes. Pass multiple symbols in the `symbols` array. Each symbol is processed sequentially and all results are saved to the same dataset.

#### Can I scrape crypto or forex?

Yahoo Finance lists some crypto pairs (e.g. `BTC-USD`, `ETH-USD`) and forex pairs (e.g. `EURUSD=X`). These tickers are supported and work the same way as stock tickers.

#### Why does a valid ticker return no data?

Possible reasons: the date range is before the stock's IPO date, the ticker has been delisted, or you requested intraday data outside the supported lookback window (7 days for 1m, 60 days for 5m–1h).

# Actor input Schema

## `symbols` (type: `array`):

List of stock ticker symbols (e.g. AAPL, MSFT, TSLA, SPY). Supports US stocks, ETFs, and indices (use ^ prefix for indices like ^GSPC for S\&P 500).

## `interval` (type: `string`):

Candlestick interval for price data. Data is only available during market hours (9:30 AM – 4:00 PM ET). Intraday limits: 1m is limited to the last 7 days; 5m–1h are limited to the last 60 days.

## `startDate` (type: `string`):

Start date for historical data in YYYY-MM-DD format (e.g. 2024-01-01).

## `endDate` (type: `string`):

End date for historical data in YYYY-MM-DD format. This date is exclusive — data is returned up to but not including this date. Defaults to today if not specified.

## `proxy` (type: `object`):

Optional proxy settings. Recommended if running from datacenter IPs to avoid rate limiting.

## Actor input object example

```json
{
  "symbols": [
    "AAPL"
  ],
  "interval": "1d",
  "startDate": "2025-01-01"
}
```

# Actor output Schema

## `priceDataset` (type: `string`):

Dataset containing OHLCV stock price data for the requested tickers and date range

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "symbols": [
        "AAPL"
    ],
    "startDate": "2025-01-01"
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/us-stock-price-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "symbols": ["AAPL"],
    "startDate": "2025-01-01",
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/us-stock-price-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "symbols": [
    "AAPL"
  ],
  "startDate": "2025-01-01"
}' |
apify call crawlerbros/us-stock-price-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/us-stock-price-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "US Stock Price Scraper",
        "description": "Download historical stock price data (OHLCV) for US stocks, ETFs, and indices from Yahoo Finance. Get open, high, low, close prices, trading volume, dividends, and stock splits for any ticker at any timeframe from 1 minute to 1 month.",
        "version": "1.0",
        "x-build-id": "AhiDG4hodgcpz8Acj"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~us-stock-price-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-us-stock-price-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~us-stock-price-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-us-stock-price-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~us-stock-price-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-us-stock-price-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "symbols",
                    "startDate"
                ],
                "properties": {
                    "symbols": {
                        "title": "Ticker Symbols",
                        "type": "array",
                        "description": "List of stock ticker symbols (e.g. AAPL, MSFT, TSLA, SPY). Supports US stocks, ETFs, and indices (use ^ prefix for indices like ^GSPC for S&P 500).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "interval": {
                        "title": "Price Interval",
                        "enum": [
                            "1m",
                            "5m",
                            "15m",
                            "30m",
                            "1h",
                            "1d",
                            "1wk",
                            "1mo"
                        ],
                        "type": "string",
                        "description": "Candlestick interval for price data. Data is only available during market hours (9:30 AM – 4:00 PM ET). Intraday limits: 1m is limited to the last 7 days; 5m–1h are limited to the last 60 days.",
                        "default": "1d"
                    },
                    "startDate": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Start date for historical data in YYYY-MM-DD format (e.g. 2024-01-01)."
                    },
                    "endDate": {
                        "title": "End Date",
                        "type": "string",
                        "description": "End date for historical data in YYYY-MM-DD format. This date is exclusive — data is returned up to but not including this date. Defaults to today if not specified."
                    },
                    "proxy": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Optional proxy settings. Recommended if running from datacenter IPs to avoid rate limiting."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
