@openfinclaw/openfinclaw-strategy 2026.3.14 → 2026.3.26
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 +34 -38
- package/index.ts +12 -872
- package/openclaw.plugin.json +2 -2
- package/package.json +1 -1
- package/skills/openfinclaw/SKILL.md +25 -34
- package/skills/price-check/SKILL.md +69 -4
- package/skills/strategy-builder/SKILL.md +42 -42
- package/skills/strategy-pack/SKILL.md +5 -5
- package/src/cli.ts +2 -2
- package/src/config.ts +1 -1
- package/src/datahub/client.ts +1 -1
- package/src/datahub/tools.ts +347 -0
- package/src/strategy/client.ts +44 -0
- package/src/{fork.ts → strategy/fork.ts} +11 -10
- package/src/{strategy-storage.ts → strategy/storage.ts} +5 -6
- package/src/strategy/tools.ts +521 -0
- package/src/{validate.ts → strategy/validate.ts} +2 -34
- package/skills/cross-asset-lite/SKILL.md +0 -95
- package/skills/crypto-altseason/SKILL.md +0 -122
- package/skills/crypto-funding-arb/SKILL.md +0 -88
- package/skills/crypto-stablecoin-flow/SKILL.md +0 -103
- package/skills/quick-quote/SKILL.md +0 -59
- package/src/strategy-storage.test.ts +0 -109
- package/src/validate.test.ts +0 -841
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: fin-quick-quote
|
|
3
|
-
description: "Crypto market overview — top coins, trending, DeFi TVL, stablecoin stats, exchange tickers, funding rates. Use when user asks about crypto market overview, top coins, DeFi rankings, or market snapshot. NOT for: individual stock analysis (use fin-price-check)."
|
|
4
|
-
metadata:
|
|
5
|
-
{ "openclaw": { "emoji": "📊", "requires": { "extensions": ["openfinclaw"] } } }
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Quick Quote — Crypto Market Overview
|
|
9
|
-
|
|
10
|
-
加密市场快照 — 市值排名、热门币种、DeFi TVL、稳定币、资金费率。
|
|
11
|
-
|
|
12
|
-
## Tools
|
|
13
|
-
|
|
14
|
-
### fin_crypto — 21 endpoints
|
|
15
|
-
|
|
16
|
-
| Parameter | Type | Required | Default | Example |
|
|
17
|
-
| ---------- | ------ | -------- | ----------- | ------------- |
|
|
18
|
-
| endpoint | string | Yes | coin/market | coin/trending |
|
|
19
|
-
| symbol | string | Depends | — | BTC/USDT |
|
|
20
|
-
| start_date | string | No | — | 2026-01-01 |
|
|
21
|
-
| end_date | string | No | — | 2026-03-12 |
|
|
22
|
-
| limit | number | No | 20 | 10 |
|
|
23
|
-
|
|
24
|
-
### Key Endpoints
|
|
25
|
-
|
|
26
|
-
| Endpoint | 用途 | 需要 symbol? |
|
|
27
|
-
| ------------------- | ----------------- | ------------ |
|
|
28
|
-
| coin/market | 市值排名 Top N | No |
|
|
29
|
-
| coin/trending | 热门搜索币种 | No |
|
|
30
|
-
| coin/global_stats | 全球加密市场概览 | No |
|
|
31
|
-
| market/ticker | 交易所实时报价 | Yes |
|
|
32
|
-
| market/funding_rate | 永续合约资金费率 | Yes |
|
|
33
|
-
| defi/protocols | DeFi TVL 排名 | No |
|
|
34
|
-
| defi/stablecoins | 稳定币市值/流通量 | No |
|
|
35
|
-
| defi/yields | DeFi 收益率排名 | No |
|
|
36
|
-
|
|
37
|
-
### fin_slim_search
|
|
38
|
-
|
|
39
|
-
| Parameter | Type | Required | Example |
|
|
40
|
-
| --------- | ------ | -------- | ------- |
|
|
41
|
-
| query | string | Yes | bitcoin |
|
|
42
|
-
| market | string | No | crypto |
|
|
43
|
-
|
|
44
|
-
## Response Guidelines
|
|
45
|
-
|
|
46
|
-
1. **表格展示** — 排名数据用表格,含:排名、名称、价格、24h 涨跌、市值
|
|
47
|
-
2. **数据时效** — 标注数据来源 (CoinGecko/Binance) 和时间
|
|
48
|
-
3. **单位换算** — 大数字用 B (billion) / M (million)
|
|
49
|
-
|
|
50
|
-
## Examples
|
|
51
|
-
|
|
52
|
-
**用户:** 加密市场现在怎么样?
|
|
53
|
-
**流程:** `fin_crypto(endpoint="coin/global_stats")` → 全局快照
|
|
54
|
-
|
|
55
|
-
**用户:** DeFi 哪个协议 TVL 最高?
|
|
56
|
-
**流程:** `fin_crypto(endpoint="defi/protocols", limit=10)` → TVL 排名
|
|
57
|
-
|
|
58
|
-
**用户:** BTC 资金费率多少?
|
|
59
|
-
**流程:** `fin_crypto(endpoint="market/funding_rate", symbol="BTC/USDT:USDT")` → 费率
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
slugifyName,
|
|
4
|
-
extractShortId,
|
|
5
|
-
generateForkDirName,
|
|
6
|
-
generateCreatedDirName,
|
|
7
|
-
parseStrategyId,
|
|
8
|
-
formatDate,
|
|
9
|
-
} from "./strategy-storage.js";
|
|
10
|
-
|
|
11
|
-
describe("slugifyName", () => {
|
|
12
|
-
it("converts to lowercase", () => {
|
|
13
|
-
expect(slugifyName("BTC Strategy")).toBe("btc-strategy");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("replaces spaces with hyphens", () => {
|
|
17
|
-
expect(slugifyName("my cool strategy")).toBe("my-cool-strategy");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("replaces underscores with hyphens", () => {
|
|
21
|
-
expect(slugifyName("my_cool_strategy")).toBe("my-cool-strategy");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("removes special characters", () => {
|
|
25
|
-
expect(slugifyName("BTC@Strategy#123!")).toBe("btcstrategy123");
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("limits length to 40 characters", () => {
|
|
29
|
-
const longName = "a".repeat(50);
|
|
30
|
-
expect(slugifyName(longName)).toHaveLength(40);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("handles multiple consecutive spaces", () => {
|
|
34
|
-
expect(slugifyName("my strategy")).toBe("my-strategy");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("strips leading and trailing hyphens", () => {
|
|
38
|
-
expect(slugifyName("-my-strategy-")).toBe("my-strategy");
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe("extractShortId", () => {
|
|
43
|
-
it("extracts first 8 chars from UUID", () => {
|
|
44
|
-
expect(extractShortId("34a5792f-7d20-4a15-90f3-26f1c54fa4a6")).toBe("34a5792f");
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("handles short input", () => {
|
|
48
|
-
expect(extractShortId("abc")).toBe("abc");
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("converts to lowercase", () => {
|
|
52
|
-
expect(extractShortId("ABC12345-XXXX-XXXX-XXXX-XXXXXXXXXXXX")).toBe("abc12345");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe("generateForkDirName", () => {
|
|
57
|
-
it("combines slug and short ID", () => {
|
|
58
|
-
expect(generateForkDirName("BTC Strategy", "34a5792f-7d20-4a15-90f3-26f1c54fa4a6")).toBe(
|
|
59
|
-
"btc-strategy-34a5792f",
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("handles long names", () => {
|
|
64
|
-
const longName = "A".repeat(50);
|
|
65
|
-
const result = generateForkDirName(longName, "12345678-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
|
|
66
|
-
expect(result).toMatch(/^a+-12345678$/);
|
|
67
|
-
expect(result.length).toBeLessThanOrEqual(49); // 40 + 1 + 8
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe("generateCreatedDirName", () => {
|
|
72
|
-
it("returns slugified name", () => {
|
|
73
|
-
expect(generateCreatedDirName("My New Strategy")).toBe("my-new-strategy");
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe("parseStrategyId", () => {
|
|
78
|
-
it("extracts ID from Hub URL", () => {
|
|
79
|
-
expect(
|
|
80
|
-
parseStrategyId("https://hub.openfinclaw.ai/strategy/34a5792f-7d20-4a15-90f3-26f1c54fa4a6"),
|
|
81
|
-
).toBe("34a5792f-7d20-4a15-90f3-26f1c54fa4a6");
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("normalizes full UUID to lowercase", () => {
|
|
85
|
-
expect(parseStrategyId("34A5792F-7D20-4A15-90F3-26F1C54FA4A6")).toBe(
|
|
86
|
-
"34a5792f-7d20-4a15-90f3-26f1c54fa4a6",
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("returns short ID as-is (lowercase)", () => {
|
|
91
|
-
expect(parseStrategyId("34A5792F")).toBe("34a5792f");
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("handles whitespace", () => {
|
|
95
|
-
expect(parseStrategyId(" 34a5792f ")).toBe("34a5792f");
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe("formatDate", () => {
|
|
100
|
-
it("formats date as YYYY-MM-DD", () => {
|
|
101
|
-
const date = new Date("2026-03-16T10:00:00Z");
|
|
102
|
-
expect(formatDate(date)).toBe("2026-03-16");
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("pads month and day", () => {
|
|
106
|
-
const date = new Date("2026-01-05T10:00:00Z");
|
|
107
|
-
expect(formatDate(date)).toBe("2026-01-05");
|
|
108
|
-
});
|
|
109
|
-
});
|