/** * 探针脚本(第三轮): * - 中证官网 index-perf 完整字段结构(确认是否含市盈率字段) * - 蛋卷 pe_percentile 的统计窗口确认 * 用法:node dev_test_scripts/debug/debug_dip_eval_sources3.js */ const axios = require('axios') const UA = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36' } ;(async () => { // 中证官网:打印最新一条记录的完整字段 try { const res = await axios.get('https://www.csindex.com.cn/csindex-home/perf/index-perf?indexCode=000300&startDate=20260701&endDate=20260804', { timeout: 15000, headers: { ...UA, 'Referer': 'https://www.csindex.com.cn/' }, validateStatus: () => true }) const d = res.data && res.data.data if (Array.isArray(d) && d.length) { const last = d[d.length - 1] console.log('[中证官网 000300 最新记录全字段]') console.log(JSON.stringify(last, null, 2)) console.log('\n字段列表:', Object.keys(last).join(', ')) } else { console.log('[中证官网] 无数据', JSON.stringify(res.data).slice(0, 300)) } } catch (e) { console.log('[中证官网] 异常:', e.message) } // 蛋卷:SH000300 完整字段 try { const res = await axios.get('https://danjuanfunds.com/djapi/index_eva/dj', { timeout: 15000, headers: UA, validateStatus: () => true }) const items = (res.data && res.data.data && res.data.data.items) || [] const t = items.find(i => i.index_code === 'SH000300') if (t) { console.log('\n[蛋卷 SH000300 全字段]') console.log(JSON.stringify(t, null, 2)) console.log('ts 对应北京时间:', new Date(t.ts + 8 * 3600 * 1000).toISOString().replace('T', ' ').slice(0, 19)) console.log('begin_at 对应北京时间:', new Date(t.begin_at + 8 * 3600 * 1000).toISOString().replace('T', ' ').slice(0, 19)) } } catch (e) { console.log('[蛋卷] 异常:', e.message) } })()