@dshtrading/connector-tushare 0.5.0 → 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 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 TushareMarketDataService extends Service implements MarketDataServ
26
26
  }
27
27
  declare class TushareTradeService 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: TushareRestOptions & {
32
32
  config: Config;
package/lib/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  import { INTERVAL_VOCABULARY, TradingServiceError, TushareRestClient, parseIntervalMs, toTushareCode } 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-tushare
9
+ * Tushare Pro A 股量化连接器插件(提供 tradingCnMarketData 与 cn_* 分析工具)。
10
+ */
6
11
  const name = "dsh-trading-cn-connector-tushare";
7
12
  const Config = Schema.object({
8
13
  enabled: Schema.boolean().default(true).description("是否激活 Tushare 连接器"),
@@ -40,7 +45,7 @@ var TushareMarketDataService = class extends Service {
40
45
  };
41
46
  var TushareTradeService = class extends Service {
42
47
  client;
43
- /** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 总闸门)。 */
48
+ /** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 非权威镜像——实盘授权由 @dshtrading/authority 的人工签署平面裁定)。 */
44
49
  config;
45
50
  constructor(ctx, options, serviceName = TRADING_CN_TRADE_KEY) {
46
51
  super(ctx, serviceName);
@@ -52,7 +57,7 @@ var TushareTradeService = class extends Service {
52
57
  }
53
58
  async placeOrder(order) {
54
59
  const requestedDryRun = order.dryRun ?? true;
55
- if (!requestedDryRun && !this.config.liveTrading) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", `Tushare TradeService.placeOrder rejected: the request asks for real execution (dryRun=${String(order.dryRun)}) but liveTrading=false — enable liveTrading explicitly or keep dryRun=true for a simulated fill.`);
60
+ if (!requestedDryRun && !liveTradingEnabled(this.config.liveTrading)) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", `Tushare 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.`);
56
61
  if (requestedDryRun || this.config.dryRun) return {
57
62
  id: `dry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
58
63
  symbol: order.symbol,
@@ -67,7 +72,7 @@ var TushareTradeService = class extends Service {
67
72
  return this.client.placeOrder(void 0, order);
68
73
  }
69
74
  async cancelOrder(orderId) {
70
- if (!this.config.liveTrading || this.config.dryRun) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", "Tushare TradeService.cancelOrder rejected at the service seam: cancel is a live action and requires liveTrading=true with dryRun=false.");
75
+ if (!liveTradingEnabled(this.config.liveTrading) || this.config.dryRun) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", "Tushare 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.");
71
76
  return this.client.cancelOrder(void 0, orderId);
72
77
  }
73
78
  async getPositions() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dshtrading/connector-tushare",
3
3
  "description": "【模板】交易所连接器插件脚手架:Tushare(tushare)v2 插件骨架 —— 市场数据服务 + 交易服务 + 三态闸门 + BYOK 凭证 ref。生成器:node scripts/new-connector.mjs --slug <exchange>",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -21,7 +21,8 @@
21
21
  ],
22
22
  "license": "PolyForm-Noncommercial-1.0.0",
23
23
  "dependencies": {
24
- "@dshtrading/api": "^0.5.0"
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",