# Macrotrends API

> Macrotrends returns company metric histories and long-term commodity and stock index prices as a workflow and API.

Macrotrends returns annual or quarterly company metrics and year-over-year changes; provide a metric and company, and optionally a period. Get long term price history returns yearly commodity or stock index prices; provide an asset and optionally start and end years.

- Page: https://fous.com/tools/macrotrends
- Handle: `@macrotrends`
- Category: [Finance](https://fous.com/tools/category/finance)
- Source website: https://macrotrends.net
- Last verified: Sep 29, 2026

## Methods

### Get company metric history

Operation `get_company_metric_history`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get annual or quarterly company metric history, newest first, with full values and year-over-year change. Dividend values are trailing twelve-month payouts per share; quarterly employee counts and histories before a company began reporting or paying dividends may be unavailable.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `metric` | string | yes | `"net_income"` | Metric to retrieve, for example revenue. |
| `period` | string | no | `"quarterly"` | Annual or quarterly history, for example annual. |
| `company` | string | yes | `"MSFT"` | Company name or ticker, for example Apple or AAPL. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "company",
    "metric"
  ],
  "properties": {
    "metric": {
      "enum": [
        "revenue",
        "net_income",
        "earnings_per_share",
        "shares_outstanding",
        "employees",
        "price_to_earnings_ratio",
        "dividend"
      ],
      "type": "string",
      "description": "Metric to retrieve, for example revenue.",
      "examples": [
        "net_income",
        "earnings_per_share",
        "shares_outstanding"
      ]
    },
    "period": {
      "enum": [
        "annual",
        "quarterly"
      ],
      "type": "string",
      "default": "annual",
      "description": "Annual or quarterly history, for example annual.",
      "examples": [
        "quarterly",
        "annual"
      ]
    },
    "company": {
      "type": "string",
      "description": "Company name or ticker, for example Apple or AAPL.",
      "examples": [
        "MSFT",
        "Apple"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "metric": "net_income",
      "period": "quarterly",
      "company": "MSFT"
    },
    {
      "metric": "earnings_per_share",
      "period": "annual",
      "company": "Apple"
    },
    {
      "metric": "shares_outstanding",
      "period": "annual",
      "company": "Apple"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `rows` | array |  |  |
| `rows[].value` | number | `35766000000` | Full numeric value in the stated unit. |
| `rows[].page_url` | string | `"https://www.macrotrends.net/stocks/charts/MSFT/microsoft/net-income"` | Company metric history page. |
| `rows[].fiscal_year` | integer or null | `2025` | Fiscal year for annual values; null for quarterly values. |
| `rows[].quarter_end_date` | string or null | `"2026-06-30"` | Quarter ending date (YYYY-MM-DD); null for annual values. |
| `rows[].change_vs_prior_year_percent` | number or null | `31.33` | Percentage change from the previous year or the same quarter a year before, when available. |
| `unit` | string | `"US dollars"` |  |
| `metric` | string | `"Net Income"` |  |
| `ticker` | string | `"MSFT"` |  |
| `company` | string | `"Microsoft"` |  |

**Example input**

```json
{
  "metric": "net_income",
  "period": "quarterly",
  "company": "MSFT"
}
```

**Example output**

```json
{
  "rows": [
    {
      "value": 35766000000,
      "page_url": "https://www.macrotrends.net/stocks/charts/MSFT/microsoft/net-income",
      "fiscal_year": null,
      "quarter_end_date": "2026-06-30",
      "change_vs_prior_year_percent": 31.33
    },
    {
      "value": 31778000000,
      "page_url": "https://www.macrotrends.net/stocks/charts/MSFT/microsoft/net-income",
      "fiscal_year": null,
      "quarter_end_date": "2026-03-31",
      "change_vs_prior_year_percent": 23.06
    },
    {
      "value": 38458000000,
      "page_url": "https://www.macrotrends.net/stocks/charts/MSFT/microsoft/net-income",
      "fiscal_year": null,
      "quarter_end_date": "2025-12-31",
      "change_vs_prior_year_percent": 59.52
    }
  ],
  "unit": "US dollars",
  "metric": "Net Income",
  "ticker": "MSFT",
  "company": "Microsoft"
}
```

### Get long term price history

Operation `get_long_term_price_history`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get decades of yearly commodity or stock-index price history from Macrotrends. Yearly open, high, low and close use daily closing prices for Dow Jones, S&P 500, Nasdaq and copper; gold, silver, crude oil and natural gas use monthly closing prices. Inflation-adjusted value is the final adjusted monthly close for each year where published. The current year may be incomplete.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `asset` | string | yes | `"gold"` | Commodity or stock index name, for example gold, crude oil, or S&P 500. |
| `end_year` | integer | no | `1973` | Last calendar year to include, for example 2024. Defaults to the last available year. |
| `start_year` | integer | no | `1970` | First calendar year to include, for example 2000. Defaults to the first available year. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "asset"
  ],
  "properties": {
    "asset": {
      "type": "string",
      "examples": [
        "gold"
      ],
      "description": "Commodity or stock index name, for example gold, crude oil, or S&P 500."
    },
    "end_year": {
      "type": "integer",
      "default": 9999,
      "description": "Last calendar year to include, for example 2024. Defaults to the last available year.",
      "examples": [
        1973,
        2024,
        1981
      ]
    },
    "start_year": {
      "type": "integer",
      "default": 1900,
      "description": "First calendar year to include, for example 2000. Defaults to the first available year.",
      "examples": [
        1970,
        2000,
        1980
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "asset": "copper",
      "end_year": 1973,
      "start_year": 1970
    },
    {
      "asset": "gold",
      "end_year": 2024,
      "start_year": 2000
    },
    {
      "asset": "crude oil",
      "end_year": 1981,
      "start_year": 1980
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `unit` | string | `"US dollars per pound"` |  |
| `asset` | string | `"Copper"` |  |
| `price_history` | array |  |  |
| `price_history[].year` | integer | `1973` |  |
| `price_history[].page_url` | string | `"https://www.macrotrends.net/1476/copper-prices-historical-chart-data"` |  |
| `price_history[].year_low` | number or null | `0.5062` |  |
| `price_history[].year_high` | number or null | `0.6875` |  |
| `price_history[].year_open` | number or null | `0.5062` |  |
| `price_history[].year_close` | number or null | `0.6875` |  |
| `price_history[].annual_change_percent` | number or null | `35.82` |  |
| `price_history[].average_closing_price` | number or null | `0.6` |  |
| `price_history[].inflation_adjusted_value` | number or null | `2792.81` |  |

**Example input**

```json
{
  "asset": "copper",
  "end_year": 1973,
  "start_year": 1970
}
```

**Example output**

```json
{
  "unit": "US dollars per pound",
  "asset": "Copper",
  "price_history": [
    {
      "year": 1973,
      "page_url": "https://www.macrotrends.net/1476/copper-prices-historical-chart-data",
      "year_low": 0.5062,
      "year_high": 0.6875,
      "year_open": 0.5062,
      "year_close": 0.6875,
      "annual_change_percent": 35.82,
      "average_closing_price": 0.6,
      "inflation_adjusted_value": null
    },
    {
      "year": 1972,
      "page_url": "https://www.macrotrends.net/1476/copper-prices-historical-chart-data",
      "year_low": 0.5,
      "year_high": 0.5265,
      "year_open": 0.5037,
      "year_close": 0.5062,
      "annual_change_percent": 0.5,
      "average_closing_price": 0.51,
      "inflation_adjusted_value": null
    },
    {
      "year": 1971,
      "page_url": "https://www.macrotrends.net/1476/copper-prices-historical-chart-data",
      "year_low": 0.5037,
      "year_high": 0.5325,
      "year_open": 0.5325,
      "year_close": 0.5037,
      "annual_change_percent": 8.42,
      "average_closing_price": 0.52,
      "inflation_adjusted_value": null
    }
  ]
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@macrotrends",
  "visibility": "public",
  "operation": "get_company_metric_history",
  "version": 1,
  "input": {
    "metric": "net_income",
    "period": "quarterly",
    "company": "MSFT"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@macrotrends\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_company_metric_history\",\n  \"version\": 1,\n  \"input\": {\n    \"metric\": \"net_income\",\n    \"period\": \"quarterly\",\n    \"company\": \"MSFT\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@macrotrends",
  "visibility": "public",
  "operation": "get_company_metric_history",
  "version": 1,
  "input": {
    "metric": "net_income",
    "period": "quarterly",
    "company": "MSFT"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/macrotrends`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_company_metric_history`: Get company metric history. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `get_long_term_price_history`: Get long term price history. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-macrotrends https://api.fous.com/mcp/tools/macrotrends --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Compare a company’s annual revenue over time
- Track quarterly company metrics and year-over-year changes
- Review long-term commodity price movements
- Compare yearly stock index highs, lows, opens, and closes
- Examine inflation-adjusted commodity values

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this Macrotrends tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a Macrotrends account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from macrotrends.net when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### What was a company’s revenue in prior years?

Get company metric history returns annual or quarterly values for a selected metric and company.

### How have commodity prices changed over time?

Get long term price history returns yearly price data, including annual change percentages, for a selected asset.

### What were a stock index’s yearly highs and lows?

Get long term price history returns yearly highs and lows for a selected stock index.

## Related

- [Yahoo Finance API](https://fous.com/tools/yahoo-finance.md): Yahoo Finance provides quotes, movers, company financials, analyst ratings, earnings, news, and up to 5,000 price rows with adjusted returns; prices may be delayed.
- [CompaniesMarketCap API](https://fous.com/tools/companiesmarketcap.md): CompaniesMarketCap ranks public companies worldwide or by country and industry across size and financial measures, and provides company figures with market-cap history for completed years.
- [Trading Economics API](https://fous.com/tools/trading-economics.md): Trading Economics provides economic indicators, market data and country statistics, including country overviews, latest reported country comparisons and current commodity prices reflecting reported trading days.
- [Stock Analysis API](https://fous.com/tools/stock-analysis.md): Stock Analysis returns free-period company statements, statistics current as of its displayed date, typically top-25 ETF holdings, and US IPOs since 2019 with potentially missing prices or returns.
- [Investing.com API](https://fous.com/tools/investing-com.md): Investing.com provides financial markets data and news, economic releases up to 31 days, and current commodity prices and government bond yields, which may be delayed or indicative.
- [Google Finance API](https://fous.com/tools/google-finance.md): Google Finance returns possibly delayed prices and figures, indexes, up to four movers timed by oldest quote, currency conversions, and up to five financial periods.
- [SEC EDGAR API](https://fous.com/tools/sec-edgar.md): SEC EDGAR provides filings, annual and quarterly financials, exact-phrase matches, up to 200 insider trades, and quarterly 13F manager holdings; older filings appear when available.
- [MSN Money API](https://fous.com/tools/msn-money.md): MSN Money provides stock quotes, key facts, financial news, and market data, including current market movers; quotes and prices may be delayed.
- [All Finance tools](https://fous.com/tools/category/finance)
