# Stock Market Scrapper (`coder_zoro/stock-market-scrapper`) Actor

A fast Apify Actor that scrapes real-time stock data from Yahoo Finance. Get trending stocks, most actives, gainers/losers, and 52-week leaders with pagination and detailed metrics like price, volume, market cap, and P/E. Perfect for analysts, traders, and automation workflows.

- **URL**: https://apify.com/coder\_zoro/stock-market-scrapper.md
- **Developed by:** [Zoro](https://apify.com/coder_zoro) (community)
- **Categories:** Other, Automation, Developer tools
- **Stats:** 92 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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?

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 Market Scrapper

A powerful Apify Actor that fetches real-time stock market data from Yahoo Finance, including trending stocks, most actives, day gainers/losers, and 52-week performance leaders.

### 🚀 Features

- **Multiple Stock Categories**: Access 6 different stock screening categories
- **Pagination Support**: Fetch multiple pages of data (25 stocks per page)
- **Real-time Data**: Get up-to-date market prices, volumes, and changes
- **Comprehensive Metrics**: Includes P/E ratios, market cap, 52-week ranges, and more
- **Fast & Reliable**: Async implementation for optimal performance

### 📊 Available Categories

1. **Top Trending** - Most searched and trending stocks on Yahoo Finance
2. **Most Active** - Stocks with highest trading volume
3. **Day Gainers** - Top performing stocks today
4. **Day Losers** - Worst performing stocks today
5. **52 Week Gainers** - Best performers over the past year
6. **52 Week Losers** - Worst performers over the past year

### 🔧 Input Configuration

| Field | Type | Required | Description | Default |
|-------|------|----------|-------------|---------|
| `category` | String | Yes | Stock category to fetch | `MOST_ACTIVES` |
| `page` | Integer | No | Number of pages to fetch (1-20) | `1` |

#### Category Options

- `Top Trending`
- `MOST_ACTIVES`
- `DAY_GAINERS`
- `DAY_LOSERS`
- `FIFTY_TWO_WK_GAINERS`
- `FIFTY_TWO_WK_LOSERS`

### 📥 Input Example

```json
{
  "category": "DAY_GAINERS",
  "page": 2
}
```

### 📤 Output Format

The actor returns a JSON object containing:

```json
{
  "category": "DAY_GAINERS",
  "count": 50,
  "data": [
    {
      "Symbol": "AAPL",
      "Name": "Apple Inc.",
      "Price": 150.25,
      "Change": 2.50,
      "Change %": 1.69,
      "Volume": 52000000,
      "Avg Vol (3M)": 48500000,
      "Market Cap": 2400000000000,
      "P/E Ratio (TTM)": 28.5,
      "52 Wk High": 198.23,
      "52 Wk Low": 124.17,
      "52 Wk Change %": 15.23,
      "Sector": "Technology",
      "Industry": "Consumer Electronics",
      "Avg Rating": "Buy"
    }
  ]
}
```

### 🎯 Use Cases

- **Market Research**: Track market trends and identify opportunities
- **Portfolio Analysis**: Monitor stocks across different categories
- **Trading Signals**: Identify day gainers and losers for trading strategies
- **Data Analytics**: Collect historical market data for analysis
- **Financial Reporting**: Generate automated market reports
- **Investment Research**: Research top-performing stocks

### 📈 Data Fields Explained

| Field | Description |
|-------|-------------|
| Symbol | Stock ticker symbol |
| Name | Company name |
| Price | Current market price |
| Change | Price change in dollars |
| Change % | Price change percentage |
| Volume | Trading volume for the day |
| Avg Vol (3M) | Average 3-month trading volume |
| Market Cap | Total market capitalization |
| P/E Ratio (TTM) | Price-to-earnings ratio (trailing twelve months) |
| 52 Wk High | Highest price in the last 52 weeks |
| 52 Wk Low | Lowest price in the last 52 weeks |
| 52 Wk Change % | Percentage change over 52 weeks |
| Sector | Business sector |
| Industry | Specific industry |
| Avg Rating | Analyst average rating |

### 🔄 Update Frequency

The actor fetches real-time data from Yahoo Finance. For the most current information:

- Run during market hours (9:30 AM - 4:00 PM EST)
- Data is typically delayed by 15-20 minutes for free tier
- After-hours trading data may be available

### ⚡ Performance

- **Average Runtime**: 5-15 seconds per page
- **Rate Limits**: Respects Yahoo Finance API limits
- **Timeout**: 60 seconds per request
- **Concurrent Requests**: Sequential processing for stability

### 🛠️ Technical Details

- **Language**: Python 3.11
- **Framework**: Apify SDK 1.7+
- **HTTP Client**: aiohttp (async)
- **Data Source**: Yahoo Finance API

### 📝 Error Handling

If an error occurs, the actor returns:

```json
{
  "message": "error"
}
```

Common reasons for errors:

- Invalid category name
- Network connectivity issues
- API rate limits exceeded
- Invalid API credentials

***

**Note**: This actor is for informational purposes only and should not be considered financial advice. Always conduct your own research before making investment decisions.

# Actor input Schema

## `category` (type: `string`):

Select the stock category to fetch

## `page` (type: `integer`):

Total number of pages to fetch (each page contains 25 stocks)

## Actor input object example

```json
{
  "category": "MOST_ACTIVES",
  "page": 1
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("coder_zoro/stock-market-scrapper").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("coder_zoro/stock-market-scrapper").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 '{}' |
apify call coder_zoro/stock-market-scrapper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,coder_zoro/stock-market-scrapper"
        }
    }
}

```

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/f4tqTdvOBwL0EkiRa/builds/N43fPDp58h1gabZeE/openapi.json
