sbd-npm 1.3.62 → 1.3.64

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/util.js +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.62",
3
+ "version": "1.3.64",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -482,6 +482,7 @@ const Util = {
482
482
  $("#price_change_" + code).html(Util.year_price_rate(item["price"], item["previous_price"]));
483
483
  } else {
484
484
  let price = Util.digit_compare_trend(item["price"], item["previous_price"]);
485
+ let price_change_rate = Util.calc_change_rate(item["price"], item["previous_price"], 4);
485
486
  $(".price_" + code).each(function () {
486
487
  if ($(this).attr("data-color")) {
487
488
  let pre_price = parseFloat(Util.strip_bracket_string($(this).text()));
@@ -496,6 +497,7 @@ const Util = {
496
497
  $(this).attr("data-color", $(this).css("background-color"));
497
498
  }
498
499
  $(this).html(price);
500
+ $(this).attr("data-val", price_change_rate);
499
501
  });
500
502
  }
501
503
  $(".year_price_" + code).each(function () {
@@ -1237,9 +1239,21 @@ const Util = {
1237
1239
  price_data.push(item["price"]);
1238
1240
  _html.push("<tr>");
1239
1241
  _html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
1240
- _html.push("<td>", item["price"], "</td>");
1241
- _html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
1242
- _html.push("<td>", item["fund_num"], "</td>");
1242
+ if (item["pre_price"]) {
1243
+ _html.push("<td>", Util.digit_compare_trend(item["price"], item["pre_price"]), "</td>");
1244
+ } else {
1245
+ _html.push("<td>", item["price"], "</td>");
1246
+ }
1247
+ let stock_num_rate = "";
1248
+ if (item["pre_stock_num"]) {
1249
+ stock_num_rate = "(" + Util.year_price_rate(item["stock_num"], item["pre_stock_num"], 1) + ")";
1250
+ }
1251
+ _html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股", stock_num_rate, "</td>");
1252
+ let fund_num_rate = "";
1253
+ if (item["pre_fund_num"]) {
1254
+ fund_num_rate = "(" + Util.year_price_rate(item["fund_num"], item["pre_fund_num"], 1) + ")";
1255
+ }
1256
+ _html.push("<td>", item["fund_num"], fund_num_rate, "</td>");
1243
1257
  let market_capital = item["price"] * item["stock_num"];
1244
1258
  _html.push("<td data-val='", market_capital, "' title='", market_capital, "'>", Util.to_unit(market_capital, 4), "</td>");
1245
1259
  _html.push("</tr>");