# Morningstar Scraper (`crawlerbros/morningstar-scraper`) Actor

Scrape Morningstar - stock and ETF quotes with intraday and yearly price data, market cap, volume, pre/post-market prices, plus top gainers/losers/actives. Search by company name or fetch by ticker or quote URL.

- **URL**: https://apify.com/crawlerbros/morningstar-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Developer tools, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## Morningstar Scraper

Scrape **Morningstar** — stock and ETF quotes with intraday and yearly price ranges, market cap, volume, pre/post-market prices, plus top gainers / losers / most-active lists. Search by company name or ticker, fetch by ticker + exchange, or pull quotes directly from a morningstar.com URL. Runs in a headless browser to pass Morningstar's anti-bot challenge; no account or API key required.

### What this actor does

- **Four modes:** `search`, `byTicker`, `byUrl`, `movers`
- **Quote data:** last price, net change, % change, day/year high-low, bid/ask, open, previous close
- **Size data:** market cap, volume, average volume, currency
- **Pre/post-market:** preMarket and postMarket prices and changes
- **Movers:** top gainers, top losers, and most-active lists (US market hours)
- **Empty fields are omitted**

### Output per quote (mode = `search` / `byTicker` / `byUrl`)

- `symbol` — `exchange:ticker` (e.g. `xnas:aapl`)
- `ticker`, `name`, `exchange`, `exchangeName`
- `lastPrice`, `netChange`, `percentNetChange`
- `previousClosePrice`, `openPrice`
- `dayHighPrice`, `dayLowPrice`, `yearHighPrice`, `yearLowPrice`
- `bidPrice`, `askPrice`
- `preMarketPrice`, `preMarketNetChange`, `postMarketPrice`, `postMarketNetChange`
- `marketCap`, `volume`, `averageVolume`
- `tradingStatus`, `currency`, `performanceID`
- `quoteUrl`, `recordType: "quote"`, `scrapedAt`

### Output per mover (mode = `movers`)

- `moverGroup` — `gainers` / `losers` / `actives`
- `rank`, `ticker`, `name`, `exchange`, `exchangeName`, `symbol`
- `lastPrice`, `netChange`, `percentNetChange`, `volume`, `marketCap`
- `recordType: "mover"`, `scrapedAt`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `search` | `search` / `byTicker` / `byUrl` / `movers` |
| `searchQuery` | string | `apple` | Company name or ticker (mode=search) |
| `securityType` | enum | `stock` | `stock` / `etf` universe (mode=search) |
| `exchange` | enum | `xnas` | `xnas` / `xnys` / `xase` / `xotc` (mode=byTicker) |
| `tickers` | array | – | Tickers on the selected exchange (mode=byTicker; one exchange per run — use `startUrls` for a mixed-exchange batch) |
| `startUrls` | array | – | Quote URLs (mode=byUrl) |
| `moversGroup` | enum | `gainers` | `gainers` / `losers` / `actives` (mode=movers) |
| `minPrice` / `maxPrice` | number | – | Filter by last price |
| `minPercentChange` / `maxPercentChange` | number | – | Filter by % change |
| `maxItems` | int | `50` | Hard cap (1–500) |

#### Example: search a company and get quotes

```json
{
  "mode": "search",
  "searchQuery": "apple",
  "maxItems": 5
}
```

#### Example: quotes for specific tickers

```json
{
  "mode": "byTicker",
  "exchange": "xnas",
  "tickers": ["AAPL", "MSFT", "GOOGL"]
}
```

#### Example: top gainers above 5%

```json
{
  "mode": "movers",
  "moversGroup": "gainers",
  "minPercentChange": 5,
  "maxItems": 20
}
```

#### Example: quote by URL

```json
{
  "mode": "byUrl",
  "startUrls": [
    {"url": "https://www.morningstar.com/stocks/xnas/aapl/quote"},
    {"url": "https://www.morningstar.com/etfs/arcx/ivv/quote"}
  ]
}
```

