sbd-npm 1.3.71 → 1.3.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.71",
3
+ "version": "1.3.73",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -367,6 +367,7 @@ let Stock = {
367
367
  "element_id": "big_deal_summary_table",
368
368
  "head_cols": [
369
369
  {"name": "主力总净流入", "link": money_inflow_url},
370
+ {"name": "60日主力净流入"},
370
371
  {"name": "20日主力净流入", "link": money_inflow_url + "?money_inflow_type=5"},
371
372
  {"name": "10日主力净流入", "link": money_inflow_url + "?money_inflow_type=4"},
372
373
  {"name": "5日主力净流入", "link": money_inflow_url + "?money_inflow_type=3"},
@@ -394,7 +395,7 @@ let Stock = {
394
395
  }
395
396
  if (j["money_net_inflow"]) {
396
397
  let _html = [], i = 0, total_net_inflow = 0;
397
- let day3_net_inflow = 0, day5_net_inflow = 0, day10_net_inflow = 0, day20_net_inflow = 0
398
+ let day3_net_inflow = 0, day5_net_inflow = 0, day10_net_inflow = 0, day20_net_inflow = 0, day60_net_inflow = 0;
398
399
  j["money_net_inflow"].forEach(function (item) {
399
400
  i++;
400
401
  total_net_inflow += item["main_net_inflow"];
@@ -410,6 +411,9 @@ let Stock = {
410
411
  if (i <= 20) {
411
412
  day20_net_inflow += item["main_net_inflow"];
412
413
  }
414
+ if (i <= 60) {
415
+ day60_net_inflow += item["main_net_inflow"];
416
+ }
413
417
  _html.push("<tr>");
414
418
  _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
415
419
  _html.push("<td><b class='", Util.text_color(item["price_change"]), "'>", item["price"], "(", item["price_change"], "%)</b></td>");
@@ -425,11 +429,12 @@ let Stock = {
425
429
  Util.render_table_html("big_deal_table_body", _html);
426
430
  _html = [];
427
431
  _html.push("<tr>");
428
- _html.push("<td><b class='", Util.text_color(total_net_inflow), "'>", Util.to_unit(total_net_inflow, 4), "</b></td>");
429
- _html.push("<td><b class='", Util.text_color(day20_net_inflow), "'>", Util.to_unit(day20_net_inflow, 4), "</b></td>");
430
- _html.push("<td><b class='", Util.text_color(day10_net_inflow), "'>", Util.to_unit(day10_net_inflow, 4), "</b></td>");
431
- _html.push("<td><b class='", Util.text_color(day5_net_inflow), "'>", Util.to_unit(day5_net_inflow, 4), "</b></td>");
432
- _html.push("<td><b class='", Util.text_color(day3_net_inflow), "'>", Util.to_unit(day3_net_inflow, 4), "</b></td>");
432
+ _html.push("<td><b class='", Util.text_color(total_net_inflow), "'>", Util.to_unit(total_net_inflow, 3), "</b></td>");
433
+ _html.push("<td><b class='", Util.text_color(day60_net_inflow), "'>", Util.to_unit(day60_net_inflow, 3), "</b></td>");
434
+ _html.push("<td><b class='", Util.text_color(day20_net_inflow), "'>", Util.to_unit(day20_net_inflow, 3), "</b></td>");
435
+ _html.push("<td><b class='", Util.text_color(day10_net_inflow), "'>", Util.to_unit(day10_net_inflow, 3), "</b></td>");
436
+ _html.push("<td><b class='", Util.text_color(day5_net_inflow), "'>", Util.to_unit(day5_net_inflow, 3), "</b></td>");
437
+ _html.push("<td><b class='", Util.text_color(day3_net_inflow), "'>", Util.to_unit(day3_net_inflow, 3), "</b></td>");
433
438
  _html.push("</tr>");
434
439
  Util.render_table_html("big_deal_summary_table_body", _html);
435
440
  }
package/summary_daily.js CHANGED
@@ -50,7 +50,7 @@ $(function () {
50
50
  Util.set_table_loading("market_overview_zone");
51
51
  let cache = DailySummary.get_cache();
52
52
  if (cache.hasOwnProperty("index")) {
53
- DailySummary.pack_index_data(cache["index"]);
53
+ DailySummary.pack_index_summary_data(cache["index"]);
54
54
  }
55
55
  if (cache.hasOwnProperty("change_percent")) {
56
56
  DailySummary.pack_change_percent(cache["change_percent"]);
@@ -85,7 +85,7 @@ $(function () {
85
85
  /**
86
86
  * 当前行情指数
87
87
  */
88
- pack_index_data: function (index_data) {
88
+ pack_index_summary_data: function (index_data) {
89
89
  let _html = [], change_color_data = [];
90
90
  index_data.forEach(function (item) {
91
91
  let cls = "", sort = "";
@@ -110,10 +110,10 @@ $(function () {
110
110
  let index_name = item["href"] ? Util.pack_html_link(item["href"], item["name"]) : item["name"];
111
111
  _html.push('<span class="count_top"><i class="fa"></i> ', index_name, '</span>');
112
112
  _html.push('<div class="count ', cls, '">', item["value"], '</div>');
113
- _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', item["change_rate"], '</span>%)</i></span>');
113
+ _html.push('<span class="count_bottom"><i class="', cls, '"><i class="fa ', sort, '"></i>', item["change"], '(<span id="', change_rate_id, '">', Util.to_float(item["change_rate"], 2), '</span>%)</i></span>');
114
114
  _html.push('</div>');
115
115
  });
116
- $("#index_data").html(_html.join(""));
116
+ $("#index_summary_data").html(_html.join(""));
117
117
  change_color_data.forEach(function (item) {
118
118
  let change_rate_obj = $("#change_rate_" + item["key"]);
119
119
  change_rate_obj.css("background-color", item["new"]);
@@ -174,7 +174,7 @@ $(function () {
174
174
  let bd_obj = $('#big_deal_pie');
175
175
  if (bd_obj.length) {
176
176
  if (big_deal_date > 0) {
177
- $("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ") ");
177
+ $("#big_deal_date").html("(" + Util.seconds_to_format(big_deal_date, "%Y-%m-%d") + ")");
178
178
  }
179
179
  if (DailySummary.big_deal === {} || DailySummary.big_deal["buy1000"] !== bd["buy1000"] || DailySummary.big_deal["buy800"] !== bd["buy800"]
180
180
  || DailySummary.big_deal["buy600"] !== bd["buy600"] || DailySummary.big_deal["buy400"] !== bd["buy400"]
@@ -358,16 +358,14 @@ $(function () {
358
358
  * 一些统计数据
359
359
  */
360
360
  fetch_statistics_daily: function () {
361
- let date = $("#trade_date").val();
362
- let news_type = $("#news_type").val();
363
361
  let payload = {
364
- date: date,
362
+ date: $("#trade_date").val(),
365
363
  action: "statistics_daily",
366
364
  limit_num: DailySummary.limit_num(),
367
- news_type: news_type
365
+ news_type: $("#news_type").val()
368
366
  };
369
367
  Util.post(location.pathname, payload, function (j) {
370
- DailySummary.pack_index_data(j["index"]);
368
+ DailySummary.pack_index_summary_data(j["index"]);
371
369
  DailySummary.pack_change_percent(j["change_percent"]);
372
370
  DailySummary.pack_big_deal(j["big_deal"], j["big_deal_date"]);
373
371
  DailySummary.pack_hsgt_money_flow(j["hmf"]);
@@ -435,6 +433,34 @@ $(function () {
435
433
  });
436
434
  Util.render_table_html(market + "_table_body", _html);
437
435
  }
436
+ },
437
+
438
+ // 指数历史行情数据
439
+ render_index_hist_modal: function() {
440
+ Util.show_loading();
441
+ let payload = {
442
+ action: "index_hist",
443
+ index_code: "ths_all_a",
444
+ start_date: $("#index_hist_modal_start_date").val(),
445
+ end_date: $("#index_hist_modal_end_date").val()
446
+ };
447
+ Util.post("/action", payload, function (j) {
448
+ let _html = [];
449
+ j["data"].forEach(function (item) {
450
+ _html.push("<tr>");
451
+ _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
452
+ _html.push("<td>", item["open"], "</td>");
453
+ _html.push("<td>", item["low"], "</td>");
454
+ _html.push("<td>", item["high"], "</td>");
455
+ _html.push("<td>", item["close"], "</td>");
456
+ _html.push("<td>", Util.parse_ratio(item["p_change_rate"]), "</td>");
457
+ _html.push("<td data-val='", item["volume"], "'>", Util.to_unit(item["volume"]), "股</td>");
458
+ _html.push("<td data-val='", item["amount"], "'>", Util.to_unit(item["amount"]), "</td>");
459
+ _html.push("</tr>");
460
+ });
461
+ Util.render_table_html("index_hist_modal_body_body", _html);
462
+ Util.hide_tips();
463
+ });
438
464
  }
439
465
 
440
466
  };
@@ -461,8 +487,7 @@ $(function () {
461
487
  if (!chart_instance) {
462
488
  $("#" + element_id).html('<div class="x_panel"><div class="x_title"><h2>' + title + '</h2><div class="clearfix"></div></div><div class="x_content2" style="height:450px;"><div id="' + line_id + '" class="graph_line"></div></div></div>');
463
489
  }
464
- let date_data = [];
465
- let val_data = [];
490
+ let date_data = [], val_data = [];
466
491
  data.forEach(function (item) {
467
492
  if (item[key] && item[key] > 0) {
468
493
  date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
@@ -475,7 +500,7 @@ $(function () {
475
500
  render_market_overview_modal: function (obj) {
476
501
  let title = $.trim($(obj).text());
477
502
  $("#at_title").html("[" + title + "]数据");
478
- $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
503
+ Util.set_table_loading("market_overview_load_status");
479
504
  if (Modal.mo_end_time === 0) {
480
505
  Modal.init_market_overview_time(obj);
481
506
  } else {
@@ -591,15 +616,46 @@ $(function () {
591
616
  Modal.render_market_overview_modal(e.relatedTarget);
592
617
  });
593
618
  mom_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
619
+ Util.set_table_loading("market_overview_load_status");
620
+ Util.hide_tips();
621
+ });
622
+
623
+ Util.init_modal_skeleton("index_hist_modal", '');
624
+ $("#index_hist_modal_title").html(Util.pack_html_link("https://m.10jqka.com.cn/stockpage/48_883957/", "同花顺全A指数"));
625
+ Util.init_table_skeleton({
626
+ "element_id": "index_hist_modal_body",
627
+ "caption": '<caption class="text-right" style="margin-top: -10px; padding-bottom: 10px;"><div class="form-inline"><div class="form-group" id="index_hist_modal_start_end_date"></div><button class="btn btn-default" id="index_hist_modal_query">查 询</button></div></caption>',
628
+ "head_cols": [
629
+ {"name": "日期", "class": "info", "table_sort": 1},
630
+ {"name": "开盘价", "table_sort": 1},
631
+ {"name": "最低价", "table_sort": 1},
632
+ {"name": "最高价", "table_sort": 1},
633
+ {"name": "收盘价", "table_sort": 1},
634
+ {"name": "涨跌", "table_sort": 1},
635
+ {"name": "成交量", "table_sort": 1},
636
+ {"name": "成交额", "table_sort": 1},
637
+ ]
638
+ });
639
+ let mam_obj = $('#index_hist_modal');
640
+ mam_obj.on('shown.bs.modal', function (e) {
641
+ Util.set_table_loading("index_hist_modal_body_body");
642
+ if ($("#index_hist_modal_start_date").length <= 0) {
643
+ Util.init_range_date("index_hist_modal_start_end_date", DailySummary, "render_index_hist_modal");
644
+ }
645
+ $("#index_hist_modal_query").click(function () {
646
+ DailySummary.render_index_hist_modal();
647
+ });
648
+ DailySummary.render_index_hist_modal();
649
+ });
650
+ mam_obj.on('hidden.bs.modal', function () {
594
651
  Util.hide_tips();
595
- $("#market_overview_load_status").html("<tr><td colspan='6'>Loading...</td></tr>");
596
652
  });
597
653
 
598
654
  Util.init_modal_skeleton("stock_rate_modal", '');
599
655
  $("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");
600
656
  Util.init_table_skeleton({
601
657
  "element_id": "stock_rate_modal_body",
602
- "caption": "none",
658
+ "caption": '<caption class="text-right" id="stock_rate_modal_body_body_tips"></caption>',
603
659
  "head_cols": [
604
660
  {"name": "序号"},
605
661
  {"name": "代码"},
@@ -624,6 +680,7 @@ $(function () {
624
680
  });
625
681
  srm_obj.on('hidden.bs.modal', function () {
626
682
  $("#cp_val").html("");
683
+ $("#stock_rate_modal_body_body_tips").html("");
627
684
  Util.set_table_loading("stock_rate_modal_body_body");
628
685
  Util.hide_tips();
629
686
  });
package/util.js CHANGED
@@ -1636,9 +1636,9 @@ const Util = {
1636
1636
  Util.init_modal_skeleton(component_id);
1637
1637
  Util.init_table_skeleton({
1638
1638
  "element_id": component_id + "_body",
1639
- "caption": '<caption class="text-right"><div class="form-inline"><div class="form-group" id="currency_modal_start_end_date"></div><button class="btn btn-default" id="' + component_id + '_query">查 询</button></div></caption>',
1639
+ "caption": '<caption class="text-right" style="margin-top: -10px;"><div class="form-inline"><div class="form-group" id="currency_modal_start_end_date"></div><button class="btn btn-default" id="' + component_id + '_query">查 询</button></div></caption>',
1640
1640
  "head_cols": [
1641
- {"name": "日期", "table_sort": 1},
1641
+ {"name": "日期", "class": "info", "table_sort": 1},
1642
1642
  {"name": "价格", "table_sort": 1},
1643
1643
  {"name": "最低价", "table_sort": 1},
1644
1644
  {"name": "最高价", "table_sort": 1},
@@ -1724,13 +1724,13 @@ const Util = {
1724
1724
  Util.init_modal_skeleton(component_id);
1725
1725
  Util.init_table_skeleton({
1726
1726
  "element_id": component_id + "_body",
1727
- "caption": '<caption class="text-right"><div class="form-inline"><div class="form-group" id="' + component_id + '_start_end_date"></div><button class="btn btn-default" id="' + component_id + '_query">查 询</button></div></caption>',
1727
+ "caption": '<caption class="text-right" style="margin-top: -10px;"><div class="form-inline"><div class="form-group" id="' + component_id + '_start_end_date"></div><button class="btn btn-default" id="' + component_id + '_query">查 询</button></div></caption>',
1728
1728
  "head_cols": [
1729
- {"name": "日期", "table_sort": 1},
1729
+ {"name": "日期", "class": "info", "table_sort": 1},
1730
1730
  {"name": "开盘价", "table_sort": 1},
1731
- {"name": "收盘价", "table_sort": 1},
1732
1731
  {"name": "最低价", "table_sort": 1},
1733
1732
  {"name": "最高价", "table_sort": 1},
1733
+ {"name": "收盘价", "table_sort": 1},
1734
1734
  {"name": "涨跌", "table_sort": 1},
1735
1735
  {"name": "成交额", "table_sort": 1},
1736
1736
  {"name": "总市值", "table_sort": 1},
@@ -1738,8 +1738,8 @@ const Util = {
1738
1738
  });
1739
1739
  let component_obj = $('#' + component_id);
1740
1740
  component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1741
- let coin = $(e.relatedTarget).attr("data-coin");
1742
1741
  Util.set_table_loading(component_id + "_body_body");
1742
+ let coin = $(e.relatedTarget).attr("data-coin");
1743
1743
  if ($("#" + component_id + "_start_date").length <= 0) {
1744
1744
  Util.init_range_date(component_id + "_start_end_date", Util, "render_btc_modal", 60);
1745
1745
  }
@@ -1752,7 +1752,6 @@ const Util = {
1752
1752
  Util.render_btc_modal();
1753
1753
  });
1754
1754
  component_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
1755
- Util.set_table_loading(component_id + "_body_body");
1756
1755
  Util.hide_tips();
1757
1756
  });
1758
1757
  },
@@ -1767,7 +1766,13 @@ const Util = {
1767
1766
  return false;
1768
1767
  }
1769
1768
  Util.show_loading();
1770
- let payload = {coin: coin, start_date: $("#btc_modal_start_date").val(), end_date: $("#btc_modal_end_date").val(), action: "btc_data", "currency_type": $("#currency_type").val()};
1769
+ let payload = {
1770
+ coin: coin,
1771
+ start_date: $("#btc_modal_start_date").val(),
1772
+ end_date: $("#btc_modal_end_date").val(),
1773
+ action: "btc_data",
1774
+ "currency_type": $("#currency_type").val()
1775
+ };
1771
1776
  Util.post(Util.get_url("coin_price"), payload, function (j) {
1772
1777
  let _html = [], low_price = 0, high_price = 0;
1773
1778
  j["data"].forEach(function (item) {
@@ -1786,9 +1791,9 @@ const Util = {
1786
1791
  }
1787
1792
  _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1788
1793
  _html.push("<td>", item["open"], "</td>");
1789
- _html.push("<td>", item["price"], "</td>");
1790
1794
  _html.push("<td>", item["low"], "</td>");
1791
1795
  _html.push("<td>", item["high"], "</td>");
1796
+ _html.push("<td>", item["price"], "</td>");
1792
1797
  _html.push("<td>", Util.parse_ratio(item["p_change"]), "</td>");
1793
1798
  _html.push("<td>", Util.to_unit(item["amount"]), "</td>");
1794
1799
  _html.push("<td>", Util.to_unit(item["market_capital"]), "</td>");