sbd-npm 1.3.53 → 1.3.54

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 CHANGED
@@ -222,7 +222,7 @@ const MenuList = [
222
222
  'menu': [
223
223
  {'key': 'rank_bias', 'name': '乖离率', 'url': '/0x14256fa2d80b7c32da6b9e39aed8e9c22b4ac769'},
224
224
  {'key': 'rank_margin_minimum', 'name': '融资余额创新低', 'url': '/0xcfabc097f26a2b9156061ac8096deef2d49da143'},
225
- {'key': 'rank_profit', 'name': '净利润/营业收入', 'url': '/0xaf9a83a251b7e71a4f321f09e6fb440fd7df05a5'},
225
+ {'key': 'rank_profit', 'name': '净利润/营收', 'url': '/0xaf9a83a251b7e71a4f321f09e6fb440fd7df05a5'},
226
226
  {'key': 'rank_roe', 'name': 'ROE(净资产收益率)', 'url': '/0xf56c10bc9ecc1ffe40a03d491c4cd6e2ac16a5c3'},
227
227
  {'key': 'rank_dividend', 'name': '股息', 'url': '/0xa609ef96b486b6896875a0be3272833693adf290'},
228
228
  {'key': 'rank_circulation_stock', 'name': '流通股份', 'url': '/0x04db78762bb6665105a17d74e7319dfe021fc0e9'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.53",
3
+ "version": "1.3.54",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -170,7 +170,7 @@ let Stock = {
170
170
  location_obj.html(_html.join(""));
171
171
  }
172
172
  let cf_obj = $("#currency_funds");
173
- cf_obj.html(Util.strip_html(Util.to_unit(cf_obj.attr("title"))));
173
+ cf_obj.html(Util.to_unit(cf_obj.attr("title"), 2, 0));
174
174
  //获取股票详情数据
175
175
  Util.post("/stock/" + Stock["code"], {action: "code_detail"}, function (item) {
176
176
  Util.init_profile_component("profile", item["intro"]);
@@ -616,6 +616,8 @@ let Stock = {
616
616
  {"name": "净利同比", "tooltip": "(当前净利润 - 去年同期的净利润) / 去年同期的净利润 × 100%"},
617
617
  {"name": "净利环比", "tooltip": "(当前净利润 - 上一季度的净利润) / 上一季度的净利润 × 100%"},
618
618
  {"name": "扣非净利润"},
619
+ {"name": "扣净同比", "tooltip": "(当前扣非净利润 - 去年同期的扣非净利润) / 去年同期的扣非净利润 × 100%"},
620
+ {"name": "扣净环比", "tooltip": "(当前扣非净利润 - 上一季度的扣非净利润) / 上一季度的扣非净利润 × 100%"},
619
621
  ]
620
622
  });
621
623
  Util.post("/stock/" + Stock["code"], {action: "finance"}, function (j) {
@@ -704,14 +706,14 @@ let Stock = {
704
706
  _html.push("<td>", total_revenue, "</td>");
705
707
  let total_revenue_yoy_title = "", total_revenue_yoy_ratio = "--";
706
708
  if (item["yoy_total_revenue"]) {
707
- total_revenue_yoy_title = " title='" + Util.strip_html(Util.to_unit(item["yoy_total_revenue"])) + " - " + Util.strip_html(total_revenue) + "'";
709
+ total_revenue_yoy_title = " title='" + Util.to_unit(item["yoy_total_revenue"], 2, 0) + " - " + Util.strip_html(total_revenue) + "'";
708
710
  total_revenue_yoy_ratio = Util.to_float(((item["total_revenue"] - item["yoy_total_revenue"]) / item["yoy_total_revenue"]) * 100, 2);
709
711
  total_revenue_yoy_ratio = Util.parse_ratio(total_revenue_yoy_ratio);
710
712
  }
711
713
  _html.push("<td", total_revenue_yoy_title, ">", total_revenue_yoy_ratio, "</td>");
712
714
  let total_revenue_qoq_title = "", total_revenue_qoq_ratio = "--";
713
715
  if (item["qoq_total_revenue"]) {
714
- total_revenue_qoq_title = " title='" + Util.strip_html(Util.to_unit(item["qoq_total_revenue"])) + " - " + Util.strip_html(Util.to_unit(item["total_revenue_add"])) + "'";
716
+ total_revenue_qoq_title = " title='" + Util.to_unit(item["qoq_total_revenue"], 2, 0) + " - " + Util.to_unit(item["total_revenue_add"], 2, 0) + "'";
715
717
  total_revenue_qoq_ratio = Util.to_float(((item["total_revenue_add"] - item["qoq_total_revenue"]) / item["qoq_total_revenue"]) * 100, 2);
716
718
  total_revenue_qoq_ratio = Util.parse_ratio(total_revenue_qoq_ratio);
717
719
  }
@@ -720,19 +722,34 @@ let Stock = {
720
722
  _html.push("<td>", net_profit, "</td>");
721
723
  let net_profit_yoy_title = "", net_profit_yoy_ratio = "--";
722
724
  if (item["yoy_net_profit"]) {
723
- net_profit_yoy_title = " title='" + Util.strip_html(Util.to_unit(item["yoy_net_profit"])) + " - " + Util.strip_html(net_profit) + "'";
725
+ net_profit_yoy_title = " title='" + Util.to_unit(item["yoy_net_profit"], 2, 0) + " - " + Util.strip_html(net_profit) + "'";
724
726
  net_profit_yoy_ratio = Util.to_float(((item["net_profit"] - item["yoy_net_profit"]) / item["yoy_net_profit"]) * 100, 2);
725
727
  net_profit_yoy_ratio = Util.parse_ratio(net_profit_yoy_ratio);
726
728
  }
727
729
  _html.push("<td", net_profit_yoy_title, ">", net_profit_yoy_ratio, "</td>");
728
730
  let net_profit_qoq_title = "", net_profit_qoq_ratio = "--";
729
731
  if (item["qoq_net_profit"]) {
730
- net_profit_qoq_title = " title='" + Util.strip_html(Util.to_unit(item["qoq_net_profit"])) + " - " + Util.strip_html(Util.to_unit(item["net_profit_add"])) + "'";
732
+ net_profit_qoq_title = " title='" + Util.to_unit(item["qoq_net_profit"], 2, 0) + " - " + Util.to_unit(item["net_profit_add"], 2, 0) + "'";
731
733
  net_profit_qoq_ratio = Util.to_float(((item["net_profit_add"] - item["qoq_net_profit"]) / item["qoq_net_profit"]) * 100, 2);
732
734
  net_profit_qoq_ratio = Util.parse_ratio(net_profit_qoq_ratio);
733
735
  }
734
736
  _html.push("<td", net_profit_qoq_title, ">", net_profit_qoq_ratio, "</td>");
735
- _html.push("<td>", Util.to_unit(item["adjusted_net_profit"], 3), "</td>");
737
+ let adjusted_net_profit = Util.to_unit(item["adjusted_net_profit"], 3);
738
+ _html.push("<td>", adjusted_net_profit, "</td>");
739
+ let adjusted_net_profit_yoy_title = "", adjusted_net_profit_yoy_ratio = "--";
740
+ if (item["yoy_adjusted_net_profit"]) {
741
+ adjusted_net_profit_yoy_title = " title='" + Util.to_unit(item["yoy_adjusted_net_profit"], 2, 0) + " - " + Util.strip_html(adjusted_net_profit) + "'";
742
+ adjusted_net_profit_yoy_ratio = Util.to_float(((item["adjusted_net_profit"] - item["yoy_adjusted_net_profit"]) / item["yoy_adjusted_net_profit"]) * 100, 2);
743
+ adjusted_net_profit_yoy_ratio = Util.parse_ratio(adjusted_net_profit_yoy_ratio);
744
+ }
745
+ _html.push("<td", adjusted_net_profit_yoy_title, ">", adjusted_net_profit_yoy_ratio, "</td>");
746
+ let adjusted_net_profit_qoq_title = "", adjusted_net_profit_qoq_ratio = "--";
747
+ if (item["qoq_adjusted_net_profit"]) {
748
+ adjusted_net_profit_qoq_title = " title='" + Util.to_unit(item["qoq_adjusted_net_profit"], 2, 0) + " - " + Util.to_unit(item["adjusted_net_profit_add"], 2, 0) + "'";
749
+ adjusted_net_profit_qoq_ratio = Util.to_float(((item["adjusted_net_profit_add"] - item["qoq_adjusted_net_profit"]) / item["qoq_adjusted_net_profit"]) * 100, 2);
750
+ adjusted_net_profit_qoq_ratio = Util.parse_ratio(adjusted_net_profit_qoq_ratio);
751
+ }
752
+ _html.push("<td", adjusted_net_profit_qoq_title, ">", adjusted_net_profit_qoq_ratio, "</td>");
736
753
  _html.push("</tr>");
737
754
  }
738
755
  });
@@ -1209,38 +1226,38 @@ let Stock = {
1209
1226
  let d1 = j["latest"][0], d2 = j["latest"][1], rzye_dist_tips = "", rqye_dist_tips = "";
1210
1227
  let rzye_difference = d1["rzye"] - d2["rzye"];
1211
1228
  if (rzye_difference > 0) {
1212
- 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>)";
1229
+ rzye_dist_tips = "(<b title='" + Util.to_unit(d2["rzye"], 3, 0) + "' style='color: #a94442;'>+" + Util.to_unit(rzye_difference, 3, 0) + "</b>)";
1213
1230
  } else if (rzye_difference < 0) {
1214
- 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>)";
1231
+ rzye_dist_tips = "(<b title='" + Util.to_unit(d2["rzye"], 3, 0) + "' style='color: #3c763d;'>" + Util.to_unit(rzye_difference, 3, 0) + "</b>)";
1215
1232
  }
1216
1233
  margin_summary = " 最新融资余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + rzye_dist_tips;
1217
1234
  let rqye_difference = d1["rqye"] - d2["rqye"];
1218
1235
  if (rqye_difference > 0) {
1219
- 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>)";
1236
+ rqye_dist_tips = "(<b title='" + Util.to_unit(d2["rqye"], 3, 0) + "' style='color: #a94442;'>+" + Util.to_unit(rqye_difference, 3, 0) + "</b>)";
1220
1237
  } else if (rqye_difference < 0) {
1221
- 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>)";
1238
+ rqye_dist_tips = "(<b title='" + Util.to_unit(d2["rqye"], 3, 0) + "' style='color: #3c763d;'>" + Util.to_unit(rqye_difference, 3, 0) + "</b>)";
1222
1239
  }
1223
1240
  rqye_summary = " 最新融券余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rqye"], 3) + rqye_dist_tips;
