# Twelve Data Historical Prices Scraper (`acquistion-automation/twelvedata-historical-prices-scraper`) Actor

Scrapes historical OHLCV price data from the Twelve Data API by stock symbol and interval. Returns datetime, open, high, low, close, and volume for every bar.

- **URL**: https://apify.com/acquistion-automation/twelvedata-historical-prices-scraper.md
- **Developed by:** [Acquisition Automation Co.](https://apify.com/acquistion-automation) (community)
- **Categories:** Business, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $19.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

[![Acquisition Automation](https://api.apify.com/v2/key-value-stores/AOdPHdOpeDpzEPS5f/records/banner.jpg)](https://apify.com/acquistion-automation)

### Twelve Data Historical Prices Scraper

**Scrape historical stock prices from Twelve Data by ticker symbol, with intervals from 1 minute to 1 month.** Every row returns open, high, low, close, and volume. Export to CSV, JSON, Excel, or XML.

Twelve Data's official API requires registration, key management, and rate limits that slow down bulk historical analysis. This Actor reads the time-series endpoint directly for any symbol you provide, returning clean OHLCV bars at your chosen interval. It handles pagination and key rotation so you get up to a million rows per run without writing a script.

| Who uses it | What they scrape Twelve Data for |
|---|---|
| Quantitative analysts | Backtest trading strategies on years of intraday or daily price history. |
| Financial data engineers | Populate a data warehouse with clean OHLCV tables for hundreds of symbols. |
| Market researchers | Compare long-term price trends across sectors using weekly or monthly bars. |
| Algorithmic traders | Feed minute-level price streams into a live signal generator. |

### What it does

This Actor collects historical price data from the Twelve Data API by stock symbol and interval, and returns each bar as a flat row with datetime, open, high, low, close, and volume.

- 📊 **OHLCV bars:** open, high, low, close, and volume for every time step.
- ⏱️ **Flexible intervals:** 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 1day, 1week, or 1month.
- 📈 **Any symbol:** stocks, ETFs, indices, forex pairs, and cryptocurrencies that Twelve Data covers.
- 🔑 **API key support:** bring your own free or paid Twelve Data key to control rate limits and data depth.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Twelve Data data

**📉 Backtest a trading strategy.**

A quant downloads 10 years of daily AAPL bars, runs a moving-average crossover backtest in Python, and decides whether to deploy it live.

**📊 Build a sector dashboard.**

A data engineer scrapes weekly prices for 50 energy stocks, loads them into a database, and powers a Tableau dashboard for a portfolio manager.

**💱 Monitor forex pairs.**

A currency analyst pulls 1-hour EUR/USD bars for the past month, spots a support break, and sends a note to the trading desk.

**🪙 Track crypto volatility.**

A crypto researcher collects 5-minute BTC/USD data for the last 90 days, calculates realized volatility, and compares it to options premiums.

### Why choose this scraper

| | What you get |
|---|---|
| **No code required** | Point the Actor at a symbol and download a structured dataset in seconds. |
| **Full OHLCV** | Every row includes datetime, open, high, low, close, and volume. |
| **Up to 1M rows** | Paid Twelve Data keys can pull deep history in one run. |
| **Standard exports** | Save results as CSV, JSON, Excel, or XML for any analysis tool. |

### How it compares

This Actor focuses on raw OHLCV price history from Twelve Data, while the competitors below serve different data needs from other sources.

| Feature | Acquisition Automation | Dividend & ETF Scraper | Stock Market Analyzer |
|---|---|---|---|
| Historical OHLCV price bars | Yes, from Twelve Data | Not listed | Not listed |
| Intraday intervals down to 1 minute | Yes | Not listed | Not listed |
| Dividend history | Not listed | Yes, from Yahoo Finance | Yes, predictive dates |
| ETF expense ratios and holdings | Not listed | Yes | Not listed |
| Valuation metrics (PE/PB ratios) | Not listed | Not listed | Yes |
| No API key required | No, Twelve Data key required | Yes | Not listed |

### What a Twelve Data record looks like

Every record returns as one flat JSON row. Here is a real one from a run:

```json
{
 "symbol": "AAPL",
 "interval": "1day",
 "currency": "USD",
 "exchange_timezone": "America/New_York",
 "exchange": "NASDAQ",
 "mic_code": "XNGS",
 "type": "Common Stock",
 "datetime": "2026-09-29",
 "open": 336.97,
 "high": 337.089996,
 "low": 328.70001,
 "close": 329.39999,
 "volume": 38427200,
 "scrapedAt": "2026-09-30T10:52:35.328Z"
}
```

Every value above comes from a real run. A field a record does not have comes back as `null`.

### Configure the run

Drive the Actor with a single ticker symbol and an interval, and set a max items limit to control how many historical bars are returned. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "symbol": "AAPL",
 "interval": "1day",
 "maxItems": 10
}
```

A larger pull:

```json
{
 "symbol": "AAPL",
 "interval": "1day",
 "maxItems": 200
}
```

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open the [Twelve Data Historical Prices Scraper](https://apify.com/acquistion-automation/twelvedata-historical-prices-scraper).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Twelve Data through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=acquistion-automation/twelvedata-historical-prices-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your API key is valid and has not exceeded its daily quota. Also verify the symbol is spelled exactly as Twelve Data expects it, for example AAPL not Apple.

**Why does the run stop after only a few rows?**

Free Twelve Data keys have a low per-request limit. Upgrade to a paid key and increase the maxItems input to pull more history.

**I get an authentication error.**

Make sure you copied the full API key from your Twelve Data dashboard with no extra spaces. If the key is new, wait a few minutes for it to activate.

**The dataset has gaps in the dates.**

Twelve Data returns only trading days for daily intervals and only active hours for intraday intervals. Gaps on weekends and holidays are expected.

### FAQ

| Question | Answer |
|---|---|
| Do I need a Twelve Data API key? | Yes. You must provide your own Twelve Data API key. Free keys are available at twelvedata.com and allow a limited number of daily requests. Paid keys unlock higher rate limits and deeper history. |
| What symbols can I scrape? | Any symbol that Twelve Data supports: US stocks, ETFs, indices, forex pairs, and cryptocurrencies. Use the same ticker format you would on the Twelve Data website, for example AAPL, EUR/USD, or BTC/USD. |
| How many historical bars can I get in one run? | Free Twelve Data keys are limited to a small number of records per request. With a paid key you can set maxItems up to 1,000,000 and the Actor will paginate through the API until it reaches your limit or runs out of history. |
| What intervals are supported? | 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 1day, 1week, and 1month. Pick the one that matches your analysis timeframe. |
| Can I scrape multiple symbols at once? | This Actor processes one symbol per run. To scrape many symbols, run multiple instances in parallel or loop over a list of tickers using Apify's scheduler or an integration like Make. |
| What output formats are available? | You can export your dataset as CSV, JSON, Excel, or XML directly from the Apify console or via the API. |
| Does this Actor handle adjusted close prices? | The Twelve Data time-series endpoint returns raw OHLCV bars. Adjusted close is not included in the standard response. Check Twelve Data's documentation for endpoints that provide adjusted data if you need it. |
| Is intraday data available? | Yes. Choose any minute or hour interval to get intraday bars. Availability depends on your Twelve Data plan and the symbol you request. |

### Related actors

Browse the full [Acquisition Automation collection](https://apify.com/acquistion-automation) for more scrapers.

🆘 **Need help?** Open an issue in the Issues tab of this Actor with your run ID, your input, and what you expected.

### Pricing

This Actor uses **pay-per-result** pricing: **$0.021 per result** collected. You are billed only for the results you receive, so a run that returns nothing costs nothing.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Twelve Data Pte. Ltd. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `symbol` (type: `string`):

Ticker symbol to fetch historical prices for, e.g., AAPL, MSFT, TSLA.

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

Interval between data points. Supported values include 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 1day, 1week, 1month.

## `apiKey` (type: `string`):

Your Twelve Data API key. Sign up at twelvedata.com to obtain a free or paid key.

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

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## Actor input object example

```json
{
  "symbol": "AAPL",
  "interval": "1day",
  "maxItems": 10
}
```

# Actor output Schema

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

Complete dataset of all scraped records.

# 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 = {
    "symbol": "AAPL",
    "interval": "1day",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("acquistion-automation/twelvedata-historical-prices-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 = {
    "symbol": "AAPL",
    "interval": "1day",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("acquistion-automation/twelvedata-historical-prices-scraper").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 '{
  "symbol": "AAPL",
  "interval": "1day",
  "maxItems": 10
}' |
apify call acquistion-automation/twelvedata-historical-prices-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,acquistion-automation/twelvedata-historical-prices-scraper"
        }
    }
}
```

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/UuGx45IHaGBjLlxDN/builds/ZUb2mFfPAM3tB4QPI/openapi.json
