sbd-npm 1.5.28 → 1.5.29

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 +66 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.28",
3
+ "version": "1.5.29",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/stock_basics.js CHANGED
@@ -47,7 +47,7 @@ let Stock = {
47
47
  Stock.fetch_bias_data();
48
48
  break;
49
49
  case "holder_top":
50
- Stock.fetch_holder_top();
50
+ Stock.fetch_top_holder();
51
51
  break;
52
52
  case "holder_data":
53
53
  Stock.fetch_holder_num_data();
@@ -473,32 +473,35 @@ let Stock = {
473
473
  }
474
474
  },
475
475
 
476
- fetch_holder_top: function () {
476
+ fetch_top_holder: function () {
477
477
  Util.show_loading();
478
- Util.init_table_skeleton({
479
- "element_id": "circulation_holder_table",
480
- "head_columns": [
481
- {"name": "排名", "table_sort": 1},
482
- {"name": "股东名"},
483
- {"name": "持股数"},
484
- {"name": "持股市值"},
485
- {"name": "持股比例"},
486
- {"name": "变化"},
487
- ]
488
- });
489
- Util.init_table_skeleton({
490
- "element_id": "main_holder_table",
491
- "head_columns": [
492
- {"name": "排名", "table_sort": 1},
493
- {"name": "股东名"},
494
- {"name": "持股数"},
495
- {"name": "持股市值"},
496
- {"name": "持股比例"},
497
- {"name": "变化"},
498
- ]
499
- });
478
+ if (!document.getElementById("circulation_holder_table_body")) {
479
+ Util.init_table_skeleton({
480
+ "element_id": "circulation_holder_table",
481
+ "head_columns": [
482
+ {"name": "排名", "table_sort": 1},
483
+ {"name": "股东名"},
484
+ {"name": "持股数"},
485
+ {"name": "持股市值"},
486
+ {"name": "持股比例"},
487
+ {"name": "变化"},
488
+ ]
489
+ });
490
+ Util.init_table_skeleton({
491
+ "element_id": "main_holder_table",
492
+ "head_columns": [
493
+ {"name": "排名", "table_sort": 1},
494
+ {"name": "股东名"},
495
+ {"name": "持股数"},
496
+ {"name": "持股市值"},
497
+ {"name": "持股比例"},
498
+ {"name": "变化"},
499
+ ]
500
+ });
501
+ Stock.fetch_top_holder_modal();
502
+ }
500
503
  let payload = {action: "top_holder"};
501
- let date = $("#holder_top_date").val();
504
+ let date = $("#top_holder_date").val();
502
505
  if (date) {
503
506
  payload.date = date;
504
507
  }
@@ -549,19 +552,19 @@ let Stock = {
549
552
  });
550
553
  let circulation_tips = "", main_tips = "";
551
554
  if (circulation_volume > 0) {
552
- circulation_tips += "[十大流通股东总持股数: <span class='label label-info'>" + Util.to_unit(circulation_volume, 3) + "股</span>(总占流比:<b class='text-primary'>" + circulation_ratio + "%</b>)";
555
+ circulation_tips += "[十大流通股东总持股数: <span class='label label-info'>" + Util.to_unit(circulation_volume, 3) + "</span>(总占流比:<b class='text-primary'>" + Util.to_float(circulation_ratio, 2) + "%</b>)";
553
556
  if (pre_circulation_volume > 0) {
554
- circulation_tips += ",上一季度: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "股</span>,";
557
+ circulation_tips += ",上一季度: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
555
558
  circulation_tips += "持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
556
559
  }
557
560
  if (j.date_price) {
558
561
  circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock.price, j.date_price);
559
562
  }
560
- circulation_tips += "]";
563
+ circulation_tips += "] <a title='十大股东的季度持股分析' style='cursor: pointer' data-toggle='modal' data-target='.top_holder_modal'><i style='color: #000' class='glyphicon glyphicon-info-sign'></i></a>";
561
564
  }