1224
1241
  }
1225
1242
  }
1226
- 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>";
1243
+ margin_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(rzye_high, 3, 0) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(rzye_low, 3, 0) + "</span>";
1227
1244
  if (j["rzye_high"] && j["rzye_high"]["date"] && j["rzye_high"]["date"] > 0) {
1228
- 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") + ')';
1245
+ margin_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["rzye_high"]["rzye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rzye_high"]["date"], "%Y-%m-%d") + ')';
1229
1246
  }
1230
1247
  if (j["rzye_low"] && j["rzye_low"]["date"] && j["rzye_low"]["date"] > 0) {
1231
- 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") + ')';
1248
+ margin_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["rzye_low"]["rzye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rzye_low"]["date"], "%Y-%m-%d") + ')';
1232
1249
  }
1233
1250
  if (j["less_rate"]) {
1234
1251
  margin_summary += '&nbsp;&nbsp;当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
1235
1252
  }
1236
1253
  $("#margin_summary").html(margin_summary);
1237
1254
  Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
1238
- 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>";
1255
+ rqye_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(rqye_high, 3, 0) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(rqye_low, 3, 0) + "</span>";
1239
1256
  if (j["rqye_high"] && j["rqye_high"]["date"] && j["rqye_high"]["date"] > 0) {
1240
- 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") + ')';
1257
+ rqye_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["rqye_high"]["rqye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rqye_high"]["date"], "%Y-%m-%d") + ')';
1241
1258
  }
