sbd-npm 1.3.93 → 1.3.95

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.93",
3
+ "version": "1.3.95",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -28,6 +28,10 @@ $(function () {
28
28
  mo_gem_chart: false,
29
29
  mo_hk_chart: false,
30
30
  key_cache: "SBD_CACHE",
31
+ index_hist_data: [
32
+ {"code": "ths_all_a", "name": "同花顺全A指数", "url": "https://m.10jqka.com.cn/stockpage/48_883957/"},
33
+ {"code": "000902", "name": "中证流通", "url": "https://xueqiu.com/S/SH000902"},
34
+ ],
31
35
 
32
36
  get_cache: function () {
33
37
  let cache = localStorage[DailySummary.key_cache];
@@ -443,7 +447,7 @@ $(function () {
443
447
  Util.set_table_loading("index_hist_modal_body_body");
444
448
  let payload = {
445
449
  action: "index_hist",
446
- index_code: "ths_all_a",
450
+ index_code: $("#index_hist_modal_code").val(),
447
451
  start_date: $("#index_hist_modal_start_date").val(),
448
452
  end_date: $("#index_hist_modal_end_date").val()
449
453
  };
@@ -479,6 +483,15 @@ $(function () {
479
483
  Util.render_table_html("index_hist_modal_body_body", _html);
480
484
  Util.hide_tips();
481
485
  });
486
+ },
487
+
488
+ init_index_hist_url: function() {
489
+ let index_code = $("#index_hist_modal_code").val();
490
+ DailySummary.index_hist_data.forEach(function (c) {
491
+ if (c["code"] === index_code) {
492
+ $("#index_hist_modal_url").attr("href", c["url"]);
493
+ }
494
+ });
482
495
  }
483
496
 
484
497
  };
@@ -639,7 +652,17 @@ $(function () {
639
652
  });
640
653
 
641
654
  Util.init_modal_skeleton("index_hist_modal", '');
642
- $("#index_hist_modal_title").html(Util.pack_html_link("https://m.10jqka.com.cn/stockpage/48_883957/", "同花顺全A指数"));
655
+ let ihmt_html = [];
656
+ ihmt_html.push("<div class='form-inline'><div class='form-group'>");
657
+ ihmt_html.push("<select id='index_hist_modal_code' class='form-control'>");
658
+ DailySummary.index_hist_data.forEach(function (c) {
659
+ ihmt_html.push("<option value='", c["code"], "'>", c["name"], "</option>");
660
+ });
661
+ ihmt_html.push("</select>");
662
+ ihmt_html.push("&nbsp;<a id='index_hist_modal_url' href='#' target='_blank' rel='noopener noreferrer nofollow'><i class='glyphicon glyphicon-link'></i></a>");
663
+ ihmt_html.push("</div></div>");
664
+ $("#index_hist_modal_title").html(ihmt_html.join(""));
665
+ DailySummary.init_index_hist_url();
643
666
  Util.init_table_skeleton({
644
667
  "element_id": "index_hist_modal_body",
645
668
  "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>',
@@ -668,6 +691,10 @@ $(function () {
668
691
  mam_obj.on('hidden.bs.modal', function () {
669
692
  Util.hide_tips();
670
693
  });
694
+ $("#index_hist_modal_code").change(function () {
695
+ DailySummary.init_index_hist_url();
696
+ DailySummary.render_index_hist_modal();
697
+ });
671
698
 
672
699
  Util.init_modal_skeleton("stock_rate_modal", '');
673
700
  $("#stock_rate_modal_title").html("<span id='cp_val'></span>涨跌幅");
package/util.js CHANGED
@@ -3291,6 +3291,103 @@ const Util = {
3291
3291
  }
3292
3292
  },
3293
3293
 
3294
+ /**
3295
+ * 周期时间内的价格涨跌幅
3296
+ * @param data
3297
+ */
3298
+ render_summary_period_price_up_down: function(data) {
3299
+ let _html = [];
3300
+ let price_market_type = $("#price_market_type").val();
3301
+ data.forEach(function (item) {
3302
+ _html.push("<tr>");
3303
+ _html.push("<td>", Util.snowball_url(item["code"]), "</td>");
3304
+ let stock_name = item["name"];
3305
+ if (price_market_type !== "cn") {
3306
+ stock_name = Util.strip_bracket_string(stock_name);
3307
+ stock_name = stock_name.substr(0, 6);
3308
+ }
3309
+ _html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
3310
+ _html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
3311
+ _html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
3312
+ let p_color = Util.text_color(item["close"], item["open"]);
3313
+ _html.push("<td><b class='", p_color, "'>", Util.to_float(item["close"], 2), "<b></td>");
3314
+ let p_change_rate = Util.calc_change_rate(item["close"], item["open"], 4);
3315
+ p_change_rate = Util.to_float(p_change_rate * 100, 2)
3316
+ if (p_change_rate > 0) {
3317
+ p_change_rate = "+" + p_change_rate;
3318
+ }
3319
+ _html.push("<td><b class='", p_color, "'>", p_change_rate, "%<b></td>");
3320
+ _html.push("</tr>");
3321
+ });
3322
+ Util.render_table_html("price_up_down_table_body", _html);
3323
+ },
3324
+
3325
+ /**
3326
+ * 周期时间内的同花顺行业板块涨跌幅
3327
+ * @param data
3328
+ */
3329
+ render_summary_period_industry_data: function(data) {
3330
+ let _html = [];
3331
+ let industry_url = Util.get_url("summary_industry");
3332
+ data.forEach(function (item) {
3333
+ _html.push("<tr>");
3334
+ _html.push("<td>", Util.pack_html_link("http://q.10jqka.com.cn/thshy/detail/code/" + item["code"], item["code"]), "</td>");
3335
+ _html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item["code"], item["name"]), "</td>");
3336
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3337
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3338
+ _html.push("</tr>");
3339
+ });
3340
+ Util.render_table_html("industry_table_body", _html);
3341
+ },
3342
+
3343
+ /**
3344
+ * 周期时间内的ETF涨跌幅
3345
+ * @param data
3346
+ */
3347
+ render_summary_period_etf_data: function(data) {
3348
+ let _html = [];
3349
+ data.forEach(function (item) {
3350
+ _html.push("<tr>");
3351
+ _html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item["code"] + ".html", item["code"]), "</td>");
3352
+ _html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["code"], "'>", item["name"], "</a></td>");
3353
+ let change_quotient = "--";
3354
+ if (item["start_quotient"] && item["end_quotient"]) {
3355
+ let title = Util.strip_html(Util.to_unit(item["start_quotient"], 3)) + " - " + Util.strip_html(Util.to_unit(item["end_quotient"], 3));
3356
+ if (item["end_quotient"] > item["start_quotient"]) {
3357
+ change_quotient = "<b title='" + title + "' class='text-danger'>+" + Util.strip_html(Util.to_unit(item["end_quotient"] - item["start_quotient"], 1)) + "</b>";
3358
+ } else if (item["end_quotient"] < item["start_quotient"]) {
3359
+ change_quotient = "<b title='" + title + "' class='text-success'>" + Util.strip_html(Util.to_unit(item["end_quotient"] - item["start_quotient"], 1)) + "</b>";
3360
+ } else {
3361
+ change_quotient = "<b title='" + title + "'>0.00</b>";
3362
+ }
3363
+ }
3364
+ _html.push("<td>", change_quotient, "</td>");
3365
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3366
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3367
+ _html.push("</tr>");
3368
+ });
3369
+ Util.render_table_html("etf_table_body", _html);
3370
+ },
3371
+
3372
+ /**
3373
+ * 周期时间内的指数涨跌幅
3374
+ * @param data
3375
+ */
3376
+ render_summary_period_index_data: function(data) {
3377
+ let _html = [];
3378
+ let index_url = Util.get_url("summary_index");
3379
+ data.forEach(function (item) {
3380
+ _html.push("<tr>");
3381
+ _html.push("<td>", Util.pack_html_link(item["url"], item["code"].toUpperCase()), "</td>");
3382
+ _html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item["code"], item["name"]), "</td>");
3383
+ _html.push("<td><b class='", Util.text_color(item["current_close"], item["start_close"]), "'>", Util.to_float(item["current_close"], 2), "</b></td>");
3384
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["year_close"], 1), "</td>");
3385
+ _html.push("<td>", Util.year_price_rate(item["current_close"], item["start_close"], 1), "</td>");
3386
+ _html.push("</tr>");
3387
+ });
3388
+ Util.render_table_html("index_table_body", _html);
3389
+ },
3390
+
3294
3391
  /**
3295
3392
  * 设置 option 的第 nth 项为默认项
3296
3393
  * @param obj