-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeep_capital.html
158 lines (151 loc) · 5.5 KB
/
deep_capital.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 引入 ECharts 文件 -->
<script src="./lib/echarts.min.js"></script>
<script src="./lib/jquery-2.2.3.min.js"></script>
<script src="./lib/server.js"></script>
<link rel="stylesheet" type="text/css" href="./lib/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="./lib/jquery.dataTables.min.js"></script>
</head>
<body>
<p><b><h2>策略:深度资金</h2></b></p>
<div>
<div style="float:left"><b>密度比下限:</b><input type="text" id="low" placeholder="0.3"></div>
<div style="float:left"><b>密度比上限:</b><input type="text" id="high" placeholder="0.8"></div>
<div style="float:left"><b> 周期:</b><input type="text" id="duration" placeholder="8"></div>
<div style="float:left"> </div>
<div style="float:left"><button id="btn1" style="float:left">过滤</button></div>
<div style="clear:both">
</div>
<br>
<div id="table" style="width: 800px;"></div>
<br>
<div>
<div style="float:left"><b>Code:</b><input type="text" id="code" placeholder="600000.SH"></div>
<div style="float:left"> </div>
<div style="float:left"><button id="btn2" style="float:left">详细图表</button></div>
<div style="clear:both">
<div>
<br>
<div id="chart" style="width: 800px;height:300px;"></div>
<div id="chart"></div>
<script type="text/javascript">
var data_globle;
$(document).ready(function(){
$("#btn1").click(function(){
var threshold_low = update_input_value("#low");
var threshold_high = update_input_value("#high");
var duration = update_input_value("#duration");
var url = "http://" + server + "/v1/strategies/deep_capital/" + threshold_low + "/" + threshold_high + "/" + duration;
$.ajax({
url: url,
dataType:'jsonp',
success: function(data) {
chart_update(data);
}
});
});
});
$(document).ready(function(){
$("#btn2").click(function(){
var code = update_input_value("#code");
show_chart(code, data_globle);
})
});
function chart_update(data) {
brief = data.brief.sort(function NumAscSort(a,b) {
return b.ratio-a.ratio;
})
html = '<table id="table01" class="display" width="100%">';
html += '<thead>'
html += '<tr>'
html += '<th>Name</th>'
html += '<th>Code</th>'
html += '<th>Ratio</th>'
html += '</tr>'
html += '</thead>'
html += '</table>'
$("#table").append(html);
$('#table01').DataTable({
paging: true,
"order": [[ 2, "desc" ]],
data: brief,
columns: [
{ data: 'name' },
{ data: 'code' },
{ data: 'ratio' }
]
});
data_globle = data;
brief_globle = brief;
}
function show_chart(code, data) {
option = {
title: {
text: code
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['股东总户数','平均每户持流通股数']
},
toolbox: {
show: true,
feature: {
dataZoom: {},
dataView: {readOnly: false},
restore: {},
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
boundaryGap : false,
data : data[code].date_list
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'股东总户数',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:data[code].holder_mun_list
},
{
name:'平均每户持流通股数',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:data[code].holder_avgnum_tradable_list
}
]
};
var myChart = echarts.init(document.getElementById("chart"));
myChart.setOption(option);
}
function update_input_value(id) {
if($(id).val() == "") {
return $(id).attr("placeholder");
} else {
return $(id).val();
}
}
</script>
</body>
</html>