sbd-npm 1.2.13 → 1.2.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/stock_basics.js +27 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -1226,11 +1226,8 @@ let Stock = {
1226
1226
  },
1227
1227
 
1228
1228
  fetch_hkex_holding: function () {
1229
+ let is_summary = Stock.hkex_holding_chart ? 0 : 1;
1229
1230
  Stock["hkex_holding_chart"] = Util.show_chart_loading(Stock["hkex_holding_chart"], "hkex_holding_line_canvas");
1230
- let is_summary = 0;
1231
- if (!Stock.hkex_holding_chart) {
1232
- is_summary = 1;
1233
- }
1234
1231
  let payload = {
1235
1232
  action: "hkex_holding",
1236
1233
  is_summary: is_summary,
@@ -1248,33 +1245,35 @@ let Stock = {
1248
1245
  volume_data.push(item["volume"]);
1249
1246
  price_data.push(item["price"]);
1250
1247
  });
1251
- let hhs_obj = $("#hkex_holding_summary");
1252
- let hkex_holding_summary = "[" + Util.pack_html_link(j["url"], hhs_obj.text()) + "]";
1253
- if (!Stock.hkex_holding_chart && j["latest"].length > 0) {
1254
- let circulation_stock = $("#circulation_stock").attr("data-val");
1255
- let latest_html = "";
1256
- if (j["latest"].length === 1) {
1257
- let holding_num = Util.to_hundred_million(j["latest"][0]["volume"]);
1258
- let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1259
- latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + holding_num + "亿股, 占 <b>" + holding_rate + "%</b> 流通股, ";
1260
- } else if (j["latest"].length === 2) {
1261
- let d1 = j["latest"][0];
1262
- let d2 = j["latest"][1];
1263
- let difference = d1["volume"] - d2["volume"];
1264
- let dist_tips = "";
1265
- if (difference > 0) {
1266
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1267
- } else if (difference < 0) {
1268
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1248
+ if (is_summary === 1) {
1249
+ let hhs_obj = $("#hkex_holding_summary");
1250
+ let hkex_holding_summary = "[" + Util.pack_html_link(j["url"], hhs_obj.text()) + "]";
1251
+ if (j["latest"].length > 0) {
1252
+ let circulation_stock = $("#circulation_stock").attr("data-val");
1253
+ let latest_html = "";
1254
+ if (j["latest"].length === 1) {
1255
+ let holding_num = Util.to_hundred_million(j["latest"][0]["volume"]);
1256
+ let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1257
+ latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + holding_num + "亿股, 占 <b>" + holding_rate + "%</b> 流通股, ";
1258
+ } else if (j["latest"].length === 2) {
1259
+ let d1 = j["latest"][0];
1260
+ let d2 = j["latest"][1];
1261
+ let difference = d1["volume"] - d2["volume"];
1262
+ let dist_tips = "";
1263
+ if (difference > 0) {
1264
+ dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1265
+ } else if (difference < 0) {
1266
+ dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1267
+ }
1268
+ let holding_num = Util.to_hundred_million(d1["volume"]);
1269
+ let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1270
+ latest_html = "最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + holding_num + "亿股" + dist_tips + ", 占 <b>" + holding_rate + "%</b> 流通股, ";
1269
1271
  }
1270
- let holding_num = Util.to_hundred_million(d1["volume"]);
1271
- let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1272
- latest_html = "最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + holding_num + "亿股" + dist_tips + ", 占 <b>" + holding_rate + "%</b> 流通股, ";
1272
+ hkex_holding_summary += (latest_html + ' 最高: ' + Util.to_unit(j["high"]["volume"]) + '股(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1273
+ ') 最低: ' + Util.to_unit(j["low"]["volume"]) + '股(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
1273
1274
  }
1274
- hkex_holding_summary += (latest_html + ' 最高: ' + Util.to_unit(j["high"]["volume"]) + '股(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1275
- ') 最低: ' + Util.to_unit(j["low"]["volume"]) + '股(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
1275
+ hhs_obj.html(hkex_holding_summary);
1276
1276
  }
1277
- hhs_obj.html(hkex_holding_summary);
1278
1277
  Stock["hkex_holding_chart"] = Util.multi_axis_line(Stock["hkex_holding_chart"], "hkex_holding_line_canvas", date_data, '持股数', volume_data, '股价', price_data);
1279
1278
  let flow_data = [];
1280
1279
  date_data = [];