sbd-npm 1.1.85 → 1.1.88

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 (4) hide show
  1. package/.npmignore +1 -0
  2. package/menu.js +1 -1
  3. package/package.json +1 -1
  4. package/util.js +19 -13
package/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
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.85",
3
+ "version": "1.1.88",
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>");
@@ -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
  /**
@@ -862,7 +865,7 @@ const Util = {
862
865
  _html = Util.stock_basics_html(_html, item);
863
866
  _html.push("<td id='high_", item["code"], "'>0</td>");
864
867
  _html.push("<td id='low_", item["code"], "'>0</td>");
865
- _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
868
+ _html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
866
869
  _html.push("<td class='high_52week_", item["code"], "'>--</td>");
867
870
  if (is_us === 0) {
868
871
  _html.push("<td id='amount_", item["code"], "'>--</td>");
@@ -997,7 +1000,7 @@ const Util = {
997
1000
  _html.push("<tr class='" + component_tr + "'>");
998
1001
  _html.push("<td>", index + 1, "</td>");
999
1002
  _html = Util.stock_basics_html(_html, item);
1000
- _html.push("<td data-val='", item["year_price"], "' class='year_price_", item["code"], "'>--</td>");
1003
+ _html.push("<td class='year_price_", item["code"], "'>", (item["stock_price"] ? Util.year_price_rate(item["stock_price"], item["year_price"]) : "--"), "</td>");
1001
1004
  let stock_num_tips = "";
1002
1005
  if (item["stock_num"] > 0 && item["pre_stock_num"] > 0) {
1003
1006
  let gap_stock_num = item["stock_num"] - item["pre_stock_num"];
@@ -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) {
@@ -3105,12 +3111,12 @@ const Util = {
3105
3111
 
3106
3112
  /**
3107
3113
  * 大单交易
3108
- * @param obj_id
3114
+ * @param element_id
3109
3115
  */
3110
- big_deal_pie: function (obj_id, data) {
3116
+ big_deal_pie: function (element_id, data) {
3111
3117
  let buy = Util.to_unit(data["buy1000"] + data["buy800"] + data["buy600"] + data["buy400"]);
3112
3118
  let sell = Util.to_unit(data["sell1000"] + data["sell800"] + data["sell600"] + data["sell400"]);
3113
- $("#" + obj_id + "_tips").html("流入: <b class='text-danger'>" + buy + "</b>,流出: <b class='text-success'>" + sell + "</b>");
3119
+ $("#" + element_id + "_tips").html("流入: <b class='text-danger'>" + Util.strip_html(buy) + "</b>,流出: <b class='text-success'>" + Util.strip_html(sell) + "</b>");
3114
3120
  let bd_data = [
3115
3121
  {name: '超大单流入', value: Util.to_hundred_million(data["buy1000"])},
3116
3122
  {name: '大单流入', value: Util.to_hundred_million(data["buy800"])},
@@ -3121,7 +3127,7 @@ const Util = {
3121
3127
  {name: '大单流出', value: Util.to_hundred_million(data["sell800"])},
3122
3128
  {name: '超大单流出', value: Util.to_hundred_million(data["sell1000"])}
3123
3129
  ];
3124
- let BigDealPie = echarts.init(document.getElementById(obj_id), {});
3130
+ let BigDealPie = echarts.init(document.getElementById(element_id), {});
3125
3131
  BigDealPie.setOption({
3126
3132
  tooltip: {
3127
3133
  trigger: 'item',