sbd-npm 1.3.41 → 1.3.42

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 (3) hide show
  1. package/package.json +1 -1
  2. package/stock_basics.js +18 -10
  3. package/util.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.41",
3
+ "version": "1.3.42",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -514,20 +514,28 @@ let Stock = {
514
514
  pre_circulation_volume += item["volume"];
515
515
  }
516
516
  });
517
- if (circulation_volume > 0 && pre_circulation_volume > 0) {
518
- let price_tips = "";
517
+ let circulation_tips = "", main_tips = "";
518
+ if (circulation_volume > 0) {
519
+ circulation_tips += " [ 当前十大流通股东总持股数: <span class='label label-info'>" + Util.to_unit(circulation_volume, 3) + "</span>";
520
+ if (pre_circulation_volume > 0) {
521
+ circulation_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
522
+ circulation_tips += " 持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
523
+ }
519
524
  if (j["date_price"]) {
520
- price_tips = ", 当时价: " + Util.digit_compare_trend1(Stock["price"], j["date_price"]);
525
+ circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock["price"], j["date_price"]);
521
526
  }
522
- $("#circulation_holder_tips").html("(持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume) + price_tips + ")");
523
- } else {
524
- $("#circulation_holder_tips").html("");
527
+ circulation_tips += " ]";
525
528
  }
526
- if (main_volume > 0 && pre_main_volume > 0) {
527
- $("#main_holder_tips").html("(持股数环比: " + Util.year_price_rate(main_volume, pre_main_volume) + ")");
528
- } else {
529
- $("#main_holder_tips").html("");
529
+ $("#circulation_holder_tips").html(circulation_tips);
530
+ if (main_volume > 0) {
531
+ main_tips += " [ 当前十大主要股东总持股数: <span class='label label-info'>" + Util.to_unit(main_volume, 3) + "</span>";
532
+ if (pre_main_volume > 0) {
533
+ main_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_main_volume, 3) + "</span>,";
534
+ main_tips += " 持股数环比: " + Util.year_price_rate(main_volume, pre_main_volume, 1);
535
+ }
536
+ main_tips += " ]";
530
537
  }
538
+ $("#main_holder_tips").html(main_tips);
531
539
  let symbol = Util.code_to_symbol(Stock.code);
532
540
  Util.render_table_html("circulation_holder_table_body", circulation_html);
533
541
  $("#circulation_holder_url").attr("href", "https://xueqiu.com/snowman/S/" + symbol + "/detail#/LTGD");
package/util.js CHANGED
@@ -2789,21 +2789,25 @@ const Util = {
2789
2789
  * 年初至今的价格幅度
2790
2790
  * @param price
2791
2791
  * @param year_price
2792
+ * @param is_plus 正数是否有加号,1是0否
2792
2793
  * @returns {string}
2793
2794
  */
2794
- year_price_rate: function (price, year_price) {
2795
- let cls = "", rate_val = 0;
2795
+ year_price_rate: function (price, year_price, is_plus = 0) {
2796
+ let cls = "", plus_sign = "", rate_val = 0;
2796
2797
  if (price > 0 && year_price > 0) {
2797
2798
  if (price > year_price) {
2798
2799
  cls = "text-danger";
2799
2800
  rate_val = Math.round(((price - year_price) / year_price) * 10000) / 100;
2801
+ if (is_plus === 1) {
2802
+ plus_sign = "+";
2803
+ }
2800
2804
  } else if (price < year_price) {
2801
2805
  cls = "text-success";
2802
2806
  rate_val = Math.round(((year_price - price) / year_price) * 10000) / 100;
2803
2807
  rate_val = -rate_val
2804
2808
  }
2805
2809
  }
2806
- return "<b title='" + (year_price + " - " + price) + "' class='" + cls + "'>" + rate_val + "%</b>";
2810
+ return "<b title='" + (year_price + " - " + price) + "' class='" + cls + "'>" + plus_sign + rate_val + "%</b>";
2807
2811
  },
2808
2812
 
2809
2813
  /**