# Yahoo Finance Historical (`pintostudio/yahoo-finance-historical`) Actor

This Actor retrieves Yahoo Finance Historical data

- **URL**: https://apify.com/pintostudio/yahoo-finance-historical.md
- **Developed by:** [Pinto Studio](https://apify.com/pintostudio) (community)
- **Categories:** Automation, Jobs
- **Features:** Limited permissions
- **Stats:** 5 total users, 0 monthly users, 94.3% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Yahoo Finance Historical Stock Data API

This Actor retrieves historical daily OHLCV (open, high, low, close, volume) price data from Yahoo Finance for any ticker symbol over a custom date range.

### Features

- **Historical Daily Prices** - Open, high, low, close, and adjusted close for every trading day in the requested range.
- **Volume Data** - Daily trading volume alongside price data.
- **Custom Date Range** - Specify any start and end date to pull exactly the window you need.
- **Split & Dividend Adjusted** - `adjClose` accounts for splits and dividends, useful for accurate return calculations.

### Input

| Field | Type | Description |
|---|---|---|
| `ticker` | String | **Required.** The stock ticker symbol to look up, e.g. `TSLA`, `AAPL`, `MSFT`. Default `TSLA`. |
| `sdate` | String | Start Date for the historical range (`YYYY-MM-DD`). Default `2025-01-03`. |
| `edate` | String | End Date for the historical range (`YYYY-MM-DD`). Default `2025-01-05`. |

```json
{
  "ticker": "TSLA",
  "sdate": "2024-01-03",
  "edate": "2024-03-04"
}
```

### Output Format

Each run returns **one dataset item per trading day** in the requested date range. Every item has the same 7 flat fields:

| Field | Type | Description |
|---|---|---|
| `date` | String | Trading date for this row (ISO 8601 timestamp). |
| `open` | Number | Opening price. |
| `high` | Number | Highest price during the session. |
| `low` | Number | Lowest price during the session. |
| `close` | Number | Closing price. |
| `adjClose` | Number | Closing price adjusted for splits and dividends. |
| `volume` | Number | Trading volume for the session. |

Note: the ticker symbol is not echoed back on each row — it's the same symbol you passed as input for the whole run.

### Output Example

A real row from a run on `TSLA` for the `2024-01-03` to `2024-03-04` range:

```json
{
  "date": "2024-01-03T14:30:00.000Z",
  "open": 244.97999572753906,
  "high": 245.67999267578125,
  "low": 236.32000732421875,
  "close": 238.4499969482422,
  "adjClose": 238.4499969482422,
  "volume": 121082600
}
```

A full run over that range returns 41 such rows, one per trading day.

### How to Use

1. Provide the ticker symbol and date range as input (see [Input](#input) above).
2. Run the Actor — it returns one dataset item per trading day in the range.
3. Use the OHLCV data for charting, backtesting, or return calculations.

### Use Cases

- Backtesting trading strategies against historical price action
- Charting price history for a stock over a custom window
- Computing historical returns and volatility using adjusted close prices
- Building datasets for quantitative research or machine learning models

# Actor input Schema

## `ticker` (type: `string`):

The Stock to get Information from

## `sdate` (type: `string`):

Start Date

## `edate` (type: `string`):

The End Date for the result, must be different from the start date

## Actor input object example

```json
{
  "ticker": "TSLA",
  "sdate": "2024-01-03",
  "edate": "2024-01-04"
}
```

# 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 = {
    "ticker": "TSLA",
    "sdate": "2024-01-03",
    "edate": "2024-01-04"
};

// Run the Actor and wait for it to finish
const run = await client.actor("pintostudio/yahoo-finance-historical").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 = {
    "ticker": "TSLA",
    "sdate": "2024-01-03",
    "edate": "2024-01-04",
}

# Run the Actor and wait for it to finish
run = client.actor("pintostudio/yahoo-finance-historical").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 '{
  "ticker": "TSLA",
  "sdate": "2024-01-03",
  "edate": "2024-01-04"
}' |
apify call pintostudio/yahoo-finance-historical --silent --output-dataset

```

## MCP server setup

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

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/c8GFIyzVlNOtpxjlJ/builds/Dnvrn4XGee214c5pc/openapi.json
