sbd-npm 1.3.60 → 1.3.62
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 -1
- package/package.json +1 -1
- package/stock_basics.js +1 -57
- package/util.js +147 -44
package/constant.js
CHANGED
@@ -27,11 +27,11 @@ const MenuList = [
|
|
27
27
|
{'key': 'trend_kdj', 'name': 'KDJ金叉', 'url': '/0x3382bdaec4e8715ce27ca2b538dce09a2f8f5e50'},
|
28
28
|
{'key': 'trend_macd_cross', 'name': 'MACD金叉', 'url': '/0x277bc35fcd21059103dd7917c8bfe0c474880b85'},
|
29
29
|
{'key': 'trend_bull_trend', 'name': '多头趋势', 'url': '/0x37b24777154ee090926e57bfa5602efa5c89b8a8'},
|
30
|
+
{'key': 'trend_fund_hold', 'name': '基金数持股变化', 'url': '/0x706c0e77ca3e314b5186c763e6ee857b744e9880'},
|
30
31
|
{'key': 'trend_money_inflow', 'name': '资金流入历史最高', 'url': '/0xfbfc92be1eebe9ccf5b2f14b9a2ea25f2cc941b8'},
|
31
32
|
{'key': 'trend_boll', 'name': '布林线', 'url': '/0x7f2c6b9542ce7626669ab4910cbf7e8812883fea'},
|
32
33
|
{'key': 'trend_holder_minimum', 'name': '股东数历史最少', 'url': '/0xf0c0c360a283689c83ae216c6bbb03777d8068ca'},
|
33
34
|
{'key': 'trend_down_maximum', 'name': '历史高位最大跌幅', 'url': '/0x8d7b8abeec94e2ebe4b25115272d9d5899355c43'},
|
34
|
-
{'key': 'trend_fund_hold', 'name': '基金数持股变化', 'url': '/0x706c0e77ca3e314b5186c763e6ee857b744e9880'},
|
35
35
|
{'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/0xa9dfc159b157ae3b694a12dc42fb8feaa75bcf51'},
|
36
36
|
{'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/0x9a2c22255e4f87592b10432c8ab24b14c82692af'},
|
37
37
|
{'key': 'trend_index_month', 'name': '指数每年月份涨跌', 'url': '/0xf59cc6347d851edfe836a6c1c23c518cb83e27de'},
|
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
@@ -1093,50 +1093,8 @@ const Util = {
|
|
1093
1093
|
{"name": ""},
|
1094
1094
|
]
|
1095
1095
|
});
|
1096
|
-
|
1097
|
-
|
1098
|
-
public_fund_date: $("#public_fund_date").val()
|
1099
|
-
};
|
1100
|
-
Util.post("/stock/" + code, payload, function (j) {
|
1101
|
-
let _html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
|
1102
|
-
j["data"].forEach(function (item) {
|
1103
|
-
total_public_fund++;
|
1104
|
-
total_stock_num += item["stock_num"];
|
1105
|
-
total_market_capital += item["market_capital"];
|
1106
|
-
let public_date = "--";
|
1107
|
-
if (item["public_date"] > 0) {
|
1108
|
-
public_date = Util.seconds_to_format(item["public_date"], "%Y-%m-%d");
|
1109
|
-
}
|
1110
|
-
let net = item["net"];
|
1111
|
-
let cls = Util.text_color(item["change_percent"])
|
1112
|
-
if (cls !== "") {
|
1113
|
-
net = "<b class='" + cls + "'>" + net + "(" + Util.to_float(item["change_percent"], 2) + "%)</b>";
|
1114
|
-
}
|
1115
|
-
_html.push("<tr class='", (($.inArray(item["fund_code"], j["etf_code_list"]) > -1) ? "danger" : ""), "'>");
|
1116
|
-
_html.push("<td>", total_public_fund, "</td>");
|
1117
|
-
_html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item["fund_code"] + '.html', item["fund_code"]), "</td>");
|
1118
|
-
_html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item["fund_code"] + '.html', item["fund_name"]), "</td>");
|
1119
|
-
_html.push("<td>", net, "</td>");
|
1120
|
-
_html.push("<td>", item["assets"], "亿</td>");
|
1121
|
-
_html.push("<td>", item["fund_type"], "</td>");
|
1122
|
-
_html.push("<td>", item["invest_type"], "</td>");
|
1123
|
-
_html.push("<td>", Util.pack_fund_administrator(item), "</td>");
|
1124
|
-
_html.push("<td>", public_date, "</td>");
|
1125
|
-
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
1126
|
-
_html.push("<td data-val='", item["market_capital"], "' title='", item["market_capital"], "'>", Util.to_unit(item["market_capital"], 3), "</td>");
|
1127
|
-
_html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["fund_code"], "'>详细</a></td>");
|
1128
|
-
_html.push("</tr>");
|
1129
|
-
});
|
1130
|
-
Util.render_table_html("public_fund_table_body", _html);
|
1131
|
-
let public_fund_tips = "";
|
1132
|
-
if (j["cur_fund_num"]) {
|
1133
|
-
total_public_fund = Util.pack_html_link(Util.get_url("trend_fund_hold"), '<span class="label label-info">' + j["cur_fund_num"] + '</span>');
|
1134
|
-
public_fund_tips = '共 ' + total_public_fund + ' 家(' + Util.year_price_rate(j["cur_fund_num"], j["pre_fund_num"], 1) + '), <span class="label label-info">' + Util.to_unit(j["cur_stock_num"], 3) + '</span> 股(' + Util.year_price_rate(j["cur_stock_num"], j["pre_stock_num"], 1) + '),<span class="label label-info">' + Util.to_unit(j["hold_value"], 3) + '</span>市值';
|
1135
|
-
} else {
|
1136
|
-
total_public_fund = Util.pack_html_link(Util.get_url("trend_fund_hold"), '<span class="label label-info">' + total_public_fund + '</span>');
|
1137
|
-
public_fund_tips = '共 ' + total_public_fund + ' 家, <span class="label label-info">' + Util.to_unit(total_stock_num, 3) + '</span> 股,<span class="label label-info">' + Util.to_unit(total_market_capital, 3) + '</span>市值';
|
1138
|
-
}
|
1139
|
-
$("#public_fund_tips").html(public_fund_tips);
|
1096
|
+
Util.post("/stock/" + code, {action: "public_fund", public_fund_date: $("#public_fund_date").val()}, function (j) {
|
1097
|
+
Util.render_public_fund(j);
|
1140
1098
|
if (j["date"] && j["date"] > 0) {
|
1141
1099
|
$("#public_fund_title").find("a").each(function() {
|
1142
1100
|
let t_text = $(this).text();
|
@@ -1158,12 +1116,157 @@ const Util = {
|
|
1158
1116
|
$("#public_fund_date").change(function () {
|
1159
1117
|
Util.fetch_public_fund(code);
|
1160
1118
|
});
|
1119
|
+
$(".public_fund_difference").each(function() {
|
1120
|
+
$(this).click(function() {
|
1121
|
+
let public_fund_date = $("#public_fund_date").val();
|
1122
|
+
if (Util.regexp_date_yyyy_mm_dd(public_fund_date)) {
|
1123
|
+
public_fund_date = Util.format_to_second(public_fund_date);
|
1124
|
+
let prev_public_fund_date = Util.get_prev_public_fund_date("public_fund_date", public_fund_date);
|
1125
|
+
if (prev_public_fund_date > 0 && public_fund_date > prev_public_fund_date) {
|
1126
|
+
Util.show_loading();
|
1127
|
+
Util.set_table_loading("public_fund_table_body");
|
1128
|
+
let payload = {
|
1129
|
+
action: "public_fund_difference",
|
1130
|
+
type: $(this).attr("data-val"),
|
1131
|
+
date: public_fund_date,
|
1132
|
+
pre_date: prev_public_fund_date
|
1133
|
+
};
|
1134
|
+
Util.post("/stock/" + code, payload, function (j) {
|
1135
|
+
Util.render_public_fund(j);
|
1136
|
+
Util.hide_tips();
|
1137
|
+
});
|
1138
|
+
}
|
1139
|
+
}
|
1140
|
+
});
|
1141
|
+
});
|
1161
1142
|
});
|
1162
1143
|
}
|
1163
1144
|
Util.hide_tips();
|
1164
1145
|
});
|
1165
1146
|
},
|
1166
1147
|
|
1148
|
+
/**
|
1149
|
+
* 基金数据渲染
|
1150
|
+
*/
|
1151
|
+
render_public_fund: function(j) {
|
1152
|
+
let _html = [], total_public_fund = 0, total_stock_num = 0, total_market_capital = 0;
|
1153
|
+
j["data"] = j["data"] ? j["data"] : [];
|
1154
|
+
j["data"].forEach(function (item) {
|
1155
|
+
total_public_fund++;
|
1156
|
+
total_stock_num += item["stock_num"];
|
1157
|
+
total_market_capital += item["market_capital"];
|
1158
|
+
let public_date = "--";
|
1159
|
+
if (item["public_date"] > 0) {
|
1160
|
+
public_date = Util.seconds_to_format(item["public_date"], "%Y-%m-%d");
|
1161
|
+
}
|
1162
|
+
let net = item["net"];
|
1163
|
+
let cls = Util.text_color(item["change_percent"])
|
1164
|
+
if (cls !== "") {
|
1165
|
+
net = "<b class='" + cls + "'>" + net + "(" + Util.to_float(item["change_percent"], 2) + "%)</b>";
|
1166
|
+
}
|
1167
|
+
_html.push("<tr class='", (($.inArray(item["fund_code"], j["etf_code_list"]) > -1) ? "danger" : ""), "'>");
|
1168
|
+
_html.push("<td>", total_public_fund, "</td>");
|
1169
|
+
_html.push("<td>", Util.pack_html_link('https://fund.eastmoney.com/' + item["fund_code"] + '.html', item["fund_code"]), "</td>");
|
1170
|
+
_html.push("<td title='基金概况'>", Util.pack_html_link('https://fundf10.eastmoney.com/jbgk_' + item["fund_code"] + '.html', item["fund_name"]), "</td>");
|
1171
|
+
_html.push("<td>", net, "</td>");
|
1172
|
+
_html.push("<td>", item["assets"], "亿</td>");
|
1173
|
+
_html.push("<td>", item["fund_type"], "</td>");
|
1174
|
+
_html.push("<td>", item["invest_type"], "</td>");
|
1175
|
+
_html.push("<td>", Util.pack_fund_administrator(item), "</td>");
|
1176
|
+
_html.push("<td>", public_date, "</td>");
|
1177
|
+
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
1178
|
+
_html.push("<td data-val='", item["market_capital"], "' title='", item["market_capital"], "'>", Util.to_unit(item["market_capital"], 3), "</td>");
|
1179
|
+
_html.push("<td><a class='link_cls' data-toggle='modal' data-target='.public_fund_modal' data-val='", item["fund_code"], "'>详细</a></td>");
|
1180
|
+
_html.push("</tr>");
|
1181
|
+
});
|
1182
|
+
Util.render_table_html("public_fund_table_body", _html);
|
1183
|
+
let public_fund_tips = "";
|
1184
|
+
if (j["cur_fund_num"]) {
|
1185
|
+
total_public_fund = Util.pack_html_link(Util.get_url("trend_fund_hold"), '<span class="label label-info">' + j["cur_fund_num"] + '</span>');
|
1186
|
+
public_fund_tips = '共 ' + total_public_fund + ' 家(' + Util.year_price_rate(j["cur_fund_num"], j["pre_fund_num"], 1) + '), <span class="label label-info">' + Util.to_unit(j["cur_stock_num"], 3) + '</span> 股(' + Util.year_price_rate(j["cur_stock_num"], j["pre_stock_num"], 1) + '),<span class="label label-info">' + Util.to_unit(j["hold_value"], 3) + '</span>市值';
|
1187
|
+
} else {
|
1188
|
+
total_public_fund = Util.pack_html_link(Util.get_url("trend_fund_hold"), '<span class="label label-info">' + total_public_fund + '</span>');
|
1189
|
+
public_fund_tips = '共 ' + total_public_fund + ' 家, <span class="label label-info">' + Util.to_unit(total_stock_num, 3) + '</span> 股,<span class="label label-info">' + Util.to_unit(total_market_capital, 3) + '</span>市值';
|
1190
|
+
}
|
1191
|
+
$("#public_fund_tips").html(public_fund_tips);
|
1192
|
+
},
|
1193
|
+
|
1194
|
+
/**
|
1195
|
+
* 前一季度日时间
|
1196
|
+
*/
|
1197
|
+
get_prev_public_fund_date: function(element_id, current_date) {
|
1198
|
+
let prev_date = 0;
|
1199
|
+
$("#" + element_id).find("option").each(function() {
|
1200
|
+
if (prev_date === 0) {
|
1201
|
+
let p_date = $(this).val();
|
1202
|
+
if (Util.regexp_date_yyyy_mm_dd(p_date)) {
|
1203
|
+
p_date = Util.format_to_second(p_date);
|
1204
|
+
if (current_date > p_date) {
|
1205
|
+
prev_date = p_date;
|
1206
|
+
}
|
1207
|
+
}
|
1208
|
+
}
|
1209
|
+
});
|
1210
|
+
return prev_date;
|
1211
|
+
},
|
1212
|
+
|
1213
|
+
/**
|
1214
|
+
* 公募持股变化
|
1215
|
+
* @param code
|
1216
|
+
*/
|
1217
|
+
fetch_public_fund_change: function (code) {
|
1218
|
+
Util["pfc_stock_chart"] = Util.show_chart_loading(Util["pfc_stock_chart"], "pfc_stock_line_canvas");
|
1219
|
+
Util.init_table_skeleton({
|
1220
|
+
"element_id": "pfc_fund_table",
|
1221
|
+
"head_cols": [
|
1222
|
+
{"name": "时间", "class": "info", "table_sort": 1},
|
1223
|
+
{"name": "当时股价", "table_sort": 1},
|
1224
|
+
{"name": "总持股数", "table_sort": 1},
|
1225
|
+
{"name": "持仓家数", "table_sort": 1},
|
1226
|
+
{"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 总持股数"},
|
1227
|
+
]
|
1228
|
+
});
|
1229
|
+
Util.post("/stock/" + code, {action: "public_fund_change"}, function (j) {
|
1230
|
+
Util["pfc_stock_chart"].hideLoading();
|
1231
|
+
let date_data = [], fund_num_data = [], stock_num_data = [], price_data = [], _html = [];
|
1232
|
+
j["data"].forEach(function (item) {
|
1233
|
+
let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
|
1234
|
+
date_data.push(date_format);
|
1235
|
+
fund_num_data.push(item["fund_num"]);
|
1236
|
+
stock_num_data.push(item["stock_num"]);
|
1237
|
+
price_data.push(item["price"]);
|
1238
|
+
_html.push("<tr>");
|
1239
|
+
_html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/zlsj/detail/" + date_format + "-1-" + code + ".html", date_format), "</td>");
|
1240
|
+
_html.push("<td>", item["price"], "</td>");
|
1241
|
+
_html.push("<td data-val='", item["stock_num"], "' title='", item["stock_num"], "'>", Util.to_unit(item["stock_num"], 3), "股</td>");
|
1242
|
+
_html.push("<td>", item["fund_num"], "</td>");
|
1243
|
+
let market_capital = item["price"] * item["stock_num"];
|
1244
|
+
_html.push("<td data-val='", market_capital, "' title='", market_capital, "'>", Util.to_unit(market_capital, 4), "</td>");
|
1245
|
+
_html.push("</tr>");
|
1246
|
+
});
|
1247
|
+
date_data = date_data.reverse();
|
1248
|
+
fund_num_data = fund_num_data.reverse();
|
1249
|
+
stock_num_data = stock_num_data.reverse();
|
1250
|
+
price_data = price_data.reverse();
|
1251
|
+
Util["pfc_stock_chart"] = Util.multi_axis_line(Util["pfc_stock_chart"], "pfc_stock_line_canvas", date_data, '总持股数', stock_num_data, '股价', price_data);
|
1252
|
+
Util["pfc_fund_chart"] = Util.multi_axis_line(Util["pfc_fund_chart"], "pfc_fund_line_canvas", date_data, '持仓家数', fund_num_data, '股价', price_data);
|
1253
|
+
if (j["data"].length > 1) {
|
1254
|
+
let cur_stock_num = j["data"][0]["stock_num"];
|
1255
|
+
let pre_stock_num = j["data"][1]["stock_num"];
|
1256
|
+
if (cur_stock_num > 0 && pre_stock_num > 0) {
|
1257
|
+
$("#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) + ")");
|
1258
|
+
}
|
1259
|
+
let cur_fund_num = j["data"][0]["fund_num"];
|
1260
|
+
let pre_fund_num = j["data"][1]["fund_num"];
|
1261
|
+
if (cur_fund_num > 0 && pre_fund_num > 0) {
|
1262
|
+
$("#pfc_fund_tips").html("(当前基金数: <b class='text-info'>" + cur_fund_num + "</b>, 环比: " + Util.year_price_rate(cur_fund_num, pre_fund_num) + ")");
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
Util.render_table_html("pfc_fund_table_body", _html);
|
1266
|
+
Util.hide_tips();
|
1267
|
+
});
|
1268
|
+
},
|
1269
|
+
|
1167
1270
|
/**
|
1168
1271
|
* 初始分类股票的显示表格
|
1169
1272
|
* @param portfolio
|