Google Finance API
从 Google Finance 获取实时市场数据、价格摘要和相关财经新闻。设置 engine=google_finance,并在 q 中传入股票代码(例如 GOOG:NASDAQ)。
Endpoint
Section titled “Endpoint” GET https://serp.shifter.io/v1?engine=google_finance&api_key=YOUR_API_KEY
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | 您的 SERP API 密钥 |
engine | string | yes | 必须为 google_finance |
q | string | yes | 带交易所的股票代码,例如 GOOG:NASDAQ |
device | string | no | desktop、mobile 或 tablet |
hl | string | no | 界面语言代码 |
Example request
Section titled “Example request”curl "https://serp.shifter.io/v1?engine=google_finance&api_key=YOUR_API_KEY&q=GOOG:NASDAQ"import requests
params = { "engine": "google_finance", "api_key": "YOUR_API_KEY", "q": "GOOG:NASDAQ",}r = requests.get("https://serp.shifter.io/v1", params=params)data = r.json()import fetch from 'node-fetch';
const url = 'https://serp.shifter.io/v1?' + new URLSearchParams({ engine: 'google_finance', api_key: 'YOUR_API_KEY', q: 'GOOG:NASDAQ',});const data = await (await fetch(url)).json();Example response
Section titled “Example response”{ "search_parameters": { "engine": "google_finance", "q": "GOOG:NASDAQ" }, "summary": { "title": "Alphabet Inc Class C", "stock": "GOOG", "exchange": "NASDAQ", "price": "$142.65", "currency": "USD", "extracted_price": 142.65, "price_movement": { "percentage": 1.23, "movement": "Up" } }, "graph": [ { "price": 141.12, "currency": "USD", "date": "Jan 1, 2024" } ], "news_results": [ { "title": "Alphabet posts strong earnings", "source": "Reuters" } ]}