@dshtrading/connector-qmt 0.4.1 → 0.6.0
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/README.md +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +9 -4
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
node scripts/new-connector.mjs --slug bybit --title Bybit --market crypto
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
生成后按 [docs/connector-playbook.md](../../docs/connector-playbook.md) 的填写顺序
|
|
10
|
+
生成后按 [docs/guides/connector-playbook.md](../../docs/guides/connector-playbook.md) 的填写顺序
|
|
11
11
|
(src/rest.ts 头部清单 7 项)实现 TODO。每个 TODO 的参照段都在 connector-okx
|
|
12
12
|
(packages/connector-okx/),它是本仓第一个真实 TradeService 连接器。
|
|
13
13
|
|
package/lib/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare class QmtMarketDataService extends Service implements MarketDataService
|
|
|
26
26
|
}
|
|
27
27
|
declare class QmtTradeService extends Service implements TradeService {
|
|
28
28
|
private readonly client;
|
|
29
|
-
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading
|
|
29
|
+
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 非权威镜像——实盘授权由 @dshtrading/authority 的人工签署平面裁定)。 */
|
|
30
30
|
private readonly config;
|
|
31
31
|
constructor(ctx: Context, options: QmtRestOptions & {
|
|
32
32
|
config: Config;
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { INTERVAL_VOCABULARY, QmtRestClient, TradingServiceError, toQmtCode as toQmtCode$1 } from "./rest.js";
|
|
2
|
+
import { liveTradingEnabled } from "@dshtrading/authority";
|
|
2
3
|
import { Service } from "@deepseek-ai/cordis";
|
|
3
4
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
4
5
|
import Schema from "@deepseek-ai/schemastery";
|
|
5
6
|
//#region src/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* @dshtrading/connector-qmt
|
|
9
|
+
* 迅投 MiniQMT A 股券商实盘交易连接器插件。
|
|
10
|
+
*/
|
|
6
11
|
const name = "dsh-trading-cn-connector-qmt";
|
|
7
12
|
const Config = Schema.object({
|
|
8
13
|
enabled: Schema.boolean().default(true).description("是否激活 QMT 连接器"),
|
|
@@ -38,7 +43,7 @@ var QmtMarketDataService = class extends Service {
|
|
|
38
43
|
};
|
|
39
44
|
var QmtTradeService = class extends Service {
|
|
40
45
|
client;
|
|
41
|
-
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading
|
|
46
|
+
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 非权威镜像——实盘授权由 @dshtrading/authority 的人工签署平面裁定)。 */
|
|
42
47
|
config;
|
|
43
48
|
constructor(ctx, options, serviceName = TRADING_CN_TRADE_KEY) {
|
|
44
49
|
super(ctx, serviceName);
|
|
@@ -50,7 +55,7 @@ var QmtTradeService = class extends Service {
|
|
|
50
55
|
}
|
|
51
56
|
async placeOrder(order) {
|
|
52
57
|
const requestedDryRun = order.dryRun ?? true;
|
|
53
|
-
if (!requestedDryRun && !this.config.liveTrading) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", `QMT TradeService.placeOrder rejected: the request asks for real execution (dryRun=${String(order.dryRun)}) but
|
|
58
|
+
if (!requestedDryRun && !liveTradingEnabled(this.config.liveTrading)) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", `QMT TradeService.placeOrder rejected: the request asks for real execution (dryRun=${String(order.dryRun)}) but the signed live-trading authority does not grant real execution (see @dshtrading/authority) — keep dryRun=true for a simulated fill.`);
|
|
54
59
|
if (requestedDryRun || this.config.dryRun) return {
|
|
55
60
|
id: `dry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
56
61
|
symbol: order.symbol,
|
|
@@ -65,7 +70,7 @@ var QmtTradeService = class extends Service {
|
|
|
65
70
|
return this.client.placeOrder(void 0, order);
|
|
66
71
|
}
|
|
67
72
|
async cancelOrder(orderId, _symbol) {
|
|
68
|
-
if (!this.config.liveTrading || this.config.dryRun) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", "QMT TradeService.cancelOrder rejected at the service seam: cancel is a live action and requires
|
|
73
|
+
if (!liveTradingEnabled(this.config.liveTrading) || this.config.dryRun) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", "QMT TradeService.cancelOrder rejected at the service seam: cancel is a live action and requires a signed live-trading grant (see @dshtrading/authority) with dryRun=false.");
|
|
69
74
|
return this.client.cancelOrder(void 0, orderId);
|
|
70
75
|
}
|
|
71
76
|
async getPositions() {
|
|
@@ -236,7 +241,7 @@ function apply(ctx, config) {
|
|
|
236
241
|
timestamp: Date.now()
|
|
237
242
|
});
|
|
238
243
|
}
|
|
239
|
-
if (!config.liveTrading) return JSON.stringify({
|
|
244
|
+
if (!liveTradingEnabled(config.liveTrading)) return JSON.stringify({
|
|
240
245
|
status: "rejected",
|
|
241
246
|
code: "TRADING_LIVE_TRADING_DISABLED",
|
|
242
247
|
message: "Live trading is disabled on QMT plugin."
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dshtrading/connector-qmt",
|
|
3
3
|
"description": "【模板】交易所连接器插件脚手架:QMT(qmt)v2 插件骨架 —— 市场数据服务 + 交易服务 + 三态闸门 + BYOK 凭证 ref。生成器:node scripts/new-connector.mjs --slug <exchange>",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dshtrading/
|
|
24
|
+
"@dshtrading/authority": "^0.6.0",
|
|
25
|
+
"@dshtrading/api": "^0.6.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"@deepseek-ai/cordis": ">=4.0.0",
|
|
28
|
-
"@deepseek-ai/dsh-tools": ">=0.
|
|
29
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2",
|
|
29
30
|
"@deepseek-ai/schemastery": ">=3.18.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|