修复一些bug

This commit is contained in:
rm 2023-11-24 23:29:22 +08:00
parent 8c46afbf31
commit d038cf355e
10 changed files with 361 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.pyc
.idea/
*.log
html/json/events.json

View File

@ -242,7 +242,7 @@ class SectorOpt:
xaxis_opts=opts.AxisOpts(offset=5, axislabel_opts=opts.LabelOpts(rotate=45, interval=0)),
legend_opts=opts.LegendOpts(pos_top="8%")
)
.render(f"../html/{self.trade_date}/{file_name}.html")
.render(f"html/{self.trade_date}/{file_name}.html")
)
@ -256,9 +256,9 @@ if __name__ == '__main__':
# sector.save_gn_sector()
# 生成报表
# sector.industry_generate_chart()
# sector.concept_generate_chart()
sector.concept_generate_chart()
# -------》 一下建议一周更新一次
# 行业板块个股
sector.stock_by_hy_sector()
# sector.stock_by_hy_sector()
# 感念板块个股
sector.stock_by_gn_sector()
# sector.stock_by_gn_sector()

View File

@ -50,7 +50,7 @@ class LimitList:
xaxis_opts=opts.AxisOpts(offset=5, axislabel_opts=opts.LabelOpts(rotate=45, interval=0)),
legend_opts=opts.LegendOpts(pos_top="8%")
)
.render(f"../html/{self.trade_date}/limit_list_chart.html")
.render(f"html/{self.trade_date}/limit_list_chart.html")
)
def html_page_data(self):

View File

@ -81,7 +81,7 @@ class MoneyFlow:
label_opts=opts.LabelOpts(is_show=False),
)
)
bar.overlap(line).render(f"../复盘指标/html/{self.trade_date}/mixed_bar_and_line.html")
bar.overlap(line).render(f"html/{self.trade_date}/mixed_bar_and_line.html")
if __name__ == '__main__':

View File

@ -126,5 +126,5 @@ if __name__ == '__main__':
# app.calendar_page_data()
# app.init_data()
# app.create_chart()
# app.create_page()
# app.upload_ftp()
app.create_page()
app.upload_ftp()

View File

View File

