sbd-npm 1.2.80 → 1.2.82

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 (3) hide show
  1. package/constant.js +3 -3
  2. package/package.json +1 -1
  3. package/util.js +98 -7
package/constant.js CHANGED
@@ -7,12 +7,12 @@ const MenuList = [
7
7
  {'key': 'summary_week', 'name': '每周概要', 'url': '/041dd556cd72d41ce3c6fd2a50340cd6'},
8
8
  {'key': 'summary_breadth', 'name': '市场宽度', 'url': '/6263b0820aa0c1b0b27e10e855b8ea1b'},
9
9
  {'key': 'summary_industry', 'name': '板块涨跌', 'url': '/ce5c0a4d19ebf14830d0a05cdf7c0eb9'},
10
+ {'key': 'summary_momentum', 'name': '板块动量', 'url': '/6bde52a3162b3973ed96f52ef0a57d0e'},
10
11
  {'key': 'summary_dashboard', 'name': '市场全景', 'url': '/dffbe86a3353af37e3471cc6a72266e9'},
11
12
  {'key': 'summary_market', 'name': '市场概要', 'url': '/1251bb015654040ba8dc38b563817586'},
12
13
  {'key': 'summary_etf', 'name': 'ETF分析', 'url': '/5e7eb433adbda09db931b9a4a3371fd5'},
13
14
  {'key': 'summary_repurchase', 'name': '闲钱流向', 'url': '/8d810d466cca69c6a91afb7fd468df93'},
14
15
  {'key': 'summary_margin_lever', 'name': '融资杠杠率', 'url': '/c0e5faf52d3f6a8a0a85100957420be0'},
15
- {'key': 'summary_momentum', 'name': '板块动量', 'url': '/6bde52a3162b3973ed96f52ef0a57d0e'},
16
16
  {'key': 'summary_index', 'name': '指数', 'url': '/60fbd3c53b23705212efb6bf010ed957'},
17
17
  ]
18
18
  },
