sbd-npm 1.3.17 → 1.3.18
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/package.json +1 -1
- package/stock_basics.js +73 -18
package/package.json
CHANGED
package/stock_basics.js
CHANGED
@@ -1183,43 +1183,98 @@ let Stock = {
|
|
1183
1183
|
volume_data.push(item["volume"]);
|
1184
1184
|
price_data.push(item["price"]);
|
1185
1185
|
});
|
1186
|
-
let
|
1187
|
-
let hkex_holding_summary = "[" + Util.pack_html_link(j["url"], hhs_obj.text()) + "]";
|
1186
|
+
let hkex_holding_summary = "[" + Util.pack_html_link(j["url"] + "&code=" + Stock["code"] + "&name=" + Stock["name"], Stock["name"]) + "]";
|
1188
1187
|
if (j["latest"].length > 0) {
|
1189
|
-
let
|
1190
|
-
let
|
1191
|
-
if (j["latest"].length ===
|
1192
|
-
let holding_num = Util.to_hundred_million(j["latest"][0]["volume"], 4);
|
1193
|
-
let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
|
1194
|
-
latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + holding_num + "亿股, 占 <b>" + holding_rate + "%</b> 流通股, ";
|
1195
|
-
} else if (j["latest"].length === 2) {
|
1188
|
+
let latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): <span style='color: #FFF;' class='label label-info'>" + Util.to_hundred_million(j["latest"][0]["volume"], 4) + "</span>亿股";
|
1189
|
+
let dist_tips = "";
|
1190
|
+
if (j["latest"].length === 2) {
|
1196
1191
|
let d1 = j["latest"][0];
|
1197
1192
|
let d2 = j["latest"][1];
|
1198
1193
|
let difference = d1["volume"] - d2["volume"];
|
1199
|
-
let dist_tips = "";
|
1200
1194
|
if (difference > 0) {
|
1201
1195
|
dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
|
1202
1196
|
} else if (difference < 0) {
|
1203
1197
|
dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
|
1204
1198
|
}
|
1205
|
-
let holding_num = Util.to_hundred_million(d1["volume"], 4);
|
1206
|
-
let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
|
1207
|
-
latest_html = "最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + holding_num + "亿股" + dist_tips + ", 占 <b>" + holding_rate + "%</b> 流通股, ";
|
1208
1199
|
}
|
1209
|
-
|
1210
|
-
|
1200
|
+
latest_html += dist_tips + ", 占 <span style='color: #FFF;' class='label label-info'>" + j["latest"][0]["ratio"] + "%</span> 流通股, ";
|
1201
|
+
hkex_holding_summary += (latest_html + ' 最高: <span style="color: #FFF;" class="label label-danger">' + Util.strip_html(Util.to_unit(j["high"]["volume"])) + '股</span>(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
|
1202
|
+
') 最低: <span style="color: #FFF;" class="label label-success">' + Util.strip_html(Util.to_unit(j["low"]["volume"])) + '股</span>(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
|
1211
1203
|
}
|
1212
|
-
|
1204
|
+
$("#hkex_holding_summary").html(hkex_holding_summary);
|
1213
1205
|
Stock["hkex_holding_chart"] = Util.multi_axis_line(Stock["hkex_holding_chart"], "hkex_holding_line_canvas", date_data, '持股数', volume_data, '股价', price_data);
|
1214
|
-
let flow_data = [];
|
1206
|
+
let flow_data = [], color_data = [];
|
1215
1207
|
date_data = [];
|
1216
|
-
let color_data = [];
|
1217
1208
|
j["flow_data"].forEach(function (item) {
|
1218
1209
|
date_data.push(item["date"]);
|
1219
1210
|
flow_data.push(item["value"]);
|
1220
1211
|
color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
|
1221
1212
|
});
|
1222
1213
|
Stock["hkex_holding_month_flow_chart"] = Util.chart_basic_bar(Stock["hkex_holding_month_flow_chart"], "hkex_holding_month_flow_chart", date_data, flow_data, "增幅", color_data);
|
1214
|
+
if ($("#hkex_holding_modal_body").length === 0) {
|
1215
|
+
Stock.fetch_hkex_holding_modal();
|
1216
|
+
}
|
1217
|
+
Util.hide_tips();
|
1218
|
+
});
|
1219
|
+
},
|
1220
|
+
|
1221
|
+
fetch_hkex_holding_modal: function () {
|
1222
|
+
Util.init_modal_skeleton("hkex_holding_modal", '');
|
1223
|
+
$("#hkex_holding_modal_title").html("[" + Stock["name"] + "]港股通持股明细数据<span style='color: #BDBDBD;' id='hkex_holding_modal_summary'></span>");
|
1224
|
+
let hhm_obj = $('#hkex_holding_modal');
|
1225
|
+
hhm_obj.on('shown.bs.modal', function (e) {
|
1226
|
+
Util.init_table_skeleton({
|
1227
|
+
"element_id": "hkex_holding_modal_body",
|
1228
|
+
"caption": "none",
|
1229
|
+
"head_cols": [
|
1230
|
+
{"name": "日期", "class": "info", "table_sort": 1},
|
1231
|
+
{"name": "持股量(万股)", "table_sort": 1},
|
1232
|
+
{"name": "净买入股数", "table_sort": 1},
|
1233
|
+
{"name": "收盘价", "table_sort": 1},
|
1234
|
+
{"name": "涨跌", "table_sort": 1},
|
1235
|
+
{"name": "持股比例", "table_sort": 1, "title": "内地港股通账户持仓股数 / 流通股本数"},
|
1236
|
+
]
|
1237
|
+
});
|
1238
|
+
Util.post("/stock/{{ stock['code'] }}", {action: "hk_stock_exchange"}, function (j) {
|
1239
|
+
let _html = [];
|
1240
|
+
j["data"].forEach(function (item, index) {
|
1241
|
+
_html.push("<tr>");
|
1242
|
+
_html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
|
1243
|
+
_html.push("<td title='", item["volume"], "' data-val='", item["volume"], "'>", Util.to_ten_thousand(item["volume"], 4), "万股</td>");
|
1244
|
+
let net_volume = "--", gap_volume = 0;
|
1245
|
+
if (j["data"][index + 1] && j["data"][index + 1]["volume"]) {
|
1246
|
+
gap_volume = item["volume"] - j["data"][index + 1]["volume"];
|
1247
|
+
if (gap_volume > 0) {
|
1248
|
+
net_volume = "<b class='text-danger'>+" + Util.to_ten_thousand(gap_volume, 4) + "万股</b>";
|
1249
|
+
} else if (gap_volume < 0) {
|
1250
|
+
net_volume = "<b class='text-success'>" + Util.to_ten_thousand(gap_volume, 4) + "万股</b>";
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
_html.push("<td data-val='", gap_volume, "'>", net_volume, "</td>");
|
1254
|
+
let text_color = Util.text_color(item["p_change"]);
|
1255
|
+
_html.push("<td><b class='", text_color, "'>", item["close"], "</b></td>");
|
1256
|
+
item["p_change"] = item["p_change"] > 0 ? ("+" + item["p_change"]) : item["p_change"];
|
1257
|
+
_html.push("<td><b class='", text_color, "'>", item["p_change"], "%</b></td>");
|
1258
|
+
_html.push("<td>", item["ratio"], "%</td>");
|
1259
|
+
_html.push("</tr>");
|
1260
|
+
});
|
1261
|
+
if (j["data"].length > 1) {
|
1262
|
+
let hkex_holding_modal_summary = " (当前最新的持股比例<b class='text-info'>(" + j["data"][0]["ratio"] + "%)</b>";
|
1263
|
+
let gap_volume = j["data"][0]["volume"] - j["data"][1]["volume"];
|
1264
|
+
if (gap_volume > 0) {
|
1265
|
+
hkex_holding_modal_summary += "相对于前一天持股增加 <b class='text-danger'>+" + Util.to_ten_thousand(gap_volume) + "万股</b>";
|
1266
|
+
} else if (gap_volume < 0) {
|
1267
|
+
hkex_holding_modal_summary += "相对于前一天持股减少 <b class='text-success'>" + Util.to_ten_thousand(gap_volume) + "万股</b>";
|
1268
|
+
}
|
1269
|
+
hkex_holding_modal_summary += ")";
|
1270
|
+
$("#hkex_holding_modal_summary").html(hkex_holding_modal_summary);
|
1271
|
+
}
|
1272
|
+
Util.render_table_html("hkex_holding_modal_body_body", _html);
|
1273
|
+
Util.hide_tips();
|
1274
|
+
});
|
1275
|
+
});
|
1276
|
+
hhm_obj.on('hidden.bs.modal', function () {
|
1277
|
+
$("#hkex_holding_modal_body").html("Loading...");
|
1223
1278
|
Util.hide_tips();
|
1224
1279
|
});
|
1225
1280
|
},
|