sbd-npm 1.3.41 → 1.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constant.js +16 -16
- package/package.json +1 -1
- package/stock_basics.js +58 -32
- package/util.js +13 -8
package/constant.js
CHANGED
@@ -16,22 +16,6 @@ const MenuList = [
|
|
16
16
|
{'key': 'summary_index', 'name': '指数', 'url': '/0x3508c4e2f30e37d9f20d412b6496fbc279170cdb'},
|
17
17
|
]
|
18
18
|
},
|
19
|
-
{
|
20
|
-
'name': '每日数据',
|
21
|
-
'icon': 'th',
|
22
|
-
'menu': [
|
23
|
-
{'key': 'daily_price_top', 'name': '每日新高', 'url': '/0x4bbed40927b5114222156b38c74fdb908e51289f'},
|
24
|
-
{'key': 'daily_price_limit_up', 'name': '每日涨停', 'url': '/0x7e05ba643accb5fc6fb4ed5962e560182bfbe782'},
|
25
|
-
{'key': 'daily_margin', 'name': '融资融券', 'url': '/0x346eb98b16e29800315ad99545be9d391d0bdcf1'},
|
26
|
-
{'key': 'daily_volume', 'name': '成交量(大量)', 'url': '/0xd92468b610939a0a904069b4293afd7f2e8c4411'},
|
27
|
-
{'key': 'daily_gap', 'name': '缺口', 'url': '/0xc09193d6aa6e30481598783ef22d3bf5d0f79aad'},
|
28
|
-
{'key': 'daily_turnover', 'name': '换手率', 'url': '/0xdf9b75b31bba10c011bbaf48799d8420f192cfa6'},
|
29
|
-
{'key': 'daily_amount', 'name': '成交额', 'url': '/0x52f628266cf952dcde3c51720f69d4cf3179282d'},
|
30
|
-
{'key': 'daily_buy_sell', 'name': '买入卖出', 'url': '/0x79d1721e939806b2ee507762ade8104bb9320cf7'},
|
31
|
-
{'key': 'daily_big_deal', 'name': '大单交易', 'url': '/0x0ecbe70538ea87c664889e763faecb4a0b080104'},
|
32
|
-
{'key': 'daily_block', 'name': '大宗交易', 'url': '/0x591119baf53f3cda6c34fd9025a5a2b5d68342ce'},
|
33
|
-
]
|
34
|
-
},
|
35
19
|
{
|
36
20
|
'name': '趋势分析',
|
37
21
|
'icon': 'edit',
|
@@ -60,6 +44,22 @@ const MenuList = [
|
|
60
44
|
{'key': 'trend_query', 'name': '趋势查询', 'url': '/0xa90dbc36401aba21fef54d90435c9a94f2976866'},
|
61
45
|
]
|
62
46
|
},
|
47
|
+
{
|
48
|
+
'name': '每日数据',
|
49
|
+
'icon': 'th',
|
50
|
+
'menu': [
|
51
|
+
{'key': 'daily_price_top', 'name': '每日新高', 'url': '/0x4bbed40927b5114222156b38c74fdb908e51289f'},
|
52
|
+
{'key': 'daily_price_limit_up', 'name': '每日涨停', 'url': '/0x7e05ba643accb5fc6fb4ed5962e560182bfbe782'},
|
53
|
+
{'key': 'daily_margin', 'name': '融资融券', 'url': '/0x346eb98b16e29800315ad99545be9d391d0bdcf1'},
|
54
|
+
{'key': 'daily_volume', 'name': '成交量(大量)', 'url': '/0xd92468b610939a0a904069b4293afd7f2e8c4411'},
|
55
|
+
{'key': 'daily_gap', 'name': '缺口', 'url': '/0xc09193d6aa6e30481598783ef22d3bf5d0f79aad'},
|
56
|
+
{'key': 'daily_turnover', 'name': '换手率', 'url': '/0xdf9b75b31bba10c011bbaf48799d8420f192cfa6'},
|
57
|
+
{'key': 'daily_amount', 'name': '成交额', 'url': '/0x52f628266cf952dcde3c51720f69d4cf3179282d'},
|
58
|
+
{'key': 'daily_buy_sell', 'name': '买入卖出', 'url': '/0x79d1721e939806b2ee507762ade8104bb9320cf7'},
|
59
|
+
{'key': 'daily_big_deal', 'name': '大单交易', 'url': '/0x0ecbe70538ea87c664889e763faecb4a0b080104'},
|
60
|
+
{'key': 'daily_block', 'name': '大宗交易', 'url': '/0x591119baf53f3cda6c34fd9025a5a2b5d68342ce'},
|
61
|
+
]
|
62
|
+
},
|
63
63
|
{
|
64
64
|
'name': '沪深港通',
|
65
65
|
'icon': 'cogs',
|
package/package.json
CHANGED
package/stock_basics.js
CHANGED
@@ -481,7 +481,7 @@ let Stock = {
|
|
481
481
|
} else if (parseInt(change) === 0) {
|
482
482
|
change = "不变";
|
483
483
|
} else if (parseFloat(change) > 0) {
|
484
|
-
change = "<b class='text-danger'
|
484
|
+
change = "<b class='text-danger'>+" + change + "%</b>";
|
485
485
|
} else if (parseFloat(change) < 0) {
|
486
486
|
change = "<b class='text-success'>" + change + "%</b>";
|
487
487
|
}
|
@@ -514,20 +514,28 @@ let Stock = {
|
|
514
514
|
pre_circulation_volume += item["volume"];
|
515
515
|
}
|
516
516
|
});
|
517
|
-
|
518
|
-
|
517
|
+
let circulation_tips = "", main_tips = "";
|
518
|
+
if (circulation_volume > 0) {
|
519
|
+
circulation_tips += " [ 当前十大流通股东总持股数: <span class='label label-info'>" + Util.to_unit(circulation_volume, 3) + "</span>";
|
520
|
+
if (pre_circulation_volume > 0) {
|
521
|
+
circulation_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
|
522
|
+
circulation_tips += " 持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
|
523
|
+
}
|
519
524
|
if (j["date_price"]) {
|
520
|
-
|
525
|
+
circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock["price"], j["date_price"]);
|
521
526
|
}
|
522
|
-
|
523
|
-
} else {
|
524
|
-
$("#circulation_holder_tips").html("");
|
527
|
+
circulation_tips += " ]";
|
525
528
|
}
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
529
|
+
$("#circulation_holder_tips").html(circulation_tips);
|
530
|
+
if (main_volume > 0) {
|
531
|
+
main_tips += " [ 当前十大主要股东总持股数: <span class='label label-info'>" + Util.to_unit(main_volume, 3) + "</span>";
|
532
|
+
if (pre_main_volume > 0) {
|
533
|
+
main_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_main_volume, 3) + "</span>,";
|
534
|
+
main_tips += " 持股数环比: " + Util.year_price_rate(main_volume, pre_main_volume, 1);
|
535
|
+
}
|
536
|
+
main_tips += " ]";
|
530
537
|
}
|
538
|
+
$("#main_holder_tips").html(main_tips);
|
531
539
|
let symbol = Util.code_to_symbol(Stock.code);
|
532
540
|
Util.render_table_html("circulation_holder_table_body", circulation_html);
|
533
541
|
$("#circulation_holder_url").attr("href", "https://xueqiu.com/snowman/S/" + symbol + "/detail#/LTGD");
|
@@ -1128,6 +1136,10 @@ let Stock = {
|
|
1128
1136
|
});
|
1129
1137
|
},
|
1130
1138
|
|
1139
|
+
/**
|
1140
|
+
* 融资融券
|
1141
|
+
* @param obj_token
|
1142
|
+
*/
|
1131
1143
|
fetch_margin: function () {
|
1132
1144
|
Stock["rzye_chart"] = Util.show_chart_loading(Stock["rzye_chart"], "rzye_line_canvas");
|
1133
1145
|
let margin_url = "http://www.szse.cn/disclosure/margin/margin/index.html";
|
@@ -1143,7 +1155,7 @@ let Stock = {
|
|
1143
1155
|
};
|
1144
1156
|
Util.post("/stock/" + Stock["code"], payload, function (j) {
|
1145
1157
|
Stock["rzye_chart"].hideLoading();
|
1146
|
-
let date_data = [], rzye_data = [], rqye_data = [], price_data = [], rzye_low = 0, rzye_high = 0;
|
1158
|
+
let date_data = [], rzye_data = [], rqye_data = [], price_data = [], rqye_color_data = [], rzye_low = 0, rzye_high = 0;
|
1147
1159
|
j["data"].forEach(function (item) {
|
1148
1160
|
if (rzye_low === 0 || item["rzye"] < rzye_low) {
|
1149
1161
|
rzye_low = item["rzye"];
|
@@ -1151,49 +1163,63 @@ let Stock = {
|
|
1151
1163
|
rzye_high = Math.max(rzye_high, item["rzye"]);
|
1152
1164
|
date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
|
1153
1165
|
rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
|
1154
|
-
rqye_data.push(Util.
|
1166
|
+
rqye_data.push(Util.to_ten_thousand(item["rqye"], 2));
|
1155
1167
|
price_data.push(item["price"]);
|
1168
|
+
rqye_color_data.push("#E74C3C");
|
1156
1169
|
});
|
1157
|
-
let margin_summary = "";
|
1170
|
+
let margin_summary = "", rqye_summary = "";
|
1158
1171
|
if (j["latest"].length > 0) {
|
1159
1172
|
if (j["latest"].length === 1) {
|
1160
|
-
margin_summary = "
|
1173
|
+
margin_summary = " 最新融资余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rzye"], 3);
|
1174
|
+
rqye_summary = " 最新融券余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rqye"], 3);
|
1161
1175
|
} else if (j["latest"].length === 2) {
|
1162
|
-
let d1 = j["latest"][0];
|
1163
|
-
let
|
1164
|
-
|
1165
|
-
|
1166
|
-
if (
|
1167
|
-
|
1168
|
-
}
|
1169
|
-
|
1176
|
+
let d1 = j["latest"][0], d2 = j["latest"][1], rzye_dist_tips = "", rqye_dist_tips = "";
|
1177
|
+
let rzye_difference = d1["rzye"] - d2["rzye"];
|
1178
|
+
if (rzye_difference > 0) {
|
1179
|
+
rzye_dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"], 3)) + "' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(rzye_difference, 3)) + "</b>)";
|
1180
|
+
} else if (rzye_difference < 0) {
|
1181
|
+
rzye_dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"], 3)) + "' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(rzye_difference, 3)) + "</b>)";
|
1182
|
+
}
|
1183
|
+
margin_summary = " 最新融资余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + rzye_dist_tips;
|
1184
|
+
let rqye_difference = d1["rqye"] - d2["rqye"];
|
1185
|
+
if (rqye_difference > 0) {
|
1186
|
+
rqye_dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rqye"], 3)) + "' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(rqye_difference, 3)) + "</b>)";
|
1187
|
+
} else if (rqye_difference < 0) {
|
1188
|
+
rqye_dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rqye"], 3)) + "' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(rqye_difference, 3)) + "</b>)";
|
1170
1189
|
}
|
1171
|
-
|
1190
|
+
rqye_summary = " 最新融券余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rqye"], 3) + rqye_dist_tips;
|
1172
1191
|
}
|
1173
1192
|
}
|
1174
|
-
margin_summary = margin_summary + '
|
1175
|
-
if (j["
|
1176
|
-
margin_summary += ' 历史最高: ' + Util.to_unit(j["
|
1193
|
+
margin_summary = margin_summary + ' 当前最高: ' + Util.to_unit(rzye_high, 3) + ' 当前最低: ' + Util.to_unit(rzye_low, 3);
|
1194
|
+
if (j["rzye_high"] && j["rzye_high"]["date"] && j["rzye_high"]["date"] > 0) {
|
1195
|
+
margin_summary += ' 历史最高: ' + Util.to_unit(j["rzye_high"]["rzye"], 3) + '(' + Util.seconds_to_format(j["rzye_high"]["date"], "%Y-%m-%d") + ')';
|
1177
1196
|
}
|
1178
|
-
if (j["
|
1179
|
-
margin_summary += ' 历史最低: ' + Util.to_unit(j["
|
1197
|
+
if (j["rzye_low"] && j["rzye_low"]["date"] && j["rzye_low"]["date"] > 0) {
|
1198
|
+
margin_summary += ' 历史最低: ' + Util.to_unit(j["rzye_low"]["rzye"], 3) + '(' + Util.seconds_to_format(j["rzye_low"]["date"], "%Y-%m-%d") + ')';
|
1180
1199
|
}
|
1181
1200
|
if (j["less_rate"]) {
|
1182
1201
|
margin_summary += ' 当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
|
1183
1202
|
}
|
1184
1203
|
$("#margin_summary").html(margin_summary);
|
1185
1204
|
Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
|
1205
|
+
if (j["rqye_high"] && j["rqye_high"]["date"] && j["rqye_high"]["date"] > 0) {
|
1206
|
+
rqye_summary += ' 历史最高: ' + Util.to_unit(j["rqye_high"]["rqye"], 3) + '(' + Util.seconds_to_format(j["rqye_high"]["date"], "%Y-%m-%d") + ')';
|
1207
|
+
}
|
1208
|
+
if (j["rqye_low"] && j["rqye_low"]["date"] && j["rqye_low"]["date"] > 0) {
|
1209
|
+
rqye_summary += ' 历史最低: ' + Util.to_unit(j["rqye_low"]["rqye"], 3) + '(' + Util.seconds_to_format(j["rqye_low"]["date"], "%Y-%m-%d") + ')';
|
1210
|
+
}
|
1211
|
+
$("#rqye_summary").html(" [" + rqye_summary + " ]");
|
1212
|
+
Stock["rqye_chart"] = Util.chart_bar_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, rqye_data, '融券余额(单位:万)', rqye_color_data, price_data, '股价');
|
1186
1213
|
let flow_data = [], color_data = [];
|
1187
1214
|
date_data = [];
|
1188
1215
|
j["flow_data"].forEach(function (item) {
|
1189
1216
|
if (item["value"] !== 0) {
|
1190
1217
|
date_data.push(item["date"]);
|
1191
|
-
flow_data.push(item["value"]);
|
1218
|
+
flow_data.push(Util.to_ten_thousand(item["value"], 2));
|
1192
1219
|
color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
|
1193
1220
|
}
|
1194
1221
|
});
|
1195
|
-
Stock["margin_month_flow_chart"] = Util.chart_basic_bar(Stock["margin_month_flow_chart"], "margin_month_flow_bar_chart", date_data, flow_data, "增幅", color_data);
|
1196
|
-
Stock["rqye_chart"] = Util.multi_axis_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, '融券余额', rqye_data, '股价', price_data);
|
1222
|
+
Stock["margin_month_flow_chart"] = Util.chart_basic_bar(Stock["margin_month_flow_chart"], "margin_month_flow_bar_chart", date_data, flow_data, "增幅(单位:万)", color_data);
|
1197
1223
|
Util.hide_tips();
|
1198
1224
|
});
|
1199
1225
|
},
|
package/util.js
CHANGED
@@ -2789,21 +2789,25 @@ const Util = {
|
|
2789
2789
|
* 年初至今的价格幅度
|
2790
2790
|
* @param price
|
2791
2791
|
* @param year_price
|
2792
|
+
* @param is_plus 正数是否有加号,1是0否
|
2792
2793
|
* @returns {string}
|
2793
2794
|
*/
|
2794
|
-
year_price_rate: function (price, year_price) {
|
2795
|
-
let cls = "", rate_val = 0;
|
2795
|
+
year_price_rate: function (price, year_price, is_plus = 0) {
|
2796
|
+
let cls = "", plus_sign = "", rate_val = 0;
|
2796
2797
|
if (price > 0 && year_price > 0) {
|
2797
2798
|
if (price > year_price) {
|
2798
2799
|
cls = "text-danger";
|
2799
2800
|
rate_val = Math.round(((price - year_price) / year_price) * 10000) / 100;
|
2801
|
+
if (is_plus === 1) {
|
2802
|
+
plus_sign = "+";
|
2803
|
+
}
|
2800
2804
|
} else if (price < year_price) {
|
2801
2805
|
cls = "text-success";
|
2802
2806
|
rate_val = Math.round(((year_price - price) / year_price) * 10000) / 100;
|
2803
2807
|
rate_val = -rate_val
|
2804
2808
|
}
|
2805
2809
|
}
|
2806
|
-
return "<b title='" + (year_price + " - " + price) + "' class='" + cls + "'>" + rate_val + "%</b>";
|
2810
|
+
return "<b title='" + (year_price + " - " + price) + "' class='" + cls + "'>" + plus_sign + rate_val + "%</b>";
|
2807
2811
|
},
|
2808
2812
|
|
2809
2813
|
/**
|
@@ -3761,17 +3765,18 @@ const Util = {
|
|
3761
3765
|
return chart_instance;
|
3762
3766
|
},
|
3763
3767
|
|
3764
|
-
|
3768
|
+
/**
|
3769
|
+
* 线柱图表
|
3770
|
+
* https://www.chartjs.org/samples/latest/charts/combo-bar-line.html
|
3771
|
+
*/
|
3765
3772
|
chart_bar_line: function (chart_instance, element_id, x_data, bar_data, bar_title, bar_color_data, line_data, line_title, zoom_start = 0) {
|
3766
3773
|
if (!chart_instance) {
|
3767
3774
|
chart_instance = Util.init_chart_instance(element_id);
|
3768
3775
|
}
|
3769
3776
|
chart_instance.clear();
|
3770
|
-
let low_bar_index = 0;
|
3771
|
-
let low_bar_value = 0;
|
3772
|
-
let max_bar_index = 0;
|
3773
|
-
let max_bar_value = 0;
|
3777
|
+
let low_bar_index = 0, low_bar_value = 0, max_bar_index = 0, max_bar_value = 0;
|
3774
3778
|
bar_data.forEach(function (bar_value, bar_index) {
|
3779
|
+
bar_value = parseFloat(bar_value);
|
3775
3780
|
if (low_bar_value === 0 || low_bar_value > bar_value) {
|
3776
3781
|
low_bar_value = bar_value;
|
3777
3782
|
low_bar_index = bar_index;
|