sbd-npm 1.3.90 → 1.3.92

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 +22 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.90",
3
+ "version": "1.3.92",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -652,7 +652,19 @@ const Util = {
652
652
  * @returns {string}
653
653
  */
654
654
  code_to_market: function (code) {
655
- return Util.is_us(code) ? "US" : (Util.is_hk(code) ? "HK" : (Util.is_sh(code) ? "SH" : "SZ"));
655
+ if (Util.is_us(code)) {
656
+ return "US";
657
+ }
658
+ if (Util.is_hk(code)) {
659
+ return "HK";
660
+ }
661
+ if (Util.is_sh(code)) {
662
+ return "SH";
663
+ }
664
+ if (Util.is_bse(code)) {
665
+ return "BJ";
666
+ }
667
+ return "SZ";
656
668
  },
657
669
 
658
670
  /**
@@ -706,6 +718,15 @@ const Util = {
706
718
  return prefix === "6";
707
719
  },
708
720
 
721
+ /**
722
+ * 是否北交所股票
723
+ * @param code
724
+ * @returns {boolean}
725
+ */
726
+ is_bse: function (code) {
727
+ return ["4", "8"].includes(code.charAt(0));
728
+ },
729
+
709
730
  /**
710
731
  * 是否A股股票
711
732
  * @param code