@dshtrading/connector-eastmoney 0.1.4 → 0.1.5
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/lib/rest.js +9 -2
- package/package.json +2 -2
package/lib/rest.js
CHANGED
|
@@ -54,6 +54,13 @@ function parseScaledHundred(value) {
|
|
|
54
54
|
return Number.isNaN(parsed) ? void 0 : parsed / 100;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
const KNOWN_SH_INDICES = /* @__PURE__ */ new Set([
|
|
58
|
+
"000688",
|
|
59
|
+
"000300",
|
|
60
|
+
"000016",
|
|
61
|
+
"000905",
|
|
62
|
+
"000852"
|
|
63
|
+
]);
|
|
57
64
|
/**
|
|
58
65
|
* 将标准代码(如 600519.SH / 000001.SZ / 600519 / 000001)转为东财 secid。
|
|
59
66
|
* 上海(60/68/51等)= 1.xxxxxx
|
|
@@ -70,12 +77,12 @@ function toEastmoneySecid(symbol) {
|
|
|
70
77
|
market = parts[1];
|
|
71
78
|
} else if (/^\d{6}$/.test(clean)) {
|
|
72
79
|
code = clean;
|
|
73
|
-
if (code.startsWith("6") || code.startsWith("5") || code.startsWith("9")) market = "SH";
|
|
80
|
+
if (KNOWN_SH_INDICES.has(code) || code.startsWith("6") || code.startsWith("5") || code.startsWith("9")) market = "SH";
|
|
74
81
|
else if (code.startsWith("0") || code.startsWith("3") || code.startsWith("1")) market = "SZ";
|
|
75
82
|
else if (code.startsWith("8") || code.startsWith("4") || code.startsWith("92")) market = "BJ";
|
|
76
83
|
}
|
|
77
84
|
if (!market) {
|
|
78
|
-
if (code.startsWith("6") || code.startsWith("5")) market = "SH";
|
|
85
|
+
if (KNOWN_SH_INDICES.has(code) || code.startsWith("6") || code.startsWith("5")) market = "SH";
|
|
79
86
|
else market = "SZ";
|
|
80
87
|
}
|
|
81
88
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dshtrading/connector-eastmoney",
|
|
3
3
|
"description": "【模板】交易所连接器插件脚手架:Eastmoney(eastmoney)v2 插件骨架 —— 市场数据服务 + 交易服务 + 三态闸门 + BYOK 凭证 ref。生成器:node scripts/new-connector.mjs --slug <exchange>",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dshtrading/api": "^0.1.
|
|
24
|
+
"@dshtrading/api": "^0.1.5"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@deepseek-ai/cordis": ">=4.0.0",
|