1242
1259
  if (j["rqye_low"] && j["rqye_low"]["date"] && j["rqye_low"]["date"] > 0) {
1243
- 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") + ')';
1260
+ rqye_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["rqye_low"]["rqye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rqye_low"]["date"], "%Y-%m-%d") + ')';
1244
1261
  }
1245
1262
  $("#rqye_summary").html(" [" + rqye_summary + " ]");
1246
1263
  Stock["rqye_chart"] = Util.chart_bar_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, rqye_data, '融券余额(单位:万)', rqye_color_data, price_data, '股价');
@@ -1283,14 +1300,14 @@ let Stock = {
1283
1300
  let d2 = j["latest"][1];
1284
1301
  let difference = d1["volume"] - d2["volume"];
1285
1302
  if (difference > 0) {
1286
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1303
+ dist_tips = "(<b title='" + Util.to_unit(d2["volume"], 2, 0) + "股' style='color: #a94442;'>+" + Util.to_unit(difference, 2, 0) + "股</b>)";
1287
1304
  } else if (difference < 0) {
1288
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["volume"])) + "股' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference)) + "股</b>)";
1305
+ dist_tips = "(<b title='" + Util.to_unit(d2["volume"], 2, 0) + "股' style='color: #3c763d;'>" + Util.to_unit(difference, 2, 0) + "股</b>)";
1289
1306
  }
1290
1307
  }
1291
1308
  latest_html += dist_tips + ", 占 <span style='color: #FFF;' class='label label-info'>" + j["latest"][0]["ratio"] + "%</span> 流通股, ";
1292
- 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") +
1293
- ') 最低: <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") + ')');
1309
+ hkex_holding_summary += (latest_html + ' 最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["high"]["volume"], 2, 0) + '股</span>(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1310
+ ') 最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["low"]["volume"], 2, 0) + '股</span>(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
1294
1311
  }
1295
1312
  $("#hkex_holding_summary").html(hkex_holding_summary);
1296
1313
  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
@@ -3207,13 +3207,22 @@ const Util = {
3207
3207
  * 转为相应单位的数值
3208
3208
  * @param digit
3209
3209
  * @param fraction
3210
+ * @param is_tips
3210
3211
  * @returns {*|number}
3211
3212
  */
3212
- to_unit: function (digit, fraction = 2) {
3213
+ to_unit: function (digit, fraction = 2, is_tips = 1) {
3213
3214
  if (digit >= 100000000 || digit <= -100000000) {
3214
- return "<span title='" + digit + "'>" + Util.to_float(digit / 100000000, fraction) + "亿</span>";
3215
+ if (is_tips === 1) {
3216
+ return "<span title='" + digit + "'>" + Util.to_float(digit / 100000000, fraction) + "亿</span>";
3217
+ } else {
3218
+ return Util.to_float(digit / 100000000, fraction) + "亿";
3219
+ }
3215
3220
  } else if (digit >= 10000 || digit <= -10000) {
3216
- return "<span title='" + digit + "'>" + Util.to_float(digit / 10000, fraction) + "万</span>";
3221
+ if (is_tips === 1) {
3222
+ return "<span title='" + digit + "'>" + Util.to_float(digit / 10000, fraction) + "万</span>";
3223
+ } else {
3224
+ return Util.to_float(digit / 10000, fraction) + "万";
3225
+ }
3217
3226
  }
3218
3227
  if (Util.is_float(digit)) {
3219
3228
  return Util.to_float(digit, fraction);