sbd-npm 1.3.90 → 1.3.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +23 -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.91",
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,16 @@ 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
+ let prefix = code.substr(0, 1);
728
+ return prefix === "4" || prefix === "8";
729
+ },
730
+
709
731
  /**
710
732
  * 是否A股股票
711
733
  * @param code