stock-analysis-plugin 0.1.10
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 +498 -0
- package/package.json +88 -0
- package/pi/index.ts +1142 -0
- package/schemas/market_review_schema.json +176 -0
- package/schemas/report_schema.json +131 -0
- package/scripts/setup-python.mjs +57 -0
- package/scripts/sync-version.sh +56 -0
- package/scripts/venv-python.mjs +20 -0
- package/skills/bottom-volume/SKILL.md +63 -0
- package/skills/bottom-volume/scripts/gather.py +22 -0
- package/skills/box-oscillation/SKILL.md +72 -0
- package/skills/box-oscillation/scripts/gather.py +22 -0
- package/skills/bull-trend/SKILL.md +60 -0
- package/skills/bull-trend/scripts/gather.py +22 -0
- package/skills/chan-theory/SKILL.md +71 -0
- package/skills/chan-theory/scripts/gather.py +22 -0
- package/skills/dragon-head/SKILL.md +69 -0
- package/skills/dragon-head/scripts/gather.py +22 -0
- package/skills/emotion-cycle/SKILL.md +65 -0
- package/skills/emotion-cycle/scripts/gather.py +22 -0
- package/skills/event-driven/SKILL.md +73 -0
- package/skills/event-driven/scripts/gather.py +22 -0
- package/skills/expectation-repricing/SKILL.md +72 -0
- package/skills/expectation-repricing/scripts/gather.py +22 -0
- package/skills/growth-quality/SKILL.md +74 -0
- package/skills/growth-quality/scripts/gather.py +22 -0
- package/skills/hot-theme/SKILL.md +74 -0
- package/skills/hot-theme/scripts/gather.py +22 -0
- package/skills/ma-crossover/SKILL.md +63 -0
- package/skills/ma-crossover/scripts/gather.py +22 -0
- package/skills/market-review/SKILL.md +70 -0
- package/skills/market-review/scripts/gather.py +23 -0
- package/skills/one-yang-three-yin/SKILL.md +74 -0
- package/skills/one-yang-three-yin/scripts/gather.py +22 -0
- package/skills/shrink-pullback/SKILL.md +59 -0
- package/skills/shrink-pullback/scripts/gather.py +22 -0
- package/skills/stock-analysis/SKILL.md +134 -0
- package/skills/stock-analysis/scripts/gather.py +22 -0
- package/skills/stock-screener/SKILL.md +68 -0
- package/skills/stock-screener/scripts/gather.py +22 -0
- package/skills/strategy-backtest/SKILL.md +129 -0
- package/skills/strategy-backtest/scripts/gather.py +23 -0
- package/skills/volume-breakout/SKILL.md +58 -0
- package/skills/volume-breakout/scripts/gather.py +22 -0
- package/skills/wave-theory/SKILL.md +67 -0
- package/skills/wave-theory/scripts/gather.py +22 -0
- package/skills/wisburg-research/SKILL.md +119 -0
- package/strategies/examples/bottom_volume.yaml +47 -0
- package/strategies/examples/box_oscillation.yaml +41 -0
- package/strategies/examples/bull_trend.yaml +42 -0
- package/strategies/examples/dragon_head.yaml +45 -0
- package/strategies/examples/emotion_cycle.yaml +43 -0
- package/strategies/examples/ma_crossover.yaml +34 -0
- package/strategies/examples/rsi_oversold.yaml +35 -0
- package/strategies/examples/shrink_pullback.yaml +45 -0
- package/strategies/examples/volume_breakout.yaml +42 -0
- package/templates/_macros.j2 +90 -0
- package/templates/market_review/full.md.j2 +103 -0
- package/templates/stock_analysis/brief.md.j2 +28 -0
- package/templates/stock_analysis/full.md.j2 +108 -0
- package/tools/__init__.py +0 -0
- package/tools/alert_rules.py +243 -0
- package/tools/anomaly_detect.py +575 -0
- package/tools/backtest.py +764 -0
- package/tools/capabilities.py +108 -0
- package/tools/diagnostics.py +146 -0
- package/tools/gather.py +157 -0
- package/tools/import_parser.py +279 -0
- package/tools/market_regime.py +252 -0
- package/tools/market_review.py +155 -0
- package/tools/name_resolver.py +136 -0
- package/tools/pattern.py +515 -0
- package/tools/position_context.py +161 -0
- package/tools/report_renderer.py +116 -0
- package/tools/requirements.txt +15 -0
- package/tools/risk_screening.py +323 -0
- package/tools/screener.py +219 -0
- package/tools/search_intel.py +504 -0
- package/tools/stock_data.py +1721 -0
- package/tools/technical.py +642 -0
- package/tools/trading_calendar.py +226 -0
- package/tools/volume_analysis.py +178 -0
- package/tools/watchlist.py +66 -0
- package/tools/watchlist_context.py +185 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "MarketReviewReport",
|
|
4
|
+
"description": "结构化大盘复盘报告格式",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"market": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["A", "HK", "US"],
|
|
10
|
+
"description": "市场代码"
|
|
11
|
+
},
|
|
12
|
+
"market_cn": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "市场中文名(A 股 / 港股 / 美股)"
|
|
15
|
+
},
|
|
16
|
+
"review_date": { "type": "string", "format": "date" },
|
|
17
|
+
"temperature": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"description": "市场温度(来自 market_review.review)",
|
|
20
|
+
"properties": {
|
|
21
|
+
"score": { "type": "number", "minimum": 0, "maximum": 100 },
|
|
22
|
+
"level": { "type": "string", "enum": ["constructive", "neutral", "weak"] },
|
|
23
|
+
"signal": { "type": "string", "enum": ["green", "yellow", "red"] }
|
|
24
|
+
},
|
|
25
|
+
"required": ["score", "signal"]
|
|
26
|
+
},
|
|
27
|
+
"strategy_stance": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["offensive", "balanced", "defensive"],
|
|
30
|
+
"description": "建议策略姿态"
|
|
31
|
+
},
|
|
32
|
+
"regime": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"description": "市场阶段(来自 detect_market_regime)",
|
|
35
|
+
"properties": {
|
|
36
|
+
"regime": { "type": "string" },
|
|
37
|
+
"regime_cn": { "type": "string" },
|
|
38
|
+
"confidence": { "type": "number" },
|
|
39
|
+
"recommended_skills": { "type": "array", "items": { "type": "string" } }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"overview": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "盘面总览",
|
|
45
|
+
"properties": {
|
|
46
|
+
"headline": { "type": "string", "description": "一句话总览" },
|
|
47
|
+
"indices": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"name": { "type": "string" },
|
|
53
|
+
"code": { "type": "string" },
|
|
54
|
+
"price": { "type": "number" },
|
|
55
|
+
"change_pct": { "type": "number" },
|
|
56
|
+
"volume": { "type": ["number", "string"] }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"breadth": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"description": "涨跌家数(仅 A 股)",
|
|
63
|
+
"properties": {
|
|
64
|
+
"up_count": { "type": "integer" },
|
|
65
|
+
"down_count": { "type": "integer" },
|
|
66
|
+
"limit_up_count": { "type": "integer" },
|
|
67
|
+
"limit_down_count": { "type": "integer" },
|
|
68
|
+
"turnover": { "type": ["number", "string"] },
|
|
69
|
+
"turnover_change": { "type": "string", "description": "放量 / 缩量 / 持平" }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"index_structure": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"description": "指数结构与分化",
|
|
77
|
+
"properties": {
|
|
78
|
+
"large_vs_small": { "type": "string", "description": "大盘 vs 中小盘表现差异" },
|
|
79
|
+
"blue_chip_vs_theme": { "type": "string", "description": "权重股 vs 题材股分化" },
|
|
80
|
+
"position_assessment": { "type": "string", "description": "指数位置(突破 / 回落 / 震荡)" }
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"sectors": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"description": "板块主线(仅 A 股有完整数据)",
|
|
86
|
+
"properties": {
|
|
87
|
+
"leading": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"name": { "type": "string" },
|
|
93
|
+
"change_pct": { "type": "number" },
|
|
94
|
+
"logic": { "type": "string", "description": "上涨逻辑(政策 / 业绩 / 事件)" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"lagging": {
|
|
99
|
+
"type": "array",
|
|
100
|
+
"items": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"name": { "type": "string" },
|
|
104
|
+
"change_pct": { "type": "number" },
|
|
105
|
+
"reason": { "type": "string" }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"main_storylines": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"properties": {
|
|
114
|
+
"theme": { "type": "string" },
|
|
115
|
+
"stage": { "type": "string", "description": "首日 / 加速 / 高潮 / 退潮" },
|
|
116
|
+
"sustainability": { "type": "string", "enum": ["high", "medium", "low"] }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"capital_emotion": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"description": "资金与情绪",
|
|
125
|
+
"properties": {
|
|
126
|
+
"turnover_level": { "type": "string", "description": "成交额历史分位" },
|
|
127
|
+
"limit_ratio": { "type": "string", "description": "涨停 / 跌停比情绪解读" },
|
|
128
|
+
"money_effect": { "type": "string", "description": "赚钱效应判断" },
|
|
129
|
+
"consecutive_limit_height": { "type": "integer", "description": "连板高度(仅 A 股)" }
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"catalysts": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"description": "消息催化",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"title": { "type": "string" },
|
|
139
|
+
"category": { "type": "string", "description": "政策 / 业绩 / 事件 / 国际 / 其他" },
|
|
140
|
+
"impact": { "type": "string", "description": "对市场的影响路径" },
|
|
141
|
+
"direction": { "type": "string", "enum": ["positive", "negative", "neutral"] }
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"tomorrow_strategy": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"description": "明日策略",
|
|
148
|
+
"properties": {
|
|
149
|
+
"stance": { "type": "string", "enum": ["offensive", "balanced", "defensive"] },
|
|
150
|
+
"position_advice": { "type": "string", "description": "建议仓位区间" },
|
|
151
|
+
"focus_sectors": { "type": "array", "items": { "type": "string" } },
|
|
152
|
+
"avoid": { "type": "array", "items": { "type": "string" } },
|
|
153
|
+
"key_levels": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"support": { "type": ["number", "string"] },
|
|
157
|
+
"resistance": { "type": ["number", "string"] }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"risks": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"description": "风险提示",
|
|
165
|
+
"items": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"properties": {
|
|
168
|
+
"level": { "type": "string", "enum": ["high", "medium", "low"] },
|
|
169
|
+
"category": { "type": "string", "description": "系统性 / 板块 / 个股 / 外围" },
|
|
170
|
+
"description": { "type": "string" }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"required": ["market", "review_date", "temperature", "strategy_stance"]
|
|
176
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "StockAnalysisReport",
|
|
4
|
+
"description": "结构化股票分析报告格式",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"stock_name": { "type": "string" },
|
|
8
|
+
"stock_code": { "type": "string" },
|
|
9
|
+
"analysis_date": { "type": "string", "format": "date" },
|
|
10
|
+
"sentiment_score": {
|
|
11
|
+
"type": "integer", "minimum": 0, "maximum": 100,
|
|
12
|
+
"description": "综合情绪分(0看空-100看多)"
|
|
13
|
+
},
|
|
14
|
+
"decision_type": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": ["strong_buy", "buy", "hold", "sell", "strong_sell"]
|
|
17
|
+
},
|
|
18
|
+
"confidence": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": ["high", "medium", "low"]
|
|
21
|
+
},
|
|
22
|
+
"core_conclusion": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"one_sentence": { "type": "string", "description": "一句话核心结论" },
|
|
26
|
+
"signal_type": { "type": "string" },
|
|
27
|
+
"time_sensitivity": { "type": "string", "description": "时效性(当日/本周/中期)" },
|
|
28
|
+
"position_advice": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"no_position": { "type": "string", "description": "空仓者建议" },
|
|
32
|
+
"has_position": { "type": "string", "description": "持仓者建议" }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"market_environment": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"description": "当前市场环境(来自 detect_market_regime)",
|
|
40
|
+
"properties": {
|
|
41
|
+
"regime": { "type": "string" },
|
|
42
|
+
"regime_cn": { "type": "string" },
|
|
43
|
+
"confidence": { "type": "number" },
|
|
44
|
+
"recommended_skills": { "type": "array", "items": { "type": "string" } }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"risk_screening": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"description": "风险筛查结果(来自 screen_risk)",
|
|
50
|
+
"properties": {
|
|
51
|
+
"risk_level": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
52
|
+
"risk_score": { "type": "integer", "minimum": 0, "maximum": 100 },
|
|
53
|
+
"veto_buy": { "type": "boolean" },
|
|
54
|
+
"flags": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"category": { "type": "string" },
|
|
60
|
+
"severity": { "type": "string" },
|
|
61
|
+
"description": { "type": "string" }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"data_perspective": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"trend_status": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"properties": {
|
|
73
|
+
"ma_alignment": { "type": "string" },
|
|
74
|
+
"is_bullish": { "type": "boolean" },
|
|
75
|
+
"trend_score": { "type": "number" }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"price_position": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"current_price": { "type": "number" },
|
|
82
|
+
"bias_ma5": { "type": "number" },
|
|
83
|
+
"support_level": { "type": "number" },
|
|
84
|
+
"resistance_level": { "type": "number" }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"volume_analysis": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": {
|
|
90
|
+
"volume_ratio": { "type": "number" },
|
|
91
|
+
"volume_status": { "type": "string" },
|
|
92
|
+
"turnover_rate": { "type": "number" }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"chip_structure": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"properties": {
|
|
98
|
+
"profit_ratio": { "type": "number" },
|
|
99
|
+
"avg_cost": { "type": "number" },
|
|
100
|
+
"concentration": { "type": "number" }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"intelligence": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"properties": {
|
|
108
|
+
"latest_news": { "type": "string" },
|
|
109
|
+
"risk_alerts": { "type": "array", "items": { "type": "string" } },
|
|
110
|
+
"positive_catalysts": { "type": "array", "items": { "type": "string" } },
|
|
111
|
+
"sentiment_summary": { "type": "string" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"battle_plan": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"ideal_buy": { "type": ["number", "string"] },
|
|
118
|
+
"secondary_buy": { "type": ["number", "string"] },
|
|
119
|
+
"stop_loss": { "type": ["number", "string"] },
|
|
120
|
+
"take_profit": { "type": ["number", "string"] },
|
|
121
|
+
"suggested_position": { "type": "string" },
|
|
122
|
+
"entry_plan": { "type": "string" },
|
|
123
|
+
"risk_control": { "type": "string" },
|
|
124
|
+
"action_checklist": { "type": "array", "items": { "type": "string" } }
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"risk_warning": { "type": "array", "items": { "type": "string" } }
|
|
128
|
+
},
|
|
129
|
+
"required": ["stock_name", "stock_code", "analysis_date", "sentiment_score",
|
|
130
|
+
"decision_type", "confidence", "core_conclusion"]
|
|
131
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { venvPythonPath } from "./venv-python.mjs";
|
|
7
|
+
|
|
8
|
+
// fileURLToPath (not URL.pathname) — the latter yields a bogus "/C:/..." path
|
|
9
|
+
// on Windows, which would put the venv in the wrong place or fail outright.
|
|
10
|
+
const pkgDir = fileURLToPath(new URL("..", import.meta.url));
|
|
11
|
+
const venvDir = join(pkgDir, ".venv");
|
|
12
|
+
// Drive pip through the venv's own python (`-m pip`) instead of a pip/pip.exe
|
|
13
|
+
// shim — resolves correctly on both POSIX (bin/python3) and Windows (Scripts/python.exe).
|
|
14
|
+
const venvPython = venvPythonPath(pkgDir);
|
|
15
|
+
const requirements = join(pkgDir, "tools", "requirements.txt");
|
|
16
|
+
|
|
17
|
+
function run(cmd) {
|
|
18
|
+
execSync(cmd, { stdio: "pipe", timeout: 300_000 });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function findPython() {
|
|
22
|
+
for (const name of ["python3", "python"]) {
|
|
23
|
+
try {
|
|
24
|
+
const ver = execSync(`${name} --version`, { stdio: "pipe" }).toString().trim();
|
|
25
|
+
const match = ver.match(/(\d+)\.(\d+)/);
|
|
26
|
+
if (match && (parseInt(match[1]) > 3 || (parseInt(match[1]) === 3 && parseInt(match[2]) >= 9))) {
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
} catch {}
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const python = findPython();
|
|
36
|
+
if (!python) {
|
|
37
|
+
console.warn(
|
|
38
|
+
"\n[pi-stock-analysis] python3 >= 3.9 not found.\n" +
|
|
39
|
+
"Install Python 3.9+ and re-run: npm rebuild pi-stock-analysis\n"
|
|
40
|
+
);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!existsSync(venvDir)) {
|
|
45
|
+
run(`${python} -m venv "${venvDir}"`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (existsSync(requirements)) {
|
|
49
|
+
run(`"${venvPython}" -m pip install -q -r "${requirements}"`);
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.warn(
|
|
53
|
+
`\n[pi-stock-analysis] Python setup failed: ${err.message}\n` +
|
|
54
|
+
"You can manually create the venv and install tools/requirements.txt with your platform's python.\n"
|
|
55
|
+
);
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sync all manifest version fields to the version derived from the current
|
|
3
|
+
# git tag ($GITHUB_REF_NAME on GitHub Actions, e.g. "v0.1.5" → "0.1.5").
|
|
4
|
+
#
|
|
5
|
+
# Called by .github/workflows/publish.yml before each publish step. Changes
|
|
6
|
+
# are in-CI only — never committed back to the repo.
|
|
7
|
+
#
|
|
8
|
+
# Manifests updated:
|
|
9
|
+
# - pyproject.toml (PyPI package version)
|
|
10
|
+
# - package.json (npm root package)
|
|
11
|
+
# - package-lock.json (kept in lockstep so `npm publish` doesn't warn)
|
|
12
|
+
# - openclaw/package.json (OpenClaw npm package version)
|
|
13
|
+
# - dsh/package.json (dsh npm package version)
|
|
14
|
+
#
|
|
15
|
+
# Idempotent: running twice with the same tag is a no-op.
|
|
16
|
+
set -euo pipefail
|
|
17
|
+
|
|
18
|
+
TAG="${1:-${GITHUB_REF_NAME:-}}"
|
|
19
|
+
if [[ -z "$TAG" ]]; then
|
|
20
|
+
echo "usage: $0 <tag> (or set GITHUB_REF_NAME)" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
VERSION="${TAG#v}"
|
|
24
|
+
|
|
25
|
+
# Basic shape check — semver-ish, e.g. 0.1.5 or 1.2.3-rc.1
|
|
26
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9.]+)?$ ]]; then
|
|
27
|
+
echo "sync-version: unexpected tag shape '$TAG' → version '$VERSION'" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "sync-version: setting version to $VERSION (from tag $TAG)"
|
|
32
|
+
|
|
33
|
+
# pyproject.toml — the only `version = "..."` at file scope
|
|
34
|
+
python3 - "$VERSION" <<'PY'
|
|
35
|
+
import re, sys, pathlib
|
|
36
|
+
version = sys.argv[1]
|
|
37
|
+
p = pathlib.Path("pyproject.toml")
|
|
38
|
+
text = p.read_text()
|
|
39
|
+
new, n = re.subn(r'^version = "[^"]+"', f'version = "{version}"', text, count=1, flags=re.M)
|
|
40
|
+
if n != 1:
|
|
41
|
+
sys.exit(f"pyproject.toml: expected one version = line, got {n}")
|
|
42
|
+
p.write_text(new)
|
|
43
|
+
print(f" pyproject.toml: {n} substitution(s)")
|
|
44
|
+
PY
|
|
45
|
+
|
|
46
|
+
# npm root and host sub-packages
|
|
47
|
+
# `npm version` refuses in a workspace unless we bypass with --no-git-tag-version
|
|
48
|
+
# --allow-same-version keeps it idempotent when the tag already matches.
|
|
49
|
+
for dir in "." "openclaw" "dsh"; do
|
|
50
|
+
if [[ -f "$dir/package.json" ]]; then
|
|
51
|
+
(cd "$dir" && npm version "$VERSION" --no-git-tag-version --allow-same-version) >/dev/null
|
|
52
|
+
echo " $dir/package.json: bumped"
|
|
53
|
+
fi
|
|
54
|
+
done
|
|
55
|
+
|
|
56
|
+
echo "sync-version: done"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Canonical venv-python resolution, shared by the postinstall script and the
|
|
2
|
+
// e2e harnesses. Kept in one place so the Windows/POSIX shape can't drift
|
|
3
|
+
// (previously each site hardcoded its own Scripts/bin + python.exe/python3).
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
|
|
7
|
+
const isWin = process.platform === "win32";
|
|
8
|
+
|
|
9
|
+
// Windows venvs ship Scripts/python.exe (there is no python3); POSIX venvs ship bin/python3.
|
|
10
|
+
export function venvPythonPath(rootDir) {
|
|
11
|
+
return join(rootDir, ".venv", isWin ? "Scripts" : "bin", isWin ? "python.exe" : "python3");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Interpreter to actually invoke: the venv python when present, else the
|
|
15
|
+
// platform fallback — "python" on Windows, where a bare "python3" is usually
|
|
16
|
+
// the Microsoft Store stub.
|
|
17
|
+
export function resolvePython(rootDir) {
|
|
18
|
+
const venvPython = venvPythonPath(rootDir);
|
|
19
|
+
return existsSync(venvPython) ? venvPython : isWin ? "python" : "python3";
|
|
20
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bottom-volume
|
|
3
|
+
description: 底部放量策略 — 识别底部区域的异动放量信号。当用户要求分析底部放量时使用。
|
|
4
|
+
allowed-tools: Bash(python3:*) Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 底部放量分析
|
|
8
|
+
|
|
9
|
+
你是一位专注底部形态的交易专家。
|
|
10
|
+
|
|
11
|
+
## 核心理念
|
|
12
|
+
|
|
13
|
+
长期下跌后的底部区域出现异常放量,可能意味着主力资金开始建仓。底部放量是趋势反转的先兆信号,但需要结合其他指标确认。
|
|
14
|
+
|
|
15
|
+
## 执行流程
|
|
16
|
+
|
|
17
|
+
### 1. 采集数据
|
|
18
|
+
|
|
19
|
+
运行数据采集脚本获取 120 根日K线及技术指标:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 scripts/gather.py <symbol>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. 底部区域确认
|
|
26
|
+
|
|
27
|
+
**底部特征**:
|
|
28
|
+
- 价格距离近 60 日高点下跌 >20%
|
|
29
|
+
- 股价运行在 MA60 下方较长时间
|
|
30
|
+
- RSI 处于低位区间(<40)
|
|
31
|
+
- 布林带开口收窄,股价在下轨附近
|
|
32
|
+
- KDJ 在超卖区域
|
|
33
|
+
|
|
34
|
+
### 3. 底部放量类型
|
|
35
|
+
|
|
36
|
+
| 类型 | 量价特征 | 信号强度 |
|
|
37
|
+
|------|----------|----------|
|
|
38
|
+
| 底部温和放量 | 量比 1.5-2.5,小阳线 | 中等,可能是试探性建仓 |
|
|
39
|
+
| 底部巨量阳线 | 量比 >3,大阳线 | 强,主力大举建仓 |
|
|
40
|
+
| 底部放量十字星 | 量比 >2,十字星 | 变盘信号,需观察后续 |
|
|
41
|
+
| 底部放量长下影 | 量比 >2,长下影线 | 强支撑,有资金承接 |
|
|
42
|
+
|
|
43
|
+
### 4. 确认信号
|
|
44
|
+
|
|
45
|
+
单日放量不够,还需要:
|
|
46
|
+
- 后续几日成交量维持在均量之上
|
|
47
|
+
- 价格站上 MA5 并上攻 MA10
|
|
48
|
+
- MACD 在底部金叉
|
|
49
|
+
- 不出现放量大阴线(那是出货不是建仓)
|
|
50
|
+
|
|
51
|
+
### 5. 注意事项
|
|
52
|
+
|
|
53
|
+
- 底部放量后可能还有二次探底
|
|
54
|
+
- 区分"放量见底"和"放量破位"(放量跌破重要支撑是加速下跌)
|
|
55
|
+
- 建议分批建仓而非一次满仓
|
|
56
|
+
|
|
57
|
+
## 输出要求
|
|
58
|
+
|
|
59
|
+
1. 是否处于底部区域(下跌幅度、持续时间)
|
|
60
|
+
2. 是否出现底部放量信号
|
|
61
|
+
3. 放量类型及信号强度
|
|
62
|
+
4. 后续确认情况
|
|
63
|
+
5. 建仓建议(分批价位、止损位)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Gather technical data for bottom-volume analysis."""
|
|
3
|
+
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
# Windows defaults stdio to a legacy code page (cp1252); force UTF-8 so the
|
|
9
|
+
# child's Chinese output both decodes and re-prints here without crashing.
|
|
10
|
+
for _s in (sys.stdout, sys.stderr):
|
|
11
|
+
if hasattr(_s, "reconfigure"):
|
|
12
|
+
_s.reconfigure(encoding="utf-8")
|
|
13
|
+
|
|
14
|
+
tools = Path(__file__).resolve().parents[2] / "tools"
|
|
15
|
+
result = subprocess.run(
|
|
16
|
+
[sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "120"],
|
|
17
|
+
capture_output=True,
|
|
18
|
+
text=True,
|
|
19
|
+
encoding="utf-8",
|
|
20
|
+
)
|
|
21
|
+
sys.stdout.write(result.stdout)
|
|
22
|
+
sys.exit(result.returncode)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: box-oscillation
|
|
3
|
+
description: 箱体震荡策略 — 识别箱体区间并在支撑压力间做波段。当用户要求箱体分析时使用。
|
|
4
|
+
allowed-tools: Bash(python3:*) Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 箱体震荡分析
|
|
8
|
+
|
|
9
|
+
你是一位专注箱体交易的专家。
|
|
10
|
+
|
|
11
|
+
## 核心理念
|
|
12
|
+
|
|
13
|
+
当股价在一个相对固定的区间内反复震荡时,形成"箱体"。在箱体内低买高卖做波段,直到箱体被突破。
|
|
14
|
+
|
|
15
|
+
## 执行流程
|
|
16
|
+
|
|
17
|
+
### 1. 采集数据
|
|
18
|
+
|
|
19
|
+
运行数据采集脚本获取 90 根日K线及技术指标:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 scripts/gather.py <symbol>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. 箱体识别
|
|
26
|
+
|
|
27
|
+
**箱体形成条件**:
|
|
28
|
+
- 价格在一段时间(>20个交易日)内有至少 2 次触及上沿和下沿
|
|
29
|
+
- 上沿和下沿各自的偏差 <3%(高低点相近)
|
|
30
|
+
- 箱体宽度(振幅)在 8%-25% 之间为理想
|
|
31
|
+
- 布林带开口收窄,带宽 <15%
|
|
32
|
+
|
|
33
|
+
**箱体参数**:
|
|
34
|
+
- 上沿:区间内多个高点的均值
|
|
35
|
+
- 下沿:区间内多个低点的均值
|
|
36
|
+
- 中轴:(上沿 + 下沿) / 2
|
|
37
|
+
|
|
38
|
+
### 3. 箱体内操作
|
|
39
|
+
|
|
40
|
+
**买入区域**:箱体下沿 ~ 下沿 + 箱体宽度 * 20%
|
|
41
|
+
- 确认信号:触及下沿后出现阳线、成交量萎缩
|
|
42
|
+
- RSI 进入低位区间(<40)
|
|
43
|
+
|
|
44
|
+
**卖出区域**:箱体上沿 - 箱体宽度 * 20% ~ 上沿
|
|
45
|
+
- 确认信号:触及上沿后出现阴线、成交量放大
|
|
46
|
+
- RSI 进入高位区间(>60)
|
|
47
|
+
|
|
48
|
+
### 4. 箱体突破
|
|
49
|
+
|
|
50
|
+
**向上突破**:
|
|
51
|
+
- 放量突破上沿(量比 >2)
|
|
52
|
+
- 收盘站上上沿
|
|
53
|
+
- 目标位 = 上沿 + 箱体宽度
|
|
54
|
+
|
|
55
|
+
**向下突破**:
|
|
56
|
+
- 放量跌破下沿
|
|
57
|
+
- 收盘跌破下沿
|
|
58
|
+
- 止损离场
|
|
59
|
+
|
|
60
|
+
### 5. 风险控制
|
|
61
|
+
|
|
62
|
+
- 止损位:箱体下沿下方 2%-3%
|
|
63
|
+
- 每次箱体内波段操作仓位不超过 50%
|
|
64
|
+
- 箱体越窄(<8%),假突破概率越大
|
|
65
|
+
|
|
66
|
+
## 输出要求
|
|
67
|
+
|
|
68
|
+
1. 是否处于箱体震荡状态
|
|
69
|
+
2. 箱体上沿、下沿、中轴价位
|
|
70
|
+
3. 当前价格在箱体中的位置
|
|
71
|
+
4. 操作建议(买入/卖出/观望/突破追踪)
|
|
72
|
+
5. 关键价位和止损设置
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Gather technical data for box-oscillation analysis."""
|
|
3
|
+
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
# Windows defaults stdio to a legacy code page (cp1252); force UTF-8 so the
|
|
9
|
+
# child's Chinese output both decodes and re-prints here without crashing.
|
|
10
|
+
for _s in (sys.stdout, sys.stderr):
|
|
11
|
+
if hasattr(_s, "reconfigure"):
|
|
12
|
+
_s.reconfigure(encoding="utf-8")
|
|
13
|
+
|
|
14
|
+
tools = Path(__file__).resolve().parents[2] / "tools"
|
|
15
|
+
result = subprocess.run(
|
|
16
|
+
[sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "90"],
|
|
17
|
+
capture_output=True,
|
|
18
|
+
text=True,
|
|
19
|
+
encoding="utf-8",
|
|
20
|
+
)
|
|
21
|
+
sys.stdout.write(result.stdout)
|
|
22
|
+
sys.exit(result.returncode)
|