Stock and ETF URLs both work; hyphenated ticker slugs (e.g. `xnys/brk-b`) are resolved to their canonical API tickers automatically.

### Use cases

- **Trading dashboards** — one-shot quote snapshots with day and year ranges
- **Screening** — filter by price and % change across search results and movers
- **Portfolio monitoring** — daily runs on your ticker list
- **Market commentary** — top movers with volumes and market caps
- **Research pipelines** — enrich security IDs (`performanceID`) for further Morningstar lookups

### FAQ

**Is Morningstar's data free?**  The quote, search and movers data used here comes from Morningstar's public website endpoints. No account, API key or payment is required.

**Why does this actor need a browser?**  Morningstar protects its API with an AWS WAF challenge. A headless browser solves the challenge automatically on the first page load, after which all data endpoints work normally. This is transparent to you.

**Why are movers sometimes empty?**  Morningstar only publishes gainers/losers/actives about 15 minutes after US markets open. Runs before market open or after hours return a clean 0-record result with a status message.

**Why are some prices fractional (e.g. `308.91`)?**  Morningstar reports real-time prices in the listed currency. Prices are returned as numbers; missing fields are omitted.

**What is `performanceID`?**  Morningstar's internal security identifier (e.g. `0P000000GY`). Useful for cross-referencing Morningstar's own pages.

**Can I get mutual funds or bonds?**  Currently the actor covers stocks and ETFs. Funds, indexes and bonds use a different Morningstar identifier scheme and are not yet supported.

**How fresh is the data?**  Live — every run queries Morningstar's realtime quote service.

**Is this affiliated with Morningstar?**  No. This is an independent third-party actor using Morningstar's public website.

# Actor input Schema

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

What to fetch.

## `searchQuery` (type: `string`):

Company name or ticker, e.g. `apple`, `tsla`, `vanguard` (mode=search).

## `securityType` (type: `string`):

Stock or ETF universe (mode=search).

## `exchange` (type: `string`):

Primary exchange used for ticker lookups (mode=byTicker).

## `tickers` (type: `array`):

Stock/ETF ticker symbols on the selected exchange, e.g. `AAPL`, `MSFT`.

## `startUrls` (type: `array`):

Morningstar quote URLs, e.g. `https://www.morningstar.com/stocks/xnas/aapl/quote` or `https://www.morningstar.com/etfs/arcx/ivv/quote`.

## `moversGroup` (type: `string`):

Which movers list to fetch (mode=movers). Available ~15 minutes after US market open.

## `minPrice` (type: `number`):

Only emit quotes with last price >= this value.

## `maxPrice` (type: `number`):

Only emit quotes with last price <= this value.

## `minPercentChange` (type: `number`):

Only emit quotes with percent change >= this value (e.g. 2.5).

## `maxPercentChange` (type: `number`):

Only emit quotes with percent change <= this value.

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

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "apple",
  "securityType": "stock",
  "exchange": "xnas",
  "tickers": [],
  "moversGroup": "gainers",
  "maxItems": 50
}
```

# Actor output Schema

## `quotes` (type: `string`):

Dataset containing all scraped Morningstar quotes and movers.

# 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 = {
    "mode": "search",
    "searchQuery": "apple",
    "securityType": "stock",
    "exchange": "xnas",
    "tickers": [],
    "moversGroup": "gainers",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/morningstar-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 = {
    "mode": "search",
    "searchQuery": "apple",
    "securityType": "stock",
    "exchange": "xnas",
    "tickers": [],
    "moversGroup": "gainers",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/morningstar-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "search",
  "searchQuery": "apple",
  "securityType": "stock",
  "exchange": "xnas",
  "tickers": [],
  "moversGroup": "gainers",
  "maxItems": 50
}' |
apify call crawlerbros/morningstar-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/morningstar-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Y94kJMopIFDfzT5cV/builds/jvDsX86Qzn7oHRNMd/openapi.json
