@dshtrading/kit-crypto 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.
@@ -5,7 +5,7 @@ description: 加密标的定性分析框架:趋势结构→量价→波动率
5
5
 
6
6
  # 加密标的定性分析框架(crypto-instrument-analysis)
7
7
 
8
- 对单个加密标的做定性分析时按本框架五步推进。原则:**每一步的数据必须来自工具调用并标注时间**,禁止凭记忆报数;结论必须附反方情景。
8
+ 对单个加密标的做定性分析时按本框架五步推进。原则:**每一步的数据必须来自工具调用并标注时间**,禁止凭记忆报数;结论必须附反方情景。不预测涨跌与点位:结论一律以可证伪假设的形式给出——一句话核心假设 + 预期走势 + 验证信号 + 失效信号;走势证伪假设时宣告假设失效并停止旧结论,不临时换理由硬扛。
9
9
 
10
10
  ## 第零步:定位
11
11
 
@@ -46,6 +46,7 @@ description: 加密标的定性分析框架:趋势结构→量价→波动率
46
46
  - **流通市值与排名**:确认标的在全网的体量与流动性层级;
47
47
  - **流通比率 (Circulating / Total Supply)**:流通量占比低(如 < 30% 且 FDV 极高)属于高通胀、大额解锁潜在抛压标的,不宜做中长线右侧持有;
48
48
  - **24h 成交额占比**:24h 交易量占市值的比重,衡量市场短期换手与博弈热度。
49
+ - **稀缺性核验**:加密标的的核心持有逻辑大多建立在稀缺性叙事上——把供给上限、减半/销毁机制、质押锁仓与解锁时间表作为「稀缺性是否真实」的核验项;交易的对象是稀缺性的预期(买预期、卖现实),先判断当前价格已反映哪一档稀缺性预期,再谈方向。稀缺性被证伪(无限增发、大额解锁临近、机制被改)即持有逻辑失效。
49
50
 
50
51
  ## 第六步:新闻面
51
52
 
@@ -64,5 +65,6 @@ description: 加密标的定性分析框架:趋势结构→量价→波动率
64
65
 
65
66
  - 禁止不带数据引用的结论("我觉得"、"大概率"无依据支撑)。
66
67
  - 禁止把指标当预测:MA/MACD 是确认工具,滞后于价格。
68
+ - 禁止预测式表述("将涨到/跌至某价位"):只输出假设、验证信号与失效信号。
67
69
  - 禁止跳过反方情景——定性分析的价值一半在能被证伪。
68
70
  - 本框架是方法论,不构成投资建议;涉及交易一律遵守铁律 #3(dry-run 起步 + 显式开关 + 审批)。
package/lib/index.d.ts CHANGED
@@ -9,11 +9,15 @@ declare const provider: SkillProvider;
9
9
  interface Config {
10
10
  dryRun: boolean;
11
11
  liveTrading: boolean;
12
+ /** 角色预设按需收窄技能面;缺省保持全量捆绑目录。 */
13
+ skills?: string[];
12
14
  }
13
15
  declare const Config: Schema<Config>;
14
16
  declare const inject: string[];
15
17
  declare const name = "dsh-trading-crypto-kit";
