sbd-npm 1.3.42 → 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 +40 -22
- 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
@@ -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,7 +1155,7 @@ 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;
|
1155
1159
|
j["data"].forEach(function (item) {
|
1156
1160
|
if (rzye_low === 0 || item["rzye"] < rzye_low) {
|
1157
1161
|
rzye_low = item["rzye"];
|
@@ -1159,49 +1163,63 @@ let Stock = {
|
|
1159
1163
|
rzye_high = Math.max(rzye_high, item["rzye"]);
|
1160
1164
|
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
|
-
rqye_data.push(Util.
|
1166
|
+
rqye_data.push(Util.to_ten_thousand(item["rqye"], 2));
|
1163
1167
|
price_data.push(item["price"]);
|
1168
|
+
rqye_color_data.push("#E74C3C");
|
1164
1169
|
});
|
1165
|
-
let margin_summary = "";
|
1170
|
+
let margin_summary = "", rqye_summary = "";
|
1166
1171
|
if (j["latest"].length > 0) {
|
1167
1172
|
if (j["latest"].length === 1) {
|
1168
|
-
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);
|
1169
1175
|
} else if (j["latest"].length === 2) {
|
1170
|
-
let d1 = j["latest"][0];
|
1171
|
-
let
|
1172
|
-
|
1173
|
-
|
1174
|
-
if (
|
1175
|
-
|
1176
|
-
}
|
1177
|
-
|
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>)";
|
1178
1189
|
}
|
1179
|
-
|
1190
|
+
rqye_summary = " 最新融券余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rqye"], 3) + rqye_dist_tips;
|
1180
1191
|
}
|
1181
1192
|
}
|
1182
|
-
margin_summary = margin_summary + '
|
1183
|
-
if (j["
|
1184
|
-
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") + ')';
|
1185
1196
|
}
|
1186
|
-
if (j["
|
1187
|
-
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") + ')';
|
1188
1199
|
}
|
1189
1200
|
if (j["less_rate"]) {
|
1190
1201
|
margin_summary += ' 当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
|
1191
1202
|
}
|
1192
1203
|
$("#margin_summary").html(margin_summary);
|
1193
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, '股价');
|
1194
1213
|
let flow_data = [], color_data = [];
|
1195
1214
|
date_data = [];
|
1196
1215
|
j["flow_data"].forEach(function (item) {
|
1197
1216
|
if (item["value"] !== 0) {
|
1198
1217
|
date_data.push(item["date"]);
|
1199
|
-
flow_data.push(item["value"]);
|
1218
|
+
flow_data.push(Util.to_ten_thousand(item["value"], 2));
|
1200
1219
|
color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
|
1201
1220
|
}
|
1202
1221
|
});
|
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);
|
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);
|
1205
1223
|
Util.hide_tips();
|
1206
1224
|
});
|
1207
1225
|
},
|
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;
|