sbd-npm 1.3.59 → 1.3.61
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/stock_basics.js +1 -57
- package/util.js +80 -3
package/package.json
CHANGED
package/stock_basics.js
CHANGED
@@ -89,7 +89,7 @@ let Stock = {
|
|
89
89
|
Util.fetch_public_fund(Stock["code"]);
|
90
90
|
break;
|
91
91
|
case "public_fund_change":
|
92
|
-
|
92
|
+
Util.fetch_public_fund_change(Stock["code"]);
|
93
93
|
break;
|
94
94
|
case "big_deal":
|
95
95
|
Stock.fetch_big_deal();
|
@@ -916,62 +916,6 @@ let Stock = {
|
|
916
916
|
});
|
917
917
|
},
|
918
918
|
|
919
|
-
/**
|
920
|
-
* 公募持股变化
|
921
|
-
*/
|
922
|
-
fetch_public_fund_change: function () {
|
923
|
-
Stock["pfc_stock_chart"] = Util.show_chart_loading(Stock["pfc_stock_chart"], "pfc_stock_line_canvas");
|
924
|
-
Util.init_table_skeleton({
|
925
|
-
"element_id": "pfc_fund_table",
|
926
|
-
"head_cols": [
|
927
|
-
{"name": "时间", "class": "info", "table_sort": 1},
|
928
|
-
{"name": "当时股价", "table_sort": 1},
|
929
|
-
{"name": "总持股数", "table_sort": 1},
|
930
|
-
{"name": "持仓家数", "table_sort": 1},
|
931
|
-
{"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 总持股数"},
|
932
|
-
]
|
933
|
-
});
|
934
|
-
Util.post("/stock/" + Stock["code"], {action: "public_fund_change"}, function (j) {
|
935
|
-
Stock["pfc_stock_chart"].hideLoading();
|
936
|
-
let date_data = [], fund_num_data = [], stock_num_data = [], price_data = [], _html = [];
|
937
|
-
j["data"].forEach(function (item) {
|
938
|
-
let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
|
939
|
-
date_data.push(date_format);
|
940
|
-
fund_num_data.push(item["fund_num"]);
|
941
|
-
stock_num_data.push(item["stock_num"]);
|
942
|
-
price_data.push(item["price"]);
|
943
|
-
_html.push("<tr>");
|
944
|
-
_html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + Stock["code"] + ".html", date_format), "</td>");
|
945
|
-
_html.push("<td>", item["price"], "</td>");
|
946
|
-
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
947
|
-
_html.push("<td>", item["fund_num"], "</td>");
|
948
|
-
let market_capital = item["price"] * item["stock_num"];
|
949
|
-
_html.push("<td data-val='", market_capital, "' title='", market_capital, "'>", Util.to_unit(market_capital, 4), "</td>");
|
950
|
-
_html.push("</tr>");
|
951
|
-
});
|
952
|
-
date_data = date_data.reverse();
|
953
|
-
fund_num_data = fund_num_data.reverse();
|
954
|
-
stock_num_data = stock_num_data.reverse();
|
955
|
-
price_data = price_data.reverse();
|
956
|
-
Stock["pfc_stock_chart"] = Util.multi_axis_line(Stock["pfc_stock_chart"], "pfc_stock_line_canvas", date_data, '总持股数', stock_num_data, '股价', price_data);
|
957
|
-
Stock["pfc_fund_chart"] = Util.multi_axis_line(Stock["pfc_fund_chart"], "pfc_fund_line_canvas", date_data, '持仓家数', fund_num_data, '股价', price_data);
|
958
|
-
if (j["data"].length > 1) {
|
959
|
-
let cur_stock_num = j["data"][0]["stock_num"];
|
960
|
-
let pre_stock_num = j["data"][1]["stock_num"];
|
961
|
-
if (cur_stock_num > 0 && pre_stock_num > 0) {
|
962
|
-
$("#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) + ")");
|
963
|
-
}
|
964
|
-
let cur_fund_num = j["data"][0]["fund_num"];
|
965
|
-
let pre_fund_num = j["data"][1]["fund_num"];
|
966
|
-
if (cur_fund_num > 0 && pre_fund_num > 0) {
|
967
|
-
$("#pfc_fund_tips").html("(当前基金数: <b class='text-info'>" + cur_fund_num + "</b>, 环比: " + Util.year_price_rate(cur_fund_num, pre_fund_num) + ")");
|
968
|
-
}
|
969
|
-
}
|
970
|
-
Util.render_table_html("pfc_fund_table_body", _html);
|
971
|
-
Util.hide_tips();
|
972
|
-
});
|
973
|
-
},
|
974
|
-
|
975
919
|
handle_metrics_statistics: function (metrics, date_type) {
|
976
920
|
Stock[metrics + "_bar_chart"] = Util.startup_metrics_statistics(Stock[metrics + "_bar_chart"], metrics, date_type);
|
977
921
|
if (metrics === "margin" || metrics === "hkex_holding") {
|
package/util.js
CHANGED
@@ -1120,7 +1120,7 @@ const Util = {
|
|
1120
1120
|
_html.push("<td>", item["assets"], "亿</td>");
|
1121
1121
|
_html.push("<td>", item["fund_type"], "</td>");
|
1122
1122
|
_html.push("<td>", item["invest_type"], "</td>");
|
1123
|
-
_html.push("<td>", Util.
|
1123
|
+
_html.push("<td>", Util.pack_fund_administrator(item), "</td>");
|
1124
1124
|
_html.push("<td>", public_date, "</td>");
|
1125
1125
|
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
1126
1126
|
_html.push("<td data-val='", item["market_capital"], "' title='", item["market_capital"], "'>", Util.to_unit(item["market_capital"], 3), "</td>");
|
@@ -1164,6 +1164,63 @@ const Util = {
|
|
1164
1164
|
});
|
1165
1165
|
},
|
1166
1166
|
|
1167
|
+
/**
|
1168
|
+
* 公募持股变化
|
1169
|
+
* @param code
|
1170
|
+
*/
|
1171
|
+
fetch_public_fund_change: function (code) {
|
1172
|
+
Util["pfc_stock_chart"] = Util.show_chart_loading(Util["pfc_stock_chart"], "pfc_stock_line_canvas");
|
1173
|
+
Util.init_table_skeleton({
|
1174
|
+
"element_id": "pfc_fund_table",
|
1175
|
+
"head_cols": [
|
1176
|
+
{"name": "时间", "class": "info", "table_sort": 1},
|
1177
|
+
{"name": "当时股价", "table_sort": 1},
|
1178
|
+
{"name": "总持股数", "table_sort": 1},
|
1179
|
+
{"name": "持仓家数", "table_sort": 1},
|
1180
|
+
{"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 总持股数"},
|
1181
|
+
]
|
1182
|
+
});
|
1183
|
+
Util.post("/stock/" + code, {action: "public_fund_change"}, function (j) {
|
1184
|
+
Util["pfc_stock_chart"].hideLoading();
|
1185
|
+
let date_data = [], fund_num_data = [], stock_num_data = [], price_data = [], _html = [];
|
1186
|
+
j["data"].forEach(function (item) {
|
1187
|
+
let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
|
1188
|
+
date_data.push(date_format);
|
1189
|
+
fund_num_data.push(item["fund_num"]);
|
1190
|
+
stock_num_data.push(item["stock_num"]);
|
1191
|
+
price_data.push(item["price"]);
|
1192
|
+
_html.push("<tr>");
|
1193
|
+
_html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
|
1194
|
+
_html.push("<td>", item["price"], "</td>");
|
1195
|
+
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
1196
|
+
_html.push("<td>", item["fund_num"], "</td>");
|
1197
|
+
let market_capital = item["price"] * item["stock_num"];
|
1198
|
+
_html.push("<td data-val='", market_capital, "' title='", market_capital, "'>", Util.to_unit(market_capital, 4), "</td>");
|
1199
|
+
_html.push("</tr>");
|
1200
|
+
});
|
1201
|
+
date_data = date_data.reverse();
|
1202
|
+
fund_num_data = fund_num_data.reverse();
|
1203
|
+
stock_num_data = stock_num_data.reverse();
|
1204
|
+
price_data = price_data.reverse();
|
1205
|
+
Util["pfc_stock_chart"] = Util.multi_axis_line(Util["pfc_stock_chart"], "pfc_stock_line_canvas", date_data, '总持股数', stock_num_data, '股价', price_data);
|
1206
|
+
Util["pfc_fund_chart"] = Util.multi_axis_line(Util["pfc_fund_chart"], "pfc_fund_line_canvas", date_data, '持仓家数', fund_num_data, '股价', price_data);
|
1207
|
+
if (j["data"].length > 1) {
|
1208
|
+
let cur_stock_num = j["data"][0]["stock_num"];
|
1209
|
+
let pre_stock_num = j["data"][1]["stock_num"];
|
1210
|
+
if (cur_stock_num > 0 && pre_stock_num > 0) {
|
1211
|
+
$("#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) + ")");
|
1212
|
+
}
|
1213
|
+
let cur_fund_num = j["data"][0]["fund_num"];
|
1214
|
+
let pre_fund_num = j["data"][1]["fund_num"];
|
1215
|
+
if (cur_fund_num > 0 && pre_fund_num > 0) {
|
1216
|
+
$("#pfc_fund_tips").html("(当前基金数: <b class='text-info'>" + cur_fund_num + "</b>, 环比: " + Util.year_price_rate(cur_fund_num, pre_fund_num) + ")");
|
1217
|
+
}
|
1218
|
+
}
|
1219
|
+
Util.render_table_html("pfc_fund_table_body", _html);
|
1220
|
+
Util.hide_tips();
|
1221
|
+
});
|
1222
|
+
},
|
1223
|
+
|
1167
1224
|
/**
|
1168
1225
|
* 初始分类股票的显示表格
|
1169
1226
|
* @param portfolio
|
@@ -1313,8 +1370,7 @@ const Util = {
|
|
1313
1370
|
_html.push("<tr><td colspan='3'>基金类型</td><td colspan='4'>", j["fund_type"], "</td><td colspan='3'>投资类型</td><td colspan='4'>", j["invest_type"], "</td></tr>");
|
1314
1371
|
_html.push("<tr><td colspan='3'>单位净值</td><td colspan='4'>", net, "</td><td colspan='3'>资产规模</td><td colspan='4'>", assets, "</td></tr>");
|
1315
1372
|
_html.push("<tr><td colspan='3'>成立日期</td><td colspan='4'>", public_date, "</td><td colspan='3'>发行日期</td><td colspan='4'>", issue_date, "</td></tr>");
|
1316
|
-
|
1317
|
-
_html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", administrator, "</td><td colspan='3'>基金经理</td><td colspan='4'>", j["managers"], "</td></tr>");
|
1373
|
+
_html.push("<tr><td colspan='3'>基金管理公司</td><td colspan='4'>", Util.pack_fund_administrator(j), "</td><td colspan='3'>基金经理</td><td colspan='4'>", j["managers"], "</td></tr>");
|
1318
1374
|
_html.push("<tr><td colspan='5'>基金托管人</td><td colspan='9'>", (j["custodian"] ? j["custodian"] : "--"), "</td></tr>");
|
1319
1375
|
_html.push("<tr><td colspan='5'>经办律师事务所</td><td colspan='9'>", (j["lawyer"] ? j["lawyer"] : "--"), "</td></tr>");
|
1320
1376
|
_html.push("<tr><td colspan='5'>会计师事务所</td><td colspan='9'>", (j["accounting"] ? j["accounting"] : "--"), "</td></tr>");
|
@@ -2998,6 +3054,9 @@ const Util = {
|
|
2998
3054
|
*/
|
2999
3055
|
pack_holder_num: function (item) {
|
3000
3056
|
let holder_info = "--";
|
3057
|
+
if (item["code"] && Util.is_hk(item["code"])) {
|
3058
|
+
return holder_info;
|
3059
|
+
}
|
3001
3060
|
if (item["holder_num"] && item["holder_num"] > 0) {
|
3002
3061
|
if (item["pre_holder_num"] && item["pre_holder_num"] > 0) {
|
3003
3062
|
holder_info = Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"]);
|
@@ -3022,6 +3081,24 @@ const Util = {
|
|
3022
3081
|
return Util.pack_html_link("/stock/" + item["code"] + "?tab=public_fund", fund_num);
|
3023
3082
|
},
|
3024
3083
|
|
3084
|
+
/**
|
3085
|
+
* 组装基金公司数据
|
3086
|
+
* @param item
|
3087
|
+
* @returns {string}
|
3088
|
+
*/
|
3089
|
+
pack_fund_administrator: function (item) {
|
3090
|
+
if (item["administrator"]) {
|
3091
|
+
let url = "";
|
3092
|
+
if (item["administrator_code"]) {
|
3093
|
+
url = "https://fund.eastmoney.com/company/" + item["administrator_code"] + ".html";
|
3094
|
+
} else {
|
3095
|
+
url = "https://baike.baidu.com/item/" + item["administrator"].replace("基金管理", "基金");
|
3096
|
+
}
|
3097
|
+
return Util.pack_html_link(url, item["administrator"]);
|
3098
|
+
}
|
3099
|
+
return "--";
|
3100
|
+
},
|
3101
|
+
|
3025
3102
|
/**
|
3026
3103
|
* 雪球人数关注排名数据
|
3027
3104
|
* @param item
|