fix(mock): 市场热力图添加涨停/跌停股票模拟数据
- 添加 8 只涨停股票(9.9%~10.05%) - 添加 2 只跌停股票(-9.9%~-10.05%) - 使用真实股票名称池增强模拟效果 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -294,7 +294,41 @@ export const marketHandlers = [
|
||||
let risingCount = 0;
|
||||
let fallingCount = 0;
|
||||
|
||||
// 先添加主要股票
|
||||
// 涨停股票名称池(模拟真实市场)
|
||||
const limitUpNames = ['东方财富', '科大讯飞', '中科曙光', '寒武纪', '金山办公', '同花顺', '三六零', '紫光股份'];
|
||||
const limitDownNames = ['某ST股A', '某ST股B'];
|
||||
|
||||
// 先添加一些涨停股票(10%)
|
||||
for (let i = 0; i < 8; i++) {
|
||||
const changePercent = parseFloat((9.9 + Math.random() * 0.15).toFixed(2)); // 9.9% ~ 10.05%(涨停)
|
||||
risingCount++;
|
||||
heatmapData.push({
|
||||
stock_code: `00${3000 + i}`,
|
||||
stock_name: limitUpNames[i] || `涨停股${i}`,
|
||||
market_cap: parseFloat((Math.random() * 300 + 50).toFixed(2)),
|
||||
change_percent: changePercent,
|
||||
amount: parseFloat((Math.random() * 30 + 5).toFixed(2)),
|
||||
industry: industries[Math.floor(Math.random() * industries.length)],
|
||||
province: provinces[Math.floor(Math.random() * provinces.length)]
|
||||
});
|
||||
}
|
||||
|
||||
// 添加一些跌停股票(-10%)
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const changePercent = parseFloat((-9.9 - Math.random() * 0.15).toFixed(2)); // -10.05% ~ -9.9%(跌停)
|
||||
fallingCount++;
|
||||
heatmapData.push({
|
||||
stock_code: `00${2000 + i}`,
|
||||
stock_name: limitDownNames[i] || `跌停股${i}`,
|
||||
market_cap: parseFloat((Math.random() * 50 + 10).toFixed(2)),
|
||||
change_percent: changePercent,
|
||||
amount: parseFloat((Math.random() * 5 + 0.5).toFixed(2)),
|
||||
industry: industries[Math.floor(Math.random() * industries.length)],
|
||||
province: provinces[Math.floor(Math.random() * provinces.length)]
|
||||
});
|
||||
}
|
||||
|
||||
// 添加主要股票
|
||||
majorStocks.forEach(stock => {
|
||||
const changePercent = parseFloat((Math.random() * 12 - 4).toFixed(2)); // -4% ~ 8%
|
||||
const amount = parseFloat((Math.random() * 100 + 10).toFixed(2)); // 10-110亿
|
||||
|
||||
Reference in New Issue
Block a user