# Download daily historical stock prices for backtesting

**Use case:** 

Downloads daily OHLCV bars from Yahoo Finance for a list of tickers: date, open, high, low, close, adjusted close and volume, plus dividends and splits. One row per ticker per day, ready for backtesting, charts and spreadsheets. Works for stocks, ETFs, indices, crypto, currencies and futures.

## Input

```json
{
  "mode": "history",
  "tickers": [
    "AAPL",
    "NVDA",
    "TSLA"
  ],
  "historyInterval": "1d",
  "historyRange": "3mo",
  "maxBarsPerTicker": 0,
  "maxOfficers": 10,
  "optionsExpirations": 1,
  "optionsExpirationDates": [],
  "optionsType": "both",
  "optionsStrikesAroundPrice": 0,
  "includeGreeks": true,
  "riskFreeRatePercent": "4",
  "maxNewsPerTicker": 20,
  "marketLists": [
    "trending"
  ],
  "maxPerMarketList": 25,
  "maxItems": 0
}
```

## Output

```json
{
  "symbol": {
    "label": "Symbol",
    "format": "text"
  },
  "date": {
    "label": "Date",
    "format": "text"
  },
  "open": {
    "label": "Open",
    "format": "number"
  },
  "high": {
    "label": "High",
    "format": "number"
  },
  "low": {
    "label": "Low",
    "format": "number"
  },
  "close": {
    "label": "Close",
    "format": "number"
  },
  "adjClose": {
    "label": "Adj close",
    "format": "number"
  },
  "volume": {
    "label": "Volume",
    "format": "number"
  },
  "dividend": {
    "label": "Dividend",
    "format": "number"
  },
  "splitRatio": {
    "label": "Split",
    "format": "text"
  },
  "currency": {
    "label": "Currency",
    "format": "text"
  },
  "interval": {
    "label": "Interval",
    "format": "text"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Yahoo Finance Scraper: Quotes, History, Options, News Actor is ready to run with the inputs already set for "Download daily historical stock prices for backtesting". [Sign up or log in](https://console.apify.com/create-task-from-example/UfppTYaNah3VbisgP) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Download daily historical stock prices for backtesting" task

The Yahoo Finance Scraper: Quotes, History, Options, News Actor will start running based on the input automatically. You can also change all the input fields, like what to scrape, ticker symbols, and more, to match your specific use case.

### 3. Receive the "Download daily historical stock prices for backtesting" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as symbol, date, open, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Download daily historical stock prices for backtesting" task via API](https://apify.com/zhtech/yahoo-finance-scraper.md).

## FAQ

### What does the daily historical stock prices task return?

The daily historical stock prices task returns one row per ticker per trading day with date, open, high, low, close, adjusted close, volume, currency and any dividend or split on that day.

### How do I get more history or weekly bars?

Set Range in the daily historical stock prices task to 1y, 5y or max, or set a start date. Switch Bar interval to weekly or monthly, and add any Yahoo symbols such as SPY, BTC-USD or ^GSPC.

### Can I run the daily historical stock prices task on a schedule or through the API?

Save the daily historical stock prices task to your Apify account, then add it to an Apify Schedule (for example daily) or start it from the Apify API, webhooks, Zapier, Make, n8n or the Apify MCP server for AI agents.

### How much does the daily historical stock prices task cost?

The daily historical stock prices task is pay per event: a small start fee per run plus a fee per price bar saved. Error rows are free. Prices are on the Pricing tab.

## About this Actor

This example demonstrates how to use [Yahoo Finance Scraper: Quotes, History, Options, News](https://apify.com/zhtech/yahoo-finance-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/zhtech/yahoo-finance-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/zhtech/yahoo-finance-scraper.md

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`).
