sbd-npm 1.4.94 → 1.4.96
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/package.json +1 -1
- package/status.js +33 -34
- package/stock_basics.js +145 -145
- package/summary_daily.js +62 -62
- package/util.js +375 -346
package/util.js
CHANGED
|
@@ -189,10 +189,10 @@ const Util = {
|
|
|
189
189
|
if (key_word === j["key_word"]) {
|
|
190
190
|
let html = [];
|
|
191
191
|
html.push('<div class="list-group">');
|
|
192
|
-
if (j
|
|
193
|
-
j
|
|
194
|
-
let upper_code = item
|
|
195
|
-
html.push('<a target="_blank" rel="noopener noreferrer nofollow" class="list-group-item" href="/stock/', upper_code, '">', (item
|
|
192
|
+
if (j.data && j.data.length > 0) {
|
|
193
|
+
j.data.forEach(function (item) {
|
|
194
|
+
let upper_code = item.code.toUpperCase();
|
|
195
|
+
html.push('<a target="_blank" rel="noopener noreferrer nofollow" class="list-group-item" href="/stock/', upper_code, '">', (item.name ? item.name : upper_code), '(', upper_code, ')</a>');
|
|
196
196
|
});
|
|
197
197
|
} else {
|
|
198
198
|
html.push('<a href="#" class="list-group-item disabled">无数据</a>');
|
|
@@ -385,18 +385,18 @@ const Util = {
|
|
|
385
385
|
* @returns {*}
|
|
386
386
|
*/
|
|
387
387
|
stock_basics_html: function (html, item) {
|
|
388
|
-
let symbol = Util.is_alphabet(item
|
|
388
|
+
let symbol = Util.is_alphabet(item.code) ? item.code.toUpperCase() : item.code;
|
|
389
389
|
let name = symbol;
|
|
390
|
-
if (item
|
|
391
|
-
if (Util.is_us(item
|
|
392
|
-
name = item
|
|
390
|
+
if (item.cname) {
|
|
391
|
+
if (Util.is_us(item.code)) {
|
|
392
|
+
name = item.cname.replace("有限公司", "").replace("公司", "").replace("•", "").replace("•", "");
|
|
393
393
|
} else {
|
|
394
|
-
name = item
|
|
394
|
+
name = item.cname;
|
|
395
395
|
}
|
|
396
|
-
} else if (item
|
|
397
|
-
name = item
|
|
398
|
-
if (Util.is_us(item
|
|
399
|
-
if (name.
|
|
396
|
+
} else if (item.name) {
|
|
397
|
+
name = item.name;
|
|
398
|
+
if (Util.is_us(item.code)) {
|
|
399
|
+
if (name.includes(' ')) {
|
|
400
400
|
let name_array = name.split(' ');
|
|
401
401
|
name = name_array[0] ? name_array[0] : name;
|
|
402
402
|
} else {
|
|
@@ -406,21 +406,21 @@ const Util = {
|
|
|
406
406
|
name = name.substring(0, 10);
|
|
407
407
|
}
|
|
408
408
|
html.push("<td>", Util.snowball_url(symbol), "</td>");
|
|
409
|
-
html.push("<td>", Util.stock_url(item
|
|
410
|
-
html.push("<td>", Util.to_float((item
|
|
411
|
-
html.push("<td>", (item
|
|
412
|
-
html.push("<td>", Util.industry_url(item
|
|
413
|
-
html.push("<td>", Util.map_url((item
|
|
414
|
-
let price = item
|
|
415
|
-
let pre_price = item
|
|
409
|
+
html.push("<td>", Util.stock_url(item.code, name), "</td>");
|
|
410
|
+
html.push("<td>", Util.to_float((item.pe_ttm ? item.pe_ttm : item.pe), 2), "</td>");
|
|
411
|
+
html.push("<td>", (item.market_capital ? (Util.to_float(item.market_capital, 2) + "亿") : "--"), "</td>");
|
|
412
|
+
html.push("<td>", Util.industry_url(item.code, item.industry), "</td>");
|
|
413
|
+
html.push("<td>", Util.map_url((item.province_city && item.province_city !== "None") ? item.province_city : item.area), "</td>");
|
|
414
|
+
let price = item.stock_price ? item.stock_price : item.price;
|
|
415
|
+
let pre_price = item.pre_price ? item.pre_price : (item.previous_price ? item.previous_price : 0);
|
|
416
416
|
if (pre_price > 0) {
|
|
417
|
-
if (item
|
|
418
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
417
|
+
if (item.no_refresh_price && item.no_refresh_price > 0) {
|
|
418
|
+
html.push("<td>", Util.digit_compare_trend(item.no_refresh_price, pre_price), "</td>");
|
|
419
419
|
} else {
|
|
420
|
-
html.push("<td class='price_", item
|
|
420
|
+
html.push("<td class='price_", item.code.toLowerCase(), "'>", Util.digit_compare_trend(price, pre_price), "</td>");
|
|
421
421
|
}
|
|
422
422
|
} else {
|
|
423
|
-
html.push("<td class='price_", item
|
|
423
|
+
html.push("<td class='price_", item.code.toLowerCase(), "'>", price, "</td>");
|
|
424
424
|
}
|
|
425
425
|
return html;
|
|
426
426
|
},
|
|
@@ -513,24 +513,24 @@ const Util = {
|
|
|
513
513
|
* @param item
|
|
514
514
|
*/
|
|
515
515
|
render_price: function (item) {
|
|
516
|
-
let code = item
|
|
517
|
-
if (item
|
|
516
|
+
let code = item.code;
|
|
517
|
+
if (item.price) {
|
|
518
518
|
if ($("#price_change_" + code).length) {
|
|
519
|
-
let price_cls = Util.text_color(item
|
|
519
|
+
let price_cls = Util.text_color(item.price, item.previous_price);
|
|
520
520
|
$(".price_" + code).each(function () {
|
|
521
|
-
$(this).html("<b class='" + price_cls + "'>" + Util.to_float(item
|
|
521
|
+
$(this).html("<b class='" + price_cls + "'>" + Util.to_float(item.price, 2) + "</b>");
|
|
522
522
|
});
|
|
523
|
-
$("#price_change_" + code).html(Util.year_price_rate(item
|
|
523
|
+
$("#price_change_" + code).html(Util.year_price_rate(item.price, item.previous_price));
|
|
524
524
|
} else {
|
|
525
|
-
let price = Util.digit_compare_trend(item
|
|
526
|
-
let price_change_rate = Util.calc_change_rate(item
|
|
525
|
+
let price = Util.digit_compare_trend(item.price, item.previous_price);
|
|
526
|
+
let price_change_rate = Util.calc_change_rate(item.price, item.previous_price, 4);
|
|
527
527
|
$(".price_" + code).each(function () {
|
|
528
528
|
if ($(this).attr("data-color")) {
|
|
529
529
|
let pre_price = parseFloat(Util.strip_bracket_string($(this).text()));
|
|
530
|
-
if (item
|
|
530
|
+
if (item.price > pre_price && pre_price > 0) {
|
|
531
531
|
$(this).css("background-color", "#FF7B7B");
|
|
532
532
|
$(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
|
|
533
|
-
} else if (item
|
|
533
|
+
} else if (item.price > 0 && item.price < pre_price) {
|
|
534
534
|
$(this).css("background-color", "#ADFFAD");
|
|
535
535
|
$(this).animate({backgroundColor: $(this).attr("data-color")}, 2000);
|
|
536
536
|
}
|
|
@@ -542,54 +542,54 @@ const Util = {
|
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
544
|
$(".year_price_" + code).each(function () {
|
|
545
|
-
if (item
|
|
546
|
-
$(this).html(Util.year_price_rate(item
|
|
545
|
+
if (item.year_price) {
|
|
546
|
+
$(this).html(Util.year_price_rate(item.price, item.year_price));
|
|
547
547
|
} else {
|
|
548
548
|
let year_price = $(this).attr("data-val");
|
|
549
549
|
if (year_price) {
|
|
550
|
-
$(this).html(Util.year_price_rate(item
|
|
550
|
+
$(this).html(Util.year_price_rate(item.price, Util.to_float(year_price)));
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
});
|
|
554
554
|
$(".d5_price_" + code).each(function () {
|
|
555
|
-
if (item
|
|
556
|
-
$(this).html(Util.year_price_rate(item
|
|
555
|
+
if (item.d5_price) {
|
|
556
|
+
$(this).html(Util.year_price_rate(item.price, item.d5_price));
|
|
557
557
|
} else {
|
|
558
558
|
let d5_price = $(this).attr("data-val");
|
|
559
559
|
if (d5_price) {
|
|
560
|
-
$(this).html(Util.year_price_rate(item
|
|
560
|
+
$(this).html(Util.year_price_rate(item.price, Util.to_float(d5_price)));
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
});
|
|
564
|
-
if (item
|
|
564
|
+
if (item.high_52week) {
|
|
565
565
|
$(".high_52week_" + code).each(function () {
|
|
566
|
-
$(this).html(Util.year_price_rate(item
|
|
566
|
+
$(this).html(Util.year_price_rate(item.price, item.high_52week));
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
if (item
|
|
571
|
-
let high_price = Util.digit_compare_trend(item
|
|
572
|
-
let limit_up_price = Math.floor((item
|
|
570
|
+
if (item.high) {
|
|
571
|
+
let high_price = Util.digit_compare_trend(item.high, item.previous_price);
|
|
572
|
+
let limit_up_price = Math.floor((item.previous_price * 1.1) * 100) / 100;
|
|
573
573
|
high_price = high_price.replace(/title='(.*?)'/, "title='" + limit_up_price + "'");
|
|
574
574
|
$("#high_" + code).html(high_price);
|
|
575
575
|
}
|
|
576
|
-
if (item
|
|
577
|
-
let low_price = Util.digit_compare_trend(item
|
|
578
|
-
let down_limit_price = Math.ceil((item
|
|
576
|
+
if (item.low) {
|
|
577
|
+
let low_price = Util.digit_compare_trend(item.low, item.previous_price);
|
|
578
|
+
let down_limit_price = Math.ceil((item.previous_price * 0.9) * 100) / 100;
|
|
579
579
|
low_price = low_price.replace(/title='(.*?)'/, "title='" + down_limit_price + "'");
|
|
580
580
|
$("#low_" + code).html(low_price);
|
|
581
581
|
}
|
|
582
|
-
if (item
|
|
583
|
-
let amount = "<span title='" + item
|
|
582
|
+
if (item.amount) {
|
|
583
|
+
let amount = "<span title='" + item.amount + "'>" + Util.to_hundred_million(item.amount) + "亿</span>";
|
|
584
584
|
$("#amount_" + code).html(amount);
|
|
585
|
-
$("#average_" + code).html(Util.to_float(item
|
|
585
|
+
$("#average_" + code).html(Util.to_float(item.amount / item.volume, 2));
|
|
586
586
|
}
|
|
587
587
|
let remark_obj = $("#remark_" + code);
|
|
588
|
-
if (remark_obj.length > 0 && ((item
|
|
588
|
+
if (remark_obj.length > 0 && ((item.buy && item.buy > 0) || (item.sell && item.sell > 0))) {
|
|
589
589
|
remark_obj.removeClass("success");
|
|
590
590
|
remark_obj.removeClass("danger");
|
|
591
|
-
remark_obj.addClass(item
|
|
592
|
-
remark_obj.attr("title", "五档卖出: " + Util.to_hundred_million(item
|
|
591
|
+
remark_obj.addClass(item.buy > item.sell ? "danger" : "success");
|
|
592
|
+
remark_obj.attr("title", "五档卖出: " + Util.to_hundred_million(item.sell) + "亿\n 五档买入: " + Util.to_hundred_million(item.buy) + "亿");
|
|
593
593
|
}
|
|
594
594
|
},
|
|
595
595
|
|
|
@@ -600,22 +600,22 @@ const Util = {
|
|
|
600
600
|
* @returns {*}
|
|
601
601
|
*/
|
|
602
602
|
stock_hk_html: function (html, item) {
|
|
603
|
-
html.push("<td>", Util.snowball_url(item
|
|
604
|
-
if (item
|
|
605
|
-
item
|
|
603
|
+
html.push("<td>", Util.snowball_url(item.code), "</td>");
|
|
604
|
+
if (item.name && item.name.length > 5) {
|
|
605
|
+
item.name = item.name.replace("有限公司", "").replace("集团", "").replace("股份", "");
|
|
606
606
|
}
|
|
607
|
-
html.push("<td>", Util.stock_url(item
|
|
608
|
-
html.push("<td class='hk_industry'>", item
|
|
609
|
-
html.push("<td>", Util.map_url(item
|
|
610
|
-
html.push("<td>", Util.to_float((item
|
|
611
|
-
html.push("<td>", Util.to_float(item
|
|
612
|
-
html.push("<td>", Util.to_float(item
|
|
613
|
-
html.push("<td>", Util.to_float(item
|
|
614
|
-
html.push("<td class='price_", item
|
|
615
|
-
html.push("<td>", Util.year_price_rate(item
|
|
616
|
-
html.push("<td>", Util.year_price_rate(item
|
|
617
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
618
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
607
|
+
html.push("<td>", Util.stock_url(item.code, item.name), "</td>");
|
|
608
|
+
html.push("<td class='hk_industry'>", item.industry, "</td>");
|
|
609
|
+
html.push("<td>", Util.map_url(item.province_city), "</td>");
|
|
610
|
+
html.push("<td>", Util.to_float((item.pe_ttm ? item.pe_ttm : item.pe), 2), "</td>");
|
|
611
|
+
html.push("<td>", Util.to_float(item.pb, 2), "</td>");
|
|
612
|
+
html.push("<td>", Util.to_float(item.total_shares, 2), "亿</td>");
|
|
613
|
+
html.push("<td>", Util.to_float(item.market_capital, 3), "亿</td>");
|
|
614
|
+
html.push("<td class='price_", item.code, "'>", item.price, "</td>");
|
|
615
|
+
html.push("<td>", Util.year_price_rate(item.price, item.year_price), "</td>");
|
|
616
|
+
html.push("<td>", Util.year_price_rate(item.price, item.d5_price), "</td>");
|
|
617
|
+
html.push("<td>", Util.digit_compare_trend(item.high_52week, item.price), "</td>");
|
|
618
|
+
html.push("<td>", Util.digit_compare_trend(item.low_52week, item.price), "</td>");
|
|
619
619
|
return html;
|
|
620
620
|
},
|
|
621
621
|
|
|
@@ -626,21 +626,21 @@ const Util = {
|
|
|
626
626
|
* @returns {*}
|
|
627
627
|
*/
|
|
628
628
|
stock_us_html: function (html, item) {
|
|
629
|
-
let code = item
|
|
630
|
-
let name = item
|
|
629
|
+
let code = item.code.toUpperCase();
|
|
630
|
+
let name = item.cname ? item.cname : (item.name ? item.name.substring(0, 10) : code);
|
|
631
631
|
html.push("<td>", Util.snowball_url(code), "</td>");
|
|
632
|
-
html.push("<td>", Util.stock_url(item
|
|
633
|
-
html.push("<td>", (item
|
|
634
|
-
html.push("<td>", Util.industry_url(item
|
|
635
|
-
html.push("<td>", Util.google_map_url(item
|
|
636
|
-
html.push("<td>", Util.to_float((item
|
|
637
|
-
html.push("<td>", Util.to_float(item
|
|
638
|
-
html.push("<td>", Util.to_float(item
|
|
639
|
-
html.push("<td class='price_", item
|
|
640
|
-
html.push("<td>", item
|
|
641
|
-
html.push("<td>", Util.year_price_rate(item
|
|
642
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
643
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
632
|
+
html.push("<td>", Util.stock_url(item.code, name), "</td>");
|
|
633
|
+
html.push("<td>", (item.sector ? item.sector : "--"), "</td>");
|
|
634
|
+
html.push("<td>", Util.industry_url(item.code, item.industry), "</td>");
|
|
635
|
+
html.push("<td>", Util.google_map_url(item.registered), "</td>");
|
|
636
|
+
html.push("<td>", Util.to_float((item.pe_ttm ? item.pe_ttm : item.pe), 2), "</td>");
|
|
637
|
+
html.push("<td>", Util.to_float(item.total_shares, 2), "亿</td>");
|
|
638
|
+
html.push("<td>", Util.to_float(item.market_capital, 3), "亿</td>");
|
|
639
|
+
html.push("<td class='price_", item.code.toLowerCase(), "'>", item.price, "</td>");
|
|
640
|
+
html.push("<td>", item.market, "</td>");
|
|
641
|
+
html.push("<td>", Util.year_price_rate(item.price, item.year_price), "</td>");
|
|
642
|
+
html.push("<td>", Util.digit_compare_trend(item.high_52week, item.price), "</td>");
|
|
643
|
+
html.push("<td>", Util.digit_compare_trend(item.low_52week, item.price), "</td>");
|
|
644
644
|
return html;
|
|
645
645
|
},
|
|
646
646
|
|
|
@@ -1028,7 +1028,7 @@ const Util = {
|
|
|
1028
1028
|
},
|
|
1029
1029
|
|
|
1030
1030
|
/**
|
|
1031
|
-
*
|
|
1031
|
+
* 渲染表格数据
|
|
1032
1032
|
* @param element_id
|
|
1033
1033
|
* @param html
|
|
1034
1034
|
*/
|
|
@@ -1042,6 +1042,36 @@ const Util = {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
},
|
|
1044
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* 渲染 industry 下拉选择框数据
|
|
1047
|
+
* @param element_id
|
|
1048
|
+
* @param industry_data
|
|
1049
|
+
*/
|
|
1050
|
+
render_industry_select_html: function (element_id, industry_data) {
|
|
1051
|
+
let html = ['<option value="0">行业</option>'];
|
|
1052
|
+
if (Array.isArray(industry_data)) {
|
|
1053
|
+
industry_data.forEach(function (i) {
|
|
1054
|
+
html.push('<option value="', i["id"], '">', i["industry"], '(', i["num"], ')</option>');
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
$("#" + element_id).html(html.join(""));
|
|
1058
|
+
},
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* 渲染 area 下拉选择框数据
|
|
1062
|
+
* @param element_id
|
|
1063
|
+
* @param area_data
|
|
1064
|
+
*/
|
|
1065
|
+
render_area_select_html: function (element_id, area_data) {
|
|
1066
|
+
let html = ['<option value="">地区</option>'];
|
|
1067
|
+
if (Array.isArray(area_data)) {
|
|
1068
|
+
area_data.forEach(function (a) {
|
|
1069
|
+
html.push('<option value="', a["area"], '">', a["area"], '(', a["num"], ')</option>');
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
$("#" + element_id).html(html.join(""));
|
|
1073
|
+
},
|
|
1074
|
+
|
|
1045
1075
|
/**
|
|
1046
1076
|
* 表格加载状态
|
|
1047
1077
|
* @param element_id
|
|
@@ -1088,9 +1118,9 @@ const Util = {
|
|
|
1088
1118
|
let code_list = Util.get_code_list(code_zone_id);
|
|
1089
1119
|
code_list = code_list.length > 0 ? code_list.join("-") : "all";
|
|
1090
1120
|
Util.post("/action", {action: "classify_num", code_list: code_list}, function (j) {
|
|
1091
|
-
if (j
|
|
1121
|
+
if (j.data) {
|
|
1092
1122
|
let classify_val = $("#" + classify_id).val();
|
|
1093
|
-
Util.render_classify_html(classify_id, j
|
|
1123
|
+
Util.render_classify_html(classify_id, j.data, callback_func);
|
|
1094
1124
|
if (classify_val && classify_val !== "0") {
|
|
1095
1125
|
$("#" + classify_id).val(classify_val);
|
|
1096
1126
|
}
|
|
@@ -1131,15 +1161,15 @@ const Util = {
|
|
|
1131
1161
|
}
|
|
1132
1162
|
Util.post("/stock/" + code, {action: "rps"}, function (j) {
|
|
1133
1163
|
let html = [];
|
|
1134
|
-
j
|
|
1164
|
+
j.data.forEach(function (item) {
|
|
1135
1165
|
html.push("<tr>");
|
|
1136
|
-
html.push("<td>", Util.seconds_to_format(item
|
|
1137
|
-
html.push("<td style='background-color: ", item
|
|
1138
|
-
html.push("<td>", Util.parse_ratio(item
|
|
1139
|
-
html.push("<td style='background-color: ", item
|
|
1140
|
-
html.push("<td>", Util.parse_ratio(item
|
|
1141
|
-
html.push("<td style='background-color: ", item
|
|
1142
|
-
html.push("<td>", Util.parse_ratio(item
|
|
1166
|
+
html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
|
|
1167
|
+
html.push("<td style='background-color: ", item.rps20_color, "'>", item.rps20, "</td>");
|
|
1168
|
+
html.push("<td>", Util.parse_ratio(item.change_percent20 * 100, 2), "</td>");
|
|
1169
|
+
html.push("<td style='background-color: ", item.rps60_color, "'>", item.rps60, "</td>");
|
|
1170
|
+
html.push("<td>", Util.parse_ratio(item.change_percent60 * 100, 2), "</td>");
|
|
1171
|
+
html.push("<td style='background-color: ", item.rps120_color, "'>", item.rps120, "</td>");
|
|
1172
|
+
html.push("<td>", Util.parse_ratio(item.change_percent120 * 100, 2), "</td>");
|
|
1143
1173
|
html.push("</tr>");
|
|
1144
1174
|
});
|
|
1145
1175
|
Util.render_table_html("rps_table_body", html);
|
|
@@ -1177,16 +1207,15 @@ const Util = {
|
|
|
1177
1207
|
};
|
|
1178
1208
|
Util.post("/stock/" + code, payload, function (j) {
|
|
1179
1209
|
Util.render_public_fund(j);
|
|
1180
|
-
if (j
|
|
1210
|
+
if (j.date && j.date > 0) {
|
|
1181
1211
|
$("#public_fund_title").find("a").each(function() {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
$(this).attr("href", "https://data.eastmoney.com/zlsj/detail/" + Util.seconds_to_format(j["date"], "%Y-%m-%d") + "-1-" + code + ".html");
|
|
1212
|
+
if ($(this).text().includes("基金明细")) {
|
|
1213
|
+
$(this).attr("href", "https://data.eastmoney.com/zlsj/detail/" + Util.seconds_to_format(j.date, "%Y-%m-%d") + "-1-" + code + ".html");
|
|
1185
1214
|
}
|
|
1186
1215
|
});
|
|
1187
1216
|
}
|
|
1188
1217
|
if ($("#public_fund_date").length === 0) {
|
|
1189
|
-
let fund_len = j
|
|
1218
|
+
let fund_len = j.data ? j.data.length : 0;
|
|
1190
1219
|
let payload = {
|
|
1191
1220
|
action: "public_fund_date",
|
|
1192
1221
|
is_fund_rank10: $("#is_fund_rank10").prop("checked") ? 1 : 0
|
|
@@ -1194,10 +1223,10 @@ const Util = {
|
|
|
1194
1223
|
Util.post("/stock/" + code, payload, function (j) {
|
|
1195
1224
|
let html = [], date_len = 0;
|
|
1196
1225
|
html.push('<select id="public_fund_date">');
|
|
1197
|
-
j
|
|
1226
|
+
j.data.forEach(function (item) {
|
|
1198
1227
|
date_len ++;
|
|
1199
|
-
let date_format = Util.seconds_to_format(item
|
|
1200
|
-
html.push('<option value="', date_format, '">', date_format, '(', item
|
|
1228
|
+
let date_format = Util.seconds_to_format(item.date, "%Y-%m-%d");
|
|
1229
|
+
html.push('<option value="', date_format, '">', date_format, '(', item.num, ')</option>');
|
|
1201
1230
|
});
|
|
1202
1231
|
html.push('</select>');
|
|
1203
1232
|
$("#public_fund_date_zone").html(html.join(""));
|
|
@@ -1248,33 +1277,33 @@ const Util = {
|
|
|
1248
1277
|
*/
|
|
1249
1278
|
render_public_fund: function(j) {
|
|
1250
1279
|
let html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
|
|
1251
|
-
j
|
|
1252
|
-
j
|
|
1280
|
+
j.data = j.data ? j.data : [];
|
|
1281
|
+
j.data.forEach(function (item) {
|
|
1253
1282
|
total_public_fund++;
|
|
1254
|
-
total_stock_num += item
|
|
1255
|
-
total_market_capital += item
|
|
1283
|
+
total_stock_num += item.stock_num;
|
|
1284
|
+
total_market_capital += item.market_capital;
|
|
1256
1285
|
let public_date = "--";
|
|
1257
|
-
if (item
|
|
1258
|
-
public_date = Util.seconds_to_format(item
|
|
1286
|
+
if (item.public_date > 0) {
|
|
1287
|
+
public_date = Util.seconds_to_format(item.public_date, "%Y-%m-%d");
|
|
1259
1288
|
}
|
|
1260
|
-
let net = item
|
|
1261
|
-
let cls = Util.text_color(item
|
|
1289
|
+
let net = item.net;
|
|
1290
|
+
let cls = Util.text_color(item.change_percent)
|
|
1262
1291
|
if (cls !== "") {
|
|
1263
|
-
net = "<b class='" + cls + "'>" + net + "(" + Util.to_float(item
|
|
1292
|
+
net = "<b class='" + cls + "'>" + net + "(" + Util.to_float(item.change_percent, 2) + "%)</b>";
|
|
1264
1293
|
}
|
|
1265
|
-
html.push("<tr class='", ((
|
|
1294
|
+
html.push("<tr class='", (j.etf_code_list.includes(item.fund_code) ? "danger" : ""), "'>");
|
|
1266
1295
|
html.push("<td>", total_public_fund, "</td>");
|
|
1267
|
-
html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item
|
|
1268
|
-
html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item
|
|
1296
|
+
html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item.fund_code + '.html', item.fund_code), "</td>");
|
|
1297
|
+
html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item.fund_code + '.html', item.fund_name), "</td>");
|
|
1269
1298
|
html.push("<td>", net, "</td>");
|
|
1270
|
-
html.push("<td>", item
|
|
1271
|
-
html.push("<td>", item
|
|
1272
|
-
html.push("<td>", item
|
|
1299
|
+
html.push("<td>", item.assets, "亿</td>");
|
|
1300
|
+
html.push("<td>", item.fund_type, "</td>");
|
|
1301
|
+
html.push("<td>", item.invest_type, "</td>");
|
|
1273
1302
|
html.push("<td>", Util.pack_fund_manager(item), "</td>");
|
|
1274
1303
|
html.push("<td>", public_date, "</td>");
|
|
1275
|
-
html.push("<td data-val='", item
|
|
1276
|
-
html.push("<td data-val='", item
|
|
1277
|
-
html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item
|
|
1304
|
+
html.push("<td data-val='", item.stock_num, "' title='", item.stock_num, "'>", Util.to_unit(item.stock_num, 3), "股</td>");
|
|
1305
|
+
html.push("<td data-val='", item.market_capital, "' title='", item.market_capital, "'>", Util.to_unit(item.market_capital, 3), "</td>");
|
|
1306
|
+
html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item.fund_code, "'>详细</a></td>");
|
|
1278
1307
|
html.push("</tr>");
|
|
1279
1308
|
});
|
|
1280
1309
|
Util.render_table_html("public_fund_table_body", html);
|
|
@@ -1338,41 +1367,41 @@ const Util = {
|
|
|
1338
1367
|
if ($("#is_fund10_num").length > 0) {
|
|
1339
1368
|
is_fund10_num = $("#is_fund10_num").prop("checked") ? 1 : 0;
|
|
1340
1369
|
}
|
|
1341
|
-
j
|
|
1342
|
-
let date_format = Util.seconds_to_format(item
|
|
1370
|
+
j.data.forEach(function (item) {
|
|
1371
|
+
let date_format = Util.seconds_to_format(item.date, "%Y-%m-%d");
|
|
1343
1372
|
date_data.push(date_format);
|
|
1344
1373
|
if (is_fund10_num === 1) {
|
|
1345
|
-
fund_num_data.push(item
|
|
1374
|
+
fund_num_data.push(item.fund_rank_num);
|
|
1346
1375
|
} else {
|
|
1347
|
-
fund_num_data.push(item
|
|
1376
|
+
fund_num_data.push(item.fund_num);
|
|
1348
1377
|
}
|
|
1349
|
-
stock_num_data.push(item
|
|
1350
|
-
let hold_value = Util.to_hundred_million(item
|
|
1378
|
+
stock_num_data.push(item.stock_num);
|
|
1379
|
+
let hold_value = Util.to_hundred_million(item.hold_value, 3);
|
|
1351
1380
|
value_data.push(hold_value);
|
|
1352
|
-
price_data.push(item
|
|
1381
|
+
price_data.push(item.price);
|
|
1353
1382
|
html.push("<tr>");
|
|
1354
1383
|
html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
|
|
1355
|
-
if (item
|
|
1356
|
-
html.push("<td>", Util.digit_compare_trend(item
|
|
1384
|
+
if (item.pre_price) {
|
|
1385
|
+
html.push("<td>", Util.digit_compare_trend(item.price, item.pre_price), "</td>");
|
|
1357
1386
|
} else {
|
|
1358
|
-
html.push("<td>", item
|
|
1387
|
+
html.push("<td>", item.price, "</td>");
|
|
1359
1388
|
}
|
|
1360
1389
|
let stock_num_rate = "";
|
|
1361
|
-
if (item
|
|
1362
|
-
stock_num_rate = "(" + Util.year_price_rate(item
|
|
1390
|
+
if (item.pre_stock_num) {
|
|
1391
|
+
stock_num_rate = "(" + Util.year_price_rate(item.stock_num, item.pre_stock_num, 1) + ")";
|
|
1363
1392
|
}
|
|
1364
|
-
html.push("<td data-val='", item
|
|
1393
|
+
html.push("<td data-val='", item.stock_num, "' title='", item.stock_num, "'>", Util.to_unit(item.stock_num, 3), "股", stock_num_rate, "</td>");
|
|
1365
1394
|
let fund_num_rate = "";
|
|
1366
|
-
if (item
|
|
1367
|
-
fund_num_rate = "(" + Util.year_price_rate(item
|
|
1395
|
+
if (item.pre_fund_num) {
|
|
1396
|
+
fund_num_rate = "(" + Util.year_price_rate(item.fund_num, item.pre_fund_num, 1) + ")";
|
|
1368
1397
|
}
|
|
1369
|
-
html.push("<td data-val='", item
|
|
1398
|
+
html.push("<td data-val='", item.fund_num, "'>", item.fund_num, fund_num_rate, "</td>");
|
|
1370
1399
|
let fund_rank_num_rate = "";
|
|
1371
|
-
if (item
|
|
1372
|
-
fund_rank_num_rate = "(" + Util.year_price_rate(item
|
|
1400
|
+
if (item.pre_fund_rank_num) {
|
|
1401
|
+
fund_rank_num_rate = "(" + Util.year_price_rate(item.fund_rank_num, item.pre_fund_rank_num, 1) + ")";
|
|
1373
1402
|
}
|
|
1374
|
-
html.push("<td data-val='", item
|
|
1375
|
-
html.push("<td data-val='", item
|
|
1403
|
+
html.push("<td data-val='", item.fund_rank_num, "'>", item.fund_rank_num, fund_rank_num_rate, "</td>");
|
|
1404
|
+
html.push("<td data-val='", item.hold_value, "' title='", item.hold_value, "'>", hold_value, "亿</td>");
|
|
1376
1405
|
html.push("</tr>");
|
|
1377
1406
|
});
|
|
1378
1407
|
date_data = date_data.reverse();
|
|
@@ -1383,19 +1412,19 @@ const Util = {
|
|
|
1383
1412
|
Util["pfc_stock_chart"] = Util.multi_axis_line(Util["pfc_stock_chart"], "pfc_stock_line_canvas", date_data, '总持股数', stock_num_data, '股价', price_data);
|
|
1384
1413
|
Util["pfc_fund_chart"] = Util.multi_axis_line(Util["pfc_fund_chart"], "pfc_fund_line_canvas", date_data, '持仓家数', fund_num_data, '股价', price_data);
|
|
1385
1414
|
Util["pfc_value_chart"] = Util.multi_axis_line(Util["pfc_value_chart"], "pfc_value_line_canvas", date_data, '持仓市值', value_data, '股价', price_data);
|
|
1386
|
-
if (j
|
|
1387
|
-
let cur_stock_num = j
|
|
1388
|
-
let pre_stock_num = j
|
|
1415
|
+
if (j.data.length > 1) {
|
|
1416
|
+
let cur_stock_num = j.data[0]["stock_num"];
|
|
1417
|
+
let pre_stock_num = j.data[1]["stock_num"];
|
|
1389
1418
|
if (cur_stock_num > 0 && pre_stock_num > 0) {
|
|
1390
1419
|
$("#pfc_stock_tips").html("(当前持股数: <b class='text-info'>" + Util.to_unit(cur_stock_num, 4) + "</b>, 环比: " + Util.year_price_rate(cur_stock_num, pre_stock_num) + ")");
|
|
1391
1420
|
}
|
|
1392
|
-
let cur_fund_num = j
|
|
1393
|
-
let pre_fund_num = j
|
|
1421
|
+
let cur_fund_num = j.data[0]["fund_num"];
|
|
1422
|
+
let pre_fund_num = j.data[1]["fund_num"];
|
|
1394
1423
|
if (cur_fund_num > 0 && pre_fund_num > 0) {
|
|
1395
1424
|
$("#pfc_fund_tips").html("(当前基金数: <b class='text-info'>" + cur_fund_num + "</b>, 环比: " + Util.year_price_rate(cur_fund_num, pre_fund_num) + ")");
|
|
1396
1425
|
}
|
|
1397
|
-
let cur_value_num = j
|
|
1398
|
-
let pre_value_num = j
|
|
1426
|
+
let cur_value_num = j.data[0]["hold_value"];
|
|
1427
|
+
let pre_value_num = j.data[1]["hold_value"];
|
|
1399
1428
|
if (cur_value_num > 0 && pre_value_num > 0) {
|
|
1400
1429
|
$("#pfc_value_tips").html("(当前持仓市值: <b class='text-info'>" + Util.to_unit(cur_value_num) + "</b>, 环比: " + Util.year_price_rate(cur_value_num, pre_value_num) + ")");
|
|
1401
1430
|
}
|
|
@@ -1447,10 +1476,10 @@ const Util = {
|
|
|
1447
1476
|
Util.init_table_skeleton(table_options);
|
|
1448
1477
|
Util["portfolio_table_id"] = table_id;
|
|
1449
1478
|
Util.post(location.pathname, {active_div: portfolio}, function (j) {
|
|
1450
|
-
Util["portfolio_data"] = j
|
|
1479
|
+
Util["portfolio_data"] = j.data ? j.data : [];
|
|
1451
1480
|
Util["portfolio_index"] = j["index_list"] ? j["index_list"] : [];
|
|
1452
|
-
Util.render_type_option($("#portfolio_industry"), j
|
|
1453
|
-
Util.render_type_option($("#portfolio_area"), j
|
|
1481
|
+
Util.render_type_option($("#portfolio_industry"), j.data, "industry", Util.render_portfolio_html);
|
|
1482
|
+
Util.render_type_option($("#portfolio_area"), j.data, "area", Util.render_portfolio_html);
|
|
1454
1483
|
Util.render_portfolio_html();
|
|
1455
1484
|
if (j["portfolio_url"]) {
|
|
1456
1485
|
$("#portfolio_remark_title").html(Util.pack_html_link(j["portfolio_url"], "备注<i class='glyphicon glyphicon-link'></i>"));
|
|
@@ -1470,22 +1499,22 @@ const Util = {
|
|
|
1470
1499
|
if (Util.is_industry_area(item, industry, area)) {
|
|
1471
1500
|
total_num++;
|
|
1472
1501
|
html.push("<tr>");
|
|
1473
|
-
item
|
|
1502
|
+
item.code = item.code.toLowerCase();
|
|
1474
1503
|
if (is_us === 1) {
|
|
1475
|
-
html.push('<td>', Util.us_logo_html(item
|
|
1504
|
+
html.push('<td>', Util.us_logo_html(item.code), '</td>');
|
|
1476
1505
|
}
|
|
1477
1506
|
html = Util.stock_basics_html(html, item);
|
|
1478
|
-
html.push("<td id='high_", item
|
|
1479
|
-
html.push("<td id='low_", item
|
|
1480
|
-
html.push("<td class='year_price_", item
|
|
1481
|
-
html.push("<td class='d5_price_", item
|
|
1482
|
-
html.push("<td class='high_52week_", item
|
|
1507
|
+
html.push("<td id='high_", item.code, "'>0</td>");
|
|
1508
|
+
html.push("<td id='low_", item.code, "'>0</td>");
|
|
1509
|
+
html.push("<td class='year_price_", item.code, "'>", (item.stock_price ? Util.year_price_rate(item.stock_price, item.year_price) : "--"), "</td>");
|
|
1510
|
+
html.push("<td class='d5_price_", item.code, "'>", (item.stock_price ? Util.year_price_rate(item.stock_price, item.d5_price) : "--"), "</td>");
|
|
1511
|
+
html.push("<td class='high_52week_", item.code, "'>--</td>");
|
|
1483
1512
|
if (is_us === 0) {
|
|
1484
|
-
html.push("<td id='amount_", item
|
|
1485
|
-
html.push("<td id='average_", item
|
|
1486
|
-
html.push("<td class='holder_", item
|
|
1487
|
-
html.push("<td class='fund_", item
|
|
1488
|
-
html.push("<td id='remark_", item
|
|
1513
|
+
html.push("<td id='amount_", item.code, "'>--</td>");
|
|
1514
|
+
html.push("<td id='average_", item.code, "'>--</td>");
|
|
1515
|
+
html.push("<td class='holder_", item.code, "'>--</td>");
|
|
1516
|
+
html.push("<td class='fund_", item.code, "'>--</td>");
|
|
1517
|
+
html.push("<td id='remark_", item.code, "'></td>");
|
|
1489
1518
|
}
|
|
1490
1519
|
html.push("</tr>");
|
|
1491
1520
|
}
|
|
@@ -1549,21 +1578,21 @@ const Util = {
|
|
|
1549
1578
|
$("#" + component_id + "_title").html(fund_code);
|
|
1550
1579
|
Util.post(Util.get_url("fund_public"), {action: "public_fund_detail", fund_code: fund_code}, function (j) {
|
|
1551
1580
|
let html = [];
|
|
1552
|
-
if (j
|
|
1553
|
-
$("#" + component_id + "_title").html(Util.pack_html_link("https://fundf10.eastmoney.com/jbgk_" + j
|
|
1581
|
+
if (j.fund_code) {
|
|
1582
|
+
$("#" + component_id + "_title").html(Util.pack_html_link("https://fundf10.eastmoney.com/jbgk_" + j.fund_code + ".html", j["fund_name"]));
|
|
1554
1583
|
let net = "--";
|
|
1555
1584
|
if (j["net"] > 0) {
|
|
1556
1585
|
net = j["net"];
|
|
1557
|
-
let net_cls = Util.text_color(j
|
|
1586
|
+
let net_cls = Util.text_color(j.change_percent);
|
|
1558
1587
|
if (net_cls !== "") {
|
|
1559
|
-
net = "<b class='" + net_cls + "'>" + net + "(" + Util.to_float(j
|
|
1588
|
+
net = "<b class='" + net_cls + "'>" + net + "(" + Util.to_float(j.change_percent, 2) + "%)</b>";
|
|
1560
1589
|
}
|
|
1561
1590
|
}
|
|
1562
1591
|
let assets = j["assets"] > 0 ? (j["assets"] + "亿") : "--";
|
|
1563
1592
|
let public_date = j["public_date"] > 0 ? Util.seconds_to_format(j["public_date"], "%Y-%m-%d") : "--";
|
|
1564
1593
|
let issue_date = j["issue_date"] > 0 ? Util.seconds_to_format(j["issue_date"], "%Y-%m-%d") : "--";
|
|
1565
1594
|
html.push("<tr title='最后更新时间: ", Util.seconds_to_format(j["update_time"], "%Y-%m-%d"), "' class='info'><th colspan='15' style='text-align: center;'>基金概况</th></tr>");
|
|
1566
|
-
html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j
|
|
1595
|
+
html.push("<tr><td colspan='3'>基金代码</td><td colspan='4'>", Util.pack_html_link('https://xueqiu.com/S/' + Util.code_to_fund_symbol(j.fund_code), j.fund_code), "</td><td colspan='3'>基金名</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + j.fund_code + '.html', j["fund_name"]), "</td></tr>");
|
|
1567
1596
|
html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", (j["fund_type"] ? j["fund_type"] : "--"), "</td><td colspan='3'>投资类型</td><td colspan='5'>", (j["invest_type"] ? j["invest_type"] : "--"), "</td></tr>");
|
|
1568
1597
|
html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='5'>", assets, "</td></tr>");
|
|
1569
1598
|
html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='5'>", issue_date, "</td></tr>");
|
|
@@ -1571,9 +1600,9 @@ const Util = {
|
|
|
1571
1600
|
html.push("<tr><td colspan='3'>基金托管人</td><td colspan='4'>", (j["custodian"] ? j["custodian"] : "--"), "</td><td colspan='3'>经办律师事务所</td><td colspan='5'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
|
|
1572
1601
|
html.push("<tr><td colspan='3'>会计师事务所</td><td colspan='4'>", (j["accounting"] ? j["accounting"] : "--"), "</td><td colspan='3'>注册地址</td><td colspan='5'>", Util.map_url(j["location"], j["location"]), "</td></tr>");
|
|
1573
1602
|
html.push("<tr><td colspan='3'>近一周</td><td colspan='4'>", Util.parse_ratio(j["one_week_change"]), "</td><td colspan='3'>近一月</td><td colspan='5'>", Util.parse_ratio(j["one_month_change"]), "</td></tr>");
|
|
1574
|
-
html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j
|
|
1603
|
+
html.push("<tr><td colspan='3'>近一年</td><td colspan='4'>", Util.parse_ratio(j["one_year_change"]), "</td><td colspan='3'>年初至今</td><td colspan='5'>", Util.pack_html_link('https://fundf10.eastmoney.com/jdzf_' + j.fund_code + '.html', Util.parse_ratio(j["ytd_change"])), "</td></tr>");
|
|
1575
1604
|
html.push("<tr><td colspan='5'>成立以来</td><td colspan='10'>", Util.parse_ratio(j["establish_change"]), "</td></tr>");
|
|
1576
|
-
html.push("<tr class='info'><th colspan='15' style='text-align: center;'>", Util.pack_html_link("https://fund.eastmoney.com/f10/ccmx_" + j
|
|
1605
|
+
html.push("<tr class='info'><th colspan='15' style='text-align: center;'>", Util.pack_html_link("https://fund.eastmoney.com/f10/ccmx_" + j.fund_code + ".html", "持股明细"), " <span id='fund_stock_date_zone'></span></th></tr>");
|
|
1577
1606
|
html.push("<tr id='" + component_id + "_head'><th>序号</th><th>股票代码</th><th>股票名</th><th>PE</th><th>总市值</th><th>行业</th><th>地区</th><th>价格</th><th>年初至今</th><th>近5日</th><th>股东数</th><th>持有量</th><th class='info'>占比</th><th>占比变化</th><th>持仓市值</th></tr>");
|
|
1578
1607
|
html.push("<tr class='" + component_id + "_tr'><td colspan='15'>暂无数据</td></tr>");
|
|
1579
1608
|
Util.render_table_html(component_id + "_body_body", html);
|
|
@@ -1587,9 +1616,9 @@ const Util = {
|
|
|
1587
1616
|
$("#fund_stock_date_zone").html(html.join(""));
|
|
1588
1617
|
let fsd_obj = $("#fund_stock_date");
|
|
1589
1618
|
fsd_obj.change(function () {
|
|
1590
|
-
Util.fetch_public_fund_stock(j
|
|
1619
|
+
Util.fetch_public_fund_stock(j.fund_code, $("#fund_stock_date").val(), component_id);
|
|
1591
1620
|
});
|
|
1592
|
-
Util.fetch_public_fund_stock(j
|
|
1621
|
+
Util.fetch_public_fund_stock(j.fund_code, fsd_obj.val(), component_id);
|
|
1593
1622
|
}
|
|
1594
1623
|
} else {
|
|
1595
1624
|
html.push("<tr><td colspan='15'>暂无数据</td></tr>");
|
|
@@ -1632,36 +1661,36 @@ const Util = {
|
|
|
1632
1661
|
$(this).remove();
|
|
1633
1662
|
});
|
|
1634
1663
|
let html = [];
|
|
1635
|
-
if (j
|
|
1636
|
-
j
|
|
1664
|
+
if (j.data) {
|
|
1665
|
+
j.data.forEach(function (item, index) {
|
|
1637
1666
|
html.push("<tr class='" + component_tr + "'>");
|
|
1638
1667
|
html.push("<td>", index + 1, "</td>");
|
|
1639
1668
|
html = Util.stock_basics_html(html, item);
|
|
1640
|
-
html.push("<td>", Util.year_price_rate(item
|
|
1641
|
-
html.push("<td>", Util.year_price_rate(item
|
|
1669
|
+
html.push("<td>", Util.year_price_rate(item.stock_price, item.year_price), "</td>");
|
|
1670
|
+
html.push("<td>", Util.year_price_rate(item.stock_price, item.d5_price), "</td>");
|
|
1642
1671
|
html.push("<td>", Util.pack_holder_num(item), "</td>");
|
|
1643
1672
|
let stock_num_tips = "";
|
|
1644
|
-
if (item
|
|
1645
|
-
let gap_stock_num = item
|
|
1673
|
+
if (item.stock_num > 0 && item.pre_stock_num > 0) {
|
|
1674
|
+
let gap_stock_num = item.stock_num - item.pre_stock_num;
|
|
1646
1675
|
if (gap_stock_num > 0) {
|
|
1647
1676
|
stock_num_tips = "<b class='text-danger'>(+" + Util.to_unit(gap_stock_num) + ")</b>";
|
|
1648
1677
|
} else if (gap_stock_num < 0) {
|
|
1649
1678
|
stock_num_tips = "<b class='text-success'>(" + Util.to_unit(gap_stock_num) + ")</b>";
|
|
1650
1679
|
}
|
|
1651
1680
|
}
|
|
1652
|
-
html.push("<td>", Util.to_unit(item
|
|
1681
|
+
html.push("<td>", Util.to_unit(item.stock_num), stock_num_tips, "</td>");
|
|
1653
1682
|
let rate_tips = "", rate_change = "--";
|
|
1654
|
-
if (item
|
|
1655
|
-
rate_tips = "<b class='text-danger'>(+" + Util.to_float(item
|
|
1656
|
-
} else if (item
|
|
1657
|
-
rate_tips = "<b class='text-success'>(" + Util.to_float(item
|
|
1683
|
+
if (item.rate > 0 && item.rate > item.pre_rate) {
|
|
1684
|
+
rate_tips = "<b class='text-danger'>(+" + Util.to_float(item.rate - item.pre_rate, 2) + "%)</b>";
|
|
1685
|
+
} else if (item.pre_rate > 0 && item.pre_rate > item.rate) {
|
|
1686
|
+
rate_tips = "<b class='text-success'>(" + Util.to_float(item.rate - item.pre_rate, 2) + "%)</b>";
|
|
1658
1687
|
}
|
|
1659
|
-
if (item
|
|
1660
|
-
rate_change = Util.year_price_rate(item
|
|
1688
|
+
if (item.pre_rate && item.pre_rate > 0) {
|
|
1689
|
+
rate_change = Util.year_price_rate(item.rate, item.pre_rate, 1);
|
|
1661
1690
|
}
|
|
1662
|
-
html.push("<td>", item
|
|
1691
|
+
html.push("<td>", item.rate, "%", rate_tips, "</td>");
|
|
1663
1692
|
html.push("<td>", rate_change, "</td>");
|
|
1664
|
-
html.push("<td>", Util.to_unit(item
|
|
1693
|
+
html.push("<td>", Util.to_unit(item.fund_market_capital), "</td>");
|
|
1665
1694
|
html.push("</tr>");
|
|
1666
1695
|
});
|
|
1667
1696
|
} else {
|
|
@@ -1669,7 +1698,7 @@ const Util = {
|
|
|
1669
1698
|
}
|
|
1670
1699
|
$(html.join("")).insertAfter("#" + component_id + "_head");
|
|
1671
1700
|
Util.hide_tips();
|
|
1672
|
-
if (j
|
|
1701
|
+
if (j.data) {
|
|
1673
1702
|
Util.refresh_price(component_id + "_body");
|
|
1674
1703
|
}
|
|
1675
1704
|
});
|
|
@@ -1681,17 +1710,17 @@ const Util = {
|
|
|
1681
1710
|
let html = [], index = 0;
|
|
1682
1711
|
let is_mobile = Util.is_mobile();
|
|
1683
1712
|
let is_speech_synthesis = $("#word_recite").length > 0 ? 1 : 0;
|
|
1684
|
-
j
|
|
1713
|
+
j.data.forEach(function (item) {
|
|
1685
1714
|
index++;
|
|
1686
1715
|
html.push("<tr>");
|
|
1687
|
-
html.push("<td>", Util.pack_html_link("https://api.mymemory.translated.net/get?langpair=en|zh-CN&q=" + item
|
|
1688
|
-
html.push("<td>", Util.pack_html_link("https://cn.bing.com/dict/search?q=" + item
|
|
1716
|
+
html.push("<td>", Util.pack_html_link("https://api.mymemory.translated.net/get?langpair=en|zh-CN&q=" + item.word, index), "</td>");
|
|
1717
|
+
html.push("<td>", Util.pack_html_link("https://cn.bing.com/dict/search?q=" + item.word, item.word), "</td>");
|
|
1689
1718
|
if (is_mobile) {
|
|
1690
|
-
html.push("<td class='text-left'>", item
|
|
1719
|
+
html.push("<td class='text-left'>", item.chinese, "</td>");
|
|
1691
1720
|
} else {
|
|
1692
|
-
html.push("<td>", item
|
|
1721
|
+
html.push("<td>", item.chinese, "</td>");
|
|
1693
1722
|
}
|
|
1694
|
-
html.push("<td>", Util.seconds_to_format(item
|
|
1723
|
+
html.push("<td>", Util.seconds_to_format(item.date), "</td>");
|
|
1695
1724
|
if (is_speech_synthesis === 1) {
|
|
1696
1725
|
html.push("<td class='word_utterance' style='cursor: pointer;'><i class='glyphicon glyphicon-volume-up'></i></td>");
|
|
1697
1726
|
}
|
|
@@ -1704,7 +1733,7 @@ const Util = {
|
|
|
1704
1733
|
let day_num_html = [];
|
|
1705
1734
|
day_num_html.push('<option value="">全部</option>');
|
|
1706
1735
|
j["day_num"].forEach(function (item) {
|
|
1707
|
-
day_num_html.push('<option value="', item
|
|
1736
|
+
day_num_html.push('<option value="', item.day, '">', item.day, '(', item.num, ')</option>');
|
|
1708
1737
|
});
|
|
1709
1738
|
let wdn_obj = $("#word_day_num");
|
|
1710
1739
|
wdn_obj.html(day_num_html.join(""));
|
|
@@ -1782,34 +1811,34 @@ const Util = {
|
|
|
1782
1811
|
let category_top_type = parseInt($("#category_top_type").val());
|
|
1783
1812
|
Util.post(location.pathname, {"action": "category_top_statistics", "type": category_top_type}, function (j) {
|
|
1784
1813
|
let html = [];
|
|
1785
|
-
j
|
|
1814
|
+
j.data.forEach(function (item) {
|
|
1786
1815
|
let date_data = [], cole_url = "";
|
|
1787
1816
|
html.push("<tr>");
|
|
1788
|
-
item
|
|
1817
|
+
item.name = item.name + "(" + item.code + ")";
|
|
1789
1818
|
if (category_top_type === 2) {
|
|
1790
|
-
cole_url = "https://q.10jqka.com.cn/thshy/detail/code/" + item
|
|
1819
|
+
cole_url = "https://q.10jqka.com.cn/thshy/detail/code/" + item.code;
|
|
1791
1820
|
} else if (category_top_type === 3) {
|
|
1792
|
-
cole_url = "https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=" + item
|
|
1821
|
+
cole_url = "https://www.swsresearch.com/institute_sw/allIndex/releasedIndex/releasedetail?code=" + item.code + "&name=" + item.code;
|
|
1793
1822
|
} else {
|
|
1794
|
-
cole_url = "https://xueqiu.com/S/" + Util.code_to_fund_symbol(item
|
|
1823
|
+
cole_url = "https://xueqiu.com/S/" + Util.code_to_fund_symbol(item.code);
|
|
1795
1824
|
}
|
|
1796
|
-
html.push("<td>", Util.pack_html_link(cole_url, item
|
|
1797
|
-
html.push("<td>", item
|
|
1798
|
-
html.push("<td data-val='", item
|
|
1799
|
-
if (item
|
|
1800
|
-
html.push("<td data-val='", item
|
|
1825
|
+
html.push("<td>", Util.pack_html_link(cole_url, item.name), "</td>");
|
|
1826
|
+
html.push("<td>", item.num, "</td>");
|
|
1827
|
+
html.push("<td data-val='", item.interval_day, "'>", (item.interval_day < 10000 ? (item.interval_day + "天") : "--"), "</td>");
|
|
1828
|
+
if (item.dist_day < item.interval_day) {
|
|
1829
|
+
html.push("<td data-val='", item.dist_day, "'>", item.dist_day, "天</td>");
|
|
1801
1830
|
} else {
|
|
1802
|
-
html.push("<td class='danger' data-val='", item
|
|
1831
|
+
html.push("<td class='danger' data-val='", item.dist_day, "'>", item.dist_day, "天</td>");
|
|
1803
1832
|
}
|
|
1804
|
-
item
|
|
1805
|
-
let date_format = Util.seconds_to_format(d
|
|
1806
|
-
if (d
|
|
1833
|
+
item.data.forEach(function (d) {
|
|
1834
|
+
let date_format = Util.seconds_to_format(d.date, "%Y-%m-%d");
|
|
1835
|
+
if (d.date === j.latest_date) {
|
|
1807
1836
|
date_format = "<span class='label label-info'>" + date_format + " </span>";
|
|
1808
1837
|
}
|
|
1809
1838
|
date_data.push(date_format + "(" + Util.parse_ratio(d["p_change"]) + ") ");
|
|
1810
1839
|
});
|
|
1811
1840
|
date_data = date_data.join("")
|
|
1812
|
-
if (item
|
|
1841
|
+
if (item.num > 6) {
|
|
1813
1842
|
date_data += "...";
|
|
1814
1843
|
}
|
|
1815
1844
|
html.push("<td class='text-left'>", date_data, "</td>");
|
|
@@ -1874,32 +1903,32 @@ const Util = {
|
|
|
1874
1903
|
};
|
|
1875
1904
|
Util.post(Util.get_url("macro_currency"), payload, function (j) {
|
|
1876
1905
|
let html = [], low_exchange_rate = 0, high_exchange_rate = 0;
|
|
1877
|
-
j
|
|
1878
|
-
if (low_exchange_rate === 0 || item
|
|
1879
|
-
low_exchange_rate = item
|
|
1906
|
+
j.data.forEach(function (item) {
|
|
1907
|
+
if (low_exchange_rate === 0 || item.exchange_rate < low_exchange_rate) {
|
|
1908
|
+
low_exchange_rate = item.exchange_rate;
|
|
1880
1909
|
}
|
|
1881
|
-
high_exchange_rate = Math.max(high_exchange_rate, item
|
|
1910
|
+
high_exchange_rate = Math.max(high_exchange_rate, item.exchange_rate);
|
|
1882
1911
|
});
|
|
1883
|
-
j
|
|
1884
|
-
if (item
|
|
1912
|
+
j.data.forEach(function (item) {
|
|
1913
|
+
if (item.exchange_rate === high_exchange_rate) {
|
|
1885
1914
|
html.push("<tr class='danger'>");
|
|
1886
|
-
} else if (item
|
|
1915
|
+
} else if (item.exchange_rate === low_exchange_rate) {
|
|
1887
1916
|
html.push("<tr class='success'>");
|
|
1888
1917
|
} else {
|
|
1889
1918
|
html.push("<tr>");
|
|
1890
1919
|
}
|
|
1891
|
-
html.push("<td>", Util.seconds_to_format(item
|
|
1892
|
-
html.push("<td>", item
|
|
1893
|
-
html.push("<td>", item
|
|
1894
|
-
html.push("<td>", item
|
|
1920
|
+
html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
|
|
1921
|
+
html.push("<td>", item.exchange_rate, "</td>");
|
|
1922
|
+
html.push("<td>", item.low_exchange_rate, "</td>");
|
|
1923
|
+
html.push("<td>", item.high_exchange_rate, "</td>");
|
|
1895
1924
|
html.push("</tr>");
|
|
1896
1925
|
});
|
|
1897
1926
|
Util.render_table_html("currency_modal_body_body", html);
|
|
1898
1927
|
let currency_modal_summary = "历史最低:<span class='label label-success'>" + j["hist_low"] +
|
|
1899
1928
|
"</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
|
|
1900
|
-
"</span> 年初至今:" + Util.digit_compare_trend1(j
|
|
1901
|
-
" 52周最高:" + Util.digit_compare_trend1(j
|
|
1902
|
-
" 52周最低:" + Util.digit_compare_trend1(j
|
|
1929
|
+
"</span> 年初至今:" + Util.digit_compare_trend1(j.exchange_rate, j["year_exchange_rate"]) +
|
|
1930
|
+
" 52周最高:" + Util.digit_compare_trend1(j.exchange_rate, j["week52high"]) +
|
|
1931
|
+
" 52周最低:" + Util.digit_compare_trend1(j.exchange_rate, j["week52low"]);
|
|
1903
1932
|
let title = j["name"] !== currency ? (j["name"] + "(" + currency.toUpperCase() + ")") : j["name"];
|
|
1904
1933
|
title = '<i class="fa fa-' + currency + '"></i> ' + title;
|
|
1905
1934
|
title = Util.pack_html_link("https://cn.investing.com/currencies/" + currency + "-cny", title);
|
|
@@ -1967,28 +1996,28 @@ const Util = {
|
|
|
1967
1996
|
};
|
|
1968
1997
|
Util.post(Util.get_url("coin_price"), payload, function (j) {
|
|
1969
1998
|
let html = [], low_price = 0, high_price = 0;
|
|
1970
|
-
j
|
|
1971
|
-
if (low_price === 0 || item
|
|
1972
|
-
low_price = item
|
|
1999
|
+
j.data.forEach(function (item) {
|
|
2000
|
+
if (low_price === 0 || item.price < low_price) {
|
|
2001
|
+
low_price = item.price;
|
|
1973
2002
|
}
|
|
1974
|
-
high_price = Math.max(high_price, item
|
|
2003
|
+
high_price = Math.max(high_price, item.price);
|
|
1975
2004
|
});
|
|
1976
|
-
j
|
|
1977
|
-
if (item
|
|
2005
|
+
j.data.forEach(function (item) {
|
|
2006
|
+
if (item.price === high_price) {
|
|
1978
2007
|
html.push("<tr class='danger'>");
|
|
1979
|
-
} else if (item
|
|
2008
|
+
} else if (item.price === low_price) {
|
|
1980
2009
|
html.push("<tr class='success'>");
|
|
1981
2010
|
} else {
|
|
1982
2011
|
html.push("<tr>");
|
|
1983
2012
|
}
|
|
1984
|
-
html.push("<td>", Util.seconds_to_format(item
|
|
1985
|
-
html.push("<td>", item
|
|
1986
|
-
html.push("<td>", item
|
|
1987
|
-
html.push("<td>", item
|
|
1988
|
-
html.push("<td>", item
|
|
1989
|
-
html.push("<td>", Util.parse_ratio(item
|
|
1990
|
-
html.push("<td>", Util.to_unit(item
|
|
1991
|
-
html.push("<td>", Util.to_unit(item
|
|
2013
|
+
html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
|
|
2014
|
+
html.push("<td>", item.open, "</td>");
|
|
2015
|
+
html.push("<td>", item.low, "</td>");
|
|
2016
|
+
html.push("<td>", item.high, "</td>");
|
|
2017
|
+
html.push("<td>", item.price, "</td>");
|
|
2018
|
+
html.push("<td>", Util.parse_ratio(item.p_change), "</td>");
|
|
2019
|
+
html.push("<td>", Util.to_unit(item.amount), "</td>");
|
|
2020
|
+
html.push("<td>", Util.to_unit(item.market_capital), "</td>");
|
|
1992
2021
|
html.push("</tr>");
|
|
1993
2022
|
});
|
|
1994
2023
|
Util.render_table_html("btc_modal_body_body", html);
|
|
@@ -2036,22 +2065,22 @@ const Util = {
|
|
|
2036
2065
|
let buy_times = 0;
|
|
2037
2066
|
let sell_times = 0;
|
|
2038
2067
|
let total_times = 0;
|
|
2039
|
-
j
|
|
2068
|
+
j.data.forEach(function (item) {
|
|
2040
2069
|
total_times += 1;
|
|
2041
|
-
if (item
|
|
2070
|
+
if (item.buy > item.sell) {
|
|
2042
2071
|
buy_times += 1;
|
|
2043
|
-
} else if (item
|
|
2072
|
+
} else if (item.buy < item.sell) {
|
|
2044
2073
|
sell_times += 1;
|
|
2045
2074
|
}
|
|
2046
|
-
let inflow = item
|
|
2075
|
+
let inflow = item.buy - item.sell;
|
|
2047
2076
|
summary_inflow += inflow;
|
|
2048
2077
|
html.push("<tr>");
|
|
2049
2078
|
html.push("<td>", total_times, "</td>");
|
|
2050
|
-
html.push("<td>", Util.seconds_to_format(item
|
|
2051
|
-
html.push("<td title='", item
|
|
2052
|
-
html.push("<td title='", item
|
|
2079
|
+
html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
|
|
2080
|
+
html.push("<td title='", item.buy, "'>", Util.to_unit(item.buy), "</td>");
|
|
2081
|
+
html.push("<td title='", item.sell, "'>", Util.to_unit(item.sell), "</td>");
|
|
2053
2082
|
html.push("<td title='", inflow, "'><b class='", Util.text_color(inflow), "'>", Util.to_unit(inflow), "</b></td>");
|
|
2054
|
-
html.push("<td>", Util.to_unit(item
|
|
2083
|
+
html.push("<td>", Util.to_unit(item.buy + item.sell), "</td>");
|
|
2055
2084
|
html.push("</tr>");
|
|
2056
2085
|
});
|
|
2057
2086
|
Util.render_table_html(component_id + "_body_body", html);
|
|
@@ -2152,8 +2181,8 @@ const Util = {
|
|
|
2152
2181
|
}
|
|
2153
2182
|
if (typeof IndexList != "undefined") {
|
|
2154
2183
|
IndexList.forEach(function (item) {
|
|
2155
|
-
if (index_type === 0 || (index_type === 1 && item
|
|
2156
|
-
html.push('<option ', ((item
|
|
2184
|
+
if (index_type === 0 || (index_type === 1 && item.is_industry === 1) || (index_type === 2 && item.is_key === 1)) {
|
|
2185
|
+
html.push('<option ', ((item.code === "SH000906" && is_select === 1) ? "selected" : ""), ' value="', item.code, '">', item.name, '</option>');
|
|
2157
2186
|
}
|
|
2158
2187
|
});
|
|
2159
2188
|
}
|
|
@@ -2172,7 +2201,7 @@ const Util = {
|
|
|
2172
2201
|
html.push('<label for="', element_id, '"></label>');
|
|
2173
2202
|
html.push('<select id="', element_id, '" class="form-control">');
|
|
2174
2203
|
data.forEach(function (item) {
|
|
2175
|
-
html.push('<option value="', item
|
|
2204
|
+
html.push('<option value="', item.val, '">', item.name, '</option>');
|
|
2176
2205
|
});
|
|
2177
2206
|
html.push('</select>');
|
|
2178
2207
|
$("#" + component_id).html(html.join(""));
|
|
@@ -2661,7 +2690,7 @@ const Util = {
|
|
|
2661
2690
|
let val = $(this).text();
|
|
2662
2691
|
if (unit === "") {
|
|
2663
2692
|
let match_array = val.match(/[\u4e00-\u9fa5]+/);
|
|
2664
|
-
if (
|
|
2693
|
+
if (Array.isArray(match_array) && match_array[0]) {
|
|
2665
2694
|
unit = match_array[0];
|
|
2666
2695
|
}
|
|
2667
2696
|
}
|
|
@@ -2839,7 +2868,7 @@ const Util = {
|
|
|
2839
2868
|
// 174.36(+0.79%) 括号里的数字
|
|
2840
2869
|
let bracket_re = /\(([-+]?\d*\.?\d+|[-+]?\d+|\d+)\%?\)/;
|
|
2841
2870
|
let match_array = bracket_re.exec(td_val);
|
|
2842
|
-
if (
|
|
2871
|
+
if (Array.isArray(match_array)) {
|
|
2843
2872
|
if (match_array.length >= 2) {
|
|
2844
2873
|
return match_array[1];
|
|
2845
2874
|
}
|
|
@@ -2848,7 +2877,7 @@ const Util = {
|
|
|
2848
2877
|
// 匹配数字
|
|
2849
2878
|
let digit_re = /([-+]?\d*\.?\d+|[-+]?\d+|\d+)/;
|
|
2850
2879
|
match_array = digit_re.exec(td_val);
|
|
2851
|
-
if (
|
|
2880
|
+
if (Array.isArray(match_array) && match_array[0]) {
|
|
2852
2881
|
return match_array[0];
|
|
2853
2882
|
}
|
|
2854
2883
|
return td_val.replace("%", "");
|
|
@@ -2883,7 +2912,7 @@ const Util = {
|
|
|
2883
2912
|
request_arguments: function () {
|
|
2884
2913
|
let url = location.search; //获取url中"?"符后的字串
|
|
2885
2914
|
let obj = {};
|
|
2886
|
-
if (url.
|
|
2915
|
+
if (url.includes("?")) {
|
|
2887
2916
|
let query_array = url.substring(1).split("&");
|
|
2888
2917
|
for (let i = 0; i < query_array.length; i++) {
|
|
2889
2918
|
let query = query_array[i].split("=");
|
|
@@ -2943,7 +2972,7 @@ const Util = {
|
|
|
2943
2972
|
if (interval > 0) {
|
|
2944
2973
|
setTimeout(Util.hide_tips, interval);
|
|
2945
2974
|
}
|
|
2946
|
-
if (msg.
|
|
2975
|
+
if (msg.endsWith('.')) {
|
|
2947
2976
|
loading = msg.replace(/[^.]/g, '').length;
|
|
2948
2977
|
setTimeout(() => {
|
|
2949
2978
|
Util.show_tips(msg, interval, cls, loading);
|
|
@@ -3023,49 +3052,49 @@ const Util = {
|
|
|
3023
3052
|
let valid_code_list = [];
|
|
3024
3053
|
let total_change_percent = 0, total_year_change_percent = 0, total_d5_change_percent = 0;
|
|
3025
3054
|
$.each(j, function (code, item) {
|
|
3026
|
-
if (item
|
|
3027
|
-
valid_code_list.push(item
|
|
3028
|
-
total_change_percent += ((item
|
|
3029
|
-
if (item
|
|
3030
|
-
total_year_change_percent += ((item
|
|
3055
|
+
if (item.price && item.previous_price && item.price > 0 && item.previous_price > 0) {
|
|
3056
|
+
valid_code_list.push(item.code);
|
|
3057
|
+
total_change_percent += ((item.price - item.previous_price) / item.previous_price);
|
|
3058
|
+
if (item.year_price && item.year_price > 0) {
|
|
3059
|
+
total_year_change_percent += ((item.price - item.year_price) / item.year_price);
|
|
3031
3060
|
}
|
|
3032
|
-
if (item
|
|
3033
|
-
total_d5_change_percent += ((item
|
|
3061
|
+
if (item.d5_price && item.d5_price > 0) {
|
|
3062
|
+
total_d5_change_percent += ((item.price - item.d5_price) / item.d5_price);
|
|
3034
3063
|
}
|
|
3035
3064
|
}
|
|
3036
3065
|
Util.render_price(item);
|
|
3037
|
-
if (item
|
|
3066
|
+
if (item.holder_num && item.holder_num > 0) {
|
|
3038
3067
|
$(".holder_" + code).each(function () {
|
|
3039
3068
|
$(this).html(Util.pack_holder_num(item));
|
|
3040
|
-
$(this).attr("data-val", item
|
|
3069
|
+
$(this).attr("data-val", item.holder_num);
|
|
3041
3070
|
});
|
|
3042
3071
|
}
|
|
3043
|
-
if (item
|
|
3072
|
+
if (item.cur_fund_num && item.cur_fund_num > 0) {
|
|
3044
3073
|
$(".fund_" + code).each(function () {
|
|
3045
3074
|
$(this).html(Util.pack_fund_num(item));
|
|
3046
|
-
$(this).attr("data-val", item
|
|
3075
|
+
$(this).attr("data-val", item.cur_fund_num);
|
|
3047
3076
|
});
|
|
3048
3077
|
}
|
|
3049
|
-
if (item
|
|
3078
|
+
if (item.money_net_inflow && item.money_net_inflow !== 0) {
|
|
3050
3079
|
$(".money_inflow_" + code).each(function () {
|
|
3051
3080
|
Util.render_money_inflow($(this), item);
|
|
3052
3081
|
});
|
|
3053
3082
|
}
|
|
3054
3083
|
if ($("#remark_" + code).length) {
|
|
3055
3084
|
let remark = "";
|
|
3056
|
-
if (item
|
|
3085
|
+
if (item.is_bull_trend) {
|
|
3057
3086
|
remark += "<b>" + Util.pack_html_link(Util.get_url("trend_bull_trend"), "多头趋势") + "</b><br>";
|
|
3058
3087
|
}
|
|
3059
|
-
if (item
|
|
3088
|
+
if (item.is_kdj_cross) {
|
|
3060
3089
|
remark += "<b>" + Util.pack_html_link(Util.get_url("trend_kdj"), "KDJ金叉") + "</b><br>";
|
|
3061
3090
|
}
|
|
3062
|
-
if (item
|
|
3091
|
+
if (item.is_macd_cross) {
|
|
3063
3092
|
remark += "<b>" + Util.pack_html_link(Util.get_url("trend_macd_cross"), "MACD金叉") + "</b><br>";
|
|
3064
3093
|
}
|
|
3065
|
-
if (item
|
|
3094
|
+
if (item.kdj_trend && item.kdj_trend > 0) {
|
|
3066
3095
|
let kdj_name = "KDJ金叉";
|
|
3067
3096
|
let kdj_url = Util.get_url("trend_kdj");
|
|
3068
|
-
if (item
|
|
3097
|
+
if (item.kdj_trend === 2) {
|
|
3069
3098
|
kdj_name = "周" + kdj_name;
|
|
3070
3099
|
kdj_url += "?date_type=3";
|
|
3071
3100
|
} else {
|
|
@@ -3112,8 +3141,8 @@ const Util = {
|
|
|
3112
3141
|
let payload = {action: "index_price", index_list: index_list, code_list: code_list.join("-")};
|
|
3113
3142
|
Util.post("/action", payload, function (j) {
|
|
3114
3143
|
// 当前行情指数
|
|
3115
|
-
if (j
|
|
3116
|
-
let index_data_html = Util.parse_index_data(j
|
|
3144
|
+
if (j.index_data && $("#index_data").length) {
|
|
3145
|
+
let index_data_html = Util.parse_index_data(j.index_data);
|
|
3117
3146
|
$("#index_data").html(index_data_html);
|
|
3118
3147
|
}
|
|
3119
3148
|
code_list.forEach(function (code) {
|
|
@@ -3122,7 +3151,7 @@ const Util = {
|
|
|
3122
3151
|
} else {
|
|
3123
3152
|
$(".price_" + code).each(function () {
|
|
3124
3153
|
let price = $(this).text();
|
|
3125
|
-
if (price.
|
|
3154
|
+
if (!price.includes("(") && !price.includes(")")) {
|
|
3126
3155
|
price = parseFloat(price);
|
|
3127
3156
|
$(this).html(Util.digit_compare_trend(price, price));
|
|
3128
3157
|
}
|
|
@@ -3278,19 +3307,19 @@ const Util = {
|
|
|
3278
3307
|
if (index_data) {
|
|
3279
3308
|
let is_small = Util.is_small_screen();
|
|
3280
3309
|
index_data.forEach(function (item) {
|
|
3281
|
-
let short_name = item
|
|
3310
|
+
let short_name = item.name;
|
|
3282
3311
|
if (is_small) {
|
|
3283
3312
|
short_name = short_name.replace("指数", "").replace("成指", "").replace("板指", "");
|
|
3284
3313
|
}
|
|
3285
|
-
if (item
|
|
3286
|
-
short_name = "<a style='text-decoration: none;' href='" + item
|
|
3314
|
+
if (item.href) {
|
|
3315
|
+
short_name = "<a style='text-decoration: none;' href='" + item.href + "' target='_blank' rel='noopener noreferrer nofollow'>" + short_name + "</a>";
|
|
3287
3316
|
}
|
|
3288
|
-
let title = item
|
|
3289
|
-
if (item
|
|
3290
|
-
title = item
|
|
3317
|
+
let title = item.name;
|
|
3318
|
+
if (item.code) {
|
|
3319
|
+
title = item.name + "(" + item.code + ")";
|
|
3291
3320
|
}
|
|
3292
3321
|
html.push("<span title='", title, "'>", short_name, ":");
|
|
3293
|
-
html.push(Util.pack_index_data(item
|
|
3322
|
+
html.push(Util.pack_index_data(item.value, item.change_rate));
|
|
3294
3323
|
html.push("</span> ");
|
|
3295
3324
|
});
|
|
3296
3325
|
}
|
|
@@ -3339,17 +3368,17 @@ const Util = {
|
|
|
3339
3368
|
*/
|
|
3340
3369
|
pack_holder_num: function (item) {
|
|
3341
3370
|
let holder_info = "--";
|
|
3342
|
-
if (item
|
|
3371
|
+
if (item.code && !Util.is_cn(item.code)) {
|
|
3343
3372
|
return holder_info;
|
|
3344
3373
|
}
|
|
3345
|
-
if (item
|
|
3346
|
-
if (item
|
|
3347
|
-
holder_info = Util.digit_compare_trend(item
|
|
3374
|
+
if (item.holder_num && item.holder_num > 0) {
|
|
3375
|
+
if (item.pre_holder_num && item.pre_holder_num > 0) {
|
|
3376
|
+
holder_info = Util.digit_compare_trend(item.holder_num, item.pre_holder_num);
|
|
3348
3377
|
} else {
|
|
3349
|
-
holder_info = Util.digit_compare_trend(item
|
|
3378
|
+
holder_info = Util.digit_compare_trend(item.holder_num, 0);
|
|
3350
3379
|
}
|
|
3351
3380
|
}
|
|
3352
|
-
let holder_url = "/stock/" + item
|
|
3381
|
+
let holder_url = "/stock/" + item.code + "?tab=holder_data";
|
|
3353
3382
|
return Util.pack_html_link(holder_url, holder_info);
|
|
3354
3383
|
},
|
|
3355
3384
|
|
|
@@ -3360,13 +3389,13 @@ const Util = {
|
|
|
3360
3389
|
*/
|
|
3361
3390
|
pack_fund_num: function (item) {
|
|
3362
3391
|
let fund_num = "--";
|
|
3363
|
-
if (item
|
|
3392
|
+
if (item.code && !Util.is_cn(item.code)) {
|
|
3364
3393
|
return fund_num;
|
|
3365
3394
|
}
|
|
3366
|
-
if (item
|
|
3367
|
-
fund_num = Util.digit_compare_trend(item
|
|
3395
|
+
if (item.cur_fund_num && item.cur_fund_num > 0) {
|
|
3396
|
+
fund_num = Util.digit_compare_trend(item.cur_fund_num, item.pre_fund_num);
|
|
3368
3397
|
}
|
|
3369
|
-
return Util.pack_html_link("/stock/" + item
|
|
3398
|
+
return Util.pack_html_link("/stock/" + item.code + "?tab=public_fund", fund_num);
|
|
3370
3399
|
},
|
|
3371
3400
|
|
|
3372
3401
|
/**
|
|
@@ -3375,14 +3404,14 @@ const Util = {
|
|
|
3375
3404
|
* @returns {string}
|
|
3376
3405
|
*/
|
|
3377
3406
|
pack_fund_administrator: function (item) {
|
|
3378
|
-
if (item
|
|
3407
|
+
if (item.administrator && item.administrator !== "---") {
|
|
3379
3408
|
let url = "";
|
|
3380
|
-
if (item
|
|
3381
|
-
url = "https://fund.eastmoney.com/company/" + item
|
|
3409
|
+
if (item.administrator_code) {
|
|
3410
|
+
url = "https://fund.eastmoney.com/company/" + item.administrator_code + ".html";
|
|
3382
3411
|
} else {
|
|
3383
|
-
url = "https://baike.baidu.com/item/" + item
|
|
3412
|
+
url = "https://baike.baidu.com/item/" + item.administrator.replace("基金管理", "基金");
|
|
3384
3413
|
}
|
|
3385
|
-
return Util.pack_html_link(url, item
|
|
3414
|
+
return Util.pack_html_link(url, item.administrator);
|
|
3386
3415
|
}
|
|
3387
3416
|
return "--";
|
|
3388
3417
|
},
|
|
@@ -3393,9 +3422,9 @@ const Util = {
|
|
|
3393
3422
|
* @returns {string}
|
|
3394
3423
|
*/
|
|
3395
3424
|
pack_fund_manager: function (item) {
|
|
3396
|
-
if (item
|
|
3425
|
+
if (item.managers && item.managers !== "---") {
|
|
3397
3426
|
let html = [];
|
|
3398
|
-
let managers = item
|
|
3427
|
+
let managers = item.managers.replace(/、/g, " ").replace(/,/g, " ").replace(/,/g, " ").split(" ");
|
|
3399
3428
|
managers.forEach(function(manager) {
|
|
3400
3429
|
if (manager) {
|
|
3401
3430
|
html.push(Util.pack_html_link("https://www.howbuy.com/search/quicksearch.htm?skey=" + manager, manager));
|
|
@@ -3412,8 +3441,8 @@ const Util = {
|
|
|
3412
3441
|
* @returns {string}
|
|
3413
3442
|
*/
|
|
3414
3443
|
pack_fund_rating: function (item) {
|
|
3415
|
-
if (item
|
|
3416
|
-
let rating = item
|
|
3444
|
+
if (item.rating) {
|
|
3445
|
+
let rating = item.rating;
|
|
3417
3446
|
if (rating.includes("买入") || rating.includes("增持") || rating.includes("推荐")) {
|
|
3418
3447
|
return "<b class='text-danger'>" + rating + "</b>";
|
|
3419
3448
|
} else if (rating.includes("卖出") || rating.includes("减持")) {
|
|
@@ -3430,15 +3459,15 @@ const Util = {
|
|
|
3430
3459
|
* @returns {string}
|
|
3431
3460
|
*/
|
|
3432
3461
|
pack_snowball_follower: function (item) {
|
|
3433
|
-
if (item
|
|
3434
|
-
let snowball_follower_rank = Util.to_unit(item
|
|
3435
|
-
let market_type = Util.is_hk(item
|
|
3462
|
+
if (item.snowball_follower && item.snowball_follower > 0) {
|
|
3463
|
+
let snowball_follower_rank = Util.to_unit(item.snowball_follower) + "(" + item.snowball_follower_rank + ")";
|
|
3464
|
+
let market_type = Util.is_hk(item.code) ? "hk" : "cn";
|
|
3436
3465
|
let url = Util.get_url("rank_holder") + "?sort_type=snowball_follower&market_type=" + market_type;
|
|
3437
|
-
if (item
|
|
3438
|
-
url += "&code=" + item
|
|
3466
|
+
if (item.code) {
|
|
3467
|
+
url += "&code=" + item.code;
|
|
3439
3468
|
}
|
|
3440
3469
|
$("#snowball_follower").html(Util.pack_html_link(url, snowball_follower_rank));
|
|
3441
|
-
let tooltip = "雪球共有 " + item
|
|
3470
|
+
let tooltip = "雪球共有 " + item.snowball_follower + " 人关注,关注排名第 " + item.snowball_follower_rank + " 位";
|
|
3442
3471
|
$("#snowball_follower_info").attr("data-original-title", tooltip);
|
|
3443
3472
|
}
|
|
3444
3473
|
},
|
|
@@ -3450,12 +3479,12 @@ const Util = {
|
|
|
3450
3479
|
* @returns {string}
|
|
3451
3480
|
*/
|
|
3452
3481
|
render_money_inflow: function (obj, item) {
|
|
3453
|
-
if (item
|
|
3454
|
-
let money_net_inflow = "<b>" + Util.to_unit(item
|
|
3455
|
-
money_net_inflow = Util.pack_html_link("/stock/" + item
|
|
3456
|
-
obj.html(Util.pack_html_link("/stock/" + item
|
|
3457
|
-
obj.attr("data-val", item
|
|
3458
|
-
obj.find("span").first().addClass(Util.text_color(item
|
|
3482
|
+
if (item.money_net_inflow && item.money_net_inflow !== 0) {
|
|
3483
|
+
let money_net_inflow = "<b>" + Util.to_unit(item.money_net_inflow) + "</b>";
|
|
3484
|
+
money_net_inflow = Util.pack_html_link("/stock/" + item.code + "?tab=big_deal", money_net_inflow);
|
|
3485
|
+
obj.html(Util.pack_html_link("/stock/" + item.code + "?tab=big_deal", money_net_inflow));
|
|
3486
|
+
obj.attr("data-val", item.money_net_inflow);
|
|
3487
|
+
obj.find("span").first().addClass(Util.text_color(item.money_net_inflow));
|
|
3459
3488
|
}
|
|
3460
3489
|
},
|
|
3461
3490
|
|
|
@@ -3465,16 +3494,16 @@ const Util = {
|
|
|
3465
3494
|
* @param element_id
|
|
3466
3495
|
*/
|
|
3467
3496
|
render_ma_deduction: function (item, element_id) {
|
|
3468
|
-
if (item
|
|
3497
|
+
if (item.price && item.ma_deduction && item.ma_deduction.length > 0) {
|
|
3469
3498
|
let ma_deduction_html = [];
|
|
3470
|
-
item
|
|
3499
|
+
item.ma_deduction.forEach(function (ma) {
|
|
3471
3500
|
if (ma["deduction_price"] > 0) {
|
|
3472
3501
|
let day_ma_str = ma["day"] + "日均线";
|
|
3473
3502
|
if (ma["day"] === 20 || ma["day"] === 60 || ma["day"] === 120) {
|
|
3474
3503
|
day_ma_str = "<span class='label label-info'>" + day_ma_str + "</span>";
|
|
3475
3504
|
}
|
|
3476
|
-
let deduction_cls = Util.text_color(item
|
|
3477
|
-
let ma_cls = Util.text_color(item
|
|
3505
|
+
let deduction_cls = Util.text_color(item.price, ma["deduction_price"]);
|
|
3506
|
+
let ma_cls = Util.text_color(item.price, ma["ma"]);
|
|
3478
3507
|
ma_deduction_html.push(day_ma_str + ":<b class='" + ma_cls + "'>" + ma["ma"] + "</b>(<b class='" + deduction_cls + "'>" + ma["deduction_price"] + "</b>)");
|
|
3479
3508
|
}
|
|
3480
3509
|
});
|
|
@@ -3491,18 +3520,18 @@ const Util = {
|
|
|
3491
3520
|
let price_market_type = $("#price_market_type").val();
|
|
3492
3521
|
data.forEach(function (item) {
|
|
3493
3522
|
html.push("<tr>");
|
|
3494
|
-
html.push("<td>", Util.snowball_url(item
|
|
3495
|
-
let stock_name = item
|
|
3523
|
+
html.push("<td>", Util.snowball_url(item.code), "</td>");
|
|
3524
|
+
let stock_name = item.name;
|
|
3496
3525
|
if (price_market_type !== "cn") {
|
|
3497
3526
|
stock_name = Util.strip_bracket_string(stock_name);
|
|
3498
3527
|
stock_name = stock_name.substring(0, 6);
|
|
3499
3528
|
}
|
|
3500
|
-
html.push("<td>", Util.stock_url(item
|
|
3501
|
-
html.push("<td>", (item
|
|
3502
|
-
html.push("<td>", Util.industry_url(item
|
|
3503
|
-
let p_color = Util.text_color(item
|
|
3504
|
-
html.push("<td><b class='", p_color, "'>", Util.to_float(item
|
|
3505
|
-
let p_change_rate = Util.calc_change_rate(item
|
|
3529
|
+
html.push("<td>", Util.stock_url(item.code, stock_name), "</td>");
|
|
3530
|
+
html.push("<td>", (item.market_capital ? (item.market_capital + "亿") : "--"), "</td>");
|
|
3531
|
+
html.push("<td>", Util.industry_url(item.code, item.industry), "</td>");
|
|
3532
|
+
let p_color = Util.text_color(item.close, item.open);
|
|
3533
|
+
html.push("<td><b class='", p_color, "'>", Util.to_float(item.close, 2), "<b></td>");
|
|
3534
|
+
let p_change_rate = Util.calc_change_rate(item.close, item.open, 4);
|
|
3506
3535
|
p_change_rate = Util.to_float(p_change_rate * 100, 2)
|
|
3507
3536
|
if (p_change_rate > 0) {
|
|
3508
3537
|
p_change_rate = "+" + p_change_rate;
|
|
@@ -3522,10 +3551,10 @@ const Util = {
|
|
|
3522
3551
|
let industry_url = Util.get_url("summary_industry");
|
|
3523
3552
|
data.forEach(function (item) {
|
|
3524
3553
|
html.push("<tr>");
|
|
3525
|
-
html.push("<td>", Util.pack_html_link("https://q.10jqka.com.cn/thshy/detail/code/" + item
|
|
3526
|
-
html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item
|
|
3527
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3528
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3554
|
+
html.push("<td>", Util.pack_html_link("https://q.10jqka.com.cn/thshy/detail/code/" + item.code, item.code), "</td>");
|
|
3555
|
+
html.push("<td>", Util.pack_html_link(industry_url + "?code=" + item.code, item.name), "</td>");
|
|
3556
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.year_close, 1), "</td>");
|
|
3557
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.start_close, 1), "</td>");
|
|
3529
3558
|
html.push("</tr>");
|
|
3530
3559
|
});
|
|
3531
3560
|
Util.render_table_html("industry_table_body", html);
|
|
@@ -3539,22 +3568,22 @@ const Util = {
|
|
|
3539
3568
|
let html = [];
|
|
3540
3569
|
data.forEach(function (item) {
|
|
3541
3570
|
html.push("<tr>");
|
|
3542
|
-
html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item
|
|
3543
|
-
html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item
|
|
3571
|
+
html.push("<td>", Util.pack_html_link("https://fund.eastmoney.com/" + item.code + ".html", item.code), "</td>");
|
|
3572
|
+
html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item.code, "'>", item.name, "</a></td>");
|
|
3544
3573
|
let change_quotient = "--";
|
|
3545
|
-
if (item
|
|
3546
|
-
let title = Util.strip_html(Util.to_unit(item
|
|
3547
|
-
if (item
|
|
3548
|
-
change_quotient = "<b title='" + title + "' class='text-danger'>+" + Util.strip_html(Util.to_unit(item
|
|
3549
|
-
} else if (item
|
|
3550
|
-
change_quotient = "<b title='" + title + "' class='text-success'>" + Util.strip_html(Util.to_unit(item
|
|
3574
|
+
if (item.start_quotient && item.end_quotient) {
|
|
3575
|
+
let title = Util.strip_html(Util.to_unit(item.start_quotient, 3)) + " - " + Util.strip_html(Util.to_unit(item.end_quotient, 3));
|
|
3576
|
+
if (item.end_quotient > item.start_quotient) {
|
|
3577
|
+
change_quotient = "<b title='" + title + "' class='text-danger'>+" + Util.strip_html(Util.to_unit(item.end_quotient - item.start_quotient, 1)) + "</b>";
|
|
3578
|
+
} else if (item.end_quotient < item.start_quotient) {
|
|
3579
|
+
change_quotient = "<b title='" + title + "' class='text-success'>" + Util.strip_html(Util.to_unit(item.end_quotient - item.start_quotient, 1)) + "</b>";
|
|
3551
3580
|
} else {
|
|
3552
3581
|
change_quotient = "<b title='" + title + "'>0.00</b>";
|
|
3553
3582
|
}
|
|
3554
3583
|
}
|
|
3555
3584
|
html.push("<td>", change_quotient, "</td>");
|
|
3556
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3557
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3585
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.year_close, 1), "</td>");
|
|
3586
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.start_close, 1), "</td>");
|
|
3558
3587
|
html.push("</tr>");
|
|
3559
3588
|
});
|
|
3560
3589
|
Util.render_table_html("etf_table_body", html);
|
|
@@ -3569,11 +3598,11 @@ const Util = {
|
|
|
3569
3598
|
let index_url = Util.get_url("summary_index");
|
|
3570
3599
|
data.forEach(function (item) {
|
|
3571
3600
|
html.push("<tr>");
|
|
3572
|
-
html.push("<td>", Util.pack_html_link(item
|
|
3573
|
-
html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item
|
|
3574
|
-
html.push("<td><b class='", Util.text_color(item
|
|
3575
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3576
|
-
html.push("<td>", Util.year_price_rate(item
|
|
3601
|
+
html.push("<td>", Util.pack_html_link(item.url, item.code.toUpperCase()), "</td>");
|
|
3602
|
+
html.push("<td>", Util.pack_html_link(index_url + "?index_code=" + item.code, item.name), "</td>");
|
|
3603
|
+
html.push("<td><b class='", Util.text_color(item.current_close, item.start_close), "'>", Util.to_float(item.current_close, 2), "</b></td>");
|
|
3604
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.year_close, 1), "</td>");
|
|
3605
|
+
html.push("<td>", Util.year_price_rate(item.current_close, item.start_close, 1), "</td>");
|
|
3577
3606
|
html.push("</tr>");
|
|
3578
3607
|
});
|
|
3579
3608
|
Util.render_table_html("index_table_body", html);
|
|
@@ -3625,7 +3654,7 @@ const Util = {
|
|
|
3625
3654
|
* @param end_date
|
|
3626
3655
|
*/
|
|
3627
3656
|
init_date_range_picker: function (element_id, Obj, callback_func, start_date = 0, end_date = 0) {
|
|
3628
|
-
let separator = element_id.
|
|
3657
|
+
let separator = element_id.includes("_start_end") ? "_start_end" : "_";
|
|
3629
3658
|
let element_array = element_id.split(separator);
|
|
3630
3659
|
let prefix = element_array[0];
|
|
3631
3660
|
let select_id = prefix + "_time_select";
|
|
@@ -3725,8 +3754,8 @@ const Util = {
|
|
|
3725
3754
|
let option_data = {};
|
|
3726
3755
|
data.forEach(function (item) {
|
|
3727
3756
|
if (item[type]) {
|
|
3728
|
-
if (item
|
|
3729
|
-
option_data[item[type]] = item
|
|
3757
|
+
if (item.num) {
|
|
3758
|
+
option_data[item[type]] = item.num;
|
|
3730
3759
|
} else {
|
|
3731
3760
|
if (option_data[item[type]]) {
|
|
3732
3761
|
option_data[item[type]] += 1;
|
|
@@ -3758,7 +3787,7 @@ const Util = {
|
|
|
3758
3787
|
* @returns {boolean}
|
|
3759
3788
|
*/
|
|
3760
3789
|
is_industry_area: function (item, industry, area) {
|
|
3761
|
-
return (industry === "" || industry === item
|
|
3790
|
+
return (industry === "" || industry === item.industry) && (area === "" || area === item.area)
|
|
3762
3791
|
},
|
|
3763
3792
|
|
|
3764
3793
|
/**
|