sbd-npm 1.2.93 → 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.
- package/constant.js +1 -0
- package/package.json +1 -1
- package/util.js +15 -16
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
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
|
-
|
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
|
247
|
-
|
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,7 +501,7 @@ 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
|
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>");
|
@@ -2972,16 +2981,6 @@ const Util = {
|
|
2972
2981
|
return Util.to_float(digit / 100000000, fraction);
|
2973
2982
|
},
|
2974
2983
|
|
2975
|
-
/**
|
2976
|
-
* 转为以万为单位的数值
|
2977
|
-
* @param digit
|
2978
|
-
* @param fraction
|
2979
|
-
* @returns {*|number}
|
2980
|
-
*/
|
2981
|
-
to_ten_thousand: function (digit, fraction = 2) {
|
2982
|
-
return Util.to_float(digit / 10000, fraction);
|
2983
|
-
},
|
2984
|
-
|
2985
2984
|
/**
|
2986
2985
|
* 转为相应单位的数值
|
2987
2986
|
* @param digit
|