# Macrotrends Scraper (`parseforge/macrotrends-scraper`) Actor

Scrapes historical financial and macro data from Macrotrends chart pages. Returns each data point as a flat row with date, value, and chart title.

- **URL**: https://apify.com/parseforge/macrotrends-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, News, Lead generation
- **Stats:** 7 total users, 0 monthly users, 90.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?

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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### Macrotrends Scraper

**Scrape Macrotrends historical financial data from any stock or macro chart URL, up to a million records per run.** Every row comes with the date, value, and chart title in one flat schema. No login or API key. Export to CSV, JSON, Excel, or XML.

Macrotrends publishes decades of stock fundamentals, price history, and country-level economic indicators, but the site has no public API and downloading each chart by hand is slow. This Actor reads the chart pages directly, extracts the underlying data series, and returns every point as a clean row. Feed it a stock chart like AAPL revenue or a macro chart like USA GDP, and it handles the rest.

| Who uses it | What they scrape Macrotrends for |
|---|---|
| Financial analysts | Pull a company's full revenue or earnings history into a spreadsheet for modeling. |
| Quant researchers | Build a time series dataset of stock fundamentals across many tickers. |
| Economists | Download country-level indicators like GDP or inflation for cross-country studies. |
| Data engineers | Automate Macrotrends data collection into a warehouse or pipeline. |
| Investors | Compare long-term valuation metrics like PE ratio across companies. |

### What it does

This Actor collects historical data points from Macrotrends chart pages and returns each one as a flat row with the date, value, and chart title.

- 📈 **Stock charts:** revenue, net income, EPS, PE ratio, stock price, and more for any ticker.
- 🌍 **Macro charts:** GDP, inflation, unemployment, debt, and other country-level indicators.
- 🔗 **Direct URL input:** paste any Macrotrends chart URL and get the data behind it.
- 📊 **Flat row output:** each record has the date, value, and chart title, ready for CSV or JSON.
- ⚙️ **Max records control:** cap the run at any number from 1 to 1,000,000.

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

### What you can do with Macrotrends data

**📊 Build a fundamentals dataset.**

A quant researcher runs the Actor on a list of stock chart URLs and collects revenue, earnings, and PE ratio history into one CSV for backtesting.

**🌍 Track economic indicators.**

An economist scrapes GDP and inflation charts for several countries and compares long-term trends in a spreadsheet.

**📈 Monitor valuation over time.**

An investor pulls the PE ratio history for a watchlist of stocks to spot when valuations are stretched.

**🔁 Automate data refreshes.**

A data engineer schedules the Actor to update a warehouse table with the latest Macrotrends data every week.

### Why choose this scraper

| | What you get |
|---|---|
| **No API key** | Macrotrends has no official API, so this Actor reads the public chart pages directly. |
| **One fixed schema** | Every chart returns the same flat structure, so you can merge stock and macro data easily. |
| **Historical depth** | Get the full series shown on the chart, often decades of annual or quarterly data. |
| **Export anywhere** | Download as CSV, JSON, Excel, or XML for use in any tool. |

### How it compares

This Actor and the other Macrotrends Scraper both target Macrotrends chart data, but this one focuses on a simple one-URL input with a flat row output.

| Feature | ParseForge | Macrotrends Scraper |
|---|---|---|
| Stock chart data | Yes | Yes |
| Macro/country chart data | Yes | Yes |
| Single URL input | Yes | Not listed |
| Max records limit | Yes | Not listed |
| Flat row output | Yes | Not listed |

### Configure the run

Drive the Actor from a single Macrotrends chart URL and set a maximum record count to keep runs predictable. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
 "maxItems": 10
}
```

A larger pull:

```json
{
 "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
 "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.21 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $21.00 |
| 1,000 results | $210.00 |
| 10,000 results | $2100.00 |

New Apify accounts start with $5 in free credit.

### Free users

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

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Macrotrends Scraper](https://apify.com/parseforge/macrotrends-scraper?fpr=vmoqkp).
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 Macrotrends 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=parseforge/macrotrends-scraper"
```

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

### Troubleshooting

**Why am I getting no results?**

Make sure the startUrl points to a valid Macrotrends chart page, not a homepage or search page. Also check that maxItems is at least 1. If the page has no chart data, the Actor will return an empty dataset.

**The run fails with an error.**

Verify the URL is correct and accessible in a browser. Macrotrends may block automated requests occasionally, so retry after a few minutes. If the problem persists, check the Actor log for details.

**Some data points are missing.**

The Actor extracts exactly what is shown on the chart. If Macrotrends truncates the series or uses a different chart type, some points may not be available. Try a different chart URL for the same metric.

**The output has unexpected fields.**

The schema is fixed for all charts, but some fields may be empty if the chart does not provide that information. Check the sample output to see the expected structure.

**Can I scrape a list of URLs?**

The Actor takes one startUrl per run. To process multiple URLs, use Apify's API or scheduler to run the Actor once per URL, or build a small script that calls it in a loop.

### FAQ

| Question | Answer |
|---|---|
| What exactly does this Actor scrape from Macrotrends? | It extracts the data points behind any Macrotrends chart page, including stock fundamentals like revenue and earnings, stock price history, and macroeconomic indicators like GDP or inflation. Each point is returned as a row with the date, value, and chart title. |
| Do I need a Macrotrends account or API key? | No. The Actor reads the public chart pages directly, so there is no login or key required. |
| Can I scrape multiple charts in one run? | The input accepts one start URL per run. To scrape multiple charts, run the Actor once per URL or use Apify's scheduler or API to loop over a list. |
| What format is the output data in? | Each record is a flat object with fields like date, value, and chart title. You can export the dataset as CSV, JSON, Excel, or XML. |
| How far back does the data go? | It depends on the chart. Macrotrends often provides decades of annual or quarterly history, and the Actor returns whatever is shown on the page. |
| Does it work for both stocks and country macro data? | Yes. Any Macrotrends chart URL works, whether it is a stock chart like AAPL revenue or a macro chart like USA GDP. |
| Can I limit how many records are collected? | Yes, set the maxItems input to any number from 1 to 1,000,000. The Actor stops after that many rows. |
| Is the data live or historical? | The Actor scrapes the data as it appears on the Macrotrends page at run time, which includes the full historical series shown on the chart. |
| What if the chart page changes or breaks? | Macrotrends occasionally updates its page structure. If you see missing data, check that the URL is still valid and try again. The Actor is maintained to handle common changes. |
| Can I use this for commercial purposes? | You should review Macrotrends' terms of service for your use case. The Actor only accesses publicly available pages. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Macrotrends LLC. 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

## `startUrl` (type: `string`):

Full Macrotrends chart URL to scrape. Supports stock charts (e.g. https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue) and macro/country charts (e.g. https://www.macrotrends.net/global-metrics/countries/usa/united-states/gdp-gross-domestic-product).

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

How many records to collect per run.

## Actor input object example

```json
{
  "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
  "maxItems": 10
}
```

# Actor output Schema

## `results` (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 = {
    "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/macrotrends-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 = {
    "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/macrotrends-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 '{
  "startUrl": "https://www.macrotrends.net/stocks/charts/AAPL/apple/revenue",
  "maxItems": 10
}' |
apify call parseforge/macrotrends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/macrotrends-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/5ukJc73kLgTAl8fj0/builds/wV6pIBHMMWjmpUCjS/openapi.json
