sbd-npm 1.2.11 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.11",
3
+ "version": "1.2.14",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/sbd.css CHANGED
@@ -64,15 +64,16 @@ table a:hover, a.btn {
64
64
  }
65
65
 
66
66
  #loading_div {
67
- position:absolute;
68
- top:0;
69
- left:0;
70
- right:0;
71
- bottom:0;
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ right: 0;
71
+ bottom: 0;
72
72
  height: 100px;
73
73
  text-align: center;
74
- margin-top: 200px;
74
+ margin-top: 300px;
75
75
  }
76
+
76
77
  #loading_div .circle {
77
78
  margin: 20px;
78
79
  height: 50px;
@@ -83,6 +84,7 @@ table a:hover, a.btn {
83
84
  transform: scale(0);
84
85
  animation: bulge 2s infinite ease-in-out;
85
86
  }
87
+
86
88
  #loading_div .circle::after {
87
89
  position: absolute;
88
90
  display: inline-block;
@@ -97,20 +99,25 @@ table a:hover, a.btn {
97
99
  transform: scale(1);
98
100
  animation: blow 2s infinite ease-in-out;
99
101
  }
102
+
100
103
  #loading_div .circle:nth-child(1) {
101
104
  animation-delay: 0s;
102
105
  }
106
+
103
107
  #loading_div .circle:nth-child(2) {
104
108
  animation-delay: .25s;
105
109
  }
110
+
106
111
  #loading_div .circle:nth-child(3) {
107
112
  animation-delay: .50s;
108
113
  }
114
+
109
115
  @keyframes bulge {
110
116
  50% {
111
117
  transform: scale(1);
112
118
  }
113
119
  }
120
+
114
121
  @keyframes blow {
115
122
  25% {
116
123
  opacity: 0.5;
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,33 @@ let Stock = {
1248
1245
  volume_data.push(item["volume"]);
1249
1246
  price_data.push(item["price"]);
1250
1247
  });
1251
- if (!Stock.hkex_holding_chart && 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>)";
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> 流通股, ";
1267
1271
  }
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> 流通股, ";
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") + ')');
1271
1274
  }
1272
- let hhs_obj = $("#hkex_holding_summary");
1273
- let hkex_holding_summary = hhs_obj.text();
1274
- hkex_holding_summary = '[<a target="_blank" rel="noopener noreferrer nofollow" class="link_cls" href="' + j["url"] + '">' +
1275
- hkex_holding_summary + "</a>]" + latest_html + ' 最高: ' + Util.to_unit(j["high"]["volume"]) +
1276
- '股(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1277
- ') 最低: ' + Util.to_unit(j["low"]["volume"]) + '股(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1278
1275
  hhs_obj.html(hkex_holding_summary);
1279
1276
  }
1280
1277
  Stock["hkex_holding_chart"] = Util.multi_axis_line(Stock["hkex_holding_chart"], "hkex_holding_line_canvas", date_data, '持股数', volume_data, '股价', price_data);
package/util.js CHANGED
@@ -253,7 +253,7 @@ const Util = {
253
253
  let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : symbol);
254
254
  html.push("<td>", Util.snowball_url(symbol), "</td>");
255
255
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
256
- html.push("<td>", (item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), "</td>");
256
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
257
257
  html.push("<td>", (item["market_capital"] ? (Util.to_float(item["market_capital"], 2) + "亿") : "--"), "</td>");
258
258
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
259
259
  html.push("<td>", Util.map_url((item["province_city"] && item["province_city"] !== "None") ? item["province_city"] : item["area"]), "</td>");
@@ -445,7 +445,7 @@ const Util = {
445
445
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
446
446
  html.push("<td class='hk_industry'>", item["industry"], "</td>");
447
447
  html.push("<td>", Util.map_url(item["province_city"]), "</td>");
448
- html.push("<td>", item["pe"], "</td>");
448
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
449
449
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
450
450
  html.push("<td>", market_capital_hkd, "亿(", market_capital_cny, "亿)</td>");
451
451
  html.push("<td>", item["chairman"], "</td>");
@@ -470,7 +470,7 @@ const Util = {
470
470
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
471
471
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
472
472
  html.push("<td>", Util.map_url(item["registered"]), "</td>");
473
- html.push("<td>", item["pe"], "</td>");
473
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
474
474
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
475
475
  html.push("<td>", Util.to_float(item["market_capital"], 3), "亿</td>");
476
476
  html.push("<td class='price_", item["code"].toLowerCase(), "'>", item["price"], "</td>");
@@ -1213,7 +1213,7 @@ const Util = {
1213
1213
  * @param element_id
1214
1214
  * @param profile
1215
1215
  */
1216
- init_profile_component: function(element_id, profile) {
1216
+ init_profile_component: function (element_id, profile) {
1217
1217
  if (profile && profile.length > 0) {
1218
1218
  let modal_id = element_id + "_modal";
1219
1219
  Util.init_modal_skeleton(modal_id);
@@ -2300,7 +2300,7 @@ const Util = {
2300
2300
  * @param item
2301
2301
  * @returns {string}
2302
2302
  */
2303
- pack_snowball_follower: function(item) {
2303
+ pack_snowball_follower: function (item) {
2304
2304
  if (item["snowball_follower"] && item["snowball_follower"] > 0) {
2305
2305
  let snowball_follower_rank = Util.to_unit(item["snowball_follower"]) + "(" + item["snowball_follower_rank"] + ")";
2306
2306
  let market_type = Util.is_hk(item["code"]) ? "hk" : "cn";