Before you start
- Get an API keySign up for 100 free credits, no card. Keys start with
gs_live_. - Put it in the environmentEvery example reads it from
GROUNDSOCIAL_API_KEY:export GROUNDSOCIAL_API_KEY=gs_live_… - Set up Python
pip install requests
Call Stock fundamentals API from Python
GET /v1/finance/fundamentals. Save this as main.py and run python main.py.
import os
import requests
API = "https://api.groundsocial.dev"
HEADERS = {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"}
res = requests.get(
f"{API}/v1/finance/fundamentals",
params={"keyword": "NVDA", "period": "quarterly"},
headers=HEADERS,
timeout=60,
)
res.raise_for_status()
data = res.json()
print(data)
print("credits charged:", res.headers["x-credits-charged"])The response
A real Finance response to this call, recorded from the live API on 27 Nov 2026 and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 4 items in earnings. Live calls return current data in the same shape.
{
"symbol": "NVDA",
"summaryDetail": {
"maxAge": 1,
"priceHint": {
"raw": 2,
"fmt": "2",
"longFmt": "2"
},
"previousClose": {
"raw": 155.38,
"fmt": "155.38"
},
"open": {
"raw": 144.02,
"fmt": "144.02"
},
"dayLow": {
"raw": 141.17,
"fmt": "141.17"
},
"dayHigh": {
"raw": 150.37,
"fmt": "150.37"
},
"regularMarketPreviousClose": {
"raw": 155.38,
"fmt": "155.38"
},
"regularMarketOpen": {
"raw": 144.02,
"fmt": "144.02"
},
"regularMarketDayLow": {
"raw": 141.17,
"fmt": "141.17"
},
"regularMarketDayHigh": {
"raw": 150.37,
"fmt": "150.37"
},
"…": "54 more fields"
},
"defaultKeyStatistics": {
"maxAge": 1,
"priceHint": {
"raw": 2,
"fmt": "2",
"longFmt": "2"
},
"enterpriseValue": {
"raw": 3539442860032,
"fmt": "3.54T",
"longFmt": "3,539,442,860,032"
},
"forwardPE": {
"raw": 8.991117,
"fmt": "8.99"
},
"profitMargins": {
"raw": 0.62535,
"fmt": "62.53%"
},
"floatShares": {
"raw": 23138626220,
"fmt": "23.14B",
"longFmt": "23,138,626,220"
},
"sharesOutstanding": {
"raw": 24147000000,
"fmt": "24.15B",
"longFmt": "24,147,000,000"
},
"sharesShort": {
"raw": 305326286,
"fmt": "305.33M",
"longFmt": "305,326,286"
},
"sharesShortPriorMonth": {
"raw": 301622687,
"fmt": "301.62M",
"longFmt": "301,622,687"
},
"sharesShortPreviousMonthDate": {
"raw": 1792022400,
"fmt": "2026-10-15"
},
"…": "51 more fields"
},
"financialData": {
"maxAge": 86400,
"currentPrice": {
"raw": 149.3,
"fmt": "149.30"
},
"targetHighPrice": {
"raw": 425,
"fmt": "425.00"
},
"targetLowPrice": {
"raw": 130,
"fmt": "130.00"
},
"targetMeanPrice": {
"raw": 242.4278,
"fmt": "242.43"
},
"targetMedianPrice": {
"raw": 240,
"fmt": "240.00"
},
"recommendationMean": {
"raw": 1.66667,
"fmt": "1.67"
},
"recommendationKey": "buy",
"numberOfAnalystOpinions": {
"raw": 59,
"fmt": "59",
"longFmt": "59"
},
"totalCash": {
"raw": 97731002368,
"fmt": "97.73B",
"longFmt": "97,731,002,368"
},
"…": "20 more fields"
},
"earnings": [
{
"date": "4Q2025",
"fiscalQuarter": "4Q2026",
"revenue": {
"raw": 68127000000,
"fmt": "68.13B",
"longFmt": "68,127,000,000"
},
"earnings": {
"raw": 42960000000,
"fmt": "42.96B",
"longFmt": "42,960,000,000"
},
"profitMargin": {
"raw": 0.630587,
"fmt": "63.06%"
}
},
"… 3 more"
],
"earningsHistory": [
{
"maxAge": 1,
"epsActual": {
"raw": 1.62,
"fmt": "1.62"
},
"epsEstimate": {
"raw": 1.53812,
"fmt": "1.54"
},
"epsDifference": {
"raw": 0.08,
"fmt": "0.08"
},
"surprisePercent": {
"raw": 0.053200003,
"fmt": "5.32%"
},
"quarter": {
"raw": 1769817600,
"fmt": "2026-01-31"
},
"currency": "USD",
"period": "-4q"
},
"… 3 more"
]
}Top-level fields
| Field | Type | Description |
|---|---|---|
symbol | string | – |
summaryDetail | object | – |
defaultKeyStatistics | object | – |
financialData | object | – |
earnings | object[] | Revenue and earnings per period, newest last. |
earningsHistory | object[] | EPS actual against estimate, last quarters. |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
keyword (required) | query | string | A ticker (AAPL, ^GSPC, EURUSD=X, BTC-USD) or a company name. Example: AAPL. |
period | query | "quarterly" | "annual" | One of quarterly, annual. |
limit | query | integer | Periods per page, 1 to 20. Defaults to 4. |
Errors and retries
Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.
import os, time
import requests
def call(url, **kwargs):
headers = {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"}
for attempt in range(3):
res = requests.get(url, headers=headers, timeout=60, **kwargs)
if res.ok:
return res.json()
err = res.json()["error"]
# Branch on the stable code; the hint says what to do next.
if err["retryable"] and attempt < 2:
time.sleep(int(res.headers.get("Retry-After", 2)))
continue
raise RuntimeError(f"{err['code']}: {err.get('hint', err['message'])}")
data = call("https://api.groundsocial.dev/v1/finance/fundamentals", params={"keyword": "NVDA", "period": "quarterly"})| Status | Meaning |
|---|---|
200 | The fundamentals. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No ticker or data matches. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Finance is temporarily unavailable. Retryable; nothing was charged. |
Every error code and what to do about it.
Pricing
| Cost | |
|---|---|
| Per call | 1 credit per call |
| 1,000 calls | $1.00 on the starter pack, $0.40 at volume |
| No key (MPP or x402) | $0.01 per call |
| Failed call | Refunded, never charged |
Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.
From an AI agent (MCP)
The same call is the finance_fundamentals_get tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcpThen ask for it in words (“Key statistics, financial data and earnings history”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "finance_fundamentals_get",
"arguments": {
"keyword": "NVDA",
"period": "quarterly"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
Screen on valuation
Compare forwardPE and profitMargins across tickers.
Questions
Quarterly or annual?
Both: pass period.
Keep going
- This call in JavaScript, TypeScript, Go, PHP, cURL.
- Stock fundamentals API reference: every field and status code.
- Finance tutorials and all Python tutorials.
- Finance API: every endpoint and price.
- How to scrape stock quote with Python: A live quote: price, change, volume, ranges, market cap, ratios.
- How to scrape financial statements with Python: Income statement, balance sheet and cash flow, annual, quarterly or trailing.
- How to scrape options chain with Python: An option chain: calls and puts for an expiry.
- How to scrape ticker search with Python: Find tickers by name or symbol: stocks, indices, funds, currencies, futures.
- How to scrape market overview with Python: Market overview: major indices, currencies, commodities and crypto.
- How to scrape Finance news with Python: Finance news about a company or topic.
Run it on your own data
One key for Finance and 76 more platforms, over REST or MCP. Free credits on signup, no card.
Finance is a trademark of Yahoo Inc. We are not affiliated with or endorsed by Yahoo Inc.