Stock Price Query Skill 实时股票行情与大盘指数查询技能,覆盖 A 股(沪深两市) 、 港股 、 美股 三大市场。支持 单只查询 和 批量查询 (一次查询多只股票对比),轻量无依赖,无需 API Key,适合聊天场景下的快速股价查询——秒级获取当前价格、涨跌幅、开高低收、成交量等行情数据。 Real-time stock quote and market index tool covering A-shares, Hong Kong, and US stocks. Supports batch queries for comparing multiple stocks in one call. Quick chat-friendly price checks with zero dependencies and no API key needed. Overview 实时股票价格查询技能,支持查询 A 股(沪深两市)、港股和美股的实时行情数据。通过调用免费公开的行情 API 获取数据,返回结构化的股票信息。 When to Use 当用户的请求涉及以下场景时触发此技能: - 查询股价:"茅台多少钱"、"查一下宁德时代" - 了解涨跌:"腾讯今天涨了吗"、"00700 行情" - 股票代码查询:"600519"、"NVDA price" - 多只对比:"比亚迪…

)\n# 市场标识白名单\nVALID_MARKETS = {\"sh\", \"sz\", \"hk\", \"us\"}\n\n# 港股指数代码集合(纯字母但属于港股,需特殊处理避免误判为美股)\nHK_INDEX_CODES = {\"HSI\", \"HSCEI\", \"HSTECH\", \"HSCCI\", \"HSCEI\"}\n# 美股指数代码集合(以 . 开头)\nUS_INDEX_CODES = {\".IXIC\", \".DJI\", \".INX\"}\n\n\ndef validate_input(code: str, market: str | None) -> str | None:\n \"\"\"校验输入参数,防止注入攻击。返回 None 表示合法,否则返回错误信息。\"\"\"\n if not VALID_CODE_PATTERN.match(code):\n return (\n f\"非法的股票代码 '{code}'。\"\n \"股票代码仅允许字母和数字,长度 1-10 位。\"\n )\n if market is not None and market not in VALID_MARKETS:\n return (\n f\"非法的市场标识 '{market}'。\"\n f\"仅支持: {', '.join(sorted(VALID_MARKETS))}。\"\n )\n return None\n\n\ndef detect_market(code: str) -> str:\n \"\"\"根据股票代码自动识别市场\"\"\"\n code = code.strip().upper()\n\n # 已带市场前缀\n if code.startswith(\"SH\"):\n return \"sh\"\n if code.startswith(\"SZ\"):\n return \"sz\"\n if code.startswith(\"HK\"):\n return \"hk\"\n\n # 美股指数(以 . 开头,如 .IXIC .DJI .INX)\n if code.startswith(\".\"):\n return \"us\"\n\n # 港股指数(纯字母但属于港股,如 HSI HSCEI)\n if code in HK_INDEX_CODES:\n return \"hk\"\n\n # 纯英文字母 -> 美股\n if re.match(r'^[A-Z]{1,5}

Stock Price Query Skill 实时股票行情与大盘指数查询技能,覆盖 A 股(沪深两市) 、 港股 、 美股 三大市场。支持 单只查询 和 批量查询 (一次查询多只股票对比),轻量无依赖,无需 API Key,适合聊天场景下的快速股价查询——秒级获取当前价格、涨跌幅、开高低收、成交量等行情数据。 Real-time stock quote and market index tool covering A-shares, Hong Kong, and US stocks. Supports batch queries for comparing multiple stocks in one call. Quick chat-friendly price checks with zero dependencies and no API key needed. Overview 实时股票价格查询技能,支持查询 A 股(沪深两市)、港股和美股的实时行情数据。通过调用免费公开的行情 API 获取数据,返回结构化的股票信息。 When to Use 当用户的请求涉及以下场景时触发此技能: - 查询股价:"茅台多少钱"、"查一下宁德时代" - 了解涨跌:"腾讯今天涨了吗"、"00700 行情" - 股票代码查询:"600519"、"NVDA price" - 多只对比:"比亚迪…

