sbd-npm 1.2.92 → 1.2.94

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/constant.js +1 -0
  2. package/package.json +1 -1
  3. package/util.js +34 -20
package/constant.js CHANGED
@@ -187,6 +187,7 @@ const MenuList = [
187
187
  {'key': 'us_sp500', 'name': '标普500', 'url': '/33f59986534947d63d6ca1dcebac15d7'},
188
188
  {'key': 'us_qqq', 'name': '纳斯达克100', 'url': '/2ce5bc68a55b5671613b66093d93b40c'},
189
189
  {'key': 'us_cn', 'name': '中国概念股', 'url': '/bff1b2e208757edb89df6e62385a8c1b'},
190
+ {'key': 'us_buffett', 'name': '巴菲特持仓', 'url': '/7140067ba3e1ed8834f72d353391e0bb'},
190
191
  {'key': 'us_dollar_index', 'name': '美元指数', 'url': '/2cba34f3658ea00c047aba2f4b790877'},
191
192
  {'key': 'us_bond_yield', 'name': '美十年国债收益率', 'url': '/3d1ba074a5d8e2e0162fce0db80753d4'},
192
193
  {'key': 'us_usd_cnh', 'name': '美元离岸人民币汇率', 'url': '/f1e85a31b0829c6de701d5f6c0b97494'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.92",
3
+ "version": "1.2.94",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -210,10 +210,9 @@ const Util = {
210
210
  * @returns {string}
211
211
  */
212
212
  snowball_url: function (code) {
213
- let stock_symbol = code;
214
- let code_name = code;
213
+ let stock_symbol = code, code_name = code;
215
214
  if (Util.is_us(code)) {
216
- stock_symbol = code;
215
+ code_name = code_name.toUpperCase();
217
216
  } else if (Util.is_hk(code)) {
218
217
  code_name = Util.code_to_symbol(code);
219
218
  } else {
@@ -243,8 +242,18 @@ const Util = {
243
242
  return "--";
244
243
  }
245
244
  if (industry) {
246
- let market = Util.code_to_market(code);
247
- return "<a target='_blank' class='industry_link' href='/query?industry=" + industry + "&market=" + market + "'>" + industry + "</a>";
245
+ let url = "?industry=" + industry;
246
+ if (Util.is_us(code)) {
247
+ url = Util.get_url("us_list") + url
248
+ } else if (Util.is_hk(code)) {
249
+ url = Util.get_url("hk_list") + url
250
+ } else {
251
+ url = Util.get_url("query_list") + url
252
+ }
253
+ if (industry.length > 6) {
254
+ return "<a title='" + industry + "' target='_blank' class='industry_link' href='" + url + "'>" + industry.substr(0, 6) + "</a>";
255
+ }
256
+ return "<a target='_blank' class='industry_link' href='" + url + "'>" + industry + "</a>";
248
257
  }
249
258
  return "--";
250
259
  },
@@ -492,11 +501,11 @@ const Util = {
492
501
  stock_us_html: function (html, item) {
493
502
  let code = item["code"].toUpperCase();
494
503
  let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : code);
495
- html.push("<td><a class='code_item' target='_blank' rel='noopener noreferrer nofollow' href='https://xueqiu.com/S/", item["code"], "'>", code, "</a></td>");
504
+ html.push("<td>", Util.snowball_url(code), "</td>");
496
505
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
497
506
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
498
507
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
499
- html.push("<td>", Util.map_url(item["registered"]), "</td>");
508
+ html.push("<td>", Util.google_map_url(item["registered"]), "</td>");
500
509
  html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
501
510
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
502
511
  html.push("<td>", Util.to_float(item["market_capital"], 3), "亿</td>");
@@ -1155,7 +1164,12 @@ const Util = {
1155
1164
  }
1156
1165
  }
1157
1166
  });
1158
- let payload = {action: "public_fund_stock", fund_code: fund_code, date: date, pre_date: pre_date};
1167
+ let payload = {
1168
+ action: "public_fund_stock",
1169
+ fund_code: fund_code,
1170
+ date: date,
1171
+ pre_date: pre_date
1172
+ };
1159
1173
  Util.post(Util.get_url("fund_public"), payload, function (j) {
1160
1174
  $("." + component_tr).each(function () {
1161
1175
  $(this).remove();
@@ -2344,8 +2358,18 @@ const Util = {
2344
2358
  if (tips_obj.length) {
2345
2359
  tips_obj.html('共 <span class="label label-info">' + code_list.length + '</span> 家');
2346
2360
  }
2347
- //获取股票详情数据
2348
- Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
2361
+ let payload = {action: "code_detail", code_list: code_list.join("-")};
2362
+ $("#" + element_id).parent().find('thead td').each(function() {
2363
+ let title = $(this).text();
2364
+ if (title === "股东数") {
2365
+ payload["is_holder"] = 1;
2366
+ } else if (title === "基金数") {
2367
+ payload["is_fund"] = 1;
2368
+ } else if (title === "主力资金") {
2369
+ payload["is_money_inflow"] = 1;
2370
+ }
2371
+ });
2372
+ Util.post("/action", payload, function (j) {
2349
2373
  let valid_code_list = [];
2350
2374
  let total_change_percent = 0, total_year_change_percent = 0, total_d5_change_percent = 0;
2351
2375
  $.each(j, function (code, item) {
@@ -2957,16 +2981,6 @@ const Util = {
2957
2981
  return Util.to_float(digit / 100000000, fraction);
2958
2982
  },
2959
2983
 
2960
- /**
2961
- * 转为以万为单位的数值
2962
- * @param digit
2963
- * @param fraction
2964
- * @returns {*|number}
2965
- */
2966
- to_ten_thousand: function (digit, fraction = 2) {
2967
- return Util.to_float(digit / 10000, fraction);
2968
- },
2969
-
2970
2984
  /**
2971
2985
  * 转为相应单位的数值
2972
2986
  * @param digit