@hedgehog-finance/hedgehog-plugin 1.0.11 → 1.0.13
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/dist/index.d.ts +10 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/src/channel.d.ts +6 -0
- package/dist/src/channel.js +620 -0
- package/dist/src/channel.js.map +1 -0
- package/dist/src/core/database.d.ts +2 -0
- package/dist/src/core/database.js +220 -0
- package/dist/src/core/database.js.map +1 -0
- package/dist/src/core/logger.d.ts +3 -0
- package/dist/src/core/logger.js +20 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/features/index.d.ts +22 -0
- package/dist/src/features/index.js +8 -0
- package/dist/src/features/index.js.map +1 -0
- package/dist/src/features/watchlist/logic.d.ts +48 -0
- package/dist/src/features/watchlist/logic.js +607 -0
- package/dist/src/features/watchlist/logic.js.map +1 -0
- package/dist/src/features/watchlist/schema.d.ts +85 -0
- package/dist/src/features/watchlist/schema.js +29 -0
- package/dist/src/features/watchlist/schema.js.map +1 -0
- package/dist/src/features/watchlist/store.d.ts +1 -0
- package/dist/src/features/watchlist/store.js +2 -0
- package/dist/src/features/watchlist/store.js.map +1 -0
- package/dist/src/features/watchlist/tools.d.ts +135 -0
- package/dist/src/features/watchlist/tools.js +572 -0
- package/dist/src/features/watchlist/tools.js.map +1 -0
- package/dist/src/runtime.d.ts +5 -0
- package/dist/src/runtime.js +40 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/types.d.ts +99 -0
- package/dist/src/types.js +16 -0
- package/dist/src/types.js.map +1 -0
- package/index.ts +5 -5
- package/openclaw.plugin.json +2 -2
- package/package.json +24 -7
- package/src/channel.ts +35 -13
- package/src/core/database.ts +90 -3
- package/src/features/index.ts +2 -1
- package/src/features/watchlist/logic.ts +503 -128
- package/src/features/watchlist/schema.ts +1 -6
- package/src/features/watchlist/tools.ts +248 -103
- package/src/runtime.ts +3 -3
- package/src/types.ts +1 -1
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "openclaw/plugin-sdk/zod";
|
|
2
|
+
export declare const GetWatchlistParamsSchema: z.ZodObject<{
|
|
3
|
+
categoryId: z.ZodOptional<z.ZodString>;
|
|
4
|
+
categoryType: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
industry: "industry";
|
|
6
|
+
theme: "theme";
|
|
7
|
+
}>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type GetWatchlistParams = z.infer<typeof GetWatchlistParamsSchema>;
|
|
10
|
+
export declare const SyncCategoriesParamsSchema: z.ZodObject<{
|
|
11
|
+
industries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
themes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type SyncCategoriesParams = z.infer<typeof SyncCategoriesParamsSchema>;
|
|
15
|
+
export declare const BatchUpdateSortOrdersParamsSchema: z.ZodObject<{
|
|
16
|
+
orderedIds: z.ZodArray<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type BatchUpdateSortOrdersParams = z.infer<typeof BatchUpdateSortOrdersParamsSchema>;
|
|
19
|
+
export declare const AddToWatchlistParamsSchema: z.ZodObject<{
|
|
20
|
+
stockCode: z.ZodString;
|
|
21
|
+
stockName: z.ZodString;
|
|
22
|
+
exchange: z.ZodEnum<{
|
|
23
|
+
SSE: "SSE";
|
|
24
|
+
SZSE: "SZSE";
|
|
25
|
+
HKEX: "HKEX";
|
|
26
|
+
NASDAQ: "NASDAQ";
|
|
27
|
+
NYSE: "NYSE";
|
|
28
|
+
AMEX: "AMEX";
|
|
29
|
+
}>;
|
|
30
|
+
market: z.ZodEnum<{
|
|
31
|
+
A_SHARE: "A_SHARE";
|
|
32
|
+
US_SHARE: "US_SHARE";
|
|
33
|
+
HK_SHARE: "HK_SHARE";
|
|
34
|
+
FUTURES: "FUTURES";
|
|
35
|
+
FUND: "FUND";
|
|
36
|
+
OTHER: "OTHER";
|
|
37
|
+
}>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type AddToWatchlistParams = z.infer<typeof AddToWatchlistParamsSchema>;
|
|
40
|
+
export declare const BatchAddToWatchlistParamsSchema: z.ZodObject<{
|
|
41
|
+
stocks: z.ZodArray<z.ZodObject<{
|
|
42
|
+
stockCode: z.ZodString;
|
|
43
|
+
stockName: z.ZodString;
|
|
44
|
+
exchange: z.ZodEnum<{
|
|
45
|
+
SSE: "SSE";
|
|
46
|
+
SZSE: "SZSE";
|
|
47
|
+
HKEX: "HKEX";
|
|
48
|
+
NASDAQ: "NASDAQ";
|
|
49
|
+
NYSE: "NYSE";
|
|
50
|
+
AMEX: "AMEX";
|
|
51
|
+
}>;
|
|
52
|
+
market: z.ZodEnum<{
|
|
53
|
+
A_SHARE: "A_SHARE";
|
|
54
|
+
US_SHARE: "US_SHARE";
|
|
55
|
+
HK_SHARE: "HK_SHARE";
|
|
56
|
+
FUTURES: "FUTURES";
|
|
57
|
+
FUND: "FUND";
|
|
58
|
+
OTHER: "OTHER";
|
|
59
|
+
}>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type BatchAddToWatchlistParams = z.infer<typeof BatchAddToWatchlistParamsSchema>;
|
|
63
|
+
export declare const UpdateWatchlistItemSchema: z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
stockName: z.ZodOptional<z.ZodString>;
|
|
66
|
+
sortOrder: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export type UpdateWatchlistItemParams = z.infer<typeof UpdateWatchlistItemSchema>;
|
|
69
|
+
export interface WatchlistRow {
|
|
70
|
+
id: string;
|
|
71
|
+
stockCode: string;
|
|
72
|
+
stockName: string;
|
|
73
|
+
exchange: string;
|
|
74
|
+
market?: string;
|
|
75
|
+
userId: string;
|
|
76
|
+
sortOrder: number;
|
|
77
|
+
isDeleted: number;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
}
|
|
80
|
+
export interface CategoryRow {
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
type?: 'industry' | 'theme';
|
|
84
|
+
weight?: number;
|
|
85
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "openclaw/plugin-sdk/zod";
|
|
2
|
+
export const GetWatchlistParamsSchema = z.object({
|
|
3
|
+
categoryId: z.string().optional().describe("分类 ID,不传返回所有"),
|
|
4
|
+
categoryType: z.enum(["industry", "theme"]).optional().describe("分类类型")
|
|
5
|
+
});
|
|
6
|
+
export const SyncCategoriesParamsSchema = z.object({
|
|
7
|
+
industries: z.array(z.string()).optional(),
|
|
8
|
+
themes: z.array(z.string()).optional()
|
|
9
|
+
});
|
|
10
|
+
export const BatchUpdateSortOrdersParamsSchema = z.object({
|
|
11
|
+
orderedIds: z.array(z.string())
|
|
12
|
+
});
|
|
13
|
+
const ExchangeEnum = z.enum(["SSE", "SZSE", "NASDAQ", "NYSE", "AMEX", "HKEX"]);
|
|
14
|
+
const MarketEnum = z.enum(["A_SHARE", "US_SHARE", "HK_SHARE", "FUTURES", "FUND", "OTHER"]);
|
|
15
|
+
export const AddToWatchlistParamsSchema = z.object({
|
|
16
|
+
stockCode: z.string(),
|
|
17
|
+
stockName: z.string(),
|
|
18
|
+
exchange: ExchangeEnum,
|
|
19
|
+
market: MarketEnum
|
|
20
|
+
});
|
|
21
|
+
export const BatchAddToWatchlistParamsSchema = z.object({
|
|
22
|
+
stocks: z.array(AddToWatchlistParamsSchema)
|
|
23
|
+
});
|
|
24
|
+
export const UpdateWatchlistItemSchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
stockName: z.string().optional(),
|
|
27
|
+
sortOrder: z.number().optional()
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @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C,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;CAClB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC;CAC3C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../src/features/watchlist/store.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from "openclaw/plugin-sdk/zod";
|
|
2
|
+
import { PluginRuntime } from "openclaw/plugin-sdk";
|
|
3
|
+
import { AddToWatchlistParams, GetWatchlistParams, SyncCategoriesParams, BatchUpdateSortOrdersParams } from "./schema.js";
|
|
4
|
+
export declare const watchlistTools: {
|
|
5
|
+
add_to_watchlist: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
parameters: z.ZodObject<{
|
|
9
|
+
stockCode: z.ZodString;
|
|
10
|
+
stockName: z.ZodString;
|
|
11
|
+
exchange: z.ZodEnum<{
|
|
12
|
+
SSE: "SSE";
|
|
13
|
+
SZSE: "SZSE";
|
|
14
|
+
HKEX: "HKEX";
|
|
15
|
+
NASDAQ: "NASDAQ";
|
|
16
|
+
NYSE: "NYSE";
|
|
17
|
+
AMEX: "AMEX";
|
|
18
|
+
}>;
|
|
19
|
+
market: z.ZodEnum<{
|
|
20
|
+
A_SHARE: "A_SHARE";
|
|
21
|
+
US_SHARE: "US_SHARE";
|
|
22
|
+
HK_SHARE: "HK_SHARE";
|
|
23
|
+
FUTURES: "FUTURES";
|
|
24
|
+
FUND: "FUND";
|
|
25
|
+
OTHER: "OTHER";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
registerTool: boolean;
|
|
29
|
+
execute: (args: AddToWatchlistParams, ctx: {
|
|
30
|
+
userId: string;
|
|
31
|
+
runtime?: PluginRuntime;
|
|
32
|
+
}) => Promise<string>;
|
|
33
|
+
};
|
|
34
|
+
batch_add_to_watchlist: {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
parameters: z.ZodObject<{
|
|
38
|
+
stocks: z.ZodArray<z.ZodObject<{
|
|
39
|
+
stockCode: z.ZodString;
|
|
40
|
+
stockName: z.ZodString;
|
|
41
|
+
exchange: z.ZodEnum<{
|
|
42
|
+
SSE: "SSE";
|
|
43
|
+
SZSE: "SZSE";
|
|
44
|
+
HKEX: "HKEX";
|
|
45
|
+
NASDAQ: "NASDAQ";
|
|
46
|
+
NYSE: "NYSE";
|
|
47
|
+
AMEX: "AMEX";
|
|
48
|
+
}>;
|
|
49
|
+
market: z.ZodEnum<{
|
|
50
|
+
A_SHARE: "A_SHARE";
|
|
51
|
+
US_SHARE: "US_SHARE";
|
|
52
|
+
HK_SHARE: "HK_SHARE";
|
|
53
|
+
FUTURES: "FUTURES";
|
|
54
|
+
FUND: "FUND";
|
|
55
|
+
OTHER: "OTHER";
|
|
56
|
+
}>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
execute: (args: {
|
|
60
|
+
stocks: AddToWatchlistParams[];
|
|
61
|
+
}, ctx: {
|
|
62
|
+
userId: string;
|
|
63
|
+
runtime?: PluginRuntime;
|
|
64
|
+
}) => Promise<string>;
|
|
65
|
+
};
|
|
66
|
+
get_watchlist: {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
parameters: z.ZodObject<{
|
|
70
|
+
categoryId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
categoryType: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
industry: "industry";
|
|
73
|
+
theme: "theme";
|
|
74
|
+
}>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
execute: (args: GetWatchlistParams, ctx: {
|
|
77
|
+
userId: string;
|
|
78
|
+
}) => Promise<string>;
|
|
79
|
+
};
|
|
80
|
+
get_thematic_dashboard: {
|
|
81
|
+
name: string;
|
|
82
|
+
description: string;
|
|
83
|
+
parameters: z.ZodObject<{}, z.core.$strip>;
|
|
84
|
+
execute: (_args: {}, ctx: {
|
|
85
|
+
userId: string;
|
|
86
|
+
}) => Promise<string>;
|
|
87
|
+
};
|
|
88
|
+
get_watchlist_tabs: {
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
parameters: z.ZodObject<{}, z.core.$strip>;
|
|
92
|
+
execute: (_args: {}, ctx: {
|
|
93
|
+
userId: string;
|
|
94
|
+
}) => Promise<string>;
|
|
95
|
+
};
|
|
96
|
+
smart_reorder_watchlist: {
|
|
97
|
+
name: string;
|
|
98
|
+
description: string;
|
|
99
|
+
parameters: z.ZodObject<{}, z.core.$strip>;
|
|
100
|
+
execute: (_args: {}, ctx: {
|
|
101
|
+
userId: string;
|
|
102
|
+
runtime?: PluginRuntime;
|
|
103
|
+
}) => Promise<string>;
|
|
104
|
+
};
|
|
105
|
+
sync_watchlist_categories: {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
parameters: z.ZodObject<{
|
|
109
|
+
industries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
|
+
themes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
execute: (args: SyncCategoriesParams, ctx: {
|
|
113
|
+
userId: string;
|
|
114
|
+
}) => Promise<string>;
|
|
115
|
+
};
|
|
116
|
+
batch_update_sort_orders: {
|
|
117
|
+
name: string;
|
|
118
|
+
description: string;
|
|
119
|
+
parameters: z.ZodObject<{
|
|
120
|
+
orderedIds: z.ZodArray<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
execute: (args: BatchUpdateSortOrdersParams, ctx: {
|
|
123
|
+
userId: string;
|
|
124
|
+
}) => Promise<string>;
|
|
125
|
+
};
|
|
126
|
+
reset_watchlist_classification: {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
parameters: z.ZodObject<{}, z.core.$strip>;
|
|
130
|
+
execute: (_args: {}, ctx: {
|
|
131
|
+
userId: string;
|
|
132
|
+
runtime?: PluginRuntime;
|
|
133
|
+
}) => Promise<string>;
|
|
134
|
+
};
|
|
135
|
+
};
|