, code):\n return \"us\"\n\n # 纯数字判断\n digits = re.sub(r'[^0-9]', '', code)\n if len(digits) == 6:\n if digits.startswith('6'):\n return \"sh\"\n elif digits.startswith(('0', '3')):\n return \"sz\"\n else:\n return \"sh\"\n elif 1 \u003c= len(digits) \u003c= 5:\n return \"hk\"\n\n return \"unknown\"\n\n\ndef clean_code(code: str) -> str:\n \"\"\"清理股票代码,去除市场前缀\"\"\"\n code = code.strip().upper()\n for prefix in [\"SH\", \"SZ\", \"HK\"]:\n if code.startswith(prefix):\n return code[len(prefix):]\n return code\n\n\ndef build_tencent_symbol(code: str, market: str) -> str:\n \"\"\"构建腾讯财经 API 的股票符号\"\"\"\n code = clean_code(code)\n if market == \"sh\":\n return f\"sh{code}\"\n elif market == \"sz\":\n return f\"sz{code}\"\n elif market == \"hk\":\n # 港股指数(纯字母如 HSI、HSCEI)不需要补零\n if code.upper() in HK_INDEX_CODES:\n return f\"hk{code.upper()}\"\n return f\"hk{code.zfill(5)}\"\n elif market == \"us\":\n return f\"us{code.upper()}\"\n return code\n\n\ndef parse_stock(raw: str, code: str, market: str) -> dict:\n \"\"\"解析腾讯财经 API 返回的行情数据(各市场格式统一)\n\n 通用字段索引:\n [1]: 名称\n [2]: 代码\n [3]: 当前价格\n [4]: 昨收\n [5]: 今开\n [6]: 成交量(手/股)\n [30]: 时间\n [31]: 涨跌额\n [32]: 涨跌幅(%)\n [33]: 最高\n [34]: 最低\n [37]: 成交额\n \"\"\"\n parts = raw.split(\"~\")\n if len(parts) \u003c 35:\n return {\"status\": \"error\", \"message\": \"数据解析失败,返回数据不完整\"}\n\n name = parts[1].strip()\n if not name:\n return {\n \"status\": \"error\",\n \"message\": f\"未找到股票 {clean_code(code)},请检查代码是否正确\",\n }\n\n current_price = float(parts[3]) if parts[3] else 0\n prev_close = float(parts[4]) if parts[4] else 0\n open_price = float(parts[5]) if parts[5] else 0\n volume_raw = parts[6].strip() if parts[6] else \"0\"\n volume = int(float(volume_raw))\n\n time_str = parts[30].strip() if len(parts) > 30 and parts[30] else \"\"\n change = float(parts[31]) if len(parts) > 31 and parts[31] else 0\n change_pct = float(parts[32]) if len(parts) > 32 and parts[32] else 0\n high = float(parts[33]) if len(parts) > 33 and parts[33] else 0\n low = float(parts[34]) if len(parts) > 34 and parts[34] else 0\n amount_raw = parts[37].strip() if len(parts) > 37 and parts[37] else \"0\"\n amount = float(amount_raw) if amount_raw else 0\n\n # A 股成交量单位为手(1 手 = 100 股),成交额单位为万元\n if market in (\"sh\", \"sz\"):\n volume = volume * 100\n amount = amount * 10000\n\n display_code = clean_code(code)\n if market == \"hk\":\n # 港股指数不补零\n if display_code.upper() not in HK_INDEX_CODES:\n display_code = display_code.zfill(5)\n else:\n display_code = display_code.upper()\n elif market == \"us\":\n display_code = display_code.upper()\n\n # 扩展字段:市盈率 [39]、总市值 [45](部分市场可用)\n pe_ratio = None\n market_cap = None\n if len(parts) > 39 and parts[39].strip():\n try:\n pe_ratio = round(float(parts[39]), 2)\n except (ValueError, IndexError):\n pass\n if len(parts) > 45 and parts[45].strip():\n try:\n market_cap = round(float(parts[45]), 2)\n except (ValueError, IndexError):\n pass\n\n result = {\n \"code\": display_code,\n \"name\": name,\n \"market\": market,\n \"current_price\": current_price,\n \"change\": change,\n \"change_percent\": change_pct,\n \"open\": open_price,\n \"high\": high,\n \"low\": low,\n \"prev_close\": prev_close,\n \"volume\": volume,\n \"amount\": amount,\n \"time\": time_str,\n \"status\": \"success\",\n }\n if pe_ratio is not None:\n result[\"pe_ratio\"] = pe_ratio\n if market_cap is not None:\n result[\"market_cap\"] = market_cap\n return result\n\n\ndef fetch_stock(code: str, market: str, retry: bool = True) -> dict:\n \"\"\"获取股票实时行情\"\"\"\n symbol = build_tencent_symbol(code, market)\n url = f\"https://qt.gtimg.cn/q={symbol}\"\n\n try:\n req = urllib.request.Request(url)\n with urllib.request.urlopen(req, timeout=10) as resp:\n raw = resp.read().decode(\"gbk\", errors=\"ignore\")\n\n # 检查返回数据是否为空\n if '=\"\"' in raw or not raw.strip():\n return {\n \"status\": \"error\",\n \"message\": f\"未找到股票 {clean_code(code)},请检查代码是否正确\",\n }\n\n return parse_stock(raw, code, market)\n\n except urllib.error.HTTPError as e:\n if e.code == 429 and retry:\n time.sleep(1)\n return fetch_stock(code, market, retry=False)\n return {\"status\": \"error\", \"message\": f\"HTTP 请求失败: {e.code} {e.reason}\"}\n except urllib.error.URLError as e:\n return {\"status\": \"error\", \"message\": f\"网络请求失败: {str(e.reason)}\"}\n except Exception as e:\n return {\"status\": \"error\", \"message\": f\"查询异常: {str(e)}\"}\n\n\ndef fetch_batch(codes: list[str]) -> list[dict]:\n \"\"\"批量获取多只股票的实时行情(单次 HTTP 请求)\"\"\"\n # 为每只股票识别市场并构建符号\n code_market_pairs = []\n symbol_list = []\n for code in codes:\n market = detect_market(code)\n code_market_pairs.append((code, market))\n if market != \"unknown\":\n symbol_list.append(build_tencent_symbol(code, market))\n else:\n symbol_list.append(None)\n\n # 过滤有效符号,构建批量请求 URL\n valid_symbols = [s for s in symbol_list if s is not None]\n if not valid_symbols:\n return [\n {\n \"status\": \"error\",\n \"code\": c,\n \"message\": \"无法识别该股票代码,请确认后重试。\"\n \"支持 A 股(6 位数字)、港股(5 位数字)、美股(英文字母)。\",\n }\n for c, _ in code_market_pairs\n ]\n\n url = f\"https://qt.gtimg.cn/q={','.join(valid_symbols)}\"\n\n try:\n req = urllib.request.Request(url)\n with urllib.request.urlopen(req, timeout=15) as resp:\n raw = resp.read().decode(\"gbk\", errors=\"ignore\")\n except urllib.error.HTTPError as e:\n return [{\"status\": \"error\", \"message\": f\"HTTP 请求失败: {e.code} {e.reason}\"}]\n except urllib.error.URLError as e:\n return [{\"status\": \"error\", \"message\": f\"网络请求失败: {str(e.reason)}\"}]\n except Exception as e:\n return [{\"status\": \"error\", \"message\": f\"查询异常: {str(e)}\"}]\n\n # 解析响应:按 v_\u003csymbol>=\"data\" 格式提取每只股票的数据\n # 响应格式: v_sh600519=\"1~贵州茅台~...\"; v_usAAPL=\"200~苹果~...\";\n response_map = {}\n for match in re.finditer(r'v_([a-zA-Z0-9.]+)=\"([^\"]*)\"', raw):\n resp_symbol = match.group(1)\n resp_data = match.group(2)\n response_map[resp_symbol.lower()] = resp_data\n\n # 按原始输入顺序,用 symbol 从 response_map 中取对应数据\n results = []\n for i, (code, market) in enumerate(code_market_pairs):\n if market == \"unknown\":\n results.append({\n \"status\": \"error\",\n \"code\": clean_code(code),\n \"message\": f\"无法识别股票代码 {code},请确认后重试。\",\n })\n continue\n\n symbol = symbol_list[i]\n resp_data = response_map.get(symbol.lower()) if symbol else None\n\n if resp_data is None or not resp_data.strip():\n results.append({\n \"status\": \"error\",\n \"code\": clean_code(code),\n \"message\": f\"未找到股票 {clean_code(code)},请检查代码是否正确\",\n })\n else:\n results.append(parse_stock(resp_data, code, market))\n\n return results\n\n\ndef main():\n if len(sys.argv) >= 2 and sys.argv[1] in (\"--version\", \"-V\"):\n print(f\"stock_query.py {VERSION}\")\n sys.exit(0)\n\n if len(sys.argv) \u003c 2:\n print(json.dumps(\n {\"status\": \"error\", \"message\": \"用法: python3 stock_query.py \u003cstock_code> [market]\\n\"\n \"批量: python3 stock_query.py \u003ccode1,code2,code3>\"},\n ensure_ascii=False,\n ))\n sys.exit(1)\n\n raw_input = sys.argv[1].strip()\n\n # 判断是否为批量查询(包含逗号)\n if \",\" in raw_input:\n codes = [c.strip() for c in raw_input.split(\",\") if c.strip()]\n if len(codes) > 20:\n print(json.dumps(\n {\"status\": \"error\", \"message\": \"批量查询最多支持 20 只股票\"},\n ensure_ascii=False,\n ))\n sys.exit(1)\n\n # 逐个校验每个代码\n for c in codes:\n validation_error = validate_input(c, None)\n if validation_error:\n print(json.dumps(\n {\"status\": \"error\", \"message\": f\"股票代码 '{c}' 校验失败: {validation_error}\"},\n ensure_ascii=False,\n ))\n sys.exit(1)\n\n results = fetch_batch(codes)\n print(json.dumps(results, ensure_ascii=False, indent=2))\n\n # 如果全部失败则退出码 1\n if all(r.get(\"status\") != \"success\" for r in results):\n sys.exit(1)\n else:\n # 单只查询(保持原有逻辑)\n code = raw_input\n market = sys.argv[2].strip().lower() if len(sys.argv) > 2 else None\n\n # 输入安全校验:仅允许字母、数字和白名单市场标识\n validation_error = validate_input(code, market)\n if validation_error:\n print(json.dumps(\n {\"status\": \"error\", \"message\": validation_error},\n ensure_ascii=False,\n ))\n sys.exit(1)\n\n if not market:\n market = detect_market(code)\n\n if market == \"unknown\":\n print(json.dumps(\n {\n \"status\": \"error\",\n \"message\": \"无法识别该股票代码,请确认后重试。\"\n \"支持 A 股(6 位数字)、港股(5 位数字)、美股(英文字母)。\",\n },\n ensure_ascii=False,\n ))\n sys.exit(1)\n\n result = fetch_stock(code, market)\n print(json.dumps(result, ensure_ascii=False, indent=2))\n\n if result.get(\"status\") != \"success\":\n sys.exit(1)\n\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":13340,"content_sha256":"44ed8d8617cc15ab1bc5378980c37e56037425b369051ff5784bf6a43cc30273"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Stock Price Query Skill","type":"text"}]},{"type":"paragraph","content":[{"text":"实时股票行情与大盘指数查询技能,覆盖 ","type":"text"},{"text":"A 股(沪深两市)","type":"text","marks":[{"type":"strong"}]},{"text":"、","type":"text"},{"text":"港股","type":"text","marks":[{"type":"strong"}]},{"text":"、","type":"text"},{"text":"美股","type":"text","marks":[{"type":"strong"}]},{"text":"三大市场。支持","type":"text"},{"text":"单只查询","type":"text","marks":[{"type":"strong"}]},{"text":"和","type":"text"},{"text":"批量查询","type":"text","marks":[{"type":"strong"}]},{"text":"(一次查询多只股票对比),轻量无依赖,无需 API Key,适合聊天场景下的快速股价查询——秒级获取当前价格、涨跌幅、开高低收、成交量等行情数据。","type":"text"}]},{"type":"paragraph","content":[{"text":"Real-time stock quote and market index tool covering A-shares, Hong Kong, and US stocks. Supports batch queries for comparing multiple stocks in one call. Quick chat-friendly price checks with zero dependencies and no API key needed.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Overview","type":"text"}]},{"type":"paragraph","content":[{"text":"实时股票价格查询技能,支持查询 A 股(沪深两市)、港股和美股的实时行情数据。通过调用免费公开的行情 API 获取数据,返回结构化的股票信息。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"paragraph","content":[{"text":"当用户的请求涉及以下场景时触发此技能:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"查询股价:\"茅台多少钱\"、\"查一下宁德时代\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"了解涨跌:\"腾讯今天涨了吗\"、\"00700 行情\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"股票代码查询:\"600519\"、\"NVDA price\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"多只对比:\"比亚迪和英伟达的股价\"、\"帮我看下茅台、腾讯和苹果\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"批量查询:\"查一下这几只:600519, 00700, AAPL\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"大盘指数:\"上证指数多少\"、\"大盘怎么样\"、\"恒指行情\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"关键词触发:\"查股票\"、\"股票行情\"、\"stock price\"","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"How to Use","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"查询流程","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"解析用户输入","type":"text","marks":[{"type":"strong"}]},{"text":":从用户消息中提取股票代码。如果用户提供的是中文名称,需先根据下方映射表将名称转换为股票代码(脚本仅接受股票代码作为输入)。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"识别市场","type":"text","marks":[{"type":"strong"}]},{"text":":根据股票代码格式自动识别所属市场:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"A 股沪市:以 ","type":"text"},{"text":"sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" 开头或 6 位数字以 6 开头(如 ","type":"text"},{"text":"sh600519","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"600519","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"A 股深市:以 ","type":"text"},{"text":"sz","type":"text","marks":[{"type":"code_inline"}]},{"text":" 开头或 6 位数字以 0/3 开头(如 ","type":"text"},{"text":"sz000001","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"300750","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"港股:以 ","type":"text"},{"text":"hk","type":"text","marks":[{"type":"code_inline"}]},{"text":" 开头或纯数字 5 位及以下(如 ","type":"text"},{"text":"hk00700","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"00700","type":"text","marks":[{"type":"code_inline"}]},{"text":"),港股指数为纯字母代码(如 ","type":"text"},{"text":"HSI","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"HSCEI","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"美股:纯英文字母代码(如 ","type":"text"},{"text":"AAPL","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"TSLA","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"GOOGL","type":"text","marks":[{"type":"code_inline"}]},{"text":"),美股指数以 ","type":"text"},{"text":".","type":"text","marks":[{"type":"code_inline"}]},{"text":" 开头(如 ","type":"text"},{"text":".IXIC","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".DJI","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".INX","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"执行查询脚本","type":"text","marks":[{"type":"strong"}]},{"text":":运行 ","type":"text"},{"text":"scripts/stock_query.py","type":"text","marks":[{"type":"code_inline"}]},{"text":" 获取实时数据。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"格式化输出","type":"text","marks":[{"type":"strong"}]},{"text":":将结果以清晰友好的格式展示给用户。","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"脚本调用方式","type":"text"}]},{"type":"paragraph","content":[{"text":"单只查询:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 {{SKILL_DIR}}/scripts/stock_query.py \u003cstock_code> [market]","type":"text"}]},{"type":"paragraph","content":[{"text":"批量查询(推荐用于多只对比):","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 {{SKILL_DIR}}/scripts/stock_query.py \u003ccode1,code2,code3>","type":"text"}]},{"type":"paragraph","content":[{"text":"参数说明:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"stock_code","type":"text","marks":[{"type":"code_inline"}]},{"text":"(必需):股票代码,如 ","type":"text"},{"text":"600519","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"AAPL","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"00700","type":"text","marks":[{"type":"code_inline"}]},{"text":"。批量查询时用逗号分隔,最多 20 只。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"market","type":"text","marks":[{"type":"code_inline"}]},{"text":"(可选):市场标识,可选值为 ","type":"text"},{"text":"sh","type":"text","marks":[{"type":"code_inline"}]},{"text":"(沪市)、","type":"text"},{"text":"sz","type":"text","marks":[{"type":"code_inline"}]},{"text":"(深市)、","type":"text"},{"text":"hk","type":"text","marks":[{"type":"code_inline"}]},{"text":"(港股)、","type":"text"},{"text":"us","type":"text","marks":[{"type":"code_inline"}]},{"text":"(美股)。不提供时脚本会自动识别。批量查询时不需要此参数(自动识别各只股票的市场)。","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"单只查询输出格式","type":"text","marks":[{"type":"strong"}]},{"text":":JSON 对象(","type":"text"},{"text":"pe_ratio","type":"text","marks":[{"type":"code_inline"}]},{"text":" 和 ","type":"text"},{"text":"market_cap","type":"text","marks":[{"type":"code_inline"}]},{"text":" 在数据源可用时返回):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"code\": \"600519\",\n \"name\": \"贵州茅台\",\n \"market\": \"sh\",\n \"current_price\": 1688.00,\n \"change\": 12.50,\n \"change_percent\": 0.75,\n \"open\": 1680.00,\n \"high\": 1695.00,\n \"low\": 1675.00,\n \"prev_close\": 1675.50,\n \"volume\": 2345678,\n \"amount\": 3956789012.50,\n \"time\": \"2026-02-24 15:00:00\",\n \"pe_ratio\": 28.35,\n \"market_cap\": 2120000000000.00,\n \"status\": \"success\"\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"批量查询输出格式","type":"text","marks":[{"type":"strong"}]},{"text":":JSON 数组,每只股票一个对象:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"[\n { \"code\": \"600519\", \"name\": \"贵州茅台\", \"market\": \"sh\", \"current_price\": 1688.00, \"change\": 12.50, \"change_percent\": 0.75, \"status\": \"success\", ... },\n { \"code\": \"00700\", \"name\": \"腾讯控股\", \"market\": \"hk\", \"current_price\": 420.60, \"change\": 5.20, \"change_percent\": 1.25, \"status\": \"success\", ... },\n { \"code\": \"AAPL\", \"name\": \"APPLE\", \"market\": \"us\", \"current_price\": 178.50, \"change\": -1.30, \"change_percent\": -0.72, \"status\": \"success\", ... }\n]","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"常见股票名称与代码映射(供 agent 参考)","type":"text"}]},{"type":"paragraph","content":[{"text":"脚本仅接受股票代码作为输入,不支持中文名称。当用户提供股票名称时,agent 应先根据下表将名称转换为对应代码后再调用脚本:","type":"text"}]},{"type":"paragraph","content":[{"text":"大盘指数:","type":"text","marks":[{"type":"strong"}]}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"名称","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"代码","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"市场","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"上证指数/大盘","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"000001","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"深证成指","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"399001","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"创业板指","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"399006","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"恒生指数/恒指","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HSI","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"国企指数/H股指数","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HSCEI","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"纳斯达克/纳指","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".IXIC","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"道琼斯/道指","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".DJI","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"标普500","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":".INX","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"热门个股:","type":"text","marks":[{"type":"strong"}]}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"名称","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"代码","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"市场","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"贵州茅台","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"600519","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"中国平安","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"601318","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"招商银行","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"600036","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"工商银行","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"601398","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"中国石油","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"601857","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sh","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"比亚迪","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"002594","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"宁德时代","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"300750","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"五粮液","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"000858","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"美的集团","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"000333","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sz","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"腾讯控股","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"00700","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"阿里巴巴","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"09988","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"美团","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"03690","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"小米集团","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"01810","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"京东","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"09618","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"hk","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"苹果/Apple","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"AAPL","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"特斯拉/Tesla","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"TSLA","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"英伟达/NVIDIA","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"NVDA","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"微软/Microsoft","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"MSFT","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"谷歌/Google","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"GOOGL","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"亚马逊/Amazon","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"AMZN","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Meta/Facebook","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"META","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"us","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"对于不在映射表中的股票名称,提示用户提供准确的股票代码。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"输出格式要求","type":"text"}]},{"type":"paragraph","content":[{"text":"单只查询","type":"text","marks":[{"type":"strong"}]},{"text":":查询成功后,以如下紧凑格式展示结果(不要使用表格,避免消息过长导致飞书分页):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"📈 **{股票名称}**({股票代码}.{市场})\n\n💰 当前价格:{current_price} 元/港元/美元 | 📊 涨跌幅:{change} ({change_percent}%) ↑/↓\n📅 行情时间:{time}\n📊 今开 {open} | 最高 {high} | 最低 {low} | 昨收 {prev_close}\n📦 成交量:{volume} | 成交额:{amount}\n📐 市盈率:{pe_ratio} | 总市值:{market_cap}(如有)","type":"text"}]},{"type":"paragraph","content":[{"text":"批量查询","type":"text","marks":[{"type":"strong"}]},{"text":":多只股票依次展示,每只之间空一行:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"📈 **贵州茅台**(600519.SH)\n💰 1688.00 元 | 🟢 +12.50 (+0.75%) ↑\n\n📈 **腾讯控股**(00700.HK)\n💰 420.60 港元 | 🟢 +5.20 (+1.25%) ↑\n\n📈 **APPLE**(AAPL.US)\n💰 178.50 美元 | 🔴 -1.30 (-0.72%) ↓","type":"text"}]},{"type":"paragraph","content":[{"text":"涨跌幅为正时使用 🟢 和 ↑,为负时使用 🔴 和 ↓。成交额如果超过 1 亿,用\"亿\"为单位显示(保留两位小数);超过 1 万不足 1 亿,用\"万\"为单位显示。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Edge Cases","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"输入安全校验","type":"text","marks":[{"type":"strong"}]},{"text":":脚本在执行前会严格校验所有输入参数。","type":"text"},{"text":"stock_code","type":"text","marks":[{"type":"code_inline"}]},{"text":" 仅允许字母、数字和前导点号(正则 ","type":"text"},{"text":"^\\.?[A-Za-z0-9]{1,10}$","type":"text","marks":[{"type":"code_inline"}]},{"text":",前导点号用于支持美股指数代码如 ","type":"text"},{"text":".IXIC","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".DJI","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":".INX","type":"text","marks":[{"type":"code_inline"}]},{"text":"),","type":"text"},{"text":"market","type":"text","marks":[{"type":"code_inline"}]},{"text":" 仅允许白名单值(","type":"text"},{"text":"sh","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"sz","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"hk","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"us","type":"text","marks":[{"type":"code_inline"}]},{"text":")。任何包含特殊字符、shell 元字符或超长输入都会被拒绝,防止命令注入。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"批量查询数量限制","type":"text","marks":[{"type":"strong"}]},{"text":":一次最多查询 20 只股票,超出时返回错误提示。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"批量查询部分失败","type":"text","marks":[{"type":"strong"}]},{"text":":批量查询中如果部分股票代码无效,有效的股票仍正常返回结果,无效的会在对应位置返回错误信息。agent 应正常展示成功的结果,对失败的提示用户。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"股票代码无效","type":"text","marks":[{"type":"strong"}]},{"text":":返回 \"无法识别该股票代码,请确认后重试。支持 A 股(6 位数字)、港股(5 位数字)、美股(英文字母)。\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"网络请求失败","type":"text","marks":[{"type":"strong"}]},{"text":":返回 \"网络请求失败,请稍后重试。\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"非交易时段","type":"text","marks":[{"type":"strong"}]},{"text":":正常返回最近的收盘数据,并提示 \"当前为非交易时段,显示的是最近一次的收盘数据。\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"股票名称模糊","type":"text","marks":[{"type":"strong"}]},{"text":":脚本不支持名称输入。如果用户提供的名称无法在映射表中匹配,agent 应提示用户提供准确的股票代码。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"API 限流","type":"text","marks":[{"type":"strong"}]},{"text":":如遇到限流,等待 1 秒后重试一次,仍失败则提示用户稍后再试。","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"stock-price-query","author":"@skillopedia","source":{"stars":2,"repo_name":"stock-price-query","origin_url":"https://github.com/tjefferson/stock-price-query/blob/HEAD/SKILL.md","repo_owner":"tjefferson","body_sha256":"8f14b619d625f4f1ad8b96cfa0547b821fe68be7e988dd48bc83bb7275000a7a","cluster_key":"d5f90218dd36450c5932be1f4b13753009a996af50ee7087268c278a261c252d","clean_bundle":{"format":"clean-skill-bundle-v1","source":"tjefferson/stock-price-query/SKILL.md","attachments":[{"id":"7ada9a31-b127-5929-9bcb-6fcab8c6ba95","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/7ada9a31-b127-5929-9bcb-6fcab8c6ba95/attachment.md","path":"CHANGELOG.md","size":3602,"sha256":"e1396b83e820df549d7c4e3608ab33eddb26b71d334125071127a3b63c8ddeb6","contentType":"text/markdown; charset=utf-8"},{"id":"cc2794a4-ccd3-5ba1-a8c7-cfc05989df48","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/cc2794a4-ccd3-5ba1-a8c7-cfc05989df48/attachment.md","path":"README.md","size":3905,"sha256":"a08216b859ea115eecc0ba893bbd72458d2e9a1e01536f45877d20afcbc382a7","contentType":"text/markdown; charset=utf-8"},{"id":"6dd4d5d7-a0c8-5ca1-b61b-2d1b524557ed","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/6dd4d5d7-a0c8-5ca1-b61b-2d1b524557ed/attachment.md","path":"references/api-docs.md","size":2361,"sha256":"65255792a114e82222f559305d4fd9367151c19ad6aab237163285dedf72783a","contentType":"text/markdown; charset=utf-8"},{"id":"18f553ff-ba67-586e-8cb5-9974dc7cc7eb","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/18f553ff-ba67-586e-8cb5-9974dc7cc7eb/attachment.py","path":"scripts/stock_query.py","size":13340,"sha256":"44ed8d8617cc15ab1bc5378980c37e56037425b369051ff5784bf6a43cc30273","contentType":"text/x-python; charset=utf-8"}],"bundle_sha256":"27cb0625c866c2652886d1c00084edf36bee95d66e2e6e4636e9c36cec27240b","attachment_count":4,"text_attachments":4,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"finance-legal-compliance","category_label":"Finance"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"finance-legal-compliance","metadata":{"openclaw":{"tags":["stock","stock-price","A-shares","Hong-Kong","US-stocks","finance","market-index","股票","港股","美股"],"emoji":"📈","requires":{"bins":["python3"]}}},"import_tag":"clean-skills-v1","description":"实时股票行情查询,支持 A 股、港股、美股及大盘指数,支持批量查询。无需 API Key。Real-time stock & index quotes for A-shares, HK & US markets. Batch supported."}},"renderedAt":1782981704407}

Stock Price Query Skill 实时股票行情与大盘指数查询技能,覆盖 A 股(沪深两市) 、 港股 、 美股 三大市场。支持 单只查询 和 批量查询 (一次查询多只股票对比),轻量无依赖,无需 API Key,适合聊天场景下的快速股价查询——秒级获取当前价格、涨跌幅、开高低收、成交量等行情数据。 Real-time stock quote and market index tool covering A-shares, Hong Kong, and US stocks. Supports batch queries for comparing multiple stocks in one call. Quick chat-friendly price checks with zero dependencies and no API key needed. Overview 实时股票价格查询技能,支持查询 A 股(沪深两市)、港股和美股的实时行情数据。通过调用免费公开的行情 API 获取数据,返回结构化的股票信息。 When to Use 当用户的请求涉及以下场景时触发此技能: - 查询股价:"茅台多少钱"、"查一下宁德时代" - 了解涨跌:"腾讯今天涨了吗"、"00700 行情" - 股票代码查询:"600519"、"NVDA price" - 多只对比:"比亚迪…