Stock historical bars

$0.005 per callUSDC via x402GET /api/stock-history

Daily OHLCV bars for a US equity: the last `days` sessions, 1 to 250, default 30. Send GET /api/stock-history with the required field symbol and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with symbol, days, bars, asOf, dataset and 4 more.

Daily only, no intraday. Built from the official consolidated end-of-day summary across all US exchanges and ATSs, so price, range and volume are market totals. If that dataset is unavailable for a read, the answer comes from a consolidation of three U.S. exchange venues instead and says so: coverage reads three-venue, venueVolume counts those venues only and volume is null. On that fallback each bar's high and low are the extremes across the three venues and open and close come from the venue that traded the most that session. A flat ascending array ready for charting or backtests. Set indicators to also get technical analysis computed from the same bars: RSI(14), MACD(12,26,9), EMA 20/50/200, SMA 20/50, Bollinger(20,2) and ATR(14), with a plain summary (close vs EMA50, RSI zone, MACD cross). Indicators need enough sessions (EMA200 needs days >= 200) and are descriptive, not a trading recommendation.

Category: Live public dataTags: finance stocks history ohlcv technical-analysis

Try in playground →

Parameters

NameTypeRequiredDescription
symbolstringyesUS equity ticker, e.g. AAPL. Indices, FX and crypto are not covered. Also accepted as ticker, coin, asset.
daysintegernoTrading sessions to return, 1 to 250 (default 30).
indicatorsanynotrue for all, or a list of: rsi, macd, ema, sma, bollinger, atr. Computed from the returned bars (default none).
pointsintegernoSeries points per indicator, newest last (default 5, max 100). Only with indicators.

Example request

curl -i "https://agent402.tools/api/stock-history?symbol=AAPL&days=30"

Without payment this returns HTTP 402 Payment Required with the exact price for stock-history; any x402 v2 or MPP client pays it and retries.

Example response

{
  "symbol": "AAPL",
  "days": 2,
  "bars": [
    {
      "day": "2026-10-12",
      "open": 338.215,
      "high": 342.63,
      "low": 337.6,
      "close": 340.97,
      "venueVolume": 25900599,
      "volume": 25900599
    },
    {
      "day": "2026-10-13",
      "open": 344.665,
      "high": 348.1499,
      "low": 340.74,
      "close": 341.27,
      "venueVolume": 38983839,
      "volume": 38983839
    }
  ],
  "asOf": "2026-10-13",
  "dataset": "EQUS.SUMMARY",
  "coverage": "consolidated",
  "venues": "All US exchanges and ATSs (consolidated end-of-day summary)",
  "source": "databento.com EQUS.SUMMARY",
  "note": "Official consolidated end-of-day bars across all US exchanges and ATSs; volume is the consolidated total and includes post-market trading. Prices are unadjusted for splits and dividends."
}
FieldTypeAlways presentIn the example
symbolstringyesAAPL
daysnumberyes2
barsarray of objectsyes2 items in the example
asOfstringyes2026-10-13
datasetstringyesEQUS.SUMMARY
coveragestringyesconsolidated
venuesstringyesAll US exchanges and ATSs (consolidated end-of-day summary)
sourcestringyesdatabento.com EQUS.SUMMARY
notestringyesOfficial consolidated end-of-day bars across all US exchanges and ATSs; volum...

From an MCP client

catalog.call {
  "slug": "stock-history",
  "params": {
    "symbol": "AAPL",
    "days": 30
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for stock-history; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y [email protected].

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/stock-history?symbol=AAPL&days=30");

Part of these workflows

Stock historical bars is one step in these 6 skill packs, each sold as a single call:

Related tools

Stock quote

$0.001 · GET /api/stock-quote

End-of-day US equity quote: last close, day range, consolidated volume, previous close and the change between them.

Amortization schedule

FREE w/ compute · or $0.001 · POST /api/amortization

Build the full per-period amortization schedule for a fully-amortizing loan.

Annuity present/future value

FREE w/ compute · or $0.001 · POST /api/annuity

Present and future value of a level annuity (equal periodic payments).

Black-Scholes option price

FREE w/ compute · or $0.002 · POST /api/black-scholes

Price a European option (call or put) with the Black-Scholes-Merton model, plus the greeks (delta, gamma, vega, theta.

Bond price

FREE w/ compute · or $0.001 · POST /api/bond-price

Price a fixed-coupon bond from its yield to maturity: present-value the coupons plus face.

Bond yield to maturity

FREE w/ compute · or $0.002 · POST /api/bond-ytm

Solve a bond's yield to maturity from its market price - the annual rate that present-values the coupons plus face.