sbd-npm 1.1.84 → 1.1.87

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/menu.js +1 -1
  2. package/package.json +1 -1
  3. package/util.js +37 -14
package/menu.js CHANGED
@@ -45,6 +45,7 @@ const MenuList = [
45
45
  'name': '趋势分析',
46
46
  'icon': 'edit',
47
47
  'menu': [
48
+ {'key': 'trend_price', 'name': '股价阶段涨跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
48
49
  {'key': 'trend_boll', 'name': '布林线', 'url': '/0c9b231a72e40475d6f985fd67bdb718'},
49
50
  {'key': 'trend_ma20_60', 'name': '20、60日均线交叉', 'url': '/4bf72713d83469ad6ec1d9fc3be8886f'},
50
51
  {'key': 'trend_macd_down', 'name': 'MACD下行', 'url': '/ff97a31b4ffbabe71315e75c4fd62047'},
@@ -54,7 +55,6 @@ const MenuList = [
54
55
  {'key': 'trend_fund_hold', 'name': '基金持股变化', 'url': '/067740976f85ec14ddae02b51829ce35'},
55
56
  {'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/722d94429b8e689fe78dca1cf67a4c67'},
56
57
  {'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/1964a6bc56dc3ce6825b23667c7fb588'},
57
- {'key': 'trend_price', 'name': '股价涨跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
58
58
  {'key': 'trend_down', 'name': '当前连跌个股', 'url': '/07fb907c7e7572fbeae98bacf5c44593'},
59
59
  {'key': 'trend_down_analysis', 'name': '连跌反弹概率', 'url': '/e9a32e4601fca33a9c3b68103f61c3bc'},
60
60
  {'key': 'trend_index_month', 'name': '指数每年月份涨跌', 'url': '/86691e421938098bab7679e43bea67a6'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.84",
3
+ "version": "1.1.87",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -233,8 +233,9 @@ const Util = {
233
233
  */
234
234
  stock_basics_html: function (html, item) {
235
235
  let symbol = Util.is_alpha(item["code"]) ? item["code"].toUpperCase() : item["code"];
236
+ let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : symbol);
236
237
  html.push("<td>", Util.snowball_url(symbol), "</td>");
237
- html.push("<td>", Util.stock_url(item["code"], item["name"]), "</td>");
238
+ html.push("<td>", Util.stock_url(item["code"], name), "</td>");
238
239
  html.push("<td>", (item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), "</td>");
239
240
  html.push("<td>", (item["market_capital"] ? (Util.to_float(item["market_capital"], 2) + "亿") : "--"), "</td>");
240
241
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
@@ -306,7 +307,7 @@ const Util = {
306
307
 
307
308
  /**
308
309
  * 获取价格数据
309
- * @param obj
310
+ * @param element_id
310
311
  * @param interval 循环间隔
311
312
  */
312
313
  refresh_price: function (element_id, interval = 0) {
@@ -763,11 +764,13 @@ const Util = {
763
764
  /**
764
765
  * 表格加载状态
765
766
  * @param element_id
767
+ * @param load_text
766
768
  */
767
- set_table_loading: function (element_id) {
769
+ set_table_loading: function (element_id, load_text = "") {
768
770
  let obj = $("#" + element_id);
769
771
  let td_num = obj.parent().find('thead td').length;
770
- obj.html('<tr><td colspan="' + td_num + '">Loading...</td></tr>');
772
+ load_text = load_text.length > 0 ? load_text : "Loading...";
773
+ obj.html('<tr><td colspan="' + td_num + '">' + load_text + '</td></tr>');
771
774
  },
772
775
 
773
776
  /**
@@ -1948,13 +1951,16 @@ const Util = {
1948
1951
  valid_code_list.forEach(function (code) {
1949
1952
  code_price_dict[code] = j[code]["price"];
1950
1953
  });
1951
- Util.post("/action", {action: "code_5d_price", code_list: code_list.join("-")}, function (j) {
1954
+ Util.post("/action", {action: "code_d5_price", code_list: code_list.join("-")}, function (j) {
1952
1955
  let total_num = 0;
1953
1956
  let total_week_change_percent = 0;
1954
- $.each(j, function (code, price_5d) {
1955
- if (price_5d > 0 && code_price_dict[code]) {
1957
+ $.each(j, function (code, d5_price) {
1958
+ if (d5_price > 0 && code_price_dict[code]) {
1956
1959
  total_num += 1;
1957
- total_week_change_percent += ((code_price_dict[code] - price_5d) / price_5d);
1960
+ total_week_change_percent += ((code_price_dict[code] - d5_price) / d5_price);
1961
+ $(".d5_price_" + code).each(function () {
1962
+ $(this).html(Util.year_price_rate(code_price_dict[code], d5_price));
1963
+ });
1958
1964
  }
1959
1965
  });
1960
1966
  if (total_num > 0) {
@@ -2179,6 +2185,16 @@ const Util = {
2179
2185
  return index_html;
2180
2186
  },
2181
2187
 
2188
+ /**
2189
+ * 组装 HTML 超链接
2190
+ * @param url
2191
+ * @param title
2192
+ * @returns {string}
2193
+ */
2194
+ pack_html_link: function (url, title) {
2195
+ return "<a target='_blank' class='link_cls' rel='noopener noreferrer nofollow' href='" + url + "'>" + title + "</a>";
2196
+ },
2197
+
2182
2198
  /**
2183
2199
  * 组装股东数据
2184
2200
  * @param item
@@ -2194,13 +2210,20 @@ const Util = {
2194
2210
  },
2195
2211
 
2196
2212
  /**
2197
- * 组装 HTML 超链接
2198
- * @param url
2199
- * @param title
2200
- * @returns {string}
2213
+ * 获取股东数据
2214
+ * @param element_id
2201
2215
  */
2202
- pack_html_link: function (url, title) {
2203
- return "<a target='_blank' class='link_cls' rel='noopener noreferrer nofollow' href='" + url + "'>" + title + "</a>";
2216
+ fetch_holder_num: function (element_id) {
2217
+ let code_list = Util.get_code_list(element_id);
2218
+ if (code_list.length > 0) {
2219
+ Util.post("/action", {action: "holder_num", code_list: code_list.join("-")}, function (j) {
2220
+ $.each(j, function (code, item) {
2221
+ $(".holder_" + code).each(function () {
2222
+ $(this).html(Util.pack_holder_num(item));
2223
+ });
2224
+ });
2225
+ });
2226
+ }
2204
2227
  },
2205
2228
 
2206
2229
  /**