← 返回
数据分析 中文

Stock Quote

Fetch real-time stock prices and fundamental data. Use when: (1) User asks for current stock price or quote, (2) Need to update portfolio holdings with lates...
获取实时股价和基本面数据。使用场景:(1) 用户询问当前股价或报价,(2) 需要用最新数据更新投资组合持仓
linux2010
数据分析 clawhub v1.1.0 2 版本 99860.9 Key: 无需
★ 0
Stars
📥 718
下载
💾 36
安装
2
版本
#latest

概述

Stock Quote Skill

Real-time stock price and fundamental data retrieval skill.

Quick Start

# Single stock (uses Stooq - free, no key)
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA

# Multiple stocks
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA TSLA BABA ORCL

# JSON output (for programmatic use)
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA TSLA --json

# Force specific data source
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA --source yfinance
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA --source stooq
python ~/.openclaw/skills/stock-quote/scripts/quote.py NVDA --source fmp

Output Fields

FieldDescription
--------------------
priceCurrent market price
changePrice change from previous close
change_percentPercentage change
previous_closePrevious trading day's close
day_high / day_lowToday's trading range
volumeTrading volume
market_capMarket capitalization
pe_ratioTrailing P/E ratio
week_52_high / week_52_low52-week range
dividend_yieldDividend yield (if applicable)

Data Sources

SourcePriorityAPI KeyCoverageNotes
--------------------------------------------
Stooq1st (auto)❌ NoUS stocksFree, delayed EOD prices
yfinance2nd❌ NoGlobalRate limited (~2000/day)
FMP3rd⚠️ DemoGlobalLimited demo data
Web4th❌ NoYahoo onlyHTML scraping

Auto mode (default): Stooq → yfinance → FMP → Web scrape

Integration Examples

Update Portfolio Holdings

from skills.stock_quote.scripts.quote import fetch_yfinance_data

# Fetch current prices for all holdings
holdings = ['NVDA', 'TSLA', 'BABA', 'ORCL', 'UNH', 'AAL', 'AMZN']
quotes = fetch_yfinance_data(holdings)

# Calculate current portfolio value
total_value = sum(quote['price'] * shares for symbol, quote in quotes.items() 
                  if 'price' in quote and quote['price'])

Check Trading Rules Compliance

# Check PE ratio rule (PE > 35 blocked)
quote = fetch_yfinance_data(['NVDA'])['NVDA']
if quote.get('pe_ratio', 0) > 35:
    print("⚠️ PE ratio exceeds 35 - rule violation")

# Check 52-week percentile (above 70% blocked)
if quote.get('price') and quote.get('week_52_high') and quote.get('week_52_low'):
    percentile = (quote['price'] - quote['week_52_low']) / \
                 (quote['week_52_high'] - quote['week_52_low'])
    if percentile > 0.70:
        print("⚠️ Price above 70th percentile of 52-week range")

Daily Heartbeat Update

Add to HEARTBEAT.md:

- Fetch current prices for all holdings (NVDA, TSLA, BABA, ORCL, UNH, AAL, AMZN)
- Update MEMORY.md position table with latest market values
- Check if any position within 5% of stop loss
- Alert if TSLA approaches $385.90 stop loss

Error Handling

  • Network failures → Returns error field with message
  • Invalid symbol → Returns error: "No data found"
  • Market closed → Returns last traded price with timestamp

Always check for 'error' field in results before using price data.

Dependencies

# Primary (recommended)
pip install yfinance

# Fallback (if yfinance unavailable)
pip install requests

Usage with Other Skills

  • stock-advisor: Provides price data for analysis
  • trading-supervisor: Validates prices against trading rules
  • elite-memory: Updates portfolio valuations in MEMORY.md

Example Output

📈 NVDA: $176.46 +2.34 (+1.35%)
   市值:$4.32T
   PE: 68.45
   52 周:$108.13 - $185.50 (当前位置:73.2%)

📉 TSLA: $398.68 -5.12 (-1.27%)
   市值:$1.28T
   PE: 95.23
   52 周:$206.50 - $479.86 (当前位置:41.5%)

版本历史

共 2 个版本

  • v1.1.0 当前
    2026-05-03 04:02 安全 安全
  • v1.0.0
    2026-03-29 22:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,582
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,086
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,167