sbd-npm 1.5.27 → 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 +71 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.27",
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,37 +473,40 @@ 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
  }
505
508
  Util.post("/stock/" + Stock.code, payload, function (j) {
506
- let main_html = [], circulation_html = [];
509
+ let main_html = [], circulation_html = [], main_ratio = 0, circulation_ratio = 0;
507
510
  let main_volume = 0, pre_main_volume = 0, circulation_volume = 0, pre_circulation_volume = 0;
508
511
  j.data.forEach(function (item) {
509
512
  let change = item.change;
@@ -518,6 +521,7 @@ let Stock = {
518
521
  }
519
522
  if (parseInt(item.type) === 1) {
520
523
  main_volume += item.volume;
524
+ main_ratio += item.holder_ratio;
521
525
  main_html.push("<tr>");
522
526
  main_html.push("<td>", item.rank, "</td>");
523
527
  main_html.push("<td>", item.holder_name, "</td>");
@@ -528,6 +532,7 @@ let Stock = {
528
532
  main_html.push("</tr>");
529
533
  } else {
530
534
  circulation_volume += item.volume;
535
+ circulation_ratio += item.holder_ratio;
531
536
  circulation_html.push("<tr>");
532
537
  circulation_html.push("<td>", item.rank, "</td>");
533
538
  circulation_html.push("<td>", item.holder_name, "</td>");
@@ -547,21 +552,21 @@ let Stock = {
547
552
  });
548
553
  let circulation_tips = "", main_tips = "";
549
554
  if (circulation_volume > 0) {
550
- circulation_tips += " [ 当前十大流通股东总持股数: <span class='label label-info'>" + Util.to_unit(circulation_volume, 3) + "</span>";
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>)";
551
556
  if (pre_circulation_volume > 0) {
552
- circulation_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
553
- circulation_tips += " 持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
557
+ circulation_tips += ",上一季度: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
558
+ circulation_tips += "持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
554
559
  }
555
560
  if (j.date_price) {
556
561
  circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock.price, j.date_price);
557
562
  }
558
- 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>";
559
564
  }
560
565
  $("#circulation_holder_tips").html(circulation_tips);
561
566
  if (main_volume > 0) {
562
- main_tips += " [ 当前十大主要股东总持股数: <span class='label label-info'>" + Util.to_unit(main_volume, 3) + "</span>";
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>)";
563
568
  if (pre_main_volume > 0) {
564
- main_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_main_volume, 3) + "</span>,";
569
+ main_tips += ",上一季度: <span class='label label-info'>" + Util.to_unit(pre_main_volume, 3) + "股</span>,";
565
570
  main_tips += " 持股数环比: " + Util.year_price_rate(main_volume, pre_main_volume, 1);
566
571
  }
567
572
  main_tips += " ]";
@@ -578,16 +583,46 @@ let Stock = {
578
583
  date = Util.seconds_to_format(date, "%Y-%m-%d");
579
584
  date_html.push("<option value='", date, "'>", date, "</option>");
580
585
  });
581
- let htd = $("#holder_top_date");
582
- htd.html(date_html.join(""));
583
- htd.change(function () {
584
- Stock.fetch_holder_top();
586
+ $("#top_holder_date").html(date_html.join("")).change(function () {
587
+ Stock.fetch_top_holder();
585
588
  });
586
589
  }
587
590
  Util.hide_tips();
588
591
  });
589
592
  },
590
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
+
591
626
  fetch_finance: function () {
592
627
  Util.show_loading();
593
628
  Util.init_table_skeleton({