feat: 新增外部因素分析模块+综合评分引擎+算法文档重构
新增模块: - fund_flow_analyzer.py: 主力资金流向分析(P0, ±20) - market_sentiment.py: 市场情绪指标(P1, ±10) - external_factors.py: 北向资金/美股/大宗商品/汇率(P2-P4,P7) - news_analyzer.py: 公告/并购/政策面LLM分析(P5-P6) - score_engine.py: 综合评分引擎,整合技术面+外部因素 路由更新: - analysis.py: deep_analyze接入综合评分,根据最终评级修正买卖建议 - market.py: 新增4个外部因素API端点 - trades.py: 交易路由更新 算法文档重构: - 章节重排: 技术面(二三)→外部因素(四)→买卖决策(五)→数据源(六)→性能(七) - 架构图更新为五层,标注章节对应 - 5.1/5.2标注纯技术面,5.3整合外部因素修正推荐
This commit is contained in:
@@ -1530,3 +1530,352 @@
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ============ 个股深析页面 ============ */
|
||||
.deep-analysis-page { padding: 0 4px; box-sizing: border-box; max-width: 100%; overflow-x: hidden; }
|
||||
|
||||
.deep-input-card {
|
||||
background: var(--card-bg, #1e1e2e);
|
||||
border-radius: 12px;
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.deep-input-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.deep-code-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid rgba(255,255,255,0.15);
|
||||
border-radius: 8px;
|
||||
background: rgba(0,0,0,0.2);
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
letter-spacing: 1px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.deep-code-input::placeholder { color: rgba(255,255,255,0.3); }
|
||||
.deep-analyze-btn {
|
||||
padding: 10px 16px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: #2196F3;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.deep-analyze-btn:disabled { opacity: 0.5; }
|
||||
|
||||
.deep-report { display: flex; flex-direction: column; gap: 10px; max-width: 100%; overflow-x: hidden; }
|
||||
|
||||
.deep-header-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: var(--card-bg, #1e1e2e);
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
.deep-stock-name { font-size: 18px; font-weight: 700; color: #fff; }
|
||||
.deep-stock-code { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }
|
||||
.deep-price { font-size: 22px; font-weight: 700; color: #fff; text-align: center; }
|
||||
.deep-change { font-size: 14px; text-align: center; margin-top: 2px; }
|
||||
.deep-change.up { color: #f44336; }
|
||||
.deep-change.down { color: #4caf50; }
|
||||
|
||||
.deep-score-circle {
|
||||
width: 50px; height: 50px; border-radius: 50%;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
margin: 0 auto;
|
||||
font-weight: 700;
|
||||
}
|
||||
.score-num { font-size: 20px; color: #fff; }
|
||||
.deep-score-circle.score-high { background: linear-gradient(135deg, #f44336, #ff5722); }
|
||||
.deep-score-circle.score-mid { background: linear-gradient(135deg, #ff9800, #ffc107); }
|
||||
.deep-score-circle.score-low { background: linear-gradient(135deg, #607d8b, #78909c); }
|
||||
.deep-verdict { text-align: center; font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 4px; }
|
||||
|
||||
.deep-section {
|
||||
background: var(--card-bg, #1e1e2e);
|
||||
border-radius: 12px;
|
||||
padding: 12px 14px;
|
||||
}
|
||||
.deep-section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: rgba(255,255,255,0.5);
|
||||
margin-bottom: 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.deep-recommend-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.deep-recommend-bar.rec-buy { background: rgba(244,67,54,0.15); }
|
||||
.deep-recommend-bar.rec-watch { background: rgba(33,150,243,0.12); }
|
||||
.deep-recommend-bar.rec-sell { background: rgba(76,175,80,0.15); }
|
||||
.rec-display {
|
||||
font-size: 16px; font-weight: 700; color: #fff;
|
||||
background: rgba(255,255,255,0.1);
|
||||
padding: 2px 10px; border-radius: 4px;
|
||||
}
|
||||
.rec-rate { font-size: 14px; color: rgba(255,255,255,0.6); }
|
||||
.rec-reason-text { font-size: 13px; color: rgba(255,255,255,0.7); }
|
||||
|
||||
.deep-signal-list { display: flex; flex-direction: column; gap: 6px; }
|
||||
.deep-signal-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 10px;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border-radius: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.deep-sig-name { font-weight: 600; color: #ff9800; font-size: 13px; }
|
||||
.deep-sig-strength {
|
||||
font-size: 11px;
|
||||
background: rgba(255,152,0,0.2);
|
||||
color: #ffb74d;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.deep-sig-desc { font-size: 12px; color: rgba(255,255,255,0.5); }
|
||||
|
||||
.deep-position-grid { display: flex; flex-direction: column; gap: 8px; }
|
||||
.deep-pos-item {
|
||||
display: grid;
|
||||
grid-template-columns: 36px 1fr 1fr 80px;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.pos-label { font-weight: 600; color: rgba(255,255,255,0.5); }
|
||||
.pos-range { color: rgba(255,255,255,0.4); font-size: 11px; }
|
||||
.pos-bar-wrap { display: flex; align-items: center; gap: 4px; }
|
||||
.pos-bar-bg { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
|
||||
.pos-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
|
||||
.pos-bar-fill.high { background: #f44336; }
|
||||
.pos-bar-fill.mid { background: #ff9800; }
|
||||
.pos-bar-fill.low { background: #4caf50; }
|
||||
.pos-pct { font-size: 11px; color: rgba(255,255,255,0.5); min-width: 28px; }
|
||||
.pos-space { display: flex; gap: 6px; font-size: 11px; }
|
||||
.space-up { color: #f44336; }
|
||||
.space-down { color: #4caf50; }
|
||||
|
||||
.deep-sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
||||
.sr-col-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.08); }
|
||||
.support-title { color: #4caf50; }
|
||||
.resist-title { color: #f44336; }
|
||||
.sr-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 4px 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
.sr-item.support .sr-level { color: #4caf50; font-weight: 600; }
|
||||
.sr-item.resist .sr-level { color: #f44336; font-weight: 600; }
|
||||
.sr-name { color: rgba(255,255,255,0.5); }
|
||||
.sr-empty { color: rgba(255,255,255,0.2); font-size: 12px; text-align: center; padding: 8px; }
|
||||
|
||||
.deep-vol-info { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
|
||||
.vol-tag {
|
||||
font-size: 13px; font-weight: 600;
|
||||
padding: 2px 10px; border-radius: 4px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: rgba(255,255,255,0.7);
|
||||
}
|
||||
.vol-tag.vol-up { background: rgba(244,67,54,0.15); color: #f44336; }
|
||||
.vol-tag.vol-dn { background: rgba(76,175,80,0.15); color: #4caf50; }
|
||||
.vol-detail { font-size: 12px; color: rgba(255,255,255,0.4); }
|
||||
|
||||
.deep-patterns { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.pattern-tag {
|
||||
font-size: 12px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
background: rgba(255,255,255,0.06);
|
||||
color: rgba(255,255,255,0.6);
|
||||
}
|
||||
.pattern-tag.bullish { background: rgba(244,67,54,0.12); color: #ef9a9a; }
|
||||
.pattern-tag.bearish { background: rgba(76,175,80,0.12); color: #a5d6a7; }
|
||||
.pattern-tag small { opacity: 0.7; }
|
||||
|
||||
.deep-ma-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.ma-trend-tag {
|
||||
font-size: 12px; font-weight: 600;
|
||||
padding: 2px 8px; border-radius: 4px;
|
||||
}
|
||||
.ma-trend-tag.bullish { background: rgba(244,67,54,0.15); color: #f44336; }
|
||||
.ma-trend-tag.bearish { background: rgba(76,175,80,0.15); color: #4caf50; }
|
||||
.ma-trend-tag.mixed { background: rgba(255,152,0,0.15); color: #ff9800; }
|
||||
.ma-val { font-size: 12px; color: rgba(255,255,255,0.4); }
|
||||
|
||||
.deep-fundamental {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
font-size: 12px;
|
||||
color: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
.deep-score-details { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.score-reason-tag {
|
||||
font-size: 12px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.score-reason-tag.positive { background: rgba(244,67,54,0.12); color: #ef9a9a; }
|
||||
.score-reason-tag.negative { background: rgba(76,175,80,0.12); color: #a5d6a7; }
|
||||
|
||||
/* AI通俗解说 */
|
||||
.deep-ai-summary {
|
||||
background: linear-gradient(135deg, rgba(33,150,243,0.08), rgba(156,39,176,0.06));
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
border-left: 3px solid #2196F3;
|
||||
}
|
||||
.deep-ai-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #64b5f6;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.deep-ai-text {
|
||||
font-size: 14px;
|
||||
line-height: 1.75;
|
||||
color: rgba(255,255,255,0.85);
|
||||
}
|
||||
.deep-ai-text p {
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
.deep-ai-text p:last-child { margin-bottom: 0; }
|
||||
.ai-action-tip {
|
||||
margin-top: 10px;
|
||||
padding: 10px 12px;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
color: rgba(255,255,255,0.7);
|
||||
}
|
||||
.ai-action-label {
|
||||
font-weight: 600;
|
||||
color: #ff9800;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.deep-section { box-sizing: border-box; overflow: hidden; }
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.deep-pos-item { grid-template-columns: 32px 1fr 80px; }
|
||||
.pos-range { display: none; }
|
||||
.deep-header-card { flex-wrap: wrap; gap: 8px; }
|
||||
.deep-section { padding: 10px 12px; }
|
||||
.deep-recommend-bar { padding: 8px 10px; }
|
||||
.deep-sr-grid { grid-template-columns: 1fr; gap: 8px; }
|
||||
.deep-ma-info { gap: 4px; }
|
||||
.ma-val { font-size: 11px; }
|
||||
}
|
||||
|
||||
/* ============ 买入分析页面 ============ */
|
||||
.buy-analysis-page { padding: 0 4px; }
|
||||
.buy-analysis-header {
|
||||
background: var(--card-bg, #1e1e2e);
|
||||
border-radius: 12px;
|
||||
padding: 14px;
|
||||
margin-bottom: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
.buy-analysis-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.buy-analysis-desc {
|
||||
font-size: 12px;
|
||||
color: rgba(255,255,255,0.4);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.buy-analysis-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
.buy-analysis-card {
|
||||
background: var(--card-bg, #1e1e2e);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.buy-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 14px;
|
||||
cursor: pointer;
|
||||
gap: 8px;
|
||||
}
|
||||
.buy-card-header:active { background: rgba(255,255,255,0.03); }
|
||||
.buy-card-left { flex: 1; min-width: 0; }
|
||||
.buy-card-name { font-size: 14px; font-weight: 600; color: #fff; }
|
||||
.buy-card-code { font-size: 11px; color: rgba(255,255,255,0.4); margin-left: 6px; }
|
||||
.buy-card-center { text-align: center; min-width: 70px; }
|
||||
.buy-card-price { font-size: 14px; font-weight: 600; color: #fff; }
|
||||
.buy-card-change { font-size: 12px; display: block; }
|
||||
.buy-card-change.up { color: #f44336; }
|
||||
.buy-card-change.down { color: #4caf50; }
|
||||
.buy-card-right { text-align: center; min-width: 50px; }
|
||||
.buy-card-score {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
}
|
||||
.buy-card-score.score-high { color: #f44336; }
|
||||
.buy-card-score.score-mid { color: #ff9800; }
|
||||
.buy-card-score.score-low { color: #78909c; }
|
||||
.buy-card-verdict { font-size: 11px; color: rgba(255,255,255,0.5); }
|
||||
.buy-card-arrow {
|
||||
font-size: 14px;
|
||||
color: rgba(255,255,255,0.3);
|
||||
transition: transform 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.buy-card-arrow.expanded { transform: rotate(90deg); }
|
||||
.buy-card-detail {
|
||||
padding: 0 14px 14px;
|
||||
border-top: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
.buy-detail-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
|
||||
.buy-detail-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
font-size: 13px;
|
||||
gap: 8px;
|
||||
}
|
||||
.buy-detail-label {
|
||||
color: rgba(255,255,255,0.4);
|
||||
flex-shrink: 0;
|
||||
min-width: 60px;
|
||||
}
|
||||
.buy-detail-value {
|
||||
color: rgba(255,255,255,0.8);
|
||||
text-align: right;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@@ -92,10 +92,24 @@
|
||||
scanSummaryCollapsed: false,
|
||||
fullScanSignalDist: [],
|
||||
|
||||
// 找牛股
|
||||
bullStocksData: null, // { stages: {1:[...], 2:[...]}, summary: {}, stage_info: [...] }
|
||||
// 找牛股(保留兼容)
|
||||
bullStocksData: null,
|
||||
bullStocksLoading: false,
|
||||
bullActiveStage: 2, // 默认显示阶段2=龙抬头(最佳买点)
|
||||
bullActiveStage: 2,
|
||||
|
||||
// 个股深析
|
||||
deepCode: '',
|
||||
deepReport: null,
|
||||
deepLoading: false,
|
||||
|
||||
// 模型页子tab
|
||||
modelSubTab: 'system',
|
||||
|
||||
// 买入分析
|
||||
buyAnalysisList: [],
|
||||
buyAnalysisLoading: false,
|
||||
buyAnalysisProgress: 0,
|
||||
buyAnalysisTotal: 0,
|
||||
|
||||
// 交易记录页面
|
||||
trades: [],
|
||||
@@ -2239,7 +2253,7 @@
|
||||
params: holding ? { holdingStocks: holding } : {}
|
||||
});
|
||||
if (resp.data.success) {
|
||||
this.bullStocksData = resp.data; // { stages, summary, total, stage_info }
|
||||
this.bullStocksData = resp.data;
|
||||
} else {
|
||||
this.showToast(resp.data.error || '获取牛股数据失败', 'error');
|
||||
}
|
||||
@@ -2251,6 +2265,75 @@
|
||||
}
|
||||
},
|
||||
|
||||
async fetchDeepAnalysis() {
|
||||
const code = (this.deepCode || '').trim();
|
||||
if (!code || code.length < 6) {
|
||||
this.showToast('请输入6位股票代码', 'error');
|
||||
return;
|
||||
}
|
||||
this.deepLoading = true;
|
||||
this.deepReport = null;
|
||||
try {
|
||||
const resp = await axios.post('/api/deep_analyze', { stock_code: code });
|
||||
if (resp.data.success) {
|
||||
this.deepReport = resp.data.report;
|
||||
} else {
|
||||
this.showToast(resp.data.error || '分析失败', 'error');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('深度分析失败:', err);
|
||||
this.showToast('深度分析失败: ' + (err.response?.data?.error || err.message), 'error');
|
||||
} finally {
|
||||
this.deepLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
async fetchBuyAnalysis() {
|
||||
if (this.buyAnalysisLoading) return;
|
||||
this.buyAnalysisLoading = true;
|
||||
this.buyAnalysisList = [];
|
||||
this.buyAnalysisProgress = 0;
|
||||
try {
|
||||
const scanResp = await axios.get('/api/scan_results', {
|
||||
params: { per_page: 200, recommend_text: '买入' }
|
||||
});
|
||||
if (!scanResp.data.success) {
|
||||
this.showToast('获取买入推荐失败', 'error');
|
||||
return;
|
||||
}
|
||||
const buyStocks = scanResp.data.results || [];
|
||||
this.buyAnalysisTotal = buyStocks.length;
|
||||
if (buyStocks.length === 0) {
|
||||
this.showToast('当前无买入推荐股票', 'info');
|
||||
return;
|
||||
}
|
||||
const results = [];
|
||||
for (let i = 0; i < buyStocks.length; i++) {
|
||||
this.buyAnalysisProgress = i + 1;
|
||||
try {
|
||||
const resp = await axios.post('/api/deep_analyze', {
|
||||
stock_code: buyStocks[i].code,
|
||||
skip_llm: true
|
||||
});
|
||||
if (resp.data.success) {
|
||||
const report = resp.data.report;
|
||||
report._expanded = false;
|
||||
results.push(report);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('分析失败:', buyStocks[i].code, e.message);
|
||||
}
|
||||
}
|
||||
results.sort((a, b) => b.deep_score - a.deep_score);
|
||||
this.buyAnalysisList = results;
|
||||
} catch (err) {
|
||||
console.error('买入分析失败:', err);
|
||||
this.showToast('买入分析失败: ' + (err.message || '未知错误'), 'error');
|
||||
} finally {
|
||||
this.buyAnalysisLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
getBullStageStocks(stageNum) {
|
||||
if (!this.bullStocksData || !this.bullStocksData.stages) return [];
|
||||
return this.bullStocksData.stages[String(stageNum)] || [];
|
||||
|
||||
Reference in New Issue
Block a user