sbd-npm 1.3.42 → 1.3.44
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 +47 -24
- package/util.js +6 -5
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
@@ -215,7 +215,7 @@ let Stock = {
|
|
215
215
|
remark_html.push("<b class='text-success'>最近解禁<a href='" + Util.get_url("holder_restricted") + "?tab=xsg_list&date=" + xsg_date + "'>" + xsg_date + "</a></b>, ");
|
216
216
|
}
|
217
217
|
if (item["price"] > 0 && item["price"] < item["block_trade_price"]) {
|
218
|
-
remark_html.push("<b class='text-danger'>当前价小于最近<a href='" + Util.get_url("daily_block") + "?code=" + item["code"] + "'>大宗交易价(" + item["block_trade_price"] + ")</a></b>, ");
|
218
|
+
remark_html.push("<b class='text-danger'>当前价小于最近<a href='" + Util.get_url("daily_block") + "?code=" + item["code"] + "&start_date=" + Util.seconds_to_format(Stock.ttm_second, "%Y-%m-%d") + "'>大宗交易价(" + item["block_trade_price"] + ")</a></b>, ");
|
219
219
|
}
|
220
220
|
if (item["desc"]) {
|
221
221
|
remark_html.push("<br><br><p>" + item["desc"] + "</p>");
|
@@ -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
|
}
|
@@ -1136,6 +1136,10 @@ let Stock = {
|
|
1136
1136
|
});
|
1137
1137
|
},
|
1138
1138
|
|
1139
|
+
/**
|
1140
|
+
* 融资融券
|
1141
|
+
* @param obj_token
|
1142
|
+
*/
|
1139
1143
|
fetch_margin: function () {
|
1140
1144
|
Stock["rzye_chart"] = Util.show_chart_loading(Stock["rzye_chart"], "rzye_line_canvas");
|
1141
1145
|
let margin_url = "http://www.szse.cn/disclosure/margin/margin/index.html";
|
@@ -1151,57 +1155,76 @@ let Stock = {
|
|
1151
1155
|
};
|
1152
1156
|
Util.post("/stock/" + Stock["code"], payload, function (j) {
|
1153
1157
|
Stock["rzye_chart"].hideLoading();
|
1154
|
-
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, rqye_low = 0, rqye_high = 0;
|
1155
1159
|
j["data"].forEach(function (item) {
|
1160
|
+
date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
|
1156
1161
|
if (rzye_low === 0 || item["rzye"] < rzye_low) {
|
1157
1162
|
rzye_low = item["rzye"];
|
1158
1163
|
}
|
1159
1164
|
rzye_high = Math.max(rzye_high, item["rzye"]);
|
1160
|
-
date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
|
1161
1165
|
rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
|
1162
|
-
|
1166
|
+
if (rqye_low === 0 || item["rqye"] < rqye_low) {
|
1167
|
+
rqye_low = item["rqye"];
|
1168
|
+
}
|
1169
|
+
rqye_high = Math.max(rqye_high, item["rqye"]);
|
1170
|
+
rqye_data.push(Util.to_ten_thousand(item["rqye"], 2));
|
1163
1171
|
price_data.push(item["price"]);
|
1172
|
+
rqye_color_data.push("#E74C3C");
|
1164
1173
|
});
|
1165
|
-
let margin_summary = "";
|
1174
|
+
let margin_summary = "", rqye_summary = "";
|
1166
1175
|
if (j["latest"].length > 0) {
|
1167
1176
|
if (j["latest"].length === 1) {
|
1168
|
-
margin_summary = "
|
1177
|
+
margin_summary = " 最新融资余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rzye"], 3);
|
1178
|
+
rqye_summary = " 最新融券余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rqye"], 3);
|
1169
1179
|
} else if (j["latest"].length === 2) {
|
1170
|
-
let d1 = j["latest"][0];
|
1171
|
-
let
|
1172
|
-
|
1173
|
-
|
1174
|
-
if (
|
1175
|
-
|
1176
|
-
} else if (difference < 0) {
|
1177
|
-
dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"], 3)) + "' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference, 3)) + "</b>)";
|
1180
|
+
let d1 = j["latest"][0], d2 = j["latest"][1], rzye_dist_tips = "", rqye_dist_tips = "";
|
1181
|
+
let rzye_difference = d1["rzye"] - d2["rzye"];
|
1182
|
+
if (rzye_difference > 0) {
|
1183
|
+
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>)";
|
1184
|
+
} else if (rzye_difference < 0) {
|
1185
|
+
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>)";
|
1178
1186
|
}
|
1179
|
-
margin_summary = "
|
1187
|
+
margin_summary = " 最新融资余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + rzye_dist_tips;
|
1188
|
+
let rqye_difference = d1["rqye"] - d2["rqye"];
|
1189
|
+
if (rqye_difference > 0) {
|
1190
|
+
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>)";
|
1191
|
+
} else if (rqye_difference < 0) {
|
1192
|
+
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>)";
|
1193
|
+
}
|
1194
|
+
rqye_summary = " 最新融券余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rqye"], 3) + rqye_dist_tips;
|
1180
1195
|
}
|
1181
1196
|
}
|
1182
|
-
margin_summary
|
1183
|
-
if (j["
|
1184
|
-
margin_summary += ' 历史最高: ' + Util.to_unit(j["
|
1197
|
+
margin_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.strip_html(Util.to_unit(rzye_high, 3)) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.strip_html(Util.to_unit(rzye_low, 3)) + "</span>";
|
1198
|
+
if (j["rzye_high"] && j["rzye_high"]["date"] && j["rzye_high"]["date"] > 0) {
|
1199
|
+
margin_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.strip_html(Util.to_unit(j["rzye_high"]["rzye"], 3)) + '</span>(' + Util.seconds_to_format(j["rzye_high"]["date"], "%Y-%m-%d") + ')';
|
1185
1200
|
}
|
1186
|
-
if (j["
|
1187
|
-
margin_summary += ' 历史最低: ' + Util.to_unit(j["
|
1201
|
+
if (j["rzye_low"] && j["rzye_low"]["date"] && j["rzye_low"]["date"] > 0) {
|
1202
|
+
margin_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.strip_html(Util.to_unit(j["rzye_low"]["rzye"], 3)) + '</span>(' + Util.seconds_to_format(j["rzye_low"]["date"], "%Y-%m-%d") + ')';
|
1188
1203
|
}
|
1189
1204
|
if (j["less_rate"]) {
|
1190
1205
|
margin_summary += ' 当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
|
1191
1206
|
}
|
1192
1207
|
$("#margin_summary").html(margin_summary);
|
1193
1208
|
Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
|
1209
|
+
rqye_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.strip_html(Util.to_unit(rqye_high, 3)) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.strip_html(Util.to_unit(rqye_low, 3)) + "</span>";
|
1210
|
+
if (j["rqye_high"] && j["rqye_high"]["date"] && j["rqye_high"]["date"] > 0) {
|
1211
|
+
rqye_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.strip_html(Util.to_unit(j["rqye_high"]["rqye"], 3)) + '</span>(' + Util.seconds_to_format(j["rqye_high"]["date"], "%Y-%m-%d") + ')';
|
1212
|
+
}
|
1213
|
+
if (j["rqye_low"] && j["rqye_low"]["date"] && j["rqye_low"]["date"] > 0) {
|
1214
|
+
rqye_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.strip_html(Util.to_unit(j["rqye_low"]["rqye"], 3)) + '</span>(' + Util.seconds_to_format(j["rqye_low"]["date"], "%Y-%m-%d") + ')';
|
1215
|
+
}
|
1216
|
+
$("#rqye_summary").html(" [" + rqye_summary + " ]");
|
1217
|
+
Stock["rqye_chart"] = Util.chart_bar_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, rqye_data, '融券余额(单位:万)', rqye_color_data, price_data, '股价');
|
1194
1218
|
let flow_data = [], color_data = [];
|
1195
1219
|
date_data = [];
|
1196
1220
|
j["flow_data"].forEach(function (item) {
|
1197
1221
|
if (item["value"] !== 0) {
|
1198
1222
|
date_data.push(item["date"]);
|
1199
|
-
flow_data.push(item["value"]);
|
1223
|
+
flow_data.push(Util.to_ten_thousand(item["value"], 2));
|
1200
1224
|
color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
|
1201
1225
|
}
|
1202
1226
|
});
|
1203
|
-
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);
|
1204
|
-
Stock["rqye_chart"] = Util.multi_axis_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, '融券余额', rqye_data, '股价', price_data);
|
1227
|
+
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);
|
1205
1228
|
Util.hide_tips();
|
1206
1229
|
});
|
1207
1230
|
},
|
package/util.js
CHANGED
@@ -3765,17 +3765,18 @@ const Util = {
|
|
3765
3765
|
return chart_instance;
|
3766
3766
|
},
|
3767
3767
|
|
3768
|
-
|
3768
|
+
/**
|
3769
|
+
* 线柱图表
|
3770
|
+
* https://www.chartjs.org/samples/latest/charts/combo-bar-line.html
|
3771
|
+
*/
|
3769
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) {
|
3770
3773
|
if (!chart_instance) {
|
3771
3774
|
chart_instance = Util.init_chart_instance(element_id);
|
3772
3775
|
}
|
3773
3776
|
chart_instance.clear();
|
3774
|
-
let low_bar_index = 0;
|
3775
|
-
let low_bar_value = 0;
|
3776
|
-
let max_bar_index = 0;
|
3777
|
-
let max_bar_value = 0;
|
3777
|
+
let low_bar_index = 0, low_bar_value = 0, max_bar_index = 0, max_bar_value = 0;
|
3778
3778
|
bar_data.forEach(function (bar_value, bar_index) {
|
3779
|
+
bar_value = parseFloat(bar_value);
|
3779
3780
|
if (low_bar_value === 0 || low_bar_value > bar_value) {
|
3780
3781
|
low_bar_value = bar_value;
|
3781
3782
|
low_bar_index = bar_index;
|