16
- declare function apply(ctx: Context, _config: Config): void;
18
+ /** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
19
+ declare function providerForSkills(allowed?: readonly string[]): SkillProvider;
20
+ declare function apply(ctx: Context, config: Config): void;
17
21
  declare function createGetDerivativesTool(options?: {
18
22
  fetch?: typeof globalThis.fetch;
19
23
  }): import("@deepseek-ai/dsh-tools").ToolDefinition;
@@ -24,4 +28,4 @@ declare function createGetNewsTool(toolOptions?: {
24
28
  cryptoPanicKey?: string;
25
29
  }): import("@deepseek-ai/dsh-tools").ToolDefinition;
26
30
  //#endregion
27
- export { AggregateNewsOptions, AggregateNewsResult, Config, CryptoFundamentalsOptions, CryptoFundamentalsResult, DerivativesFetchOptions, DerivativesResult, NewsItem, NewsSource, aggregateNews, apply, createGetDerivativesTool, createGetFundamentalsTool, createGetNewsTool, deriveSymbolTokens, extractBaseAsset, fetchCryptoDerivatives, fetchCryptoFundamentals, fetchCryptoFundamentalsPackage, inject, name, normalizeBinanceFuturesSymbol, parseCryptoPanic, parseRss2, provider, renderCryptoFundamentals, renderDerivativesData };
31
+ export { AggregateNewsOptions, AggregateNewsResult, Config, CryptoFundamentalsOptions, CryptoFundamentalsResult, DerivativesFetchOptions, DerivativesResult, NewsItem, NewsSource, aggregateNews, apply, createGetDerivativesTool, createGetFundamentalsTool, createGetNewsTool, deriveSymbolTokens, extractBaseAsset, fetchCryptoDerivatives, fetchCryptoFundamentals, fetchCryptoFundamentalsPackage, inject, name, normalizeBinanceFuturesSymbol, parseCryptoPanic, parseRss2, provider, providerForSkills, renderCryptoFundamentals, renderDerivativesData };
package/lib/index.js CHANGED
@@ -115,7 +115,7 @@ const SKILL_CANDIDATES = [
115
115
  const provider = {
116
116
  name: PROVIDER_NAME,
117
117
  list: () => Promise.resolve(SKILL_CANDIDATES),
118
- async get(candidate) {
118
+ async get(candidate, _options) {
119
119
  const target = SKILL_CANDIDATES.find((c) => c.name === candidate.name) ?? CANDIDATE;
120
120
  return {
121
121
  name: target.name,
@@ -130,7 +130,8 @@ const provider = {
130
130
  };
131
131
  const Config = Schema.object({
132
132
  dryRun: Schema.boolean().default(true),
133
- liveTrading: Schema.boolean().default(false)
133
+ liveTrading: Schema.boolean().default(false),
134
+ skills: Schema.array(Schema.string())
134
135
  });
135
136
  const inject = ["skills", "tools"];
136
137
  const name = "dsh-trading-crypto-kit";
@@ -161,8 +162,23 @@ function renderFundingRates(symbol, records) {
161
162
  });
162
163
  return [`crypto_funding_rate ${symbol} — last ${records.length} funding event(s):`, ...lines].join("\n");
163
164
  }
164
- function apply(ctx, _config) {
165
- ctx.skills.registerProvider(() => provider);
165
+ /** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
166
+ function providerForSkills(allowed) {
167
+ if (!allowed) return provider;
168
+ const unknown = allowed.filter((name) => !SKILL_CANDIDATES.some((c) => c.name === name));
169
+ if (unknown.length > 0) throw new Error(`[${PROVIDER_NAME}] unknown skills in whitelist: ${unknown.join(", ")}`);
170
+ const active = SKILL_CANDIDATES.filter((c) => allowed.includes(c.name));
171
+ return {
172
+ name: provider.name,
173
+ list: () => Promise.resolve(active),
174
+ async get(candidate, options) {
175
+ if (!active.some((c) => c.name === candidate.name)) throw new Error(`[${PROVIDER_NAME}] skill not in whitelist: ${candidate.name}`);
176
+ return provider.get(candidate, options);
177
+ }
178
+ };
179
+ }
180
+ function apply(ctx, config) {
181
+ ctx.skills.registerProvider(() => providerForSkills(config.skills));
166
182
  const fundingTool = defineTool({
167
183
  name: "crypto_funding_rate",
168
184
  description: "Get recent funding rate history for a Binance USDⓈ-M perpetual futures symbol (public endpoint, no credentials). Returns the most recent funding events with rate and mark price.",
@@ -320,4 +336,4 @@ function createGetNewsTool(toolOptions = {}) {
320
336
  });
321
337
  }
322
338
  //#endregion
323
- export { Config, aggregateNews, apply, createGetDerivativesTool, createGetFundamentalsTool, createGetNewsTool, deriveSymbolTokens, extractBaseAsset, fetchCryptoDerivatives, fetchCryptoFundamentals, fetchCryptoFundamentalsPackage, inject, name, normalizeBinanceFuturesSymbol, parseCryptoPanic, parseRss2, provider, renderCryptoFundamentals, renderDerivativesData };
339
+ export { Config, aggregateNews, apply, createGetDerivativesTool, createGetFundamentalsTool, createGetNewsTool, deriveSymbolTokens, extractBaseAsset, fetchCryptoDerivatives, fetchCryptoFundamentals, fetchCryptoFundamentalsPackage, inject, name, normalizeBinanceFuturesSymbol, parseCryptoPanic, parseRss2, provider, providerForSkills, renderCryptoFundamentals, renderDerivativesData };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dshtrading/kit-crypto",
3
3
  "description": "Crypto toolkit plugin for dsh-trading: market-specific tools and bundled trading skills (skill provider); runs as a crypto-trader preset row (session-scoped)",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  ],
19
19
  "license": "PolyForm-Noncommercial-1.0.0",
20
20
  "dependencies": {
21
- "@dshtrading/indicators": "0.1.4",
22
- "@dshtrading/knowledge": "0.1.4"
21
+ "@dshtrading/indicators": "0.1.5",
22
+ "@dshtrading/knowledge": "0.1.5"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@deepseek-ai/cordis": ">=4.0.0",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "tsdown": "^0.22.0",
32
32
  "vitest": "^3.0.0",
33
- "@dshtrading/api": "0.1.4"
33
+ "@dshtrading/api": "0.1.5"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsdown",