# Macrotrends API: Get long-term price history

> Gets decades of yearly commodity or stock-index price history from Macrotrends: yearly average, open, high, low, close, annual change and inflation-adjusted value for gold, silver, crude oil, natural gas, copper, Dow Jones, S&P 500 and Nasdaq. The current year may be incomplete.

Unofficial. Not affiliated with or endorsed by Macrotrends.

- Page: https://fous.com/methods/macrotrends.net/get-long-term-price-history
- Method: `macrotrends.net/get_long_term_price_history`, version 1
- Website: macrotrends.net
- Returns: asset, unit, yearly average, open, high, low, close, annual change percent, inflation-adjusted value
- Effect: read (it gets data and changes nothing)
- Sign-in: none needed
- Cost: 1 credit per completed run (1¢ with pay as you go); failed runs are free

## Inputs

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

## Output

From a run on Oct 31, 2026, shortened. Its input:

```json
{
  "asset": "gold",
  "end_year": 2024,
  "start_year": 2000
}
```

Its output:

```json
{
  "unit": "US dollars per troy ounce",
  "asset": "Gold",
  "price_history": [
    {
      "year": 2024,
      "page_url": "https://www.macrotrends.net/1333/historical-gold-prices-100-year-chart",
      "year_low": 2039.1538,
      "year_high": 2746.7019,
      "year_open": 2039.1538,
      "year_close": 2624.603,
      "annual_change_percent": 27.23,
      "average_closing_price": 2404.58,
      "inflation_adjusted_value": 2792.81
    },
    {
      "year": 2023,
      "page_url": "https://www.macrotrends.net/1333/historical-gold-prices-100-year-chart",
      "year_low": 1826.7404,
      "year_high": 2062.9233,
      "year_open": 1928.1201,
      "year_close": 2062.9233,
      "annual_change_percent": 13.08,
      "average_closing_price": 1953.69,
      "inflation_adjusted_value": 2258.53
    },
    {
      "year": 2022,
      "page_url": "https://www.macrotrends.net/1333/historical-gold-prices-100-year-chart",
      "year_low": 1632.38,
      "year_high": 1953.04,
      "year_open": 1796.12,
      "year_close": 1824.3233,
      "annual_change_percent": -0.23,
      "average_closing_price": 1798.96,
      "inflation_adjusted_value": 2064.26
    }
  ]
}
```

## Run it

From code, with a Fous API key in `FOUS_API_KEY`; the answer's `data` holds the output:

```bash
curl https://api.fous.com/v1/runs \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"macrotrends.net/get_long_term_price_history","input":{"asset":"gold","end_year":2024,"start_year":2000}}'
```

From an AI agent connected to the Fous MCP server: its `run` with the same method and input. To connect one, give it `set up https://fous.com/SKILL.md`.

## Ask your agent

- Show me yearly gold prices from 1970 to 2024 with the open, high, low, close and annual percent change for each year
- I need the inflation-adjusted average price of crude oil for every year since 1980 from macrotrends.net
- What were the Dow Jones annual closing values and year-over-year changes between 1929 and 1950?
- Pull the full yearly price history of silver, including average price and inflation-adjusted value, using Macrotrends data
- Give me copper's annual high and low prices per pound from 2000 through 2023

## 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."
    },
    "start_year": {
      "type": "integer",
      "default": 1900,
      "description": "First calendar year to include, for example 2000. Defaults to the first available year."
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "required": [
    "asset",
    "unit",
    "price_history"
  ],
  "properties": {
    "unit": {
      "type": "string"
    },
    "asset": {
      "type": "string"
    },
    "price_history": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "year",
          "average_closing_price",
          "year_open",
          "year_high",
          "year_low",
          "year_close",
          "annual_change_percent",
          "inflation_adjusted_value",
          "page_url"
        ],
        "properties": {
          "year": {
            "type": "integer"
          },
          "page_url": {
            "type": "string"
          },
          "year_low": {
            "type": [
              "number",
              "null"
            ]
          },
          "year_high": {
            "type": [
              "number",
              "null"
            ]
          },
          "year_open": {
            "type": [
              "number",
              "null"
            ]
          },
          "year_close": {
            "type": [
              "number",
              "null"
            ]
          },
          "annual_change_percent": {
            "type": [
              "number",
              "null"
            ]
          },
          "average_closing_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "inflation_adjusted_value": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
```

## See more

- [Yahoo API: Get price history](https://fous.com/methods/finance.yahoo.com/get-price-history.md): Returns Yahoo Finance daily, weekly or monthly price history and total adjusted-close return for a stock, fund, index or cryptocurrency.
- [Trading Economics API: Get commodity prices](https://fous.com/methods/tradingeconomics.com/get-commodity-prices.md): Gets current commodity prices and price movements from the Trading Economics commodities page, in the page's group order; filter by a commodity name, slug, symbol or group (e.g. copper, energy), or leave blank for all groups including Electricity.
- [Investing.com API: Get commodity prices](https://fous.com/methods/investing.com/get-commodity-prices.md): Gets current quoted prices for energy, metals, and agricultural commodities from Investing.com's real-time futures page, optionally for one commodity. Some quotes may be delayed or indicative; units are null when the contract specification is missing.
- [Google API: Get quote](https://fous.com/methods/google.com/get-quote.md): Gets the current quoted price and key figures for a stock, fund, index, or cryptocurrency on Google Finance, by name or ticker. Prices may be delayed, and figures Google does not show are null.
- [Kitco API: Get precious metal prices](https://fous.com/methods/kitco.com/get-precious-metal-prices.md): Gets Kitco spot bid, ask, daily change and range for gold, silver, platinum or palladium. Non-USD prices use Kitco's current exchange rate, so converted daily changes are not adjusted for exchange-rate moves since the prior close.
- [Yahoo API: Get quote](https://fous.com/methods/finance.yahoo.com/get-quote.md): Looks up a stock, fund, index, or cryptocurrency by name or ticker and returns its latest displayed price and key statistics. Unavailable figures are null; quotes may be delayed.
- [CoinGecko API: Get coin price history](https://fous.com/methods/coingecko.com/get-coin-price-history.md): Gets a coin's daily prices and price change over the last 7, 30, 90 or 365 days, with UTC dates. Today's price may change.
- [Binance API: Get price history](https://fous.com/methods/binance.com/get-price-history.md): Gets Binance spot price candles for a coin and quote currency, newest by default or within a UTC date range, up to 1,000 candles.
