{"record":{"id":"a3cb48245b9aa960","repo":"jackwener/OpenCLI","slug":"xueqiu-stock","errorCode":null,"errorMessage":"xueqiu/stock","messagePattern":"xueqiu/stock","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/stock.js","lineNumber":37,"sourceCode":"    description: '获取雪球股票实时行情',\n    domain: 'xueqiu.com',\n    browser: true,\n    args: [\n        {\n            name: 'symbol',\n            required: true,\n            positional: true,\n            help: '股票代码，如 SH600519、SZ000858、AAPL、00700',\n        },\n    ],\n    columns: ['name', 'symbol', 'price', 'changePercent', 'marketCap'],\n    func: async (page, kwargs) => {\n        await page.goto('https://xueqiu.com');\n        const symbol = String(kwargs.symbol).toUpperCase();\n        const url = `https://stock.xueqiu.com/v5/stock/batch/quote.json?symbol=${encodeURIComponent(symbol)}`;\n        const d = await fetchXueqiuJson(page, url);\n        if (!d.data?.items?.length)\n            throw new EmptyResultError('xueqiu/stock', '请确认股票代码是否正确: ' + symbol);\n        const item = d.data.items[0];\n        const q = item.quote || {};\n        const m = item.market || {};\n        return [{\n                name: q.name,\n                symbol: q.symbol,\n                exchange: q.exchange,\n                currency: q.currency,\n                price: q.current,\n                change: q.chg,\n                changePercent: q.percent != null ? q.percent.toFixed(2) + '%' : null,\n                open: q.open,\n                high: q.high,\n                low: q.low,\n                prevClose: q.last_close,\n                amplitude: q.amplitude != null ? q.amplitude.toFixed(2) + '%' : null,\n                volume: q.volume,\n                amount: fmtAmount(q.amount),","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/stock.js#L19-L55","documentation":"The xueqiu stock command fetches a quote via stock.xueqiu.com/v5/stock/batch/quote.json for the given symbol. If the response has no data.items entries, it throws EmptyResultError('xueqiu/stock', ...) asking the user to confirm the symbol. Like kline, this means the session was valid but xueqiu returned no matching quote.","triggerScenarios":"Passing a symbol that doesn't resolve on xueqiu (missing market prefix, typo, delisted), or an otherwise valid-looking code the batch quote endpoint doesn't cover.","commonSituations":"Bare numeric codes without SH/SZ/HK prefixes; old or delisted tickers; US/HK symbols formatted differently than xueqiu expects; copy-paste errors in ticker strings.","solutions":["Verify the symbol on xueqiu.com and use xueqiu's exact format (e.g. SH600519, SZ000001, HK00700)","Check the error detail message which echoes the symbol that failed","Confirm the security is still listed/tradeable on xueqiu","Test the symbol against the kline command; if it also fails, the symbol is wrong"],"exampleFix":"// before\nstock --symbol AAPL\n// after\nstock --symbol SH600519   // use xueqiu's expected prefixed format","handlingStrategy":"validation","validationCode":"const symbol = String(kwargs.symbol || '').toUpperCase().trim();\nif (!symbol) {\n  throw new Error('symbol is required for the xueqiu stock command (e.g. SH600519)');\n}\nif (!/^(SH|SZ|HK|US)?[0-9A-Za-z.]{4,10}$/.test(symbol)) {\n  throw new Error(`Suspicious xueqiu symbol format: '${symbol}'`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const q = await xueqiuStock({ symbol: 'SH600519' });\n} catch (e) {\n  if (/EmptyResultError|xueqiu\\/stock/.test(e.message)) {\n    console.error(`Quote not found — verify the symbol on xueqiu.com: ${e.message}`);\n  } else throw e;\n}","preventionTips":["Use xueqiu's canonical prefixed tickers (SH600519, SZ000001, HK00700)","Validate/normalize symbols (uppercase, trim) before calling the command","Verify new symbols manually on xueqiu.com before adding them to automated lists","Handle EmptyResultError separately from auth errors so bad symbols don't trigger pointless re-logins"],"tags":["empty-result","xueqiu","validation","symbol"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}