sbd-npm 1.3.10 → 1.3.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/stock_basics.js CHANGED
@@ -910,7 +910,8 @@ let Stock = {
910
910
  let _html = [];
911
911
  _html.push('<select id="public_fund_date">');
912
912
  j["data"].forEach(function (item) {
913
- _html.push('<option value="', item["date"], '">', item["date"], '</option>');
913
+ let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
914
+ _html.push('<option value="', date_format, '">', date_format, '(', item["num"], ')</option>');
914
915
  });
915
916
  _html.push('</select>');
916
917
  $("#public_fund_date_zone").html(_html.join(""));
@@ -1121,9 +1122,10 @@ let Stock = {
1121
1122
  rzye_high = Math.max(rzye_high, item["rzye"]);
1122
1123
  date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
1123
1124
  rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
1124
- rqye_data.push(Util.to_float(item["rqye"] / 10000, 2));
1125
+ rqye_data.push(Util.to_float(item["rqye"], 2));
1125
1126
  price_data.push(item["price"]);
1126
1127
  });
1128
+ $("#margin_title").html(Util.pack_html_link(j["url"], "[" + Stock.name + "]融资余额"));
1127
1129
  let margin_summary = "";
1128
1130
  if (j["latest"].length > 0) {
1129
1131
  if (j["latest"].length === 1) {
@@ -1141,7 +1143,7 @@ let Stock = {
1141
1143
  margin_summary = " 最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + Util.to_unit(d1["rzye"], 3) + dist_tips;
1142
1144
  }
1143
1145
  }
1144
- margin_summary = Util.pack_html_link(j["url"], "[" + Stock.name + "]融资余额(单位:亿)") + margin_summary + ' 最高: ' + Util.to_unit(rzye_high, 3) + ' 最低: ' + Util.to_unit(rzye_low, 3);
1146
+ margin_summary = margin_summary + ' 最高: ' + Util.to_unit(rzye_high, 3) + ' 最低: ' + Util.to_unit(rzye_low, 3);
1145
1147
  if (j["high"] && j["high"]["date"] && j["high"]["date"] > 0) {
1146
1148
  margin_summary += ' 历史最高: ' + Util.to_unit(j["high"]["rzye"], 3) + '(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") + ')';
1147
1149
  }
@@ -1149,7 +1151,7 @@ let Stock = {
1149
1151
  margin_summary += ' 历史最低: ' + Util.to_unit(j["low"]["rzye"], 3) + '(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1150
1152
  }
1151
1153
  $("#margin_summary").html(margin_summary);
1152
- Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额', rzye_data, '股价', price_data);
1154
+ Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
1153
1155
  let flow_data = [], color_data = [];
1154
1156
  date_data = [];
1155
1157
  j["flow_data"].forEach(function (item) {
package/util.js CHANGED
@@ -632,13 +632,22 @@ const Util = {
632
632
  return prefix === "6";
633
633
  },
634
634
 
635
+ /**
636
+ * 是否A股股票
637
+ * @param code
638
+ * @returns {boolean}
639
+ */
640
+ is_cn: function (code) {
641
+ return /^\d{6}$/.test(code);
642
+ },
643
+
635
644
  /**
636
645
  * 是否港股
637
646
  * @param code
638
647
  * @returns {boolean}
639
648
  */
640
649
  is_hk: function (code) {
641
- return code.length === 5;
650
+ return /^\d{5}$/.test(code);
642
651
  },
643
652
 
644
653
  /**