# Yahoo Finance Stock Quotes & OHLCV Price History (`arthursbuisness/yahoo-finance-quotes-ohlcv-history`) Actor

- **URL**: https://apify.com/arthursbuisness/yahoo-finance-quotes-ohlcv-history.md
- **Developed by:** [Arthur](https://apify.com/arthursbuisness) (community)
- **Categories:** Business, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 stored row (quote or ohlcv bar)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Yahoo Finance Stock Quotes & OHLCV Price History

Pull **live quotes and full OHLCV price history** for any symbol Yahoo Finance knows — US and international stocks, ETFs, indices, crypto, forex and futures — into a clean dataset. Optionally enrich each ticker with **fundamentals** (market cap, P/E, EPS, dividends, sector, revenue, margins, analyst targets). Uses Yahoo's public chart and quote endpoints, so there is **no API key, no browser and no proxy**; a 50-ticker run finishes in under a minute.

Typical uses: portfolio trackers and Google Sheets dashboards, backtesting datasets (1-minute to monthly bars), screeners, price alerts via Make/Zapier, feeding market context into LLM agents.

### What you get

**`outputMode: "quote"` → one `quote` row per ticker:**

| field | description |
|---|---|
| `symbol`, `name`, `short_name`, `instrument_type` | e.g. `ASML.AS`, `ASML Holding N.V.`, `EQUITY` / `ETF` / `INDEX` / `CRYPTOCURRENCY` / `CURRENCY` |
| `currency`, `exchange`, `exchange_code`, `timezone`, `market_state` | `EUR`, `Amsterdam`, `AMS`, `Europe/Amsterdam`, `REGULAR` / `CLOSED` / `PRE` / `POST` |
| `price`, `previous_close`, `change`, `change_percent`, `open`, `day_high`, `day_low`, `volume` | Latest regular-session quote |
| `pre_market_price`, `post_market_price` (+ `_change_percent`) | Extended hours (US stocks) |
| `fifty_two_week_high`, `fifty_two_week_low`, `fifty_day_average`, `two_hundred_day_average`, `avg_volume_3m`, `avg_volume_10d` | Ranges and averages |
| `market_cap`, `trailing_pe`, `forward_pe`, `eps_trailing`, `eps_forward`, `price_to_book`, `dividend_rate`, `dividend_yield`, `earnings_date` | Valuation basics (from Yahoo's quote endpoint) |
| `market_time`, `first_trade_date`, `data_source`, `url` | Quote timestamp (UTC), listing date, `chart+quote` or `chart` (fallback), Yahoo page |

With **`includeFundamentals`** the quote row also gets: `sector`, `industry`, `country`, `city`, `website`, `employees`, `business_summary`, `beta`, `payout_ratio`, `ex_dividend_date`, `shares_outstanding`, `float_shares`, `book_value`, `enterprise_value`, `peg_ratio`, `trailing_eps`, `forward_eps`, `short_percent_of_float`, `held_percent_institutions`, `total_revenue`, `revenue_growth`, `earnings_growth`, `gross_margins`, `operating_margins`, `profit_margins`, `ebitda`, `total_cash`, `total_debt`, `free_cashflow`, `debt_to_equity`, `return_on_equity`, `target_mean_price`, `target_high_price`, `target_low_price`, `recommendation`, `analyst_count`, `next_earnings_date`, and `fundamentals_status`.

**`outputMode: "bars"` → one `bar` row per OHLCV bar:** `symbol`, `date`, `timestamp` (UTC ISO), `epoch`, `datetime_local` (exchange time), `timezone`, `interval`, `range`, `currency`, `open`, `high`, `low`, `close`, `adj_close` (dividend/split-adjusted, daily and coarser only), `volume`. Bars with no trade are skipped.

**`outputMode: "both"`** gives the quote row first, then the bars.

Unknown or delisted symbols and impossible range/interval combinations produce a `type: "error"` row (free) with Yahoo's message; the run continues with the next ticker.

Export as JSON, CSV or Excel, or push rows to Google Sheets, Make, Zapier, webhooks or your code through the Apify API.

### Input

| field | default | meaning |
|---|---|---|
| `tickers` | — | Yahoo symbols: `AAPL`, `ASML.AS`, `SAP.DE`, `7203.T`, `^GSPC`, `BTC-USD`, `EURUSD=X`, `GC=F` |
| `outputMode` | `quote` | `quote` (1 row/ticker), `bars` (1 row/bar), `both` |
| `range` | `1mo` | `1d`, `5d`, `1mo`, `3mo`, `6mo`, `1y`, `2y`, `5y`, `10y`, `ytd`, `max` |
| `interval` | `1d` | `1m`, `2m`, `5m`, `15m`, `30m`, `60m`, `90m`, `1h`, `1d`, `5d`, `1wk`, `1mo`, `3mo` |
| `includePrePost` | false | extended-hours bars for intraday intervals |
| `includeFundamentals` | false | company profile, financials and analyst data on quote rows |
| `maxBarsPerTicker` | 5000 | keep only the most recent N bars per ticker |
| `maxItems` | 100000 | hard cap on stored rows |

Example — daily history for one year plus a quote, for three tickers:

```json
{
  "tickers": ["NVDA", "ASML.AS", "BTC-USD"],
  "outputMode": "both",
  "range": "1y",
  "interval": "1d"
}
```

That returns 3 quote rows and ~250 daily bars per stock (≈ 365 for crypto).

### Pricing

Pay per event: **$0.0005 per stored row** — a quote row or a bar row ($0.50 per 1,000 rows). A 50-ticker quote snapshot costs $0.025; one year of daily bars for one stock (~250 bars) costs $0.125. Use `range`, `interval` and `maxBarsPerTicker` to control bar counts. Error rows are free. Apify platform usage (a few seconds of compute per run) is billed separately by Apify.

### Limitations — please read

- Data comes from Yahoo Finance's public endpoints, which are undocumented and can change; quotes are delayed per Yahoo's exchange rules (real-time for many US exchanges, 15–20 min for some others).
- `market_cap`, P/E, dividends and fundamentals need a Yahoo session "crumb"; the actor obtains it automatically, and if Yahoo refuses, quote rows still come from the chart endpoint (`data_source: "chart"`) with those fields `null` and `fundamentals_status` explaining why.
- Yahoo's history limits: 1m bars for the last 7 days only, 2m–30m for 60 days, 1h for 730 days. Asking for more returns a free error row with Yahoo's message.
- Indices, forex and most crypto have no fundamentals; ETFs have partial fundamentals.
- Options chains and full financial statements are not included (open an issue if you need them).

Not affiliated with Yahoo. Data is for personal/informational use — check Yahoo's terms for redistribution.

# Actor input Schema

## `tickers` (type: `array`):

Yahoo Finance symbols: stocks (AAPL, MSFT), non-US listings with exchange suffix (ASML.AS, SAP.DE, 7203.T, SHOP.TO), ETFs (SPY, VWRL.AS), indices (^GSPC, ^AEX), crypto (BTC-USD, ETH-EUR), forex (EURUSD=X), futures (GC=F). Unknown symbols give a free error row.

## `outputMode` (type: `string`):

'quote': one row per ticker with the latest price, change, volume, 52-week range, market cap, P/E, dividend, exchange. 'bars': one row per OHLCV bar for the chosen range/interval. 'both': quote row followed by bars.

## `range` (type: `string`):

How far back to fetch bars. Yahoo keeps 1-minute bars for 7 days, 2m–30m for 60 days, 1h for 730 days; daily and coarser bars go back to the first trade.

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

Bar size. Intraday intervals (1m–1h) are only available for recent ranges (see 'History range').

## `includePrePost` (type: `boolean`):

For intraday intervals on US stocks: also return extended-hours bars.

## `includeFundamentals` (type: `boolean`):

Adds sector, industry, employees, business summary, beta, payout ratio, shares outstanding, float, book value, enterprise value, PEG, EPS, revenue, margins, EBITDA, cash/debt, free cash flow, analyst target prices and recommendation, next earnings date. One extra request per ticker; empty for symbols without fundamentals (indices, forex, most crypto).

## `maxBarsPerTicker` (type: `integer`):

Keeps the most recent N bars per ticker (cost control for long histories / fine intervals).

## `maxItems` (type: `integer`):

Hard cap on stored rows (quotes + bars) for the whole run.

## Actor input object example

```json
{
  "tickers": [
    "AAPL",
    "MSFT",
    "BTC-USD"
  ],
  "outputMode": "quote",
  "range": "1mo",
  "interval": "1d",
  "includePrePost": false,
  "includeFundamentals": false,
  "maxBarsPerTicker": 5000,
  "maxItems": 100000
}
```

# Actor output Schema

## `results` (type: `string`):

All items as JSON

## `resultsCsv` (type: `string`):

Same dataset as CSV — open in Excel/Sheets

# 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 = {
    "tickers": [
        "AAPL",
        "MSFT",
        "BTC-USD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arthursbuisness/yahoo-finance-quotes-ohlcv-history").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 = { "tickers": [
        "AAPL",
        "MSFT",
        "BTC-USD",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("arthursbuisness/yahoo-finance-quotes-ohlcv-history").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "tickers": [
    "AAPL",
    "MSFT",
    "BTC-USD"
  ]
}' |
apify call arthursbuisness/yahoo-finance-quotes-ohlcv-history --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arthursbuisness/yahoo-finance-quotes-ohlcv-history"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/TlPbqagfUt88WjJuH/builds/LV2js9h20uosDkXWD/openapi.json