562
565
  $("#circulation_holder_tips").html(circulation_tips);
563
566
  if (main_volume > 0) {
564
- main_tips += " [ 当前十大主要股东总持股数: <span class='label label-info'>" + Util.to_unit(main_volume, 3) + "股</span>(总占比:<b class='text-primary'>" + main_ratio + "%</b>)";
567
+ main_tips += " [ 当前十大主要股东总持股数: <span class='label label-info'>" + Util.to_unit(main_volume, 3) + "股</span>(总占比:<b class='text-primary'>" + Util.to_float(main_ratio, 2) + "%</b>)";
565
568
  if (pre_main_volume > 0) {
566
569
  main_tips += ",上一季度: <span class='label label-info'>" + Util.to_unit(pre_main_volume, 3) + "股</span>,";
567
570
  main_tips += " 持股数环比: " + Util.year_price_rate(main_volume, pre_main_volume, 1);
@@ -580,16 +583,46 @@ let Stock = {
580
583
  date = Util.seconds_to_format(date, "%Y-%m-%d");
581
584
  date_html.push("<option value='", date, "'>", date, "</option>");
582
585
  });
583
- let htd = $("#holder_top_date");
584
- htd.html(date_html.join(""));
585
- htd.change(function () {
586
- Stock.fetch_holder_top();
586
+ $("#top_holder_date").html(date_html.join("")).change(function () {
587
+ Stock.fetch_top_holder();
587
588
  });
588
589
  }
589
590
  Util.hide_tips();
590
591
  });
591
592
  },
592
593
 
594
+ fetch_top_holder_modal: function() {
595
+ Util.init_modal_skeleton("top_holder_modal", "<div id='top_holder_circulation_chart' style='height: 350px;'></div><div id='top_holder_main_chart' style='height: 350px;'></div>");
596
+ $("#top_holder_modal_title").html("十大(流通/主要)股东的季度持股分析");
597
+ let htm_object = $('#top_holder_modal');
598
+ htm_object.on('shown.bs.modal', function (e) {
599
+ Stock.top_holder_circulation_chart = Util.show_chart_loading(Stock.top_holder_circulation_chart, "top_holder_circulation_chart");
600
+ Stock.top_holder_main_chart = Util.show_chart_loading(Stock.top_holder_main_chart, "top_holder_main_chart");
601
+ Util.post("/stock/" + Stock.code, {action: "top_holder_statistics"}, function (j) {
602
+ Stock.top_holder_circulation_chart.hideLoading();
603
+ let date_data = [], volume_data = [], ratio_data = [];
604
+ j.circulation_data.forEach(function (item) {
605
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
606
+ volume_data.push(Util.to_ten_thousand(item.volume, 3));
607
+ ratio_data.push(Util.to_float(item.ratio, 2));
608
+ });
609
+ Stock.top_holder_circulation_chart = Util.multi_axis_line(Stock.top_holder_circulation_chart, "top_holder_circulation_chart", date_data, "十大流通股东总持股数(万股)", volume_data, "总持股比例", ratio_data);
610
+ Stock.top_holder_main_chart.hideLoading();
611
+ date_data = [], volume_data = [], ratio_data = [];
612
+ j.main_data.forEach(function (item) {
613
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
614
+ volume_data.push(Util.to_ten_thousand(item.volume, 2));
615
+ ratio_data.push(Util.to_float(item.ratio, 2));
616
+ });
617
+ Stock.top_holder_main_chart = Util.multi_axis_line(Stock.top_holder_main_chart, "top_holder_main_chart", date_data, "十大主要股东总持股数(万股)", volume_data, "总持股比例", ratio_data);
618
+ Util.hide_tips();
619
+ });
620
+ });
621
+ htm_object.on('hidden.bs.modal', function () {
622
+ Util.hide_tips();
623
+ });
624
+ },
625
+
593
626
  fetch_finance: function () {
594
627
  Util.show_loading();
595
628
  Util.init_table_skeleton({