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 ? '股价触及涨停板,资金流入明显' : '股价正常波动,交投活跃'
};
})
},
// 最新分时数据

View File

@@ -212,4 +212,64 @@ export const companyHandlers = [
data: data.forecastReport || null
});
}),
// 14. 价值链关联公司
http.get('/api/company/value-chain/related-companies', async ({ request }) => {
await delay(300);
const url = new URL(request.url);
const nodeName = url.searchParams.get('node_name') || '';
console.log('[Mock] 获取价值链关联公司:', nodeName);
// 生成模拟的关联公司数据
const relatedCompanies = [
{
stock_code: '601318',
stock_name: '中国平安',
industry: '保险',
relation: '同业竞争',
market_cap: 9200,
change_pct: 1.25
},
{
stock_code: '600036',
stock_name: '招商银行',
industry: '银行',
relation: '核心供应商',
market_cap: 8500,
change_pct: 0.85
},
{
stock_code: '601166',
stock_name: '兴业银行',
industry: '银行',
relation: '同业竞争',
market_cap: 4200,
change_pct: -0.32
},
{
stock_code: '601398',
stock_name: '工商银行',
industry: '银行',
relation: '同业竞争',
market_cap: 15000,
change_pct: 0.15
},
{
stock_code: '601288',
stock_name: '农业银行',
industry: '银行',
relation: '同业竞争',
market_cap: 12000,
change_pct: -0.08
}
];
return HttpResponse.json({
success: true,
data: relatedCompanies,
node_name: nodeName
});
}),
];