Stock historical bars

$0.005 per call · USDC via x402 · GET /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, venues and 2 more.

Daily only, no intraday. Built from a three-venue consolidation (Databento DBEQ.BASIC), so each bar's high and low are the extremes across those venues, open and close come from the venue that traded the most that session, and venueVolume sums those three venues rather than the consolidated tape. 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 data · Tags: 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-09-17",
      "open": 218.2,
      "high": 220.3,
      "low": 217.65,
      "close": 219.8,
      "venueVolume": 1481234
    },
    {
      "day": "2026-09-18",
      "open": 219.9,
      "high": 221.05,
      "low": 219.1,
      "close": 220.4,
      "venueVolume": 1630155
    }
  ],
  "asOf": "2026-09-18",
  "venues": "NYSE Texas (formerly NYSE Chicago), NYSE National, IEX",
  "source": "databento.com DBEQ.BASIC",
  "note": "Daily bars from a three-venue consolidation; venueVolume counts those venues only, not the consolidated tape."
}
FieldTypeAlways presentIn the example
symbolstringyesAAPL
daysnumberyes2
barsarray of objectsyes2 items in the example
asOfstringyes2026-09-18
venuesstringyesNYSE Texas (formerly NYSE Chicago), NYSE National, IEX
sourcestringyesdatabento.com DBEQ.BASIC
notestringyesDaily bars from a three-venue consolidation; venueVolume counts those venues ...

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 AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

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?.(false); // keep your own spending ceiling in code
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, previous close and the change between them. US equities only; indices…

Amortization schedule

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

Build the full per-period amortization schedule for a fully-amortizing loan. Each row reports the period number, payment…

Annuity present/future value

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

Present and future value of a level annuity (equal periodic payments). Supports an ordinary annuity (payments at period …

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, r…

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. Returns clean price, coupon p…

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 to th…