You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

575 lines
24 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI期货分析系统 - 多品种分析面板</title>
<link href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #f0f2f5;
color: #333;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
border-radius: 12px;
margin-bottom: 30px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.header h1 {
font-size: 28px;
font-weight: 600;
margin-bottom: 10px;
}
.header p {
font-size: 16px;
opacity: 0.9;
}
.section {
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
margin-bottom: 30px;
}
.section-title {
font-size: 20px;
font-weight: 600;
color: #333;
margin-bottom: 20px;
display: flex;
align-items: center;
justify-content: space-between;
}
.search-container {
margin-bottom: 20px;
}
.search-input {
width: 100%;
padding: 12px 16px;
border: 1px solid #d9d9d9;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: all 0.3s ease;
}
.search-input:focus {
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.panel-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.symbol-card {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
position: relative;
}
.symbol-card:hover {
transform: translateY(-5px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.symbol-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.symbol-name {
font-size: 18px;
font-weight: 600;
color: #333;
}
.symbol-code {
font-size: 14px;
color: #999;
margin-top: 4px;
}
.price-info {
text-align: right;
}
.current-price {
font-size: 24px;
font-weight: 700;
color: #333;
}
.direction-indicator {
display: inline-block;
padding: 4px 12px;
border-radius: 16px;
font-size: 12px;
font-weight: 500;
margin-top: 8px;
}
.direction-up {
background-color: #f6ffed;
color: #52c41a;
border: 1px solid #b7eb8f;
}
.direction-down {
background-color: #fff2f0;
color: #ff4d4f;
border: 1px solid #ffccc7;
}
.direction-sideways {
background-color: #f0f5ff;
color: #1890ff;
border: 1px solid #adc6ff;
}
.analysis-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-top: 20px;
}
.analysis-item {
background-color: #f9fafb;
padding: 12px;
border-radius: 8px;
}
.analysis-label {
font-size: 12px;
color: #666;
margin-bottom: 4px;
}
.analysis-value {
font-size: 14px;
font-weight: 500;
color: #333;
}
.win-rate {
color: #1890ff;
}
.rollover-warning {
color: #fa8c16;
}
.fund-flow {
color: #52c41a;
}
.hot-section {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 20px;
margin-top: 20px;
}
.hot-subsection {
background: #f9fafb;
border-radius: 8px;
padding: 16px;
}
.hot-subsection-title {
font-size: 16px;
font-weight: 600;
color: #333;
margin-bottom: 12px;
}
.favorite-btn {
position: absolute;
top: 8px;
right: 8px;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
font-size: 12px;
color: #999;
}
.favorite-btn:hover {
background-color: rgba(255, 77, 79, 0.1);
color: #ff4d4f;
}
.favorite-btn.favorite {
background-color: rgba(255, 77, 79, 0.1);
color: #ff4d4f;
}
.footer {
text-align: center;
padding: 20px;
color: #999;
font-size: 14px;
margin-top: 40px;
}
@media (max-width: 768px) {
.panel-grid {
grid-template-columns: 1fr;
}
.analysis-grid {
grid-template-columns: 1fr;
}
.hot-section {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<!-- 头部 -->
<div class="header">
<h1>AI期货分析系统</h1>
<p>基于DeepSeek大模型和量化分析算法的智能决策平台</p>
</div>
{% if data_unavailable %}
<div style="text-align: center; padding: 60px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);">
<div style="font-size: 48px; margin-bottom: 20px;">⚠️</div>
<h2 style="font-size: 24px; font-weight: 600; color: #333; margin-bottom: 16px;">数据不可用</h2>
<p style="font-size: 16px; color: #666; margin-bottom: 32px;">{{ message }}</p>
<div style="display: flex; justify-content: center; gap: 16px;">
<a href="/" style="padding: 10px 24px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; text-decoration: none; border-radius: 6px; font-size: 14px; font-weight: 500;">重试</a>
<a href="javascript:location.reload()" style="padding: 10px 24px; background: #f0f0f0; color: #333; text-decoration: none; border-radius: 6px; font-size: 14px; font-weight: 500;">刷新</a>
</div>
</div>
{% else %}
<!-- 自选关注模块 -->
<div class="section">
<div class="section-title">
自选关注
<span style="font-size: 14px; font-weight: 400; color: #666;">{{ selected_symbols_data | length }} 个品种</span>
</div>
{% if selected_symbols_data %}
<div class="panel-grid">
{% for symbol_data in selected_symbols_data %}
<div class="symbol-card" onclick="window.location.href='/symbol/{{ symbol_data.symbol }}'">
<div class="favorite-btn favorite" onclick="event.stopPropagation(); removeFromFavorite('{{ symbol_data.symbol }}');"></div>
<div class="symbol-header">
<div>
<div class="symbol-name">{{ symbol_data.name }}</div>
<div class="symbol-code">{{ symbol_data.symbol }}</div>
</div>
<div class="price-info">
<div class="current-price">{{ symbol_data.current_price }}</div>
<div class="direction-indicator
{% if symbol_data.direction == 'bullish' or symbol_data.direction == 'strong_bullish' or symbol_data.direction == 'weak_bullish' %}direction-up{% elif symbol_data.direction == 'bearish' or symbol_data.direction == 'strong_bearish' or symbol_data.direction == 'weak_bearish' %}direction-down{% else %}direction-sideways{% endif %}">
{% if symbol_data.direction == 'strong_bullish' %}强多头
{% elif symbol_data.direction == 'strong_bearish' %}强空头
{% elif symbol_data.direction == 'weak_bullish' %}弱多头
{% elif symbol_data.direction == 'weak_bearish' %}弱空头
{% elif symbol_data.direction == 'bullish' %}多头
{% elif symbol_data.direction == 'bearish' %}空头
{% elif symbol_data.direction == 'neutral' %}中性
{% else %}{{ symbol_data.direction | capitalize }}
{% endif %}
</div>
</div>
</div>
<div class="analysis-grid">
<div class="analysis-item">
<div class="analysis-label">趋势强度</div>
<div class="analysis-value">{{ symbol_data.trend_strength }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div style="text-align: center; padding: 40px; color: #666;">
<p>暂无自选品种,可从下方品种列表中添加</p>
</div>
{% endif %}
</div>
<!-- 热门交易品种展示模块 -->
<div class="section">
<div class="section-title">热门交易品种</div>
<div class="hot-section">
<!-- 成交量热门 -->
<div class="hot-subsection">
<div class="hot-subsection-title">成交量热门</div>
<div class="panel-grid">
{% for symbol_data in hot_symbols.volume %}
<div class="symbol-card" onclick="window.location.href='/symbol/{{ symbol_data.symbol }}'">
<div class="favorite-btn" onclick="event.stopPropagation(); addToFavorite('{{ symbol_data.symbol }}');"></div>
<div class="symbol-header">
<div>
<div class="symbol-name">{{ symbol_data.name }}</div>
<div class="symbol-code">{{ symbol_data.symbol }}</div>
</div>
<div class="price-info">
<div class="current-price">{{ symbol_data.current_price }}</div>
<div class="direction-indicator
{% if symbol_data.direction == 'bullish' or symbol_data.direction == 'strong_bullish' or symbol_data.direction == 'weak_bullish' %}direction-up{% elif symbol_data.direction == 'bearish' or symbol_data.direction == 'strong_bearish' or symbol_data.direction == 'weak_bearish' %}direction-down{% else %}direction-sideways{% endif %}">
{% if symbol_data.direction == 'strong_bullish' %}强多头
{% elif symbol_data.direction == 'strong_bearish' %}强空头
{% elif symbol_data.direction == 'weak_bullish' %}弱多头
{% elif symbol_data.direction == 'weak_bearish' %}弱空头
{% elif symbol_data.direction == 'bullish' %}多头
{% elif symbol_data.direction == 'bearish' %}空头
{% elif symbol_data.direction == 'neutral' %}中性
{% else %}{{ symbol_data.direction | capitalize }}
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<!-- 振幅热门 -->
<div class="hot-subsection">
<div class="hot-subsection-title">振幅热门</div>
<div class="panel-grid">
{% for symbol_data in hot_symbols.amplitude %}
<div class="symbol-card" onclick="window.location.href='/symbol/{{ symbol_data.symbol }}'">
<div class="favorite-btn" onclick="event.stopPropagation(); addToFavorite('{{ symbol_data.symbol }}');"></div>
<div class="symbol-header">
<div>
<div class="symbol-name">{{ symbol_data.name }}</div>
<div class="symbol-code">{{ symbol_data.symbol }}</div>
</div>
<div class="price-info">
<div class="current-price">{{ symbol_data.current_price }}</div>
<div class="direction-indicator
{% if symbol_data.direction == 'bullish' or symbol_data.direction == 'strong_bullish' or symbol_data.direction == 'weak_bullish' %}direction-up{% elif symbol_data.direction == 'bearish' or symbol_data.direction == 'strong_bearish' or symbol_data.direction == 'weak_bearish' %}direction-down{% else %}direction-sideways{% endif %}">
{% if symbol_data.direction == 'strong_bullish' %}强多头
{% elif symbol_data.direction == 'strong_bearish' %}强空头
{% elif symbol_data.direction == 'weak_bullish' %}弱多头
{% elif symbol_data.direction == 'weak_bearish' %}弱空头
{% elif symbol_data.direction == 'bullish' %}多头
{% elif symbol_data.direction == 'bearish' %}空头
{% elif symbol_data.direction == 'neutral' %}中性
{% else %}{{ symbol_data.direction | capitalize }}
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<!-- 涨速热门 -->
<div class="hot-subsection">
<div class="hot-subsection-title">涨速热门</div>
<div class="panel-grid">
{% for symbol_data in hot_symbols.speed %}
<div class="symbol-card" onclick="window.location.href='/symbol/{{ symbol_data.symbol }}'">
<div class="favorite-btn" onclick="event.stopPropagation(); addToFavorite('{{ symbol_data.symbol }}');"></div>
<div class="symbol-header">
<div>
<div class="symbol-name">{{ symbol_data.name }}</div>
<div class="symbol-code">{{ symbol_data.symbol }}</div>
</div>
<div class="price-info">
<div class="current-price">{{ symbol_data.current_price }}</div>
<div class="direction-indicator
{% if symbol_data.direction == 'bullish' or symbol_data.direction == 'strong_bullish' or symbol_data.direction == 'weak_bullish' %}direction-up{% elif symbol_data.direction == 'bearish' or symbol_data.direction == 'strong_bearish' or symbol_data.direction == 'weak_bearish' %}direction-down{% else %}direction-sideways{% endif %}">
{% if symbol_data.direction == 'strong_bullish' %}强多头
{% elif symbol_data.direction == 'strong_bearish' %}强空头
{% elif symbol_data.direction == 'weak_bullish' %}弱多头
{% elif symbol_data.direction == 'weak_bearish' %}弱空头
{% elif symbol_data.direction == 'bullish' %}多头
{% elif symbol_data.direction == 'bearish' %}空头
{% elif symbol_data.direction == 'neutral' %}中性
{% else %}{{ symbol_data.direction | capitalize }}
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
<!-- 所有品种的列表 -->
<div class="section">
<div class="section-title">所有品种</div>
<div class="search-container">
<input type="text" class="search-input" placeholder="搜索品种代码或名称" id="symbolSearch">
</div>
<div class="panel-grid" id="allSymbolsGrid">
{% for symbol_data in all_symbols_data %}
<div class="symbol-card" onclick="window.location.href='/symbol/{{ symbol_data.symbol }}'">
<div class="favorite-btn" onclick="event.stopPropagation(); addToFavorite('{{ symbol_data.symbol }}');"></div>
<div class="symbol-header">
<div>
<div class="symbol-name">{{ symbol_data.name }}</div>
<div class="symbol-code">{{ symbol_data.symbol }}</div>
</div>
<div class="price-info">
<div class="current-price">{{ symbol_data.current_price }}</div>
<div class="direction-indicator
{% if symbol_data.direction == 'bullish' or symbol_data.direction == 'strong_bullish' or symbol_data.direction == 'weak_bullish' %}direction-up{% elif symbol_data.direction == 'bearish' or symbol_data.direction == 'strong_bearish' or symbol_data.direction == 'weak_bearish' %}direction-down{% else %}direction-sideways{% endif %}">
{% if symbol_data.direction == 'strong_bullish' %}强多头
{% elif symbol_data.direction == 'strong_bearish' %}强空头
{% elif symbol_data.direction == 'weak_bullish' %}弱多头
{% elif symbol_data.direction == 'weak_bearish' %}弱空头
{% elif symbol_data.direction == 'bullish' %}多头
{% elif symbol_data.direction == 'bearish' %}空头
{% elif symbol_data.direction == 'neutral' %}中性
{% else %}{{ symbol_data.direction | capitalize }}
{% endif %}
</div>
</div>
</div>
<div class="analysis-grid">
<div class="analysis-item">
<div class="analysis-label">趋势强度</div>
<div class="analysis-value">{{ symbol_data.trend_strength }}</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<!-- 底部 -->
<div class="footer">
<p>© 2024 AI期货分析系统 | 数据更新时间: {{ now() }}</p>
</div>
</div>
<script>
// 获取当前时间
function now() {
const date = new Date();
return date.toLocaleString('zh-CN');
}
// 添加到自选
function addToFavorite(symbol) {
fetch(`/api/selected/add/${symbol}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
alert('已添加到自选');
// 刷新页面以更新自选列表
window.location.reload();
})
.catch(error => {
console.error('添加自选失败:', error);
alert('添加自选失败');
});
}
// 从自选中删除
function removeFromFavorite(symbol) {
fetch(`/api/selected/remove/${symbol}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
alert('已从自选中删除');
// 刷新页面以更新自选列表
window.location.reload();
})
.catch(error => {
console.error('删除自选失败:', error);
alert('删除自选失败');
});
}
// 搜索功能
document.addEventListener('DOMContentLoaded', function() {
const searchInput = document.getElementById('symbolSearch');
const symbolsGrid = document.getElementById('allSymbolsGrid');
if (searchInput && symbolsGrid) {
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
const symbolCards = symbolsGrid.querySelectorAll('.symbol-card');
symbolCards.forEach(card => {
const symbolName = card.querySelector('.symbol-name').textContent.toLowerCase();
const symbolCode = card.querySelector('.symbol-code').textContent.toLowerCase();
if (symbolName.includes(searchTerm) || symbolCode.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
}
});
// 定时刷新数据
setInterval(() => {
window.location.reload();
}, 60000); // 每分钟刷新一次
</script>
</body>
</html>