sbd-npm 1.3.3 → 1.3.5

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/constant.js CHANGED
@@ -139,6 +139,7 @@ const MenuList = [
139
139
  {'key': 'concept_cloud', 'name': '心似白云常自在', 'url': '/0xaacc2078f38307e8a6855ecd96c69af39e1d69d3'},
140
140
  {'key': 'concept_vegetable', 'name': 'Veget', 'url': '/0xbd14b9e9686c14863ea0849fb60ba90acf4e35eb'},
141
141
  {'key': 'concept_zan', 'name': 'zangyn', 'url': '/0xbdc27e0a9908ee586033dbb801c57369e687810c'},
142
+ {'key': 'concept_follow', 'name': '跟我走吧14', 'url': '/0x70da61572340cef1dd3506f6505b1d2fc8d45156'},
142
143
  {'key': 'concept_peng', 'name': '吴小朋同学', 'url': '/0x02073ae93ccbbda6e2f6a9d7588ba4f7c30a9af8'},
143
144
  {'key': 'concept_xiong', 'name': '王朝雄', 'url': '/0x7bf85e4b9a10a5a144cb079425581844d185a52e'},
144
145
  {'key': 'concept_penny', 'name': '梁斌penny', 'url': '/0xe796e2ec1b573ab027f72072147f8dfddc5d3368'},
@@ -147,7 +148,7 @@ const MenuList = [
147
148
  {'key': 'concept_star50', 'name': '科创50', 'url': '/0x9b4e2daac43b0391842cb8e62c8b9aa07662d8bd'},
148
149
  {'key': 'concept_bellwether', 'name': '龙头股', 'url': '/0x4acb881cf7b392df48e10b52fe77115836d4cc10'},
149
150
  {'key': 'concept_market_situation', 'name': '市值风云', 'url': '/0xa2df531f71114d2001427d83d9955d2ab0a50cdf'},
150
- {'key': 'concept_down_top', 'name': '15-21年的超跌股', 'url': '/0x4f30e7aa31c910be8b4cecf1ec5cbcfa0fcd74b7'},
151
+ {'key': 'concept_down_top', 'name': '15-21年超跌股', 'url': '/0x4f30e7aa31c910be8b4cecf1ec5cbcfa0fcd74b7'},
151
152
  {'key': 'concept_auto_intelligent', 'name': '智能电动车', 'url': '/0x4594dd03fe141df964e980080769c5e171243ef0'},
152
153
  {'key': 'concept_hk', 'name': '港股', 'url': '/0xd63fedf985a711ff5b3b6567ee94e1ba49d3787c'},
153
154
  {'key': 'concept_us', 'name': '美股', 'url': '/0x77b7acd63bd93517f933bf0a02dafe82260f4791'},
@@ -179,6 +180,7 @@ const MenuList = [
179
180
  {'key': 'hk_hsm100', 'name': '恒生中国100指数', 'url': '/0x759fcb84a0a322125df6748dffad66d7b2b44c2d'},
180
181
  {'key': 'hk_biotechnology', 'name': '生物科技', 'url': '/0xa131be85db2beb939e93207d0966c3710c7b761a'},
181
182
  {'key': 'hk_sell_short', 'name': '沽空排行', 'url': '/0x4ecddc987891875a42d206620cd97ca382613485'},
183
+ {'key': 'hk_stock_exchange', 'name': '港股通持股排行', 'url': '/0x7549960a2de98a41a1b78e63202003a175b93dbb'},
182
184
  ]
183
185
  },
184
186
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -951,7 +951,7 @@ let Stock = {
951
951
  Stock["pfc_stock_chart"] = Util.multi_axis_line(Stock["pfc_stock_chart"], "pfc_stock_line_canvas", date_data, '总持股数(万股)', stock_num_data, '股价', price_data);
952
952
  Stock["pfc_fund_chart"] = Util.multi_axis_line(Stock["pfc_fund_chart"], "pfc_fund_line_canvas", date_data, '持仓家数', fund_num_data, '股价', price_data);
953
953
  if (j["cur_stock_num"] && j["cur_stock_num"] > 0 && j["pre_stock_num"] && j["pre_stock_num"] > 0) {
954
- $("#pfc_stock_tips").html("(当前持股数: <b class='text-info'>" + Util.to_unit(j["cur_stock_num"] * 10000, 3) + "</b>, 环比: " + Util.year_price_rate(j["cur_stock_num"], j["pre_stock_num"]) + ")");
954
+ $("#pfc_stock_tips").html("(当前持股数: <b class='text-info'>" + Util.to_unit(j["cur_stock_num"] * 10000, 4) + "</b>, 环比: " + Util.year_price_rate(j["cur_stock_num"], j["pre_stock_num"]) + ")");
955
955
  }
956
956
  if (j["cur_fund_num"] && j["cur_fund_num"] > 0 && j["pre_fund_num"] && j["pre_fund_num"] > 0) {
957
957
  $("#pfc_fund_tips").html("(当前基金数: <b class='text-info'>" + Util.to_unit(j["cur_fund_num"]) + "</b>, 环比: " + Util.year_price_rate(j["cur_fund_num"], j["pre_fund_num"]) + ")");
@@ -1094,11 +1094,8 @@ let Stock = {
1094
1094
  },
1095
1095
 
1096
1096
  fetch_margin: function () {
1097
+ let is_summary = Stock["rzye_chart"] ? 0 : 1;
1097
1098
  Stock["rzye_chart"] = Util.show_chart_loading(Stock["rzye_chart"], "rzye_line_canvas");
1098
- let is_summary = 0;
1099
- if (!Stock.rzye_chart) {
1100
- is_summary = 1;
1101
- }
1102
1099
  let payload = {
1103
1100
  action: "margin",
1104
1101
  is_summary: is_summary,
@@ -1115,39 +1112,38 @@ let Stock = {
1115
1112
  }
1116
1113
  rzye_high = Math.max(rzye_high, item["rzye"]);
1117
1114
  date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
1118
- rzye_data.push(Util.to_hundred_million(item["rzye"]));
1115
+ rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
1119
1116
  rqye_data.push(Util.to_float(item["rqye"] / 10000, 2));
1120
1117
  price_data.push(item["price"]);
1121
1118
  });
1122
1119
  let margin_summary = "";
1123
- if (!Stock.rzye_chart && j["latest"].length > 0) {
1120
+ if (is_summary === 1 && j["latest"].length > 0) {
1124
1121
  if (j["latest"].length === 1) {
1125
- margin_summary = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rzye"]);
1122
+ margin_summary = " 最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rzye"], 3);
1126
1123
  } else if (j["latest"].length === 2) {
1127
1124
  let d1 = j["latest"][0];
1128
1125
  let d2 = j["latest"][1];
1129
1126
  let difference = d1["rzye"] - d2["rzye"];
1130
1127
  let dist_tips = "";
1131
1128
  if (difference > 0) {
1132
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"])) + "' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference)) + "</b>)";
1129
+ dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"], 3)) + "' style='color: #a94442;'>+" + Util.strip_html(Util.to_unit(difference, 3)) + "</b>)";
1133
1130
  } else if (difference < 0) {
1134
- dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"])) + "' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference)) + "</b>)";
1131
+ dist_tips = "(<b title='" + Util.strip_html(Util.to_unit(d2["rzye"], 3)) + "' style='color: #3c763d;'>" + Util.strip_html(Util.to_unit(difference, 3)) + "</b>)";
1135
1132
  }
1136
- margin_summary = "最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"]) + dist_tips;
1133
+ margin_summary = " 最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + dist_tips;
1137
1134
  }
1138
1135
  }
