SuperAPI AI Directory

yahoo-finance

Data & analytics

View repository

Updated 10-16 01:32

About this skill

Yahoo Finance Stock Query Skill

Use the Yahoo Finance API to query global stock market data, supporting markets such as Hong Kong stocks, A-shares, and US stocks.

Features

  1. Real-time stock quotes - Get real-time stock quotes (about 15 minutes delayed)
  2. Basic company information - Query company overview, industry, market cap, and other information
  3. Historical price data - Get historical price data (supports multiple time ranges and intervals)
  4. Search stocks - Search stocks by company name or ticker symbol

Supported markets

  • Hong Kong stocks(Hong Kong Stock Exchange)
  • A-shares(Shanghai & Shenzhen Stock Exchange)
  • US stocks(US Stock Markets)
  • Other global markets

Stock ticker format

Hong Kong stocks

  • Tencent Holdings:0700.HK
  • Alibaba:9988.HK
  • Xiaomi Group:1810.HK
  • Meituan:3690.HK
  • BYD:1211.HK

A-shares

  • Shanghai Composite Index:000001.SS
  • Kweichow Moutai:600519.SS
  • Wuliangye:000858.SZ
  • CATL:300750.SZ

US stocks

  • Apple:AAPL
  • Tesla:TSLA
  • Microsoft:MSFT

Usage

1. Query real-time stock quotes

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs quote 0700.HK

2. Query basic company information

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs profile 9988.HK

3. Get historical price data

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs history 0700.HK --range 1mo --interval 1d

4. Search stocks

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs search "Tencent"

Parameter description

Historical data range (--range)

  • 1d - 1 day
  • 5d - 5 days
  • 1mo - 1 month
  • 3mo - 3 months
  • 6mo - 6 months
  • 1y - 1 year
  • 2y - 2 years
  • 5y - 5 years
  • 10y - 10 years
  • ytd - Year to date
  • max - Maximum range

Data interval (--interval)

  • 1m, 2m, 5m, 15m, 30m, 60m, 90m - Minute level
  • 1h - Hourly
  • 1d - Daily
  • 5d - 5-day
  • 1wk - Weekly
  • 1mo - Monthly
  • 3mo - Quarterly

Examples

Query Tencent stock price

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs quote 0700.HK

Output:

📈 0700.HK 实时报价:

交易所:   HKSE
货币:     HKD
当前价格: HKD 385.60
开盘价:   HKD 382.00
最高价:   HKD 388.20
最低价:   HKD 380.40
前收盘:   HKD 383.00
涨跌额:   HKD 2.60
涨跌幅:   0.68%
成交量:   25,432,100

Query Alibaba company information

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs profile 9988.HK

Get Xiaomi's daily candlestick chart for the last 3 months

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs history 1810.HK --range 3mo --interval 1d

Search BYD

node ~/.openclaw/workspace-stock/yahoo-finance/scripts/query.mjs search "BYD"

Module import usage

Import and use in other scripts:

import { fetchQuote, fetchProfile, fetchHistory, fetchSearch } from '../yahoo-finance/scripts/query.mjs';

// 查询腾讯股价
const quote = await fetchQuote('0700.HK');
console.log(quote.regularMarketPrice);

// 查询公司信息
const profile = await fetchProfile('9988.HK');
console.log(profile.longName);

// 获取历史数据
const history = await fetchHistory('1810.HK', '1mo', '1d');
console.log(history.close);

// 搜索股票
const results = await fetchSearch('Tencent');
console.log(results.quotes);

Notes

  1. Data delay: Yahoo Finance free data usually has a delay of about 15 minutes
  2. Request frequency: Although there is no explicit request limit, reasonable use is recommended to avoid overly frequent requests
  3. Data accuracy: Data is for reference only and does not constitute investment advice
  4. API stability: Yahoo Finance is an unofficial API and may change

Technical details

  • Uses Node.js native https module
  • RESTful API calls
  • JSON format output
  • Supports both command-line and module import usage
  • Completely free, no API Key required