@ -0,0 +1,160 @@
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 的 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>复盘首页</title>
</head>
<body>
<div id="head"></div>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<div class="container">
<div class="row border p-3">
{{badge}}
</div>
</div>
</div>
</div>
<div class="card text-center">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" id="bkTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="bk1-tab" data-toggle="tab" href="#tab1" role="tab"
data-target="#tab1" aria-controls="tab1" aria-selected="true">行业板块</a>
</li>
<li class="nav-item">
<a class="nav-link" id="bk2-tab" data-toggle="tab" href="#tab2" role="tab" data-target="#tab2"
aria-controls="tab2" aria-selected="false">概念板块</a>
</li>
<li class="nav-item">
<a class="nav-link" id="bk3-tab" data-toggle="tab" href="#tab3" role="tab" data-target="#tab3"
aria-controls="tab3" aria-selected="false">涨跌幅</a>
</li>
<li class="nav-item">
<a class="nav-link" id="bk4-tab" data-toggle="tab" href="#tab4" role="tab" data-target="#tab4"
aria-controls="tab4" aria-selected="false">资金情况</a>
</li>
</ul>
</div>
<div class="card-body tab-content" id="bkTabContent">
<div class="tab-pane fade show active jumbotron jumbotron-fluid" id="tab1" aria-labelledby="tab1-tab">
<iframe src="industry_generate_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
<div class="tab-pane fade jumbotron jumbotron-fluid" id="tab2" aria-labelledby="tab2-tab">
<iframe src="concept_generate_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
<div class="tab-pane fade jumbotron jumbotron-fluid" id="tab3" aria-labelledby="tab3-tab">
<iframe src="limit_list_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
<div class="tab-pane fade jumbotron jumbotron-fluid" id="tab4" aria-labelledby="tab4-tab">
<iframe src="mixed_bar_and_line.html" frameborder="0" width="100%" height="430"></iframe>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-news-tab" role="tablist" aria-orientation="vertical">
<button class="nav-link active" id="v-news-xwlb-tab" type="button"
data-target="#v-news-xwlb">新闻联播</button>
<button class="nav-link" id="v-news-cls-tab" type="button"
data-target="#v-news-cls">财联社快讯</button>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-news-tabContent">
<div class="tab-pane fade show active" id="v-news-xwlb">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">标题</th>
<th scope="col">情感</th>
</tr>
</thead>
<tbody class="text-left small">
{{news_cctv}}
</tbody>
</table>
</div>
<div class="tab-pane fade" id="v-news-cls">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">标题</th>
<th scope="col">情感</th>
</tr>
</thead>
<tbody class="text-left small">
{{news_cls}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 选项 1jQuery 和 Bootstrap 集成包(集成了 Popper -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua" crossorigin="anonymous">
</script>
<script>
// 使用 fetch 来加载 content.html 的内容,并将其插入到指定的容器中
document.addEventListener('DOMContentLoaded', function() {
fetch('../head.html')
.then(response => response.text())
.then(content => {
document.querySelector('#head').innerHTML = content;
});
});
// 使用 jQuery 来实现卡片切换和内容变换
$(document).ready(function() {
bkTab = $('#bkTab')
newsTab = $('#v-news-tab')
bkTab.find('.nav-link').on('click', function(e) {
e.preventDefault();
// 获取目标选项卡内容的 ID
var targetId = $(this).data('target');
bkTab.find('.nav-link').removeClass('active');
$(this).addClass('active');
// 隐藏所有选项卡内容
$('#bkTabContent').find('.tab-pane').removeClass('show active');
// 显示目标选项卡内容
$(targetId).addClass('show active');
});
newsTab.find('.nav-link').on('click', function(e) {
e.preventDefault();
// 获取目标选项卡内容的 ID
var targetId = $(this).data('target');
newsTab.find('.nav-link').removeClass('active');
$(this).addClass('active');
// 隐藏所有选项卡内容
$('#v-news-tabContent').find('.tab-pane').removeClass('show active');
// 显示目标选项卡内容
$(targetId).addClass('show active');
});
});
</script>
<!-- 选项 2Popper 和 Bootstrap 的 JS 插件各自独立 -->
<!--
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-Lge2E2XotzMiwH69/MXB72yLpwyENMiOKX8zS8Qo7LDCvaBIWGL+GlRQEKIpYR04" crossorigin="anonymous"></script>
-->
</body>
</html>

View File

@ -0,0 +1,85 @@
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 的 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>复盘-涨跌停数据</title>
</head>
<body>
<div id="head"></div>
<div class="card text-center">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" id="bkTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="bk1-tab" data-toggle="tab" href="#tab1" role="tab"
data-target="#tab1" aria-controls="tab1" aria-selected="true">行业板块</a>
</li>
<li class="nav-item">
<a class="nav-link" id="bk2-tab" data-toggle="tab" href="#tab2" role="tab" data-target="#tab2"
aria-controls="tab2" aria-selected="false">概念板块</a>
</li>
<li class="nav-item">
<a class="nav-link" id="bk3-tab" data-toggle="tab" href="#tab3" role="tab" data-target="#tab3"
aria-controls="tab3" aria-selected="false">涨跌幅</a>
</li>
</ul>
</div>
<div class="card-body tab-content" id="bkTabContent">
<div class="tab-pane fade show active jumbotron jumbotron-fluid" id="tab1" aria-labelledby="tab1-tab">
<iframe src="industry_generate_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
<div class="tab-pane fade jumbotron jumbotron-fluid" id="tab2" aria-labelledby="tab2-tab">
<iframe src="concept_generate_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
<div class="tab-pane fade jumbotron jumbotron-fluid" id="tab3" aria-labelledby="tab3-tab">
<iframe src="limit_list_chart.html" frameborder="0" width="100%" height="430"></iframe>
</div>
</div>
</div>
<div class="container">
{{limit_table}}
</div>
<!-- 选项 1jQuery 和 Bootstrap 集成包(集成了 Popper -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua" crossorigin="anonymous">
</script>
<script>
// 使用 fetch 来加载 content.html 的内容,并将其插入到指定的容器中
document.addEventListener('DOMContentLoaded', function() {
fetch('../head.html')
.then(response => response.text())
.then(content => {
document.querySelector('#head').innerHTML = content;
});
});
// 使用 jQuery 来实现卡片切换和内容变换
$(document).ready(function() {
$('.nav-link').on('click', function(e) {
e.preventDefault();
// 获取目标选项卡内容的 ID
var targetId = $(this).data('target');
$('.nav-link').removeClass('active');
$(this).addClass('active');
// 隐藏所有选项卡内容
$('.tab-pane').removeClass('show active');
// 显示目标选项卡内容
$(targetId).addClass('show active');
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,47 @@
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 的 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>复盘-指数数据</title>
</head>
<body>
<div id="head"></div>
<div class="container">
{{card_deck}}
</div>
<!-- 选项 1jQuery 和 Bootstrap 集成包(集成了 Popper -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua"
crossorigin="anonymous">
</script>
<script>
// 使用 fetch 来加载 content.html 的内容,并将其插入到指定的容器中
document.addEventListener('DOMContentLoaded', function() {
fetch('../head.html')
.then(response => response.text())
.then(content => {
document.querySelector('#head').innerHTML = content;
});
});
</script>
<!-- 选项 2Popper 和 Bootstrap 的 JS 插件各自独立 -->
<!--
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-Lge2E2XotzMiwH69/MXB72yLpwyENMiOKX8zS8Qo7LDCvaBIWGL+GlRQEKIpYR04" crossorigin="anonymous"></script>
-->
</body>
</html>

View File

@ -0,0 +1,60 @@
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 的 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>复盘-我的自选</title>
</head>
<body>
<div id="head"></div>
<div class="container">
{{pills_tabContent}}
</div>
<!-- 选项 1jQuery 和 Bootstrap 集成包(集成了 Popper -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua" crossorigin="anonymous">
</script>
<script>
// 使用 fetch 来加载 content.html 的内容,并将其插入到指定的容器中
document.addEventListener('DOMContentLoaded', function() {
fetch('../head.html')
.then(response => response.text())
.then(content => {
document.querySelector('#head').innerHTML = content;
});
});
// 使用 jQuery 来实现卡片切换和内容变换
$(document).ready(function() {
$('.nav-link').on('click', function(e) {
e.preventDefault();
// 获取目标选项卡内容的 ID
var targetId = $(this).data('target');
$('.nav-link').removeClass('active');
$(this).addClass('active');
// 隐藏所有选项卡内容
$('.tab-pane').removeClass('show active');
// 显示目标选项卡内容
$(targetId).addClass('show active');
});
});
</script>
<!-- 选项 2Popper 和 Bootstrap 的 JS 插件各自独立 -->
<!--
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-Lge2E2XotzMiwH69/MXB72yLpwyENMiOKX8zS8Qo7LDCvaBIWGL+GlRQEKIpYR04" crossorigin="anonymous"></script>
-->
</body>
</html>