# Stock Exchange Scraper (`gentle_cloud/stock-exchange-scraper`) Actor

Scrape real-time and historical stock market data from major exchanges (NYSE, NASDAQ, LSE, TSE, etc.). Get quotes, OHLCV data, and company info for any publicly traded stock. No API key required.

- **URL**: https://apify.com/gentle\_cloud/stock-exchange-scraper.md
- **Developed by:** [Monkey Coder](https://apify.com/gentle_cloud) (community)
- **Categories:** Other
- **Stats:** 31 total users, 5 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## 📈 Stock Exchange Scraper

Scrape **real-time stock quotes** and **historical OHLCV data** from major global stock exchanges — NYSE, NASDAQ, London, Tokyo, Frankfurt, Hong Kong, and more. No API key required.

### ✨ Features

- **Real-time quotes**: Current price, change %, volume, 52-week high/low
- **Historical data**: Open/High/Low/Close/Volume with configurable range and interval
- **Global coverage**: US, European, Asian, and other international exchanges
- **Dual data sources**: Yahoo Finance (primary) + Stooq (fallback) for reliability
- **No API key needed**: Works out of the box

### 🔧 How It Works

1. Provide a comma-separated list of stock ticker symbols
2. Choose **quote** mode for current prices or **historical** mode for time series
3. For historical data, select time range (5 days to max) and interval (daily/weekly/monthly)
4. The Actor fetches data from Yahoo Finance, falling back to Stooq if needed
5. Results are pushed to the Apify dataset in clean, flat JSON format

### 📋 Input Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `symbols` | String | Comma-separated ticker symbols | `AAPL,MSFT,GOOGL,TSLA,AMZN` |
| `mode` | Select | `quote` for current prices, `historical` for OHLCV series | `quote` |
| `range` | Select | Time range: 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, max | `1mo` |
| `interval` | Select | Data granularity: 1d (daily), 1wk (weekly), 1mo (monthly) | `1d` |

#### Stock Symbol Format

- **US stocks**: Just the ticker — `AAPL`, `MSFT`, `GOOGL`
- **Tokyo Stock Exchange**: Add `.T` — `7203.T` (Toyota), `6758.T` (Sony)
- **London Stock Exchange**: Add `.L` — `HSBA.L` (HSBC), `VOD.L` (Vodafone)
- **Frankfurt (Xetra)**: Add `.DE` — `BMW.DE`, `SAP.DE`
- **Hong Kong**: Add `.HK` — `0700.HK` (Tencent), `9988.HK` (Alibaba)
- **Paris**: Add `.PA` — `MC.PA` (LVMH), `TTE.PA` (TotalEnergies)

### 📊 Sample Output — Quote Mode

```json
{
    "symbol": "AAPL",
    "name": "Apple Inc.",
    "price": 249.94,
    "change_percent": -1.14,
    "previous_close": 252.82,
    "open": 252.63,
    "high": 254.94,
    "low": 249.0,
    "volume": 35757874,
    "exchange": "NMS",
    "full_exchange_name": "NasdaqGS",
    "currency": "USD",
    "instrument_type": "EQUITY",
    "fifty_two_week_high": 260.1,
    "fifty_two_week_low": 164.08,
    "timezone": "America/New_York",
    "checked_at": "2026-03-19T09:34:00Z"
}
```

### 📊 Sample Output — Historical Mode

```json
{
    "symbol": "AAPL",
    "name": "Apple Inc.",
    "date": "2026-03-18",
    "open": 252.63,
    "high": 254.94,
    "low": 249.0,
    "close": 249.94,
    "volume": 35757874,
    "exchange": "NMS",
    "currency": "USD",
    "range": "1mo",
    "interval": "1d"
}
```

### 💡 Use Cases

- **Portfolio monitoring**: Track multiple stocks in real time
- **Financial research**: Download historical price data for analysis
- **Algorithmic trading**: Feed OHLCV data into trading strategies
- **Market comparison**: Compare stocks across global exchanges
- **Price alerts**: Monitor stock prices and detect significant moves

### ⚠️ Notes

- Data is sourced from Yahoo Finance (primary) and Stooq (fallback)
- Quotes are near-real-time (15-20 min delay for some exchanges)
- Historical data availability depends on the stock and exchange
- Rate limiting is applied automatically between requests
- No API key or authentication required

# Actor input Schema

## `symbols` (type: `string`):

Comma-separated stock ticker symbols (e.g. AAPL,MSFT,GOOGL). Use suffix for non-US exchanges: .T (Tokyo), .L (London), .DE (Germany), .HK (Hong Kong).

## `mode` (type: `string`):

Type of data to retrieve: 'quote' for current price/info, 'historical' for OHLCV time series.

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

Time range for historical data. Only used when mode is 'historical'.

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

Data granularity for historical data. Only used when mode is 'historical'.

## Actor input object example

```json
{
  "symbols": "AAPL,MSFT,GOOGL,TSLA,AMZN",
  "mode": "quote",
  "range": "1mo",
  "interval": "1d"
}
```

# 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,MSFT,GOOGL,TSLA,AMZN",
    "mode": "quote",
    "range": "1mo",
    "interval": "1d"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gentle_cloud/stock-exchange-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,MSFT,GOOGL,TSLA,AMZN",
    "mode": "quote",
    "range": "1mo",
    "interval": "1d",
}

# Run the Actor and wait for it to finish
run = client.actor("gentle_cloud/stock-exchange-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 '{
  "symbols": "AAPL,MSFT,GOOGL,TSLA,AMZN",
  "mode": "quote",
  "range": "1mo",
  "interval": "1d"
}' |
apify call gentle_cloud/stock-exchange-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gentle_cloud/stock-exchange-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/JT39Q0T7jEZVe7c9a/builds/rw3CvUh52zaWXiS3Q/openapi.json
