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 price history API from Python
GET /v1/finance/history. 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/history",
params={"keyword": "AAPL", "start_date": "2025-01-01", "end_date": "2025-06-30"},
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 122 items in rows. Live calls return current data in the same shape.
{
"symbol": "AAPL",
"interval": "1d",
"chart": {
"meta": {
"symbol": "AAPL",
"currency": "USD",
"exchangeName": "NMS",
"fullExchangeName": "NasdaqGS",
"instrumentType": "EQUITY",
"firstTradeDate": 345479400,
"regularMarketTime": 1795640402,
"hasPrePostMarketData": true,
"gmtoffset": -18000,
"timezone": "EST",
"exchangeTimezoneName": "America/New_York",
"regularMarketPrice": 355.58,
"regularMarketChangePercent": 0.426,
"fulldayPrice": 355.58,
"fulldayChange": 1.03,
"fulldayChangePercent": 0.291,
"fiftyTwoWeekHigh": 360.83,
"fiftyTwoWeekLow": 243.42,
"regularMarketDayHigh": 356.75,
"regularMarketDayLow": 345.13,
"regularMarketVolume": 53060252,
"longName": "Apple Inc.",
"shortName": "Apple Inc.",
"chartPreviousClose": 250.42,
"…": "5 more fields"
},
"timestamp": [
1735828200,
1735914600,
"… 120 more"
],
"indicators": {
"quote": [
{
"open": [
248.92999267578125,
243.36000061035156,
"… 120 more"
],
"volume": [
55740700,
40244100,
"… 120 more"
],
"low": [
241.82000732421875,
241.88999938964844,
"… 120 more"
],
"high": [
249.1000061035156,
244.17999267578125,
"… 120 more"
],
"close": [
243.8500061035156,
243.36000061035156,
"… 120 more"
]
}
],
"adjclose": [
{
"adjclose": [
241.90933227539065,
241.42323303222656,
"… 120 more"
]
}
]
},
"events": {
"dividends": {
"1739197800": {
"amount": 0.25,
"date": 1739197800
},
"1747056600": {
"amount": 0.26,
"date": 1747056600
}
}
}
},
"rows": [
{
"date": "2025-01-02T14:30:00.000Z",
"open": 248.92999267578125,
"high": 249.1000061035156,
"low": 241.82000732421875,
"close": 243.8500061035156,
"adjclose": 241.90933227539065,
"volume": 55740700
},
{
"date": "2025-01-03T14:30:00.000Z",
"open": 243.36000061035156,
"high": 244.17999267578125,
"low": 241.88999938964844,
"close": 243.36000061035156,
"adjclose": 241.42323303222656,
"volume": 40244100
},
"… 120 more"
]
}Top-level fields
| Field | Type | Description |
|---|---|---|
symbol | string | – |
interval | string | – |
chart | FinanceChart | – |
rows | object[] | – |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
keyword (required) | query | string | A ticker (AAPL, ^GSPC, EURUSD=X, BTC-USD) or a company name. Example: AAPL. |
start_date (required) | query | string | YYYY-MM-DD. |
end_date (required) | query | string | YYYY-MM-DD. |
interval | query | "1d" | "5d" | "1wk" | "1mo" | "3mo" | One of 1d, 5d, 1wk, 1mo, 3mo. |
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/history", params={"keyword": "AAPL", "start_date": "2025-01-01", "end_date": "2025-06-30"})| Status | Meaning |
|---|---|
200 | Price rows, oldest first, and the raw chart. |
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_history_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 (“Price history between two dates, daily to quarterly”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "finance_history_get",
"arguments": {
"keyword": "AAPL",
"start_date": "2025-01-01",
"end_date": "2025-06-30"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
Backtest a strategy
Pull daily rows for the window you test.
Questions
Which intervals?
1d, 5d, 1wk, 1mo and 3mo.
Keep going
- This call in JavaScript, TypeScript, Go, PHP, cURL.
- Stock price history API reference: every field and status code.
- Finance tutorials and all Python tutorials.
- Finance API: every endpoint and price.
- 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.
- How to scrape stock quote with Python: A live quote: price, change, volume, ranges, market cap, ratios.
- How to scrape ticker search with Python: Find tickers by name or symbol: stocks, indices, funds, currencies, futures.
- 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.
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.