sbd-npm 1.3.67 → 1.3.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +34 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.67",
3
+ "version": "1.3.68",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -1224,23 +1224,38 @@ const Util = {
1224
1224
  */
1225
1225
  fetch_public_fund_change: function (code) {
1226
1226
  Util["pfc_stock_chart"] = Util.show_chart_loading(Util["pfc_stock_chart"], "pfc_stock_line_canvas");
1227
- Util.init_table_skeleton({
1228
- "element_id": "pfc_fund_table",
1229
- "head_cols": [
1230
- {"name": "季度时间", "class": "info", "table_sort": 1},
1231
- {"name": "当时股价", "table_sort": 1, "title": "当季最后一个交易日的收盘价"},
1232
- {"name": "持股总数", "table_sort": 1},
1233
- {"name": "持仓家数", "table_sort": 1},
1234
- {"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 总持股数"},
1235
- ]
1236
- });
1227
+ if ($("#pfc_fund_table_body").length === 0) {
1228
+ Util.init_table_skeleton({
1229
+ "element_id": "pfc_fund_table",
1230
+ "head_cols": [
1231
+ {"name": "季度时间", "class": "info", "table_sort": 1},
1232
+ {"name": "当时股价", "table_sort": 1, "title": "当季最后一个交易日的收盘价"},
1233
+ {"name": "持股总数", "table_sort": 1},
1234
+ {"name": "持仓基金数", "table_sort": 1},
1235
+ {"name": "持股进前10的基金数", "table_sort": 1, "title": "基金数以持股数占比进前10内的股票来统计"},
1236
+ {"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 持股总数"},
1237
+ ]
1238
+ });
1239
+ if ($("#is_fund10_num").length > 0) {
1240
+ $("#is_fund10_num").click(function() {
1241
+ Util.fetch_public_fund_change(code);
1242
+ });
1243
+ }
1244
+ }
1237
1245
  Util.post("/stock/" + code, {action: "public_fund_change"}, function (j) {
1238
1246
  Util["pfc_stock_chart"].hideLoading();
1239
- let date_data = [], fund_num_data = [], stock_num_data = [], price_data = [], _html = [];
1247
+ let date_data = [], fund_num_data = [], stock_num_data = [], price_data = [], _html = [], is_fund10_num = 0;
1248
+ if ($("#is_fund10_num").length > 0) {
1249
+ is_fund10_num = $("#is_fund10_num").prop("checked") ? 1 : 0;
1250
+ }
1240
1251
  j["data"].forEach(function (item) {
1241
1252
  let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
1242
1253
  date_data.push(date_format);
1243
- fund_num_data.push(item["fund_num"]);
1254
+ if (is_fund10_num === 1) {
1255
+ fund_num_data.push(item["fund_rank_num"]);
1256
+ } else {
1257
+ fund_num_data.push(item["fund_num"]);
1258
+ }
1244
1259
  stock_num_data.push(item["stock_num"]);
1245
1260
  price_data.push(item["price"]);
1246
1261
  _html.push("<tr>");
@@ -1259,9 +1274,13 @@ const Util = {
1259
1274
  if (item["pre_fund_num"]) {
1260
1275
  fund_num_rate = "(" + Util.year_price_rate(item["fund_num"], item["pre_fund_num"], 1) + ")";
1261
1276
  }
1262
- _html.push("<td>", item["fund_num"], fund_num_rate, "</td>");
1263
- let market_capital = item["price"] * item["stock_num"];
1264
- _html.push("<td data-val='", market_capital, "' title='", market_capital, "'>", Util.to_unit(market_capital, 4), "</td>");
1277
+ _html.push("<td data-val='", item["fund_num"], "'>", item["fund_num"], fund_num_rate, "</td>");
1278
+ let fund_rank_num_rate = "";
1279
+ if (item["pre_fund_rank_num"]) {
1280
+ fund_rank_num_rate = "(" + Util.year_price_rate(item["fund_rank_num"], item["pre_fund_rank_num"], 1) + ")";
1281
+ }
1282
+ _html.push("<td data-val='", item["fund_rank_num"], "'>", item["fund_rank_num"], fund_rank_num_rate, "</td>");
1283
+ _html.push("<td data-val='", item["hold_value"], "' title='", item["hold_value"], "'>", Util.to_unit(item["hold_value"], 3), "</td>");
1265
1284
  _html.push("</tr>");
1266
1285
  });
1267
1286
  date_data = date_data.reverse();