1139
- margin_summary = '[' + Util.pack_html_link(j["url"], Stock.name) + ']融资余额(单位:亿)' + margin_summary + ' 最高: ' + Util.to_unit(rzye_high) + ' 最低: ' + Util.to_unit(rzye_low);
1136
+ margin_summary = Util.pack_html_link(j["url"], "[" + Stock.name + "融资余额(单位:亿)]") + margin_summary + ' 最高: ' + Util.to_unit(rzye_high, 3) + ' 最低: ' + Util.to_unit(rzye_low, 3);
1140
1137
  if (j["high"] && j["high"]["date"] && j["high"]["date"] > 0) {
1141
- margin_summary += ' 历史最高: ' + Util.to_unit(j["high"]["rzye"]) + '(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") + ')';
1138
+ margin_summary += ' 历史最高: ' + Util.to_unit(j["high"]["rzye"], 3) + '(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") + ')';
1142
1139
  }
1143
1140
  if (j["low"] && j["low"]["date"] && j["low"]["date"] > 0) {
1144
- margin_summary += ' 历史最低: ' + Util.to_unit(j["low"]["rzye"]) + '(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1141
+ margin_summary += ' 历史最低: ' + Util.to_unit(j["low"]["rzye"], 3) + '(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1145
1142
  }
1146
1143
  $("#margin_summary").html(margin_summary);
1147
1144
  Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额', rzye_data, '股价', price_data);
1148
- let flow_data = [];
1145
+ let flow_data = [], color_data = [];
1149
1146
  date_data = [];
1150
- let color_data = [];
1151
1147
  j["flow_data"].forEach(function (item) {
1152
1148
  if (item["value"] !== 0) {
1153
1149
  date_data.push(item["date"]);
@@ -1188,7 +1184,7 @@ let Stock = {
1188
1184
  let circulation_stock = $("#circulation_stock").attr("data-val");
1189
1185
  let latest_html = "";
1190
1186
  if (j["latest"].length === 1) {
1191
- let holding_num = Util.to_hundred_million(j["latest"][0]["volume"]);
1187
+ let holding_num = Util.to_hundred_million(j["latest"][0]["volume"], 3);
1192
1188
  let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1193
1189
  latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + holding_num + "亿股, 占 <b>" + holding_rate + "%</b> 流通股, ";
1194
1190
  } else if (j["latest"].length === 2) {
package/util.js CHANGED
@@ -27,6 +27,7 @@ const Util = {
27
27
  interval_timer: null,
28
28
  stock_timer_id: 0,
29
29
  is_init: 0,
30
+ is_load: 0,
30
31
  // 1年的天数
31
32
  one_year_day: 365,
32
33
  // 一天的秒数
@@ -230,7 +231,7 @@ const Util = {
230
231
  * @returns {string}
231
232
  */
232
233
  stock_url: function (code, name) {
233
- return "<a target='_blank' class='link_cls' rel='noopener noreferrer nofollow' href='/stock/" + code + "'>" + name + "</a>";
234
+ return Util.pack_html_link("/stock/" + code, name);
234
235
  },
235
236
 
236
237
  /**