feat: 添加mock数据

This commit is contained in:
zdl
2025-12-09 11:34:07 +08:00
parent da2007386e
commit c704b12bce
2 changed files with 76 additions and 10 deletions

View File

@@ -111,18 +111,24 @@ export const generateMarketData = (stockCode) => {
}
},
// 涨停分析
// 涨停分析 - 返回数组格式,每个元素对应一个交易日
riseAnalysisData: {
success: true,
data: {
is_limit_up: false,
limit_up_price: basePrice * 1.10,
current_price: basePrice,
distance_to_limit: 8.92, // %
consecutive_days: 0,
reason: '',
concept_tags: ['银行', '深圳国资', 'MSCI', '沪深300']
}
data: Array(30).fill(null).map((_, i) => {
const tradeDate = new Date(Date.now() - (29 - i) * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
const isLimitUp = Math.random() < 0.05; // 5%概率涨停
return {
trade_date: tradeDate,
is_limit_up: isLimitUp,
limit_up_price: (basePrice * 1.10).toFixed(2),
current_price: (basePrice + (Math.random() - 0.5) * 0.5).toFixed(2),
distance_to_limit: (Math.random() * 10).toFixed(2), // %
consecutive_days: isLimitUp ? Math.floor(Math.random() * 3) + 1 : 0,
reason: isLimitUp ? '业绩超预期' : '',
concept_tags: ['银行', '深圳国资', 'MSCI', '沪深300'],
analysis: isLimitUp ? '股价触及涨停板,资金流入明显' : '股价正常波动,交投活跃'
};
})
},
// 最新分时数据