sbd-npm 1.1.87 → 1.1.90

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/util.js +28 -8
  3. package/.npmignore +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.87",
3
+ "version": "1.1.90",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -368,6 +368,16 @@ const Util = {
368
368
  }
369
369
  }
370
370
  });
371
+ $(".d5_price_" + code).each(function () {
372
+ if (item["d5_price"]) {
373
+ $(this).html(Util.year_price_rate(item["price"], item["d5_price"]));
374
+ } else {
375
+ let d5_price = $(this).attr("data-val");
376
+ if (d5_price) {
377
+ $(this).html(Util.year_price_rate(item["price"], Util.to_float(d5_price)));
378
+ }
379
+ }
380
+ });
371
381
  if (item["high_52week"]) {
372
382
  $(".high_52week_" + code).each(function () {
373
383
  $(this).html(Util.year_price_rate(item["price"], item["high_52week"]));
@@ -865,7 +875,7 @@ const Util = {
865
875
  _html = Util.stock_basics_html(_html, item);
866
876
  _html.push("<td id='high_", item["code"], "'>0</td>");
867
877
  _html.push("<td id='low_", item["code"], "'>0</td>");
868
- _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
878
+ _html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
869
879
  _html.push("<td class='high_52week_", item["code"], "'>--</td>");
870
880
  if (is_us === 0) {
871
881
  _html.push("<td id='amount_", item["code"], "'>--</td>");
@@ -1000,7 +1010,7 @@ const Util = {
1000
1010
  _html.push("<tr class='" + component_tr + "'>");
1001
1011
  _html.push("<td>", index + 1, "</td>");
1002
1012
  _html = Util.stock_basics_html(_html, item);
1003
- _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
1013
+ _html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
1004
1014
  let stock_num_tips = "";
1005
1015
  if (item["stock_num"] > 0 && item["pre_stock_num"] > 0) {
1006
1016
  let gap_stock_num = item["stock_num"] - item["pre_stock_num"];
@@ -1940,9 +1950,9 @@ const Util = {
1940
1950
  } else {
1941
1951
  Util.refresh_index_price(element_id, index_list.join("-"), is_us, 0);
1942
1952
  }
1943
- if (valid_code_list.length > 0) { // 涨跌统计
1953
+ let total_num = valid_code_list.length;
1954
+ if (total_num > 0 && total_num < 100) { // 涨跌统计
1944
1955
  if ($("#" + element_id + "_tips").length) {
1945
- let total_num = valid_code_list.length;
1946
1956
  let average_change_percent = Math.round((total_change_percent / total_num) * 10000) / 100;
1947
1957
  let average_year_change_percent = Math.round((total_year_change_percent / total_num) * 10000) / 100;
1948
1958
  let week_tips_id = element_id + "week_tips";
@@ -2448,6 +2458,16 @@ const Util = {
2448
2458
  return Util.to_float(digit / 100000000, fraction);
2449
2459
  },
2450
2460
 
2461
+ /**
2462
+ * 转为以万为单位的数值
2463
+ * @param digit
2464
+ * @param fraction
2465
+ * @returns {*|number}
2466
+ */
2467
+ to_ten_thousand: function (digit, fraction = 2) {
2468
+ return Util.to_float(digit / 10000, fraction);
2469
+ },
2470
+
2451
2471
  /**
2452
2472
  * 转为相应单位的数值
2453
2473
  * @param digit
@@ -3111,12 +3131,12 @@ const Util = {
3111
3131
 
3112
3132
  /**
3113
3133
  * 大单交易
3114
- * @param obj_id
3134
+ * @param element_id
3115
3135
  */
3116
- big_deal_pie: function (obj_id, data) {
3136
+ big_deal_pie: function (element_id, data) {
3117
3137
  let buy = Util.to_unit(data["buy1000"] + data["buy800"] + data["buy600"] + data["buy400"]);
3118
3138
  let sell = Util.to_unit(data["sell1000"] + data["sell800"] + data["sell600"] + data["sell400"]);
3119
- $("#" + obj_id + "_tips").html("流入: <b class='text-danger'>" + buy + "</b>,流出: <b class='text-success'>" + sell + "</b>");
3139
+ $("#" + element_id + "_tips").html("流入: <b class='text-danger'>" + Util.strip_html(buy) + "</b>,流出: <b class='text-success'>" + Util.strip_html(sell) + "</b>");
3120
3140
  let bd_data = [
3121
3141
  {name: '超大单流入', value: Util.to_hundred_million(data["buy1000"])},
3122
3142
  {name: '大单流入', value: Util.to_hundred_million(data["buy800"])},
@@ -3127,7 +3147,7 @@ const Util = {
3127
3147
  {name: '大单流出', value: Util.to_hundred_million(data["sell800"])},
3128
3148
  {name: '超大单流出', value: Util.to_hundred_million(data["sell1000"])}
3129
3149
  ];
3130
- let BigDealPie = echarts.init(document.getElementById(obj_id), {});
3150
+ let BigDealPie = echarts.init(document.getElementById(element_id), {});
3131
3151
  BigDealPie.setOption({
3132
3152
  tooltip: {
3133
3153
  trigger: 'item',
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- sbd-npm.md