sbd-npm 1.2.37 → 1.2.40

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 +15 -14
  3. package/util.js +21 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.37",
3
+ "version": "1.2.40",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -86,6 +86,9 @@ let Stock = {
86
86
  Stock.fetch_report_organization();
87
87
  break;
88
88
  case "public_fund":
89
+ $("#is_fund_ten").click(function () {
90
+ Stock.fetch_public_fund();
91
+ });
89
92
  Stock.fetch_public_fund();
90
93
  break;
91
94
  case "public_fund_change":
@@ -348,6 +351,7 @@ let Stock = {
348
351
  Util.init_table_skeleton({
349
352
  "element_id": "big_deal_summary_table",
350
353
  "head_cols": [
354
+ {"name": "主力总净流入"},
351
355
  {"name": "20日主力净流入"},
352
356
  {"name": "10日主力净流入"},
353
357
  {"name": "5日主力净流入"},
@@ -374,14 +378,11 @@ let Stock = {
374
378
  //Stock.pack_big_deal("big_deal1", j["data"], "最近一天", date, date);
375
379
  }
376
380
  if (j["money_net_inflow"]) {
377
- let _html = [];
378
- let i = 0;
379
- let day3_net_inflow = 0;
380
- let day5_net_inflow = 0;
381
- let day10_net_inflow = 0;
382
- let day20_net_inflow = 0;
381
+ let _html = [], i = 0, total_net_inflow = 0;
382
+ let day3_net_inflow = 0, day5_net_inflow = 0, day10_net_inflow = 0, day20_net_inflow = 0
383
383
  j["money_net_inflow"].forEach(function (item) {
384
384
  i++;
385
+ total_net_inflow += item["main_net_inflow"];
385
386
  if (i <= 3) {
386
387
  day3_net_inflow += item["main_net_inflow"];
387
388
  }
@@ -409,6 +410,7 @@ let Stock = {
409
410
  Util.render_table_html("big_deal_table_body", _html);
410
411
  _html = [];
411
412
  _html.push("<tr>");
413
+ _html.push("<td><b class='", Util.text_color(total_net_inflow), "'>", Util.to_unit(total_net_inflow), "</b></td>");
412
414
  _html.push("<td><b class='", Util.text_color(day20_net_inflow), "'>", Util.to_unit(day20_net_inflow), "</b></td>");
413
415
  _html.push("<td><b class='", Util.text_color(day10_net_inflow), "'>", Util.to_unit(day10_net_inflow), "</b></td>");
414
416
  _html.push("<td><b class='", Util.text_color(day5_net_inflow), "'>", Util.to_unit(day5_net_inflow), "</b></td>");
@@ -907,19 +909,18 @@ let Stock = {
907
909
  {"name": "投资类型"},
908
910
  {"name": "基金管理公司"},
909
911
  {"name": "成立日期", "table_sort": 1},
910
- {"name": "持有量", "table_sort": 1},
912
+ {"name": "持有量", "table_sort": 1, "class": "info"},
911
913
  {"name": "持仓市值", "table_sort": 1},
912
914
  {"name": ""},
913
915
  ]
914
916
  });
915
- Util.post("/stock/" + Stock["code"], {
917
+ let payload = {
916
918
  action: "public_fund",
917
- public_fund_date: $("#public_fund_date").val()
918
- }, function (j) {
919
- let _html = [];
920
- let total_public_fund = 0;
921
- let total_stock_num = 0;
922
- let total_market_capital = 0;
919
+ public_fund_date: $("#public_fund_date").val(),
920
+ is_fund_ten: $("#is_fund_ten").prop("checked") ? 1 : 0
921
+ };
922
+ Util.post("/stock/" + Stock["code"], payload, function (j) {
923
+ let _html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
923
924
  j["data"].forEach(function (item) {
924
925
  total_public_fund++;
925
926
  total_stock_num += item["stock_num"];
package/util.js CHANGED
@@ -1042,7 +1042,7 @@ const Util = {
1042
1042
  $("." + component_tr).each(function () {
1043
1043
  $(this).remove();
1044
1044
  });
1045
- $("<tr class='" + component_tr + "'><td colspan='12'>Loading...</td></tr>").insertAfter("#" + component_id + "_head");
1045
+ $("<tr class='" + component_tr + "'><td colspan='14'>Loading...</td></tr>").insertAfter("#" + component_id + "_head");
1046
1046
  let pre_date = 0;
1047
1047
  date = parseInt(date);
1048
1048
  $("#fund_stock_date").find("option").each(function () {
@@ -2092,9 +2092,7 @@ const Util = {
2092
2092
  //获取股票详情数据
2093
2093
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
2094
2094
  let valid_code_list = [];
2095
- let total_change_percent = 0;
2096
- let total_year_change_percent = 0;
2097
- let total_d5_change_percent = 0;
2095
+ let total_change_percent = 0, total_year_change_percent = 0, total_d5_change_percent = 0;
2098
2096
  $.each(j, function (code, item) {
2099
2097
  if (item["price"] && item["previous_price"] && item["price"] > 0 && item["previous_price"] > 0) {
2100
2098
  valid_code_list.push(item["code"]);
@@ -2113,6 +2111,12 @@ const Util = {
2113
2111
  $(this).attr("data-val", item["holder_num"]);
2114
2112
  });
2115
2113
  }
2114
+ if (item["cur_fund_num"] && item["cur_fund_num"] > 0) {
2115
+ $(".fund_" + code).each(function () {
2116
+ $(this).html(Util.pack_fund_num(item));
2117
+ $(this).attr("data-val", item["cur_fund_num"]);
2118
+ });
2119
+ }
2116
2120
  if (item["money_net_inflow"] && item["money_net_inflow"] !== 0) {
2117
2121
  $(".money_inflow_" + code).each(function () {
2118
2122
  Util.render_money_inflow($(this), item);
@@ -2397,6 +2401,19 @@ const Util = {
2397
2401
  return "--";
2398
2402
  },
2399
2403
 
2404
+ /**
2405
+ * 组装基金数据
2406
+ * @param item
2407
+ * @returns {string}
2408
+ */
2409
+ pack_fund_num: function (item) {
2410
+ if (item["cur_fund_num"] && item["cur_fund_num"] > 0) {
2411
+ let fund_num = Util.digit_compare_trend(item["cur_fund_num"], item["pre_fund_num"]);
2412
+ return Util.pack_html_link("/stock/" + item["code"] + "?tab=public_fund", fund_num);
2413
+ }
2414
+ return "--";
2415
+ },
2416
+
2400
2417
  /**
2401
2418
  * 雪球人数关注排名数据
2402
2419
  * @param item