Skip to content
--:--:--LOCAL ·--:--UTC
    US EQUITIESLAST CLOSE
    AAPL$358.54+0.83%
    MSFT$492.85+0.60%
    GOOGL$274.96+0.68%
    AMZN$254.12+3.96%
    NVDA$150.49+0.80%
    META$628.96+3.13%
    TSLA$400.00+5.22%
    NFLX$60.93+2.56%
    BRK.B$580.79+0.25%
    AVGO$312.34+3.82%
    DIS$127.24+1.31%
    SBUX$108.80+0.98%
    MCD$282.62-0.31%
    NKE$37.32+1.80%
    COST$1097.81+1.01%
    WMT$133.13+0.90%
    HD$362.15+0.25%
    KO$97.40-0.19%
    PG$172.86-0.21%
    ORCL$107.13+3.13%
    CRM$198.21+0.51%
    ADBE$234.79+0.84%
    AMD$424.54+4.56%
    INTC$57.40+5.38%
    QCOM$179.27+6.29%
    CSCO$97.04+3.01%
    IBM$248.08+1.89%
    UBER$66.63+0.42%
    ABNB$179.16+4.07%
    SHOP$141.78+6.28%
    PYPL$59.14+2.30%
    COIN$107.04+3.20%
    PLTR$172.17+5.24%
    HOOD$67.92+3.25%
    JPM$322.96+1.96%
    V$429.56+1.22%
    MA$666.96+1.06%
    BAC$49.07+1.09%
    GS$812.87+1.48%
    LLY$1392.38+0.01%
    UNH$351.41+1.51%
    JNJ$275.51+0.57%
    PFE$28.52+0.21%
    XOM$160.18+1.33%
    BA$167.24+1.65%
    BABA$89.68+3.96%
    TSM$353.34+3.21%
    US EQUITIESLAST CLOSE
    AAPL$358.54+0.83%
    MSFT$492.85+0.60%
    GOOGL$274.96+0.68%
    AMZN$254.12+3.96%
    NVDA$150.49+0.80%
    META$628.96+3.13%
    TSLA$400.00+5.22%
    NFLX$60.93+2.56%
    BRK.B$580.79+0.25%
    AVGO$312.34+3.82%
    DIS$127.24+1.31%
    SBUX$108.80+0.98%
    MCD$282.62-0.31%
    NKE$37.32+1.80%
    COST$1097.81+1.01%
    WMT$133.13+0.90%
    HD$362.15+0.25%
    KO$97.40-0.19%
    PG$172.86-0.21%
    ORCL$107.13+3.13%
    CRM$198.21+0.51%
    ADBE$234.79+0.84%
    AMD$424.54+4.56%
    INTC$57.40+5.38%
    QCOM$179.27+6.29%
    CSCO$97.04+3.01%
    IBM$248.08+1.89%
    UBER$66.63+0.42%
    ABNB$179.16+4.07%
    SHOP$141.78+6.28%
    PYPL$59.14+2.30%
    COIN$107.04+3.20%
    PLTR$172.17+5.24%
    HOOD$67.92+3.25%
    JPM$322.96+1.96%
    V$429.56+1.22%
    MA$666.96+1.06%
    BAC$49.07+1.09%
    GS$812.87+1.48%
    LLY$1392.38+0.01%
    UNH$351.41+1.51%
    JNJ$275.51+0.57%
    PFE$28.52+0.21%
    XOM$160.18+1.33%
    BA$167.24+1.65%
    BABA$89.68+3.96%
    TSM$353.34+3.21%
    Plug stock market data into your AI agent — one command: Get your free API key →
    LoginGet API Key

    Stock market data infrastructure

    Load financial statements into pandas

    Turn the periods response into a pandas table while keeping currency, period type, cash-flow basis, and source attribution intact.

    Documentation revised

    Create a metadata-preserving table

    Install httpx and pandas in your client environment. The example requests FY rows explicitly and reindexes display columns so a sparse response remains inspectable. The JSON response envelope is periods, not a bare list of statements.

    import os
    import httpx
    import pandas as pd
    
    response = httpx.get(
        "https://stockmarketapi.ai/api/v1/companies/AAPL/financials",
        params={"period_type": "FY", "limit": 5, "exchange": "NASDAQ"},
        headers={"X-API-Key": os.environ["STOCKMARKET_API_KEY"]},
        timeout=30,
    )
    response.raise_for_status()
    payload = response.json()
    frame = pd.DataFrame(payload["periods"])
    if not frame.empty:
        columns = ["period_end", "period_type", "currency", "revenue",
                   "primary_source", "cash_flow_basis"]
        print(frame.reindex(columns=columns).to_string(index=False))

    Keep missing values and source maps

    Do not run fillna(0) on statement values. Preserve primary_source and the nested sources dictionary in your stored raw response even if the display table shows only selected columns. Check currency before joining companies, and keep fiscal_year with period_end.

    Change frequency deliberately

    For quarterly ingestion, inspect cash_flow_basis and request cash_flow=standalone when you need de-cumulated cash flows. For period=ttm, inspect ttm_quarters rather than assuming the aggregate represents four usable quarters. Do not mix FY and quarterly rows in an unqualified sum.