@dshtrading/connector-okx 0.1.5 → 0.2.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/lib/index.d.ts CHANGED
@@ -108,6 +108,15 @@ declare class OkxTradeService extends Service implements TradeService {
108
108
  private readonly instruments;
109
109
  constructor(ctx: Context, options: OkxTradeServiceOptions, serviceName?: string);
110
110
  private get simulated();
111
+ /**
112
+ * 运行环境自述(issue #86 / G1):host 平面只读账户工具(base/market-tools)
113
+ * 鸭式读取本方法,把 demo/live 安全信号带进工具输出。api TradeService 契约
114
+ * 不声明它——可选扩展,缺席即省略该字段。
115
+ */
116
+ environment(): {
117
+ env: string;
118
+ simulated: boolean;
119
+ };
111
120
  private auth;
112
121
  /** 规格(带 TTL 缓存;demo/live 分桶)。查不到 → TRADING_UNSUPPORTED_SYMBOL。 */
113
122
  private getInstrument;
package/lib/index.js CHANGED
@@ -206,6 +206,17 @@ var OkxTradeService = class extends Service {
206
206
  get simulated() {
207
207
  return this.config.env === "demo";
208
208
  }
209
+ /**
210
+ * 运行环境自述(issue #86 / G1):host 平面只读账户工具(base/market-tools)
211
+ * 鸭式读取本方法,把 demo/live 安全信号带进工具输出。api TradeService 契约
212
+ * 不声明它——可选扩展,缺席即省略该字段。
213
+ */
214
+ environment() {
215
+ return {
216
+ env: String(this.config.env),
217
+ simulated: this.simulated
218
+ };
219
+ }
209
220
  auth(credentials) {
210
221
  return {
211
222
  credentials,
@@ -642,12 +653,17 @@ function createPlaceOrderTool(deps) {
642
653
  /**
643
654
  * 互斥激活的注册面:dsh-tools 对同名重复注册直接抛错(会炸 boot/preset 挂载),
644
655
  * 而互斥纪律下「同时至多一个连接器激活」只是配置约定。这里把冲突降级为
645
- * 「先到先得 + log」:已被占用(binance 或 kit-crypto 先注册)的名字跳过。
656
+ * 「先到先得 + log」:已被占用的名字跳过。
657
+ *
658
+ * 占用方有两类(2026-09-08 审查 P2-3 修正文案,此前一律说成「另一 provider 互斥」):
659
+ * 1. host 平面能力包工具(如 @dshtrading/base/market-tools 的 <market>_get_positions
660
+ * 等只读账户工具,boot 时先注册)——这类跳过是**预期**的,连接器版本不再生效;
661
+ * 2. 同市场另一连接器/kit 先注册(真正的互斥冲突,需要用户检查配置)。
646
662
  */
647
663
  function registerTool(ctx, tool, log) {
648
664
  const tools = ctx.tools;
649
665
  if (tools.get(tool.name) !== void 0) {
650
- log.warn("[dsh-trading-crypto-connector-okx] tool %s already registered by another provider — skipped (mutual exclusion: at most one crypto connector/toolset may be active)", tool.name);
666
+ log.warn("[dsh-trading-crypto-connector-okx] tool %s already registered — skipped. If this name belongs to the host-plane @dshtrading/base/market-tools read-only family (crypto_get_positions/_get_balance/_get_order) this is expected and the host version serves the tool; otherwise another crypto connector/toolset registered it first (mutual exclusion) — check dshtrading.markets.crypto.provider.", tool.name);
651
667
  return;
652
668
  }
653
669
  tools.register(tool);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dshtrading/connector-okx",
3
3
  "description": "OKX market connector plugin for dsh-trading: public market data + signed demo/live trading (R1-R3), mutual-exclusion activation with connector-binance",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  ],
22
22
  "license": "PolyForm-Noncommercial-1.0.0",
23
23
  "dependencies": {
24
- "@dshtrading/api": "^0.1.5",
25
- "@dshtrading/indicators": "^0.1.5"
24
+ "@dshtrading/api": "^0.2.0",
25
+ "@dshtrading/indicators": "^0.2.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@deepseek-ai/cordis": ">=4.0.0",
@@ -32,7 +32,7 @@
32
32
  "devDependencies": {
33
33
  "tsdown": "^0.22.0",
34
34
  "vitest": "^3.0.0",
35
- "@dshtrading/connector-binance": "^0.1.5"
35
+ "@dshtrading/connector-binance": "^0.2.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsdown",