sbd-npm 1.3.52 → 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.52",
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) {
@@ -700,13 +702,54 @@ let Stock = {
700
702
  _html.push("<td>", Util.to_float(item["gross_profit_rate"], 2), "%</td>");
701
703
  _html.push("<td>", Util.to_float(item["eps"], 2), "元</td>");
702
704
  _html.push("<td>", item["roe"], "%</td>");
703
- _html.push("<td>", Util.to_unit(item["total_revenue"], 3), "</td>");
704
- _html.push("<td>", (item["total_revenue_yoy"] ? Util.parse_ratio(item["total_revenue_yoy"]) : "--"), "</td>");
705
- _html.push("<td>", (item["total_revenue_qoq"] ? Util.parse_ratio(item["total_revenue_qoq"]) : "--"), "</td>");
706
- _html.push("<td>", Util.to_unit(item["net_profit"], 3), "</td>");
707
- _html.push("<td>", (item["net_profit_yoy"] ? Util.parse_ratio(item["net_profit_yoy"]) : "--"), "</td>");
708
- _html.push("<td>", (item["net_profit_qoq"] ? Util.parse_ratio(item["net_profit_qoq"]) : "--"), "</td>");
709
- _html.push("<td>", Util.to_unit(item["adjusted_net_profit"], 3), "</td>");
705
+ let total_revenue = Util.to_unit(item["total_revenue"], 3);
706
+ _html.push("<td>", total_revenue, "</td>");
707
+ let total_revenue_yoy_title = "", total_revenue_yoy_ratio = "--";
708
+ if (item["yoy_total_revenue"]) {
709
+ total_revenue_yoy_title = " title='" + Util.to_unit(item["yoy_total_revenue"], 2, 0) + " - " + Util.strip_html(total_revenue) + "'";
710
+ total_revenue_yoy_ratio = Util.to_float(((item["total_revenue"] - item["yoy_total_revenue"]) / item["yoy_total_revenue"]) * 100, 2);
711
+ total_revenue_yoy_ratio = Util.parse_ratio(total_revenue_yoy_ratio);
712
+ }
713
+ _html.push("<td", total_revenue_yoy_title, ">", total_revenue_yoy_ratio, "</td>");
714
+ let total_revenue_qoq_title = "", total_revenue_qoq_ratio = "--";
715
+ if (item["qoq_total_revenue"]) {
716
+ total_revenue_qoq_title = " title='" + Util.to_unit(item["qoq_total_revenue"], 2, 0) + " - " + Util.to_unit(item["total_revenue_add"], 2, 0) + "'";
717
+ total_revenue_qoq_ratio = Util.to_float(((item["total_revenue_add"] - item["qoq_total_revenue"]) / item["qoq_total_revenue"]) * 100, 2);
718
+ total_revenue_qoq_ratio = Util.parse_ratio(total_revenue_qoq_ratio);
719
+ }
720
+ _html.push("<td", total_revenue_qoq_title, ">", total_revenue_qoq_ratio, "</td>");
721
+ let net_profit = Util.to_unit(item["net_profit"], 3);
722
+ _html.push("<td>", net_profit, "</td>");
723
+ let net_profit_yoy_title = "", net_profit_yoy_ratio = "--";
724
+ if (item["yoy_net_profit"]) {
725
+ net_profit_yoy_title = " title='" + Util.to_unit(item["yoy_net_profit"], 2, 0) + " - " + Util.strip_html(net_profit) + "'";
726
+ net_profit_yoy_ratio = Util.to_float(((item["net_profit"] - item["yoy_net_profit"]) / item["yoy_net_profit"]) * 100, 2);
727
+ net_profit_yoy_ratio = Util.parse_ratio(net_profit_yoy_ratio);
728
+ }
729
+ _html.push("<td", net_profit_yoy_title, ">", net_profit_yoy_ratio, "</td>");
730
+ let net_profit_qoq_title = "", net_profit_qoq_ratio = "--";
731
+ if (item["qoq_net_profit"]) {
732
+ net_profit_qoq_title = " title='" + Util.to_unit(item["qoq_net_profit"], 2, 0) + " - " + Util.to_unit(item["net_profit_add"], 2, 0) + "'";
733
+ net_profit_qoq_ratio = Util.to_float(((item["net_profit_add"] - item["qoq_net_profit"]) / item["qoq_net_profit"]) * 100, 2);
734
+ net_profit_qoq_ratio = Util.parse_ratio(net_profit_qoq_ratio);
735
+ }
736
+ _html.push("<td", net_profit_qoq_title, ">", net_profit_qoq_ratio, "</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>");
710
753
  _html.push("</tr>");
711
754
  }
712
755
  });
@@ -1183,38 +1226,38 @@ let Stock = {
1183
1226
  let d1 = j["latest"][0], d2 = j["latest"][1], rzye_dist_tips = "", rqye_dist_tips = "";
1184
1227
  let rzye_difference = d1["rzye"] - d2["rzye"];
1185
1228
  if (rzye_difference > 0) {
1186
- 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>)";
1187
1230
  } else if (rzye_difference < 0) {
1188
- 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>)";
1189
1232
  }
1190
1233
  margin_summary = " 最新融资余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + rzye_dist_tips;
1191
1234
  let rqye_difference = d1["rqye"] - d2["rqye"];
1192
1235
  if (rqye_difference > 0) {
1193
- 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>)";
1194
1237
  } else if (rqye_difference < 0) {
1195
- 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>)";
1196
1239
  }
1197
1240
  rqye_summary = " 最新融券余额(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rqye"], 3) + rqye_dist_tips;
1198
1241
  }
1199
1242
  }
1200
- 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>";
1201
1244
  if (j["rzye_high"] && j["rzye_high"]["date"] && j["rzye_high"]["date"] > 0) {
1202
- 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") + ')';
1203
1246
  }
1204
1247
  if (j["rzye_low"] && j["rzye_low"]["date"] && j["rzye_low"]["date"] > 0) {
1205
- 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") + ')';
1206
1249
  }
1207
1250
  if (j["less_rate"]) {
1208
1251
  margin_summary += '&nbsp;&nbsp;当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
1209
1252
  }
1210
1253
  $("#margin_summary").html(margin_summary);
1211
1254
  Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
1212
- 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>";
1213
1256
  if (j["rqye_high"] && j["rqye_high"]["date"] && j["rqye_high"]["date"] > 0) {
1214
- 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") + ')';
1215
1258
  }
1216
1259
  if (j["rqye_low"] && j["rqye_low"]["date"] && j["rqye_low"]["date"] > 0) {
1217
- 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") + ')';
1218
1261
  }
1219
1262
  $("#rqye_summary").html(" [" + rqye_summary + " ]");
1220
1263
  Stock["rqye_chart"] = Util.chart_bar_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, rqye_data, '融券余额(单位:万)', rqye_color_data, price_data, '股价');
@@ -1257,14 +1300,14 @@ let Stock = {
1257
1300
  let d2 = j["latest"][1];
1258
1301
  let difference = d1["volume"] - d2["volume"];
1259
1302
  if (difference > 0) {
1260
- 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>)";
1261
1304
  } else if (difference < 0) {
1262
- 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>)";
1263
1306
  }
1264
1307
  }
1265
1308
  latest_html += dist_tips + ", 占 <span style='color: #FFF;' class='label label-info'>" + j["latest"][0]["ratio"] + "%</span> 流通股, ";
1266
- 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") +
1267
- ') 最低: <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") + ')');
1268
1311
  }
1269
1312
  $("#hkex_holding_summary").html(hkex_holding_summary);
1270
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);