{"record":{"id":"ffe857dc72ea6ab1","repo":"jackwener/OpenCLI","slug":"xueqiu-earnings-date","errorCode":null,"errorMessage":"xueqiu/earnings-date","messagePattern":"xueqiu/earnings-date","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xueqiu/earnings-date.js","lineNumber":28,"sourceCode":"    browser: true,\n    args: [\n        {\n            name: 'symbol',\n            required: true,\n            positional: true,\n            help: '股票代码，如 SH600519、SZ000858、00700',\n        },\n        { name: 'next', type: 'bool', default: false, help: '仅返回最近一次未发布的财报日期' },\n        { name: 'limit', type: 'int', default: 10, help: '返回数量，默认 10' },\n    ],\n    columns: ['date', 'report', 'status'],\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/screener/event/list.json?symbol=${encodeURIComponent(symbol)}&page=1&size=100`;\n        const d = await fetchXueqiuJson(page, url);\n        if (!d.data?.items)\n            throw new EmptyResultError('xueqiu/earnings-date', '请确认股票代码是否正确: ' + symbol);\n        // subtype 2 = 预计财报发布\n        const now = Date.now();\n        let results = d.data.items\n            .filter((item) => item.subtype === 2)\n            .map((item) => {\n            const ts = item.timestamp;\n            const dateStr = ts ? formatChinaDate(ts) : null;\n            const isFuture = ts && ts > now;\n            return { date: dateStr, report: item.message, status: isFuture ? '⏳ 未发布' : '✅ 已发布', _ts: ts, _future: isFuture };\n        });\n        if (kwargs.next) {\n            const future = results.filter((r) => r._future).sort((a, b) => a._ts - b._ts);\n            results = future.length ? [future[0]] : [];\n        }\n        return results.slice(0, kwargs.limit).map(({ date, report, status }) => ({ date, report, status }));\n    },\n});\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/earnings-date.js#L10-L46","documentation":"The xueqiu earnings-date command fetches xueqiu's screener event list for a symbol and throws EmptyResultError('xueqiu/earnings-date', ...) when the response has no d.data.items array. This means xueqiu returned a payload without event items — usually because the symbol has no earnings-date records or the symbol/query is wrong.","triggerScenarios":"Calling the earnings-date command for a symbol where the list.json response lacks data.items: misspelled or delisted symbol, a symbol with no scheduled/reported earnings events, or an API response shaped differently (auth/anti-bot interstitial yielding a different JSON).","commonSituations":"Querying OTC or illiquid tickers xueqiu doesn't cover, wrong market code format, symbol typos, or xueqiu cookies expired so the API returns an error object instead of data.","solutions":["Verify the symbol is correct and formatted per xueqiu conventions (e.g. SH600519, AAPL, 00700).","Check the stock on xueqiu.com to confirm it exists and has earnings events.","Refresh xueqiu cookies (log in) if the API is returning non-data payloads.","Treat it as 'no data available' if the stock genuinely has no earnings-date records."],"exampleFix":"// before\nclis/xueqiu earnings-date SH60051   # typo — EmptyResultError\n// after\nclis/xueqiu earnings-date SH600519","handlingStrategy":"try-catch","validationCode":"// validate the symbol before calling\nconst PATTERN = /^(?:[A-Z]{2}\\d{5,6}|\\d{4,6}|[A-Z]{1,5}(?:[.-][A-Z]{1,2})?)$/;\nif (!PATTERN.test(symbol.toUpperCase())) throw new Error(`bad symbol: ${symbol}`);","typeGuard":null,"tryCatchPattern":"try {\n  const dates = await getEarningsDate(symbol);\n} catch (err) {\n  if (/xueqiu\\/earnings-date/.test(err.message)) {\n    // treat as 'no earnings data for this symbol'; fall back to empty list\n  } else throw err;\n}","preventionTips":["Verify symbols exist on xueqiu.com before querying.","Keep xueqiu cookies fresh so the API returns data payloads, not error objects.","Handle 'no data' as an expected outcome for illiquid/delisted tickers."],"tags":["empty-result","xueqiu","data-source"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}