---
title: "Stock Price API: Quotes and History as JSON | Perceptlayer"
description: "Get a stock price as JSON with GET /v1/google-finance/quote: current_price, price_change, key stats and a Python watchlist loop at 1 credit per symbol."
url: https://perceptlayer.com/blog/stock-price-api-google-finance
---

[Blog](https://perceptlayer.com/blog) / [API guides](https://perceptlayer.com/blog/category/api-guides)

# Stock Price API: Quotes and History as JSON

29 Oct 2026 Perceptlayer 9 min read

A stock price API returns a ticker's price as JSON you can store and compare. With Perceptlayer, one `GET /v1/google-finance/quote` call with a `symbol` returns `current_price`, `price_change`, `percent_change`, the session in `market.trading` and key stats such as `previous_close`, for 1 credit per successful call. `historical` and `intraday` cover price series. This guide shows the request, the price fields in a recorded AAPL quote, a Python watchlist loop and the cost per symbol per day.

## Key takeaways

-   `GET /v1/google-finance/quote` needs only `symbol` (up to 20 characters); `exchange` and `period_type` ( `quarterly` or `annual`) are optional. Each successful call costs 1 credit.
-   The recorded AAPL quote has numeric `current_price` (347.725), `price_change` (-0.49) and `percent_change` (-0.14), plus a `market` block with `trading: "Extended Hours"` and `extracted_price` 347.2001.
-   Key stats such as `previous_close`, `day_range` and `market_cap` are display strings ( `"$348.22"`, `"5.07T USD"`), so parse them before you compute with them.
-   One quote per symbol per trading day is 1 credit per symbol per day: 40 symbols × 21 trading days = 840 credits a month; the 100 free credits on signup cover the first two trading days.
-   Failed calls cost nothing and return `X-Credits-Used: 0`, so a retry after a 429 is billed only when it succeeds.

## Which endpoints return stock prices?

Three of the six Google Finance endpoints return prices for a ticker: `quote` for a snapshot with key stats and financials, `historical` for a series over a date window, and `intraday` for the current day's movement. All three take a required `symbol` and an optional `exchange`. The other three help you find symbols and read the wider market: `search` takes a free-text `q`, `markets` lists movers by `trend`, and `indices` returns index levels. Every endpoint is a `GET` and costs 1 credit per successful call.

| Endpoint | Use it for | Required | Optional |
| --- | --- | --- | --- |
| [`/v1/google-finance/quote`](https://perceptlayer.com/apis/google-finance/quote) | Price snapshot, key stats, company profile, financials | `symbol` | `exchange`, `period_type`, `hl`, `gl` |
| [`/v1/google-finance/historical`](https://perceptlayer.com/apis/google-finance/historical) | Price history over a window | `symbol` | `exchange`, `range`, `start_date`, `end_date`, `interval`, `hl`, `gl` |
| [`/v1/google-finance/intraday`](https://perceptlayer.com/apis/google-finance/intraday) | Movement during the day | `symbol` | `exchange`, `hl`, `gl` |
| [`/v1/google-finance/search`](https://perceptlayer.com/apis/google-finance/search) | Finding a ticker from a name | `q` | `hl`, `gl` |
| [`/v1/google-finance/markets`](https://perceptlayer.com/apis/google-finance/markets) | Gainers, losers, most active and more | none | `trend`, `index_market`, `hl`, `gl` |
| [`/v1/google-finance/indices`](https://perceptlayer.com/apis/google-finance/indices) | Index levels | none | `indices`, `hl`, `gl` |

Only `quote` has a recorded response in this guide, so the field names below all come from it. For the other endpoints, run a call in the playground on the [Google Finance API page](https://perceptlayer.com/apis/google-finance) before you write a parser.

## How do you get a stock quote as JSON?

Send a `GET` request to `https://api.perceptlayer.com/v1/google-finance/quote` with the ticker in `symbol` and your key in the `X-API-Key` header. Adding `exchange` names the listing you mean, which is useful when a ticker could match more than one. This is the request behind the recorded response used in the rest of the guide:

```bash
curl "https://api.perceptlayer.com/v1/google-finance/quote?symbol=AAPL&exchange=NASDAQ" \
  -H "X-API-Key: $API_KEY"
```

Keys start with `sk_live_`. Where you can't set a header, the key can go in the `api_key` query parameter; the [authentication docs](https://docs.perceptlayer.com/authentication) cover both. A successful response carries `X-Credits-Used` and `X-Credits-Remaining` headers, so a script can log the cost of every call and the balance left after it. The [requests docs](https://docs.perceptlayer.com/requests) list the other headers.

## Which parameters does the quote endpoint take?

The quote endpoint takes one required parameter and four optional ones. `symbol` is the ticker, `exchange` pins the listing, `period_type` picks quarterly or annual financial statements, and `hl` and `gl` set language and country. Nothing else is documented about them, including defaults, so keep the values you choose fixed across runs and you'll compare like with like.

| Parameter | Type | Required | Documented constraint |
| --- | --- | --- | --- |
| `symbol` | string | yes | Up to 20 characters |
| `exchange` | string | no | None documented; the recorded call uses `NASDAQ` |
| `period_type` | string | no | One of `quarterly`, `annual` |
| `hl` | string | no | Up to 10 characters |
| `gl` | string | no | Up to 10 characters |

`period_type` changes the financial statements, not the price. The recorded response shows `"period_type": "Quarterly"` on each statement result.

## What does the price part of the response contain?

The response is one `quote` object with four blocks: `summary`, `key_stats`, `about` and `financials`. For price tracking, `summary` and `key_stats` matter. This is the recorded AAPL response, trimmed to those parts:

```json
{
  "quote": {
    "summary": {
      "name": "Apple Inc",
      "symbol": "AAPL",
      "exchange": "NASDAQ",
      "current_price": 347.725,
      "price_change": -0.49,
      "percent_change": -0.14,
      "currency": "USD",
      "market": {
        "trading": "Extended Hours",
        "price": "$347.20",
        "extracted_price": 347.2001,
        "price_movement": {
          "percentage": 0.15,
          "movement": "Down"
        }
      },
      …
    },
    "key_stats": {
      "previous_close": "$348.22",
      "day_range": "$345.75 - $351.73",
      "year_range": "$243.42 - $351.73",
      "market_cap": "5.07T USD",
      "avg_volume": "39.13M",
      "pe_ratio": 39.86,
      "dividend_yield": "0.31%",
      "primary_exchange": "NASDAQ",
      …
    },
    …
  }
}
```

| Field | Shape in the recording | What to do with it |
| --- | --- | --- |
| `summary.current_price` | number, `347.725` | Store as the price |
| `summary.price_change` | number, `-0.49` | Store as the day's change |
| `summary.percent_change` | number, `-0.14` | Store as the day's change in percent |
| `summary.currency` | string, `"USD"` | Store next to every price |
| `summary.market.trading` | string, `"Extended Hours"` | Store as the session label |
| `summary.market.extracted_price` | number, `347.2001` | Store as the session price |
| `key_stats.previous_close` | string, `"$348.22"` | Parse to a number |
| `key_stats.pe_ratio` | number, `39.86` | Store as is |

### How do current\_price and the market block relate?

The figures in the recording are consistent with each other. `current_price` 347.725 minus the previous close of 348.22 is -0.495, which matches `price_change` -0.49, and -0.495 ÷ 348.22 is about -0.14%, which matches `percent_change`. The `market` block is a second reading: `extracted_price` 347.2001 is about 0.15% below 347.725, matching `price_movement.percentage` 0.15 with `movement` `"Down"`. So in this recording, `summary` describes one price and `market` describes the extended-hours session against it. Check that relationship on your own symbols in the playground before you depend on it, and store both readings with the `trading` label.

### Which values need parsing?

Several key stats are display strings rather than numbers: `previous_close`, `day_range`, `year_range`, `market_cap`, `avg_volume` and `dividend_yield`. `pe_ratio` is already numeric. Strip the currency symbol and commas, and apply a `K`, `M`, `B` or `T` suffix where there is one. Keep the raw string next to the parsed value so you can audit a surprising number later.

## How do you build a watchlist loop in Python?

A watchlist loop calls `quote` once per symbol, reads the price fields, and appends one row per symbol to a CSV file with the time of the call. The script below uses Python with `requests`. It waits on a 429 or 503 using the `Retry-After` header, pauses one second between calls to stay within the free rate of 1 request a second, and reads only fields that appear in the recorded response, with `.get` so a missing field becomes an empty cell rather than a crash.

```python
import csv
import datetime
import os
import re
import time

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/google-finance/quote"
WATCHLIST = [
    {"symbol": "AAPL", "exchange": "NASDAQ"},
    {"symbol": "MSFT", "exchange": "NASDAQ"},
]

def fetch(params, attempts=3):
    for _ in range(attempts):
        r = requests.get(URL, params=params, headers={"X-API-Key": API_KEY}, timeout=60)
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json(), r.headers.get("X-Credits-Used")
    raise RuntimeError(f"gave up on {params['symbol']}")

def money(value):
    """'$348.22' -> 348.22; None when there is no number."""
    m = re.search(r"-?[\d,]*\.?\d+", value or "")
    return float(m.group().replace(",", "")) if m else None

now = datetime.datetime.now(datetime.timezone.utc).isoformat(timespec="seconds")
with open("quotes.csv", "a", newline="") as f:
    out = csv.writer(f)
    for params in WATCHLIST:
        data, credits = fetch(params)
        quote = data.get("quote", {})
        summary = quote.get("summary", {})
        market = summary.get("market", {})
        stats = quote.get("key_stats", {})
        out.writerow([
            now,
            summary.get("symbol", params["symbol"]),
            summary.get("exchange", params["exchange"]),
            summary.get("current_price"),
            summary.get("price_change"),
            summary.get("percent_change"),
            summary.get("currency"),
            market.get("trading"),
            market.get("extracted_price"),
            stats.get("previous_close"),
            money(stats.get("previous_close")),
            credits,
        ])
        time.sleep(1)
```

Each row holds the UTC time of the run, the symbol and exchange, the three summary price fields, the currency, the session label and price, the raw and parsed previous close, and the credits the call used. Run it from cron once a day after the session you care about; a paying account runs at least 5 requests a second, so you can shorten the pause for a long list.

### What should the loop do with errors?

Every error comes back with an HTTP status and a JSON body with `code`, `message` and `request_id`. `invalid_parameters` (422) means a bad value, such as a `symbol` over 20 characters, so fix the watchlist rather than retrying. `source_error` (502) is worth one retry on the next run. Requests have no idempotency key, so a client timeout can hide a call that succeeded and was billed; keep the timeout generous. The [errors docs](https://docs.perceptlayer.com/errors) list every code.

## How do you get historical and intraday prices?

`historical` takes a `symbol`, an optional `exchange`, and a window: either `start_date` and `end_date` as strings, or `range` as an integer. `interval` sets the spacing to `daily`, `weekly` or `monthly`. `intraday` takes `symbol` and `exchange` only, plus `hl` and `gl`. Neither has a recorded response here, so this guide doesn't show their fields or the date format `start_date` expects; run one call of each in the playground before you write code against them.

```bash
curl "https://api.perceptlayer.com/v1/google-finance/historical?symbol=AAPL&exchange=NASDAQ&interval=daily" \
  -H "X-API-Key: $API_KEY"

curl "https://api.perceptlayer.com/v1/google-finance/intraday?symbol=AAPL&exchange=NASDAQ" \
  -H "X-API-Key: $API_KEY"
```

A sensible split for a watchlist is one `historical` call per symbol when you add it, to backfill, and one `quote` per symbol per day after that. Poll `intraday` only where the shape of the day matters; each poll is another call.

## What does a stock price API cost per symbol per day?

The cost is 1 credit per call, so the cost per symbol per day is the number of calls you make for it each day. A daily `quote` is 1 credit per symbol per trading day. Polling `intraday` every 15 minutes over a 6-hour window is 24 calls, so 24 credits per symbol per day. Failed calls cost nothing, and a failed call followed by a successful retry costs 1 credit, not 2.

| Plan | Arithmetic | Credits a month |
| --- | --- | --- |
| 40 symbols, 1 quote a day | 40 × 21 trading days × 1 credit | 840 |
| 40 symbols, 1 quote a day, plus a one-off backfill | 840 + 40 × 1 credit | 880 |
| 200 symbols, 2 quotes a day | 200 × 2 × 21 × 1 credit | 8,400 |
| 10 symbols, intraday every 15 minutes for 6 hours | 10 × 24 × 21 × 1 credit | 5,040 |

The 100 free credits on signup that come with a verified email cover the first two trading days of the first plan. Past that, each plan needs a pack, and a month of any of them fits the Starter pack's 10,000 credits, and purchased credits last 12 months, with no subscription. When the balance runs out, calls return `insufficient_credits` (402) and nothing more is debited. See [pricing](https://perceptlayer.com/pricing) for what credits cost and the [credits docs](https://docs.perceptlayer.com/credits) for how debits work.

Speed follows the rate limit, which is per account and shared by all its keys. At the free rate of 1 request a second, 40 symbols take at least 40 seconds; the [rate limits docs](https://docs.perceptlayer.com/rate-limits) list the rate each pack includes.

## What should you check before relying on the price?

Data is collected from publicly available sources and returned as found at the time of the call. The recorded quote shows why the time matters: `market.trading` reads `"Extended Hours"`, so the same symbol can carry a regular price and a session price in one response. Store the time of each call and the `trading` label with every row, and don't treat the data as a trading feed.

If an agent needs to look up a ticker on demand, the same endpoints work through the MCP server; the [AI agents docs](https://docs.perceptlayer.com/ai-agents) show how to add it. For other search-engine sources, browse the [search engines APIs](https://perceptlayer.com/verticals/search) or the [API guides](https://perceptlayer.com/blog/category/api-guides). To start, run `quote` for your own ticker in the playground on the [Google Finance API page](https://perceptlayer.com/apis/google-finance), then [get a free API key](https://perceptlayer.com/signup) and schedule the loop.

## APIs in this post

-   [Google Finance **1 credit per call** · 6 endpoints](https://perceptlayer.com/apis/google-finance)

## Frequently asked questions

### How much does a stock price API call cost?

Each successful call to any Google Finance endpoint, including `quote`, `historical` and `intraday`, costs 1 credit. Failed calls cost nothing and return `X-Credits-Used: 0`. One quote per symbol per trading day is 1 credit per symbol per day, so a 40-symbol watchlist over 21 trading days is 840 credits. The pricing page shows what credits cost.

### Is the price real time?

The data is returned as found at the time of the call, and we make no promise about delay beyond that. The recorded AAPL quote shows `market.trading` as `"Extended Hours"` alongside `current_price`, so a response can describe more than one session. Store the call time and the `trading` label with each price, and use a licensed feed for trading decisions.

### Can I get price history for a date range?

Yes. `GET /v1/google-finance/historical` takes a required `symbol` and optional `start_date`, `end_date`, `range` and `interval`, where `interval` is one of `daily`, `weekly` or `monthly`. There's no recorded response in this guide, so check the date format and fields in the playground first. One backfill call per symbol costs 1 credit.

### How do I find the right symbol for a company?

Call `GET /v1/google-finance/search` with the company name or ticker in `q`, up to 255 characters. There's no recorded `search` response in this guide, so check in the playground which fields carry the symbol and exchange. Then pass a ticker as `symbol`, with `exchange` when it could match more than one listing, to `quote` or `historical`.

### What happens when a quote call fails?

You get an HTTP status and a JSON body with `error.code`, `error.message` and `error.request_id`, and no credits are debited. A `rate_limited` (429) or `temporarily_unavailable` (503) response carries `Retry-After` with the seconds to wait. An `invalid_parameters` (422) response means a value needs fixing, such as a `period_type` other than `quarterly` or `annual`.

stock price api stock quotes google finance python watchlist

## More from the blog

1.  [API guides](https://perceptlayer.com/blog/category/api-guides) 10 Jul 2026 Perceptlayer 8 min read
    
    ## [Google Finance API: Stock Quotes and History as JSON](https://perceptlayer.com/blog/google-finance-api-stock-quotes)
    
    Six Google Finance endpoints return quotes, history, intraday, markets and indices as JSON at 1 credit a call. Parameters, a recorded AAPL quote and costs.
    
2.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Depop API: Resale Listings as JSON](https://perceptlayer.com/blog/depop-api-json)
    
    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total\_count of 6,815,522. 1 credit.
    
3.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Similarweb API: Website Traffic Data as JSON](https://perceptlayer.com/blog/similarweb-api-json)
    
    Get Similarweb traffic estimates as JSON: visits, bounce\_rate, traffic\_sources, top\_countries and top\_keywords for a domain, at 1 credit a call.
