tickflow-assist 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/README.md +151 -0
- package/day_future.txt +8797 -0
- package/dist/analysis/orchestrators/composite-analysis.orchestrator.d.ts +35 -0
- package/dist/analysis/orchestrators/composite-analysis.orchestrator.js +232 -0
- package/dist/analysis/parsers/json-block.parser.d.ts +1 -0
- package/dist/analysis/parsers/json-block.parser.js +13 -0
- package/dist/analysis/parsers/key-levels.parser.d.ts +5 -0
- package/dist/analysis/parsers/key-levels.parser.js +61 -0
- package/dist/analysis/parsers/post-close-review.parser.d.ts +2 -0
- package/dist/analysis/parsers/post-close-review.parser.js +79 -0
- package/dist/analysis/parsers/watchlist-profile.parser.d.ts +6 -0
- package/dist/analysis/parsers/watchlist-profile.parser.js +93 -0
- package/dist/analysis/providers/financial-analysis.provider.d.ts +12 -0
- package/dist/analysis/providers/financial-analysis.provider.js +85 -0
- package/dist/analysis/providers/market-analysis.provider.d.ts +27 -0
- package/dist/analysis/providers/market-analysis.provider.js +187 -0
- package/dist/analysis/providers/news-analysis.provider.d.ts +9 -0
- package/dist/analysis/providers/news-analysis.provider.js +60 -0
- package/dist/analysis/tasks/analysis-step-task.d.ts +11 -0
- package/dist/analysis/tasks/analysis-step-task.js +1 -0
- package/dist/analysis/tasks/analysis-task.d.ts +13 -0
- package/dist/analysis/tasks/analysis-task.js +1 -0
- package/dist/analysis/tasks/composite-stock-analysis.task.d.ts +17 -0
- package/dist/analysis/tasks/composite-stock-analysis.task.js +47 -0
- package/dist/analysis/tasks/financial-fundamental-lite.task.d.ts +10 -0
- package/dist/analysis/tasks/financial-fundamental-lite.task.js +21 -0
- package/dist/analysis/tasks/financial-fundamental.task.d.ts +12 -0
- package/dist/analysis/tasks/financial-fundamental.task.js +64 -0
- package/dist/analysis/tasks/kline-technical-signal.task.d.ts +10 -0
- package/dist/analysis/tasks/kline-technical-signal.task.js +41 -0
- package/dist/analysis/tasks/kline-technical.task.d.ts +32 -0
- package/dist/analysis/tasks/kline-technical.task.js +61 -0
- package/dist/analysis/tasks/news-catalyst.task.d.ts +11 -0
- package/dist/analysis/tasks/news-catalyst.task.js +62 -0
- package/dist/analysis/tasks/post-close-review.task.d.ts +12 -0
- package/dist/analysis/tasks/post-close-review.task.js +35 -0
- package/dist/analysis/types/composite-analysis.d.ts +123 -0
- package/dist/analysis/types/composite-analysis.js +1 -0
- package/dist/background/daily-update.worker.d.ts +50 -0
- package/dist/background/daily-update.worker.js +546 -0
- package/dist/background/realtime-monitor.worker.d.ts +8 -0
- package/dist/background/realtime-monitor.worker.js +28 -0
- package/dist/bootstrap.d.ts +45 -0
- package/dist/bootstrap.js +214 -0
- package/dist/config/normalize.d.ts +4 -0
- package/dist/config/normalize.js +99 -0
- package/dist/config/schema.d.ts +23 -0
- package/dist/config/schema.js +18 -0
- package/dist/config/tickflow-access.d.ts +4 -0
- package/dist/config/tickflow-access.js +28 -0
- package/dist/constants/market-indexes.d.ts +5 -0
- package/dist/constants/market-indexes.js +4 -0
- package/dist/dev/run-daily-update-loop.d.ts +1 -0
- package/dist/dev/run-daily-update-loop.js +48 -0
- package/dist/dev/run-monitor-loop.d.ts +1 -0
- package/dist/dev/run-monitor-loop.js +60 -0
- package/dist/dev/run-tool.d.ts +1 -0
- package/dist/dev/run-tool.js +49 -0
- package/dist/dev/tickflow-assist-cli.d.ts +2 -0
- package/dist/dev/tickflow-assist-cli.js +525 -0
- package/dist/dev/validate-mx-search.d.ts +1 -0
- package/dist/dev/validate-mx-search.js +212 -0
- package/dist/plugin-commands.d.ts +3 -0
- package/dist/plugin-commands.js +229 -0
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.js +151 -0
- package/dist/prompts/analysis/common-system-prompt.d.ts +1 -0
- package/dist/prompts/analysis/common-system-prompt.js +44 -0
- package/dist/prompts/analysis/composite-analysis-user-prompt.d.ts +11 -0
- package/dist/prompts/analysis/composite-analysis-user-prompt.js +102 -0
- package/dist/prompts/analysis/financial-analysis-user-prompt.d.ts +7 -0
- package/dist/prompts/analysis/financial-analysis-user-prompt.js +106 -0
- package/dist/prompts/analysis/financial-lite-analysis-user-prompt.d.ts +7 -0
- package/dist/prompts/analysis/financial-lite-analysis-user-prompt.js +59 -0
- package/dist/prompts/analysis/index.d.ts +8 -0
- package/dist/prompts/analysis/index.js +8 -0
- package/dist/prompts/analysis/kline-analysis-user-prompt.d.ts +13 -0
- package/dist/prompts/analysis/kline-analysis-user-prompt.js +215 -0
- package/dist/prompts/analysis/news-analysis-user-prompt.d.ts +8 -0
- package/dist/prompts/analysis/news-analysis-user-prompt.js +57 -0
- package/dist/prompts/analysis/post-close-review-user-prompt.d.ts +3 -0
- package/dist/prompts/analysis/post-close-review-user-prompt.js +129 -0
- package/dist/prompts/analysis/watchlist-profile-extraction-prompt.d.ts +7 -0
- package/dist/prompts/analysis/watchlist-profile-extraction-prompt.js +52 -0
- package/dist/prompts/analysis-system-prompt.d.ts +1 -0
- package/dist/prompts/analysis-system-prompt.js +1 -0
- package/dist/prompts/analysis-user-prompt.d.ts +1 -0
- package/dist/prompts/analysis-user-prompt.js +1 -0
- package/dist/runtime/daily-update-process.d.ts +3 -0
- package/dist/runtime/daily-update-process.js +24 -0
- package/dist/runtime/monitor-process.d.ts +3 -0
- package/dist/runtime/monitor-process.js +24 -0
- package/dist/runtime/plugin-api.d.ts +22 -0
- package/dist/runtime/plugin-api.js +2 -0
- package/dist/runtime/process-config.d.ts +8 -0
- package/dist/runtime/process-config.js +35 -0
- package/dist/services/alert-service.d.ts +45 -0
- package/dist/services/alert-service.js +198 -0
- package/dist/services/analysis-service.d.ts +20 -0
- package/dist/services/analysis-service.js +73 -0
- package/dist/services/analysis-view-service.d.ts +23 -0
- package/dist/services/analysis-view-service.js +343 -0
- package/dist/services/financial-lite-service.d.ts +23 -0
- package/dist/services/financial-lite-service.js +201 -0
- package/dist/services/financial-service.d.ts +20 -0
- package/dist/services/financial-service.js +47 -0
- package/dist/services/indicator-service.d.ts +9 -0
- package/dist/services/indicator-service.js +67 -0
- package/dist/services/instrument-service.d.ts +6 -0
- package/dist/services/instrument-service.js +21 -0
- package/dist/services/key-level-service.d.ts +2 -0
- package/dist/services/key-level-service.js +2 -0
- package/dist/services/key-levels-backtest-service.d.ts +71 -0
- package/dist/services/key-levels-backtest-service.js +427 -0
- package/dist/services/kline-service.d.ts +19 -0
- package/dist/services/kline-service.js +91 -0
- package/dist/services/monitor-service.d.ts +44 -0
- package/dist/services/monitor-service.js +598 -0
- package/dist/services/mx-search-service.d.ts +22 -0
- package/dist/services/mx-search-service.js +286 -0
- package/dist/services/post-close-review-service.d.ts +31 -0
- package/dist/services/post-close-review-service.js +402 -0
- package/dist/services/quote-service.d.ts +7 -0
- package/dist/services/quote-service.js +9 -0
- package/dist/services/review-memory-service.d.ts +7 -0
- package/dist/services/review-memory-service.js +76 -0
- package/dist/services/tickflow-client.d.ts +43 -0
- package/dist/services/tickflow-client.js +126 -0
- package/dist/services/trading-calendar-service.d.ts +20 -0
- package/dist/services/trading-calendar-service.js +102 -0
- package/dist/services/update-service.d.ts +21 -0
- package/dist/services/update-service.js +130 -0
- package/dist/services/watchlist-profile-service.d.ts +20 -0
- package/dist/services/watchlist-profile-service.js +76 -0
- package/dist/services/watchlist-service.d.ts +43 -0
- package/dist/services/watchlist-service.js +204 -0
- package/dist/storage/db.d.ts +23 -0
- package/dist/storage/db.js +70 -0
- package/dist/storage/repositories/alert-log-repo.d.ts +15 -0
- package/dist/storage/repositories/alert-log-repo.js +54 -0
- package/dist/storage/repositories/analysis-log-repo.d.ts +8 -0
- package/dist/storage/repositories/analysis-log-repo.js +48 -0
- package/dist/storage/repositories/composite-analysis-repo.d.ts +9 -0
- package/dist/storage/repositories/composite-analysis-repo.js +116 -0
- package/dist/storage/repositories/financial-analysis-repo.d.ts +9 -0
- package/dist/storage/repositories/financial-analysis-repo.js +107 -0
- package/dist/storage/repositories/indicators-repo.d.ts +8 -0
- package/dist/storage/repositories/indicators-repo.js +98 -0
- package/dist/storage/repositories/intraday-klines-repo.d.ts +9 -0
- package/dist/storage/repositories/intraday-klines-repo.js +102 -0
- package/dist/storage/repositories/key-levels-history-repo.d.ts +9 -0
- package/dist/storage/repositories/key-levels-history-repo.js +91 -0
- package/dist/storage/repositories/key-levels-repo.d.ts +9 -0
- package/dist/storage/repositories/key-levels-repo.js +83 -0
- package/dist/storage/repositories/klines-repo.d.ts +8 -0
- package/dist/storage/repositories/klines-repo.js +60 -0
- package/dist/storage/repositories/news-analysis-repo.d.ts +9 -0
- package/dist/storage/repositories/news-analysis-repo.js +107 -0
- package/dist/storage/repositories/technical-analysis-repo.d.ts +9 -0
- package/dist/storage/repositories/technical-analysis-repo.js +80 -0
- package/dist/storage/repositories/watchlist-repo.d.ts +10 -0
- package/dist/storage/repositories/watchlist-repo.js +124 -0
- package/dist/storage/schemas.d.ts +13 -0
- package/dist/storage/schemas.js +177 -0
- package/dist/tools/add-stock.tool.d.ts +13 -0
- package/dist/tools/add-stock.tool.js +123 -0
- package/dist/tools/analyze.tool.d.ts +8 -0
- package/dist/tools/analyze.tool.js +24 -0
- package/dist/tools/backtest-key-levels.tool.d.ts +8 -0
- package/dist/tools/backtest-key-levels.tool.js +43 -0
- package/dist/tools/daily-update-status.tool.d.ts +6 -0
- package/dist/tools/daily-update-status.tool.js +9 -0
- package/dist/tools/fetch-financials.tool.d.ts +8 -0
- package/dist/tools/fetch-financials.tool.js +224 -0
- package/dist/tools/fetch-intraday-klines.tool.d.ts +11 -0
- package/dist/tools/fetch-intraday-klines.tool.js +58 -0
- package/dist/tools/fetch-klines.tool.d.ts +11 -0
- package/dist/tools/fetch-klines.tool.js +61 -0
- package/dist/tools/list-watchlist.tool.d.ts +6 -0
- package/dist/tools/list-watchlist.tool.js +22 -0
- package/dist/tools/monitor-status.tool.d.ts +6 -0
- package/dist/tools/monitor-status.tool.js +9 -0
- package/dist/tools/mx-search.tool.d.ts +8 -0
- package/dist/tools/mx-search.tool.js +77 -0
- package/dist/tools/mx-select-stock.tool.d.ts +8 -0
- package/dist/tools/mx-select-stock.tool.js +118 -0
- package/dist/tools/query-database.tool.d.ts +8 -0
- package/dist/tools/query-database.tool.js +283 -0
- package/dist/tools/refresh-watchlist-names.tool.d.ts +7 -0
- package/dist/tools/refresh-watchlist-names.tool.js +17 -0
- package/dist/tools/refresh-watchlist-profiles.tool.d.ts +9 -0
- package/dist/tools/refresh-watchlist-profiles.tool.js +67 -0
- package/dist/tools/remove-stock.tool.d.ts +9 -0
- package/dist/tools/remove-stock.tool.js +27 -0
- package/dist/tools/start-daily-update.tool.d.ts +10 -0
- package/dist/tools/start-daily-update.tool.js +23 -0
- package/dist/tools/start-monitor.tool.d.ts +9 -0
- package/dist/tools/start-monitor.tool.js +52 -0
- package/dist/tools/stop-daily-update.tool.d.ts +9 -0
- package/dist/tools/stop-daily-update.tool.js +20 -0
- package/dist/tools/stop-monitor.tool.d.ts +9 -0
- package/dist/tools/stop-monitor.tool.js +44 -0
- package/dist/tools/test-alert.tool.d.ts +7 -0
- package/dist/tools/test-alert.tool.js +21 -0
- package/dist/tools/update-all.tool.d.ts +9 -0
- package/dist/tools/update-all.tool.js +17 -0
- package/dist/tools/view-analysis.tool.d.ts +8 -0
- package/dist/tools/view-analysis.tool.js +95 -0
- package/dist/types/daily-update.d.ts +26 -0
- package/dist/types/daily-update.js +1 -0
- package/dist/types/domain.d.ts +140 -0
- package/dist/types/domain.js +1 -0
- package/dist/types/indicator.d.ts +43 -0
- package/dist/types/indicator.js +1 -0
- package/dist/types/monitor.d.ts +17 -0
- package/dist/types/monitor.js +1 -0
- package/dist/types/mx-search.d.ts +14 -0
- package/dist/types/mx-search.js +1 -0
- package/dist/types/mx-select-stock.d.ts +28 -0
- package/dist/types/mx-select-stock.js +1 -0
- package/dist/types/tickflow.d.ts +133 -0
- package/dist/types/tickflow.js +1 -0
- package/dist/utils/abortable-sleep.d.ts +1 -0
- package/dist/utils/abortable-sleep.js +20 -0
- package/dist/utils/china-time.d.ts +3 -0
- package/dist/utils/china-time.js +18 -0
- package/dist/utils/cost-price.d.ts +3 -0
- package/dist/utils/cost-price.js +18 -0
- package/dist/utils/format.d.ts +1 -0
- package/dist/utils/format.js +3 -0
- package/dist/utils/process.d.ts +5 -0
- package/dist/utils/process.js +1 -0
- package/dist/utils/symbol.d.ts +1 -0
- package/dist/utils/symbol.js +13 -0
- package/docs/installation.md +391 -0
- package/docs/usage.md +244 -0
- package/openclaw.plugin.json +116 -0
- package/package.json +57 -0
- package/python/indicator_runner.py +31 -0
- package/python/indicators.py +148 -0
- package/python/pyproject.toml +9 -0
- package/python/requirements.txt +3 -0
- package/python/uv.lock +366 -0
- package/skills/database-query/SKILL.md +58 -0
- package/skills/stock-analysis/SKILL.md +106 -0
- package/skills/usage-help/SKILL.md +102 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnalysisViewService } from "../services/analysis-view-service.js";
|
|
2
|
+
export declare function viewAnalysisTool(analysisViewService: AnalysisViewService): {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
run({ rawInput }: {
|
|
6
|
+
rawInput?: unknown;
|
|
7
|
+
}): Promise<string>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { normalizeSymbol } from "../utils/symbol.js";
|
|
2
|
+
function parseInput(rawInput) {
|
|
3
|
+
if (typeof rawInput === "string" && rawInput.trim()) {
|
|
4
|
+
const [symbol, secondToken, thirdToken] = rawInput.trim().split(/\s+/, 3);
|
|
5
|
+
const parsed = parseProfileAndLimit(secondToken, thirdToken);
|
|
6
|
+
return {
|
|
7
|
+
symbol,
|
|
8
|
+
profile: parsed.profile,
|
|
9
|
+
limit: parsed.limit,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (typeof rawInput === "object" && rawInput !== null) {
|
|
13
|
+
const input = rawInput;
|
|
14
|
+
const symbol = String(input.symbol ?? "").trim();
|
|
15
|
+
if (symbol) {
|
|
16
|
+
const explicitLimit = normalizeLimit(input.limit ?? input.count);
|
|
17
|
+
const historyLimit = explicitLimit ??
|
|
18
|
+
(Boolean(input.history) ? 5 : undefined);
|
|
19
|
+
return {
|
|
20
|
+
symbol,
|
|
21
|
+
profile: normalizeProfile(input.profile ?? input.view ?? input.section),
|
|
22
|
+
limit: historyLimit ?? 1,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw new Error("view-analysis requires a symbol");
|
|
27
|
+
}
|
|
28
|
+
function parseProfileAndLimit(secondToken, thirdToken) {
|
|
29
|
+
const secondLimit = normalizeLimit(secondToken);
|
|
30
|
+
if (secondLimit != null) {
|
|
31
|
+
return {
|
|
32
|
+
profile: "composite",
|
|
33
|
+
limit: secondLimit,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
profile: normalizeProfile(secondToken),
|
|
38
|
+
limit: normalizeLimit(thirdToken) ?? 1,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function normalizeProfile(rawValue) {
|
|
42
|
+
const value = String(rawValue ?? "").trim().toLowerCase();
|
|
43
|
+
switch (value) {
|
|
44
|
+
case "technical":
|
|
45
|
+
case "tech":
|
|
46
|
+
case "技术":
|
|
47
|
+
case "技术面":
|
|
48
|
+
return "technical";
|
|
49
|
+
case "financial":
|
|
50
|
+
case "fundamental":
|
|
51
|
+
case "fundamentals":
|
|
52
|
+
case "财务":
|
|
53
|
+
case "基本面":
|
|
54
|
+
return "financial";
|
|
55
|
+
case "news":
|
|
56
|
+
case "info":
|
|
57
|
+
case "资讯":
|
|
58
|
+
case "消息":
|
|
59
|
+
case "研报":
|
|
60
|
+
return "news";
|
|
61
|
+
case "all":
|
|
62
|
+
case "全部":
|
|
63
|
+
case "所有":
|
|
64
|
+
return "all";
|
|
65
|
+
case "composite":
|
|
66
|
+
case "full":
|
|
67
|
+
case "综合":
|
|
68
|
+
case "综合分析":
|
|
69
|
+
case "":
|
|
70
|
+
return "composite";
|
|
71
|
+
default:
|
|
72
|
+
return "composite";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function normalizeLimit(rawValue) {
|
|
76
|
+
if (rawValue == null || rawValue === "") {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const value = Number(rawValue);
|
|
80
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
81
|
+
throw new Error("view-analysis limit must be > 0");
|
|
82
|
+
}
|
|
83
|
+
return Math.min(Math.trunc(value), 20);
|
|
84
|
+
}
|
|
85
|
+
export function viewAnalysisTool(analysisViewService) {
|
|
86
|
+
return {
|
|
87
|
+
name: "view_analysis",
|
|
88
|
+
description: "View latest or recent saved analyses for a symbol. Supports composite, technical, financial, news, or all.",
|
|
89
|
+
async run({ rawInput }) {
|
|
90
|
+
const input = parseInput(rawInput);
|
|
91
|
+
const symbol = normalizeSymbol(input.symbol);
|
|
92
|
+
return analysisViewService.render(symbol, input.profile, input.limit);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type DailyUpdateResultType = "success" | "skipped" | "failed";
|
|
2
|
+
export interface DailyUpdateState {
|
|
3
|
+
running: boolean;
|
|
4
|
+
startedAt: string | null;
|
|
5
|
+
lastStoppedAt: string | null;
|
|
6
|
+
workerPid: number | null;
|
|
7
|
+
expectedStop: boolean;
|
|
8
|
+
runtimeHost: "project_scheduler" | "plugin_service" | null;
|
|
9
|
+
runtimeObservedAt: string | null;
|
|
10
|
+
runtimeConfigSource: "openclaw_plugin" | "local_config" | null;
|
|
11
|
+
lastHeartbeatAt: string | null;
|
|
12
|
+
lastAttemptAt: string | null;
|
|
13
|
+
lastAttemptDate: string | null;
|
|
14
|
+
lastSuccessAt: string | null;
|
|
15
|
+
lastSuccessDate: string | null;
|
|
16
|
+
lastResultType: DailyUpdateResultType | null;
|
|
17
|
+
lastResultSummary: string | null;
|
|
18
|
+
consecutiveFailures: number;
|
|
19
|
+
lastReviewAttemptAt: string | null;
|
|
20
|
+
lastReviewAttemptDate: string | null;
|
|
21
|
+
lastReviewSuccessAt: string | null;
|
|
22
|
+
lastReviewSuccessDate: string | null;
|
|
23
|
+
lastReviewResultType: DailyUpdateResultType | null;
|
|
24
|
+
lastReviewResultSummary: string | null;
|
|
25
|
+
reviewConsecutiveFailures: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export interface WatchlistItem {
|
|
2
|
+
symbol: string;
|
|
3
|
+
name: string;
|
|
4
|
+
costPrice: number | null;
|
|
5
|
+
addedAt: string;
|
|
6
|
+
sector: string | null;
|
|
7
|
+
themes: string[];
|
|
8
|
+
themeQuery: string | null;
|
|
9
|
+
themeUpdatedAt: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface QuoteSnapshot {
|
|
12
|
+
symbol: string;
|
|
13
|
+
name: string;
|
|
14
|
+
lastPrice: number;
|
|
15
|
+
prevClose: number;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}
|
|
18
|
+
export interface KeyLevels {
|
|
19
|
+
symbol?: string;
|
|
20
|
+
analysis_date?: string;
|
|
21
|
+
current_price: number;
|
|
22
|
+
stop_loss?: number | null;
|
|
23
|
+
breakthrough?: number | null;
|
|
24
|
+
support?: number | null;
|
|
25
|
+
cost_level?: number | null;
|
|
26
|
+
resistance?: number | null;
|
|
27
|
+
take_profit?: number | null;
|
|
28
|
+
gap?: number | null;
|
|
29
|
+
target?: number | null;
|
|
30
|
+
round_number?: number | null;
|
|
31
|
+
analysis_text: string;
|
|
32
|
+
score: number;
|
|
33
|
+
}
|
|
34
|
+
export interface AnalysisLogEntry {
|
|
35
|
+
symbol: string;
|
|
36
|
+
analysis_date: string;
|
|
37
|
+
analysis_text: string;
|
|
38
|
+
structured_ok: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type AnalysisBias = "positive" | "neutral" | "negative";
|
|
41
|
+
export interface AnalysisLevelsSnapshot {
|
|
42
|
+
current_price: number | null;
|
|
43
|
+
stop_loss: number | null;
|
|
44
|
+
breakthrough: number | null;
|
|
45
|
+
support: number | null;
|
|
46
|
+
cost_level: number | null;
|
|
47
|
+
resistance: number | null;
|
|
48
|
+
take_profit: number | null;
|
|
49
|
+
gap: number | null;
|
|
50
|
+
target: number | null;
|
|
51
|
+
round_number: number | null;
|
|
52
|
+
score: number | null;
|
|
53
|
+
}
|
|
54
|
+
export interface KeyLevelsHistoryEntry extends AnalysisLevelsSnapshot {
|
|
55
|
+
symbol: string;
|
|
56
|
+
analysis_date: string;
|
|
57
|
+
activated_at: string;
|
|
58
|
+
profile: "composite";
|
|
59
|
+
analysis_text: string;
|
|
60
|
+
}
|
|
61
|
+
export interface TechnicalAnalysisEntry extends AnalysisLevelsSnapshot {
|
|
62
|
+
symbol: string;
|
|
63
|
+
analysis_date: string;
|
|
64
|
+
analysis_text: string;
|
|
65
|
+
structured_ok: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface FinancialAnalysisEvidence {
|
|
68
|
+
available: boolean;
|
|
69
|
+
mode?: "full" | "lite" | "none";
|
|
70
|
+
source?: "tickflow" | "mx_select_stock" | "none";
|
|
71
|
+
note?: string | null;
|
|
72
|
+
latest_period_end: string | null;
|
|
73
|
+
latest_announce_date: string | null;
|
|
74
|
+
income_count: number;
|
|
75
|
+
metrics_count: number;
|
|
76
|
+
cash_flow_count: number;
|
|
77
|
+
balance_sheet_count: number;
|
|
78
|
+
lite_as_of?: string | null;
|
|
79
|
+
lite_query?: string | null;
|
|
80
|
+
lite_metric_count?: number;
|
|
81
|
+
lite_metric_labels?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface FinancialAnalysisEntry {
|
|
84
|
+
symbol: string;
|
|
85
|
+
analysis_date: string;
|
|
86
|
+
analysis_text: string;
|
|
87
|
+
score: number | null;
|
|
88
|
+
bias: AnalysisBias;
|
|
89
|
+
strengths: string[];
|
|
90
|
+
risks: string[];
|
|
91
|
+
watch_items: string[];
|
|
92
|
+
evidence: FinancialAnalysisEvidence;
|
|
93
|
+
}
|
|
94
|
+
export interface NewsAnalysisEvidenceItem {
|
|
95
|
+
title: string;
|
|
96
|
+
source: string | null;
|
|
97
|
+
published_at: string | null;
|
|
98
|
+
securities: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface NewsAnalysisEvidence {
|
|
101
|
+
available: boolean;
|
|
102
|
+
source_count: number;
|
|
103
|
+
documents: NewsAnalysisEvidenceItem[];
|
|
104
|
+
}
|
|
105
|
+
export interface NewsAnalysisEntry {
|
|
106
|
+
symbol: string;
|
|
107
|
+
analysis_date: string;
|
|
108
|
+
query: string;
|
|
109
|
+
analysis_text: string;
|
|
110
|
+
score: number | null;
|
|
111
|
+
bias: AnalysisBias;
|
|
112
|
+
catalysts: string[];
|
|
113
|
+
risks: string[];
|
|
114
|
+
watch_items: string[];
|
|
115
|
+
source_count: number;
|
|
116
|
+
evidence: NewsAnalysisEvidence;
|
|
117
|
+
}
|
|
118
|
+
export interface CompositeAnalysisEvidence {
|
|
119
|
+
technical_structured: boolean;
|
|
120
|
+
financial_available: boolean;
|
|
121
|
+
financial_mode?: "full" | "lite" | "none";
|
|
122
|
+
financial_source?: "tickflow" | "mx_select_stock" | "none";
|
|
123
|
+
financial_latest_period_end: string | null;
|
|
124
|
+
financial_lite_as_of?: string | null;
|
|
125
|
+
news_available: boolean;
|
|
126
|
+
news_query: string;
|
|
127
|
+
news_source_count: number;
|
|
128
|
+
}
|
|
129
|
+
export interface CompositeAnalysisEntry extends AnalysisLevelsSnapshot {
|
|
130
|
+
symbol: string;
|
|
131
|
+
analysis_date: string;
|
|
132
|
+
analysis_text: string;
|
|
133
|
+
structured_ok: boolean;
|
|
134
|
+
technical_score: number | null;
|
|
135
|
+
financial_score: number | null;
|
|
136
|
+
news_score: number | null;
|
|
137
|
+
financial_bias: AnalysisBias;
|
|
138
|
+
news_bias: AnalysisBias;
|
|
139
|
+
evidence: CompositeAnalysisEvidence;
|
|
140
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface IndicatorInputRow {
|
|
2
|
+
trade_date: string;
|
|
3
|
+
trade_time?: string;
|
|
4
|
+
period?: string;
|
|
5
|
+
timestamp?: number;
|
|
6
|
+
open: number;
|
|
7
|
+
high: number;
|
|
8
|
+
low: number;
|
|
9
|
+
close: number;
|
|
10
|
+
volume: number;
|
|
11
|
+
amount: number;
|
|
12
|
+
prev_close?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface IndicatorRow {
|
|
15
|
+
symbol?: string;
|
|
16
|
+
trade_date: string;
|
|
17
|
+
trade_time?: string;
|
|
18
|
+
period?: string;
|
|
19
|
+
timestamp?: number;
|
|
20
|
+
ma5?: number | null;
|
|
21
|
+
ma10?: number | null;
|
|
22
|
+
ma20?: number | null;
|
|
23
|
+
ma60?: number | null;
|
|
24
|
+
macd?: number | null;
|
|
25
|
+
macd_signal?: number | null;
|
|
26
|
+
macd_hist?: number | null;
|
|
27
|
+
kdj_k?: number | null;
|
|
28
|
+
kdj_d?: number | null;
|
|
29
|
+
kdj_j?: number | null;
|
|
30
|
+
rsi_6?: number | null;
|
|
31
|
+
rsi_12?: number | null;
|
|
32
|
+
rsi_24?: number | null;
|
|
33
|
+
cci?: number | null;
|
|
34
|
+
bias_6?: number | null;
|
|
35
|
+
bias_12?: number | null;
|
|
36
|
+
bias_24?: number | null;
|
|
37
|
+
plus_di?: number | null;
|
|
38
|
+
minus_di?: number | null;
|
|
39
|
+
adx?: number | null;
|
|
40
|
+
boll_upper?: number | null;
|
|
41
|
+
boll_mid?: number | null;
|
|
42
|
+
boll_lower?: number | null;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface MonitorState {
|
|
2
|
+
running: boolean;
|
|
3
|
+
startedAt: string | null;
|
|
4
|
+
lastStoppedAt: string | null;
|
|
5
|
+
lastMode: "manual" | "system";
|
|
6
|
+
workerPid: number | null;
|
|
7
|
+
expectedStop: boolean;
|
|
8
|
+
runtimeHost: "plugin_service" | "fallback_process" | null;
|
|
9
|
+
runtimeObservedAt: string | null;
|
|
10
|
+
lastHeartbeatAt: string | null;
|
|
11
|
+
lastLoopError: string | null;
|
|
12
|
+
lastLoopErrorAt: string | null;
|
|
13
|
+
lastObservedPhase: "non_trading_day" | "pre_market" | "trading" | "lunch_break" | "closed" | null;
|
|
14
|
+
lastObservedPhaseDate: string | null;
|
|
15
|
+
sessionNotificationsDate: string | null;
|
|
16
|
+
sessionNotificationsSent: string[];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface MxSearchSecurity {
|
|
2
|
+
secuCode?: string | null;
|
|
3
|
+
secuName?: string | null;
|
|
4
|
+
secuType?: string | null;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface MxSearchDocument {
|
|
8
|
+
title: string;
|
|
9
|
+
trunk: string;
|
|
10
|
+
secuList: MxSearchSecurity[];
|
|
11
|
+
source: string | null;
|
|
12
|
+
publishedAt: string | null;
|
|
13
|
+
raw: Record<string, unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface MxSelectStockColumn {
|
|
2
|
+
title: string;
|
|
3
|
+
key: string;
|
|
4
|
+
dateMsg: string | null;
|
|
5
|
+
sortable: boolean;
|
|
6
|
+
sortWay: string | null;
|
|
7
|
+
redGreenAble: boolean;
|
|
8
|
+
unit: string | null;
|
|
9
|
+
dataType: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface MxSelectStockCondition {
|
|
12
|
+
describe: string;
|
|
13
|
+
stockCount: number | null;
|
|
14
|
+
}
|
|
15
|
+
export interface MxSelectStockResult {
|
|
16
|
+
status: number | null;
|
|
17
|
+
message: string | null;
|
|
18
|
+
code: string | null;
|
|
19
|
+
msg: string | null;
|
|
20
|
+
resultType: number | null;
|
|
21
|
+
total: number;
|
|
22
|
+
totalRecordCount: number;
|
|
23
|
+
parserText: string | null;
|
|
24
|
+
columns: MxSelectStockColumn[];
|
|
25
|
+
dataList: Array<Record<string, unknown>>;
|
|
26
|
+
responseConditionList: MxSelectStockCondition[];
|
|
27
|
+
totalCondition: MxSelectStockCondition | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export interface TickFlowInstrument {
|
|
2
|
+
symbol: string;
|
|
3
|
+
name?: string | null;
|
|
4
|
+
exchange: string;
|
|
5
|
+
code: string;
|
|
6
|
+
region: string;
|
|
7
|
+
type?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface TickFlowQuote {
|
|
10
|
+
symbol: string;
|
|
11
|
+
last_price: number;
|
|
12
|
+
prev_close: number;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
volume?: number;
|
|
15
|
+
ext?: {
|
|
16
|
+
name?: string;
|
|
17
|
+
change_pct?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface TickFlowCompactKline {
|
|
21
|
+
timestamp: number[];
|
|
22
|
+
open: number[];
|
|
23
|
+
high: number[];
|
|
24
|
+
low: number[];
|
|
25
|
+
close: number[];
|
|
26
|
+
volume: number[];
|
|
27
|
+
amount: number[];
|
|
28
|
+
prev_close?: number[];
|
|
29
|
+
open_interest?: number[];
|
|
30
|
+
settlement_price?: number[];
|
|
31
|
+
}
|
|
32
|
+
export interface TickFlowKlineRow {
|
|
33
|
+
symbol: string;
|
|
34
|
+
trade_date: string;
|
|
35
|
+
timestamp: number;
|
|
36
|
+
open: number;
|
|
37
|
+
high: number;
|
|
38
|
+
low: number;
|
|
39
|
+
close: number;
|
|
40
|
+
volume: number;
|
|
41
|
+
amount: number;
|
|
42
|
+
prev_close: number;
|
|
43
|
+
}
|
|
44
|
+
export interface TickFlowIntradayKlineRow {
|
|
45
|
+
symbol: string;
|
|
46
|
+
period: string;
|
|
47
|
+
trade_date: string;
|
|
48
|
+
trade_time: string;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
open: number;
|
|
51
|
+
high: number;
|
|
52
|
+
low: number;
|
|
53
|
+
close: number;
|
|
54
|
+
volume: number;
|
|
55
|
+
amount: number;
|
|
56
|
+
prev_close: number;
|
|
57
|
+
open_interest: number | null;
|
|
58
|
+
settlement_price: number | null;
|
|
59
|
+
}
|
|
60
|
+
export interface TickFlowFinancialQueryOptions {
|
|
61
|
+
start_date?: string;
|
|
62
|
+
end_date?: string;
|
|
63
|
+
latest?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface TickFlowBalanceSheetRecord {
|
|
66
|
+
period_end: string;
|
|
67
|
+
announce_date?: string | null;
|
|
68
|
+
accounts_payable?: number | null;
|
|
69
|
+
accounts_receivable?: number | null;
|
|
70
|
+
cash_and_equivalents?: number | null;
|
|
71
|
+
equity_attributable?: number | null;
|
|
72
|
+
fixed_assets?: number | null;
|
|
73
|
+
goodwill?: number | null;
|
|
74
|
+
intangible_assets?: number | null;
|
|
75
|
+
inventory?: number | null;
|
|
76
|
+
long_term_borrowing?: number | null;
|
|
77
|
+
minority_interest?: number | null;
|
|
78
|
+
retained_earnings?: number | null;
|
|
79
|
+
short_term_borrowing?: number | null;
|
|
80
|
+
total_assets?: number | null;
|
|
81
|
+
total_current_assets?: number | null;
|
|
82
|
+
total_current_liabilities?: number | null;
|
|
83
|
+
total_equity?: number | null;
|
|
84
|
+
total_liabilities?: number | null;
|
|
85
|
+
total_non_current_assets?: number | null;
|
|
86
|
+
total_non_current_liabilities?: number | null;
|
|
87
|
+
}
|
|
88
|
+
export interface TickFlowCashFlowRecord {
|
|
89
|
+
period_end: string;
|
|
90
|
+
announce_date?: string | null;
|
|
91
|
+
capex?: number | null;
|
|
92
|
+
net_cash_change?: number | null;
|
|
93
|
+
net_financing_cash_flow?: number | null;
|
|
94
|
+
net_investing_cash_flow?: number | null;
|
|
95
|
+
net_operating_cash_flow?: number | null;
|
|
96
|
+
}
|
|
97
|
+
export interface TickFlowIncomeRecord {
|
|
98
|
+
period_end: string;
|
|
99
|
+
announce_date?: string | null;
|
|
100
|
+
admin_expense?: number | null;
|
|
101
|
+
basic_eps?: number | null;
|
|
102
|
+
diluted_eps?: number | null;
|
|
103
|
+
financial_expense?: number | null;
|
|
104
|
+
income_tax?: number | null;
|
|
105
|
+
net_income?: number | null;
|
|
106
|
+
net_income_attributable?: number | null;
|
|
107
|
+
non_operating_expense?: number | null;
|
|
108
|
+
non_operating_income?: number | null;
|
|
109
|
+
operating_cost?: number | null;
|
|
110
|
+
operating_profit?: number | null;
|
|
111
|
+
rd_expense?: number | null;
|
|
112
|
+
revenue?: number | null;
|
|
113
|
+
selling_expense?: number | null;
|
|
114
|
+
total_profit?: number | null;
|
|
115
|
+
}
|
|
116
|
+
export interface TickFlowFinancialMetricsRecord {
|
|
117
|
+
period_end: string;
|
|
118
|
+
announce_date?: string | null;
|
|
119
|
+
bps?: number | null;
|
|
120
|
+
debt_to_asset_ratio?: number | null;
|
|
121
|
+
eps_basic?: number | null;
|
|
122
|
+
eps_diluted?: number | null;
|
|
123
|
+
gross_margin?: number | null;
|
|
124
|
+
inventory_turnover?: number | null;
|
|
125
|
+
net_income_yoy?: number | null;
|
|
126
|
+
net_margin?: number | null;
|
|
127
|
+
ocfps?: number | null;
|
|
128
|
+
operating_cash_to_revenue?: number | null;
|
|
129
|
+
revenue_yoy?: number | null;
|
|
130
|
+
roa?: number | null;
|
|
131
|
+
roe?: number | null;
|
|
132
|
+
roe_diluted?: number | null;
|
|
133
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleepWithAbort(ms: number, signal?: AbortSignal): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function sleepWithAbort(ms, signal) {
|
|
2
|
+
if (signal?.aborted) {
|
|
3
|
+
return Promise.resolve();
|
|
4
|
+
}
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
const timer = setTimeout(() => {
|
|
7
|
+
cleanup();
|
|
8
|
+
resolve();
|
|
9
|
+
}, ms);
|
|
10
|
+
const onAbort = () => {
|
|
11
|
+
clearTimeout(timer);
|
|
12
|
+
cleanup();
|
|
13
|
+
resolve();
|
|
14
|
+
};
|
|
15
|
+
const cleanup = () => {
|
|
16
|
+
signal?.removeEventListener("abort", onAbort);
|
|
17
|
+
};
|
|
18
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const CHINA_OFFSET_HOURS = 8;
|
|
2
|
+
export function chinaNow() {
|
|
3
|
+
return new Date();
|
|
4
|
+
}
|
|
5
|
+
export function formatChinaDateTime(date = chinaNow()) {
|
|
6
|
+
const utcMs = date.getTime() + date.getTimezoneOffset() * 60_000;
|
|
7
|
+
const chinaDate = new Date(utcMs + CHINA_OFFSET_HOURS * 60 * 60 * 1000);
|
|
8
|
+
const year = chinaDate.getUTCFullYear();
|
|
9
|
+
const month = String(chinaDate.getUTCMonth() + 1).padStart(2, "0");
|
|
10
|
+
const day = String(chinaDate.getUTCDate()).padStart(2, "0");
|
|
11
|
+
const hour = String(chinaDate.getUTCHours()).padStart(2, "0");
|
|
12
|
+
const minute = String(chinaDate.getUTCMinutes()).padStart(2, "0");
|
|
13
|
+
const second = String(chinaDate.getUTCSeconds()).padStart(2, "0");
|
|
14
|
+
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
|
15
|
+
}
|
|
16
|
+
export function chinaToday(date = chinaNow()) {
|
|
17
|
+
return formatChinaDateTime(date).slice(0, 10);
|
|
18
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function normalizeCostPrice(value: unknown): number | null;
|
|
2
|
+
export declare function formatCostPrice(value: number | null | undefined, suffix?: string): string;
|
|
3
|
+
export declare function calculateProfitPct(currentPrice: number, costPrice: number | null | undefined): number | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function normalizeCostPrice(value) {
|
|
2
|
+
const numeric = Number(value ?? NaN);
|
|
3
|
+
if (!Number.isFinite(numeric) || numeric <= 0) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
return numeric;
|
|
7
|
+
}
|
|
8
|
+
export function formatCostPrice(value, suffix = "") {
|
|
9
|
+
const numeric = normalizeCostPrice(value);
|
|
10
|
+
return numeric == null ? "未设置" : `${numeric.toFixed(2)}${suffix}`;
|
|
11
|
+
}
|
|
12
|
+
export function calculateProfitPct(currentPrice, costPrice) {
|
|
13
|
+
const numeric = normalizeCostPrice(costPrice);
|
|
14
|
+
if (numeric == null) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return ((currentPrice - numeric) / numeric) * 100;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatPrice(value: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeSymbol(input: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function normalizeSymbol(input) {
|
|
2
|
+
const normalized = input.trim().toUpperCase();
|
|
3
|
+
if (/^\d{6}\.(SH|SZ)$/.test(normalized)) {
|
|
4
|
+
return normalized;
|
|
5
|
+
}
|
|
6
|
+
if (/^\d{6}$/.test(normalized)) {
|
|
7
|
+
if (normalized.startsWith("6") || normalized.startsWith("9")) {
|
|
8
|
+
return `${normalized}.SH`;
|
|
9
|
+
}
|
|
10
|
+
return `${normalized}.SZ`;
|
|
11
|
+
}
|
|
12
|
+
return normalized;
|
|
13
|
+
}
|