@@ -26,7 +26,7 @@ const MenuList = [
26
26
  {'key': 'daily_volume', 'name': '成交量(大量)', 'url': '/5f3f29dc703951cd66f5c6320fa369ae'},
27
27
  {'key': 'daily_gap', 'name': '缺口', 'url': '/d058569e38097c2e55539d181a135552'},
28
28
  {'key': 'daily_turnover', 'name': '换手率', 'url': '/15a76715b18475790992305b45d2bba2'},
29
- {'key': 'daily_amount', 'name': '成交金额', 'url': '/a6f1471ed69d2c03785d1ad889dfb041'},
29
+ {'key': 'daily_amount', 'name': '成交额', 'url': '/a6f1471ed69d2c03785d1ad889dfb041'},
30
30
  {'key': 'daily_buy_sell', 'name': '买入卖出', 'url': '/2636399252f1170c41ec73d872252995'},
31
31
  {'key': 'daily_big_deal', 'name': '大单交易', 'url': '/3ece809352ebd8c55c859dda0e7cafe0'},
32
32
  {'key': 'daily_block', 'name': '大宗交易', 'url': '/3eec763b6402d5327a2f1d8964f78c93'},
@@ -138,9 +138,9 @@ const MenuList = [
138
138
  {'key': 'concept_vegetable', 'name': 'Veget', 'url': '/b1769a58f0f3d4a92bad61c97a2232f0'},
139
139
  {'key': 'concept_zan', 'name': 'zangyn', 'url': '/860a3a9647efad436894b4aa3843da42'},
140
140
  {'key': 'concept_peng', 'name': '吴小朋同学', 'url': '/8aa7536ca01724a5d2b580b22dea15de'},
141
+ {'key': 'concept_xiong', 'name': '王朝雄', 'url': '/f1d1315e5ce6b25c7e220e4d6ed9c06e'},
141
142
  {'key': 'concept_penny', 'name': '梁斌penny', 'url': '/8c1660155f89650a471edf54414cac49'},
142
143
  {'key': 'concept_wen', 'name': '崇文不尚武', 'url': '/b6fd64a2c54250b8ac039123e74e9b7e'},
143
- {'key': 'concept_dao', 'name': '成长股事(大道)', 'url': '/7b7ea877f6793752e2b981d82da81e1b'},
144
144
  {'key': 'concept_patience', 'name': '耐力投资', 'url': '/d3e193cf9cdba853133c046ca3406867'},
145
145
  {'key': 'concept_bellwether', 'name': '龙头股', 'url': '/2995afdea420471e00c536182e711bef'},
146
146
  {'key': 'concept_market_situation', 'name': '市值风云', 'url': '/02fdaf4d66cdecb092bcd65f569aa493'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.80",
3
+ "version": "1.2.82",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -961,7 +961,7 @@ const Util = {
961
961
  {"name": "52周最高", "table_sort": 1}
962
962
  ];
963
963
  if (stock_category !== "us") {
964
- head_cols.push({"name": "成交金额", "table_sort": 1});
964
+ head_cols.push({"name": "成交额", "table_sort": 1});
965
965
  head_cols.push({"name": "成交均价", "table_sort": 1});
966
966
  head_cols.push({"name": "股东数", "table_sort": 1});
967
967
  head_cols.push({"name": "基金数", "table_sort": 1});
@@ -1189,7 +1189,7 @@ const Util = {
1189
1189
  },
1190
1190
 
1191
1191
  /**
1192
- * 货币汇率
1192
+ * 初始货币汇率组件
1193
1193
  * @param component_id
1194
1194
  */
1195
1195
  init_currency_modal_component: function (component_id) {
@@ -1208,24 +1208,27 @@ const Util = {
1208
1208
  component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1209
1209
  let obj = e.relatedTarget;
1210
1210
  let currency = $(obj).attr("data-code");
1211
- $("#" + component_id + "_body_body").html("<tr><td colspan='4'>Loading...</td></tr>");
1211
+ Util.set_table_loading(component_id + "_body_body");
1212
1212
  if ($("#currency_modal_start_date").length <= 0) {
1213
1213
  Util.init_range_date("currency_modal_start_end_date", Util, "render_currency_modal", 60);
1214
1214
  }
1215
- let t_obj = $("#currency_modal_title");
1216
- t_obj.html(currency);
1217
- t_obj.attr("data-code", currency);
1215
+ let title_obj = $("#currency_modal_title");
1216
+ title_obj.html(currency);
1217
+ title_obj.attr("data-code", currency);
1218
1218
  $("#" + component_id + "_query").click(function () {
1219
1219
  Util.render_currency_modal();
1220
1220
  });
1221
1221
  Util.render_currency_modal();
1222
1222
  });
1223
1223
  component_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
1224
- $("#" + component_id + "_body_body").html("<tr><td colspan='4'>Loading...</td></tr>");
1224
+ Util.set_table_loading(component_id + "_body_body");
1225
1225
  Util.hide_tips();
1226
1226
  });
1227
1227
  },
1228
1228
 
1229
+ /**
1230
+ * 渲染货币汇率数据
1231
+ */
1229
1232
  render_currency_modal: function () {
1230
1233
  let currency = $("#currency_modal_title").attr("data-code");
1231
1234
  if (!currency) {
@@ -1274,6 +1277,94 @@ const Util = {
1274
1277
  });
1275
1278
  },
1276
1279
 
1280
+ /**
1281
+ * 初始加密数字货币组件
1282
+ * @param component_id
1283
+ */
1284
+ init_btc_modal_component: function(component_id) {
1285
+ Util.init_modal_skeleton(component_id);
1286
+ Util.init_table_skeleton({
1287
+ "element_id": component_id + "_body",
1288
+ "caption": '<caption class="text-right"><div class="form-inline"><div class="form-group" id="' + component_id + '_start_end_date"></div><button class="btn btn-default" id="' + component_id + '_query">查 询</button></div></caption>',
1289
+ "head_cols": [
1290
+ {"name": "日期", "table_sort": 1},
1291
+ {"name": "开盘价", "table_sort": 1},
1292
+ {"name": "收盘价", "table_sort": 1},
1293
+ {"name": "最低价", "table_sort": 1},
1294
+ {"name": "最高价", "table_sort": 1},
1295
+ {"name": "成交额", "table_sort": 1},
1296
+ {"name": "总市值", "table_sort": 1},
1297
+ ]
1298
+ });
1299
+ let component_obj = $('#' + component_id);
1300
+ component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1301
+ let obj = e.relatedTarget;
1302
+ let coin = $(obj).attr("data-coin");
1303
+ Util.set_table_loading(component_id + "_body_body");
1304
+ if ($("#" + component_id + "_start_date").length <= 0) {
1305
+ Util.init_range_date(component_id + "_start_end_date", Util, "render_btc_modal", 60);
1306
+ }
1307
+ let title_obj = $("#" + component_id + "_title");
1308
+ title_obj.html(coin);
1309
+ title_obj.attr("data-coin", coin);
1310
+ $("#" + component_id + "_query").click(function () {
1311
+ Util.render_btc_modal();
1312
+ });
1313
+ Util.render_btc_modal();
1314
+ });
1315
+ component_obj.on('hidden.bs.modal', function () { // 此事件在模态框被隐藏(并且同时在 CSS 过渡效果完成)之后被触发
1316
+ Util.set_table_loading(component_id + "_body_body");
1317
+ Util.hide_tips();
1318
+ });
1319
+ },
1320
+
1321
+ /**
1322
+ * 渲染加密数字货币数据
1323
+ */
1324
+ render_btc_modal: function() {
1325
+ let coin = $("#btc_modal_title").attr("data-coin");
1326
+ if (!coin) {
1327
+ $("#btc_modal_title").html(coin);
1328
+ return false;
1329
+ }
1330
+ Util.show_loading();
1331
+ let payload = {coin: coin, start_date: $("#btc_modal_start_date").val(), end_date: $("#btc_modal_end_date").val(), action: "btc_data", "currency_type": $("#currency_type").val()};
1332
+ Util.post(location.pathname, payload, function (j) {
1333
+ let _html = [], low_price = 0, high_price = 0;
1334
+ j["data"].forEach(function (item) {
1335
+ if (low_price === 0 || item["price"] < low_price) {
1336
+ low_price = item["price"];
1337
+ }
1338
+ high_price = Math.max(high_price, item["price"]);
1339
+ });
1340
+ j["data"].forEach(function (item) {
1341
+ if (item["price"] === high_price) {
1342
+ _html.push("<tr class='danger'>");
1343
+ } else if (item["price"] === low_price) {
1344
+ _html.push("<tr class='success'>");
1345
+ } else {
1346
+ _html.push("<tr>");
1347
+ }
1348
+ _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1349
+ _html.push("<td>", item["open"], "</td>");
1350
+ _html.push("<td>", item["price"], "</td>");
1351
+ _html.push("<td>", item["low"], "</td>");
1352
+ _html.push("<td>", item["high"], "</td>");
1353
+ _html.push("<td>", Util.to_unit(item["amount"]), "</td>");
1354
+ _html.push("<td>", Util.to_unit(item["market_capital"]), "</td>");
1355
+ _html.push("</tr>");
1356
+ });
1357
+ Util.render_table_html("btc_modal_body_body", _html);
1358
+ let btc_title = j["cn_name"] + "(" + Util.pack_html_link('https://www.binance.com/zh-CN/trade/' + j["short_name"] + '_USDT?theme=dark', j["short_name"]) + ", " + Util.pack_html_link("https://www.feixiaohaozh.info/currencies/" + j["coin"], j["coin"]) + ")";
1359
+ btc_title += "&nbsp;&nbsp;<small>历史最低:<span class='label label-success'>" + j["hist_low"] + "</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
1360
+ "</span> 年初至今:" + Util.digit_compare_trend1(j["price"], j["year_price"]) +
1361
+ " 52周最高:" + Util.digit_compare_trend1(j["price"], j["week52high"]) +
1362
+ " 52周最低:" + Util.digit_compare_trend1(j["price"], j["week52low"]) + "</small>";
1363
+ $("#btc_modal_title").html(btc_title);
1364
+ Util.hide_tips();
1365
+ });
1366
+ },
1367
+
1277
1368
  /**
1278
1369
  * 沪深港股通成交股统计
1279
1370
  * @param component_id