Skip to content
--:--:--LOCAL ·--:--UTC
    US EQUITIESLAST CLOSE
    AAPL$344.63-1.23%
    MSFT$521.91-1.55%
    GOOGL$279.84-1.40%
    AMZN$240.35-1.41%
    NVDA$204.64-4.22%
    META$614.99-1.53%
    TSLA$399.81-0.87%
    NFLX$62.08+0.05%
    BRK.B$542.49+0.10%
    AVGO$326.08-5.48%
    DIS$110.94+0.03%
    SBUX$103.67-1.74%
    MCD$258.12+0.29%
    NKE$38.67+0.65%
    COST$1012.28+1.63%
    WMT$123.51+1.86%
    HD$329.20+0.07%
    KO$94.08+1.36%
    PG$161.57+0.61%
    ORCL$130.67-6.37%
    CRM$229.17-0.75%
    ADBE$250.23+0.85%
    AMD$504.80-10.88%
    INTC$65.76-28.58%
    QCOM$164.79-11.12%
    CSCO$104.51-3.76%
    IBM$257.81-0.18%
    UBER$65.25-0.75%
    ABNB$164.39-1.24%
    SHOP$157.49-5.63%
    PYPL$57.01+0.11%
    COIN$143.54-10.62%
    PLTR$184.11-6.27%
    HOOD$84.99-7.21%
    JPM$337.04-1.90%
    V$413.59+0.74%
    MA$638.01+0.36%
    BAC$50.01-2.21%
    GS$894.55-3.58%
    LLY$1417.54+3.19%
    UNH$406.97-0.96%
    JNJ$273.20-0.73%
    PFE$30.52+1.90%
    XOM$187.25+2.16%
    BA$171.55-0.64%
    BABA$98.04-1.51%
    TSM$406.13-5.95%
    US EQUITIESLAST CLOSE
    AAPL$344.63-1.23%
    MSFT$521.91-1.55%
    GOOGL$279.84-1.40%
    AMZN$240.35-1.41%
    NVDA$204.64-4.22%
    META$614.99-1.53%
    TSLA$399.81-0.87%
    NFLX$62.08+0.05%
    BRK.B$542.49+0.10%
    AVGO$326.08-5.48%
    DIS$110.94+0.03%
    SBUX$103.67-1.74%
    MCD$258.12+0.29%
    NKE$38.67+0.65%
    COST$1012.28+1.63%
    WMT$123.51+1.86%
    HD$329.20+0.07%
    KO$94.08+1.36%
    PG$161.57+0.61%
    ORCL$130.67-6.37%
    CRM$229.17-0.75%
    ADBE$250.23+0.85%
    AMD$504.80-10.88%
    INTC$65.76-28.58%
    QCOM$164.79-11.12%
    CSCO$104.51-3.76%
    IBM$257.81-0.18%
    UBER$65.25-0.75%
    ABNB$164.39-1.24%
    SHOP$157.49-5.63%
    PYPL$57.01+0.11%
    COIN$143.54-10.62%
    PLTR$184.11-6.27%
    HOOD$84.99-7.21%
    JPM$337.04-1.90%
    V$413.59+0.74%
    MA$638.01+0.36%
    BAC$50.01-2.21%
    GS$894.55-3.58%
    LLY$1417.54+3.19%
    UNH$406.97-0.96%
    JNJ$273.20-0.73%
    PFE$30.52+1.90%
    XOM$187.25+2.16%
    BA$171.55-0.64%
    BABA$98.04-1.51%
    TSM$406.13-5.95%
    Plug stock market data into your AI agent — one command: Get your free API key →
    LoginGet API Key

    Stock market data infrastructure

    Get historical stock prices with Python

    Fetch a historical OHLCV series with httpx, parse the bars envelope, and preserve adjusted price metadata and missing-data states.

    Documentation revised

    Fetch one daily series

    Install httpx in your own client environment and set STOCKMARKET_API_KEY before running this example. It requests one year of daily bars for an illustrative NASDAQ listing and raises on an HTTP failure before parsing JSON.

    import os
    import httpx
    
    response = httpx.get(
        "https://stockmarketapi.ai/api/v1/companies/AAPL/prices",
        params={"range": "1Y", "interval": "1d", "exchange": "NASDAQ"},
        headers={"X-API-Key": os.environ["STOCKMARKET_API_KEY"]},
        timeout=30,
    )
    response.raise_for_status()
    payload = response.json()
    for bar in payload["bars"]:
        print(bar["t"], bar["close"], bar.get("close_split_adjusted"))

    Retain the response metadata

    Store payload adjustment, source, currency, currency_basis, and interval beside the bars. The close field has a split-and-dividend basis for daily history; close_split_adjusted is split-only. Inspect each bar's t value rather than assuming observations occur on every calendar day.

    Make gaps visible

    If bars is empty, record an unavailable-series result rather than generating zero-valued bars. Compare the latest returned date with the exchange calendar. The requested range anchors to the newest stored observation, so a successful 1Y request can still be stale.