python_kline_chart_dark_theme
使用mplfinance生成黑色背景的专业K线图,支持白灰涨跌配色、数据自动处理及预测信号叠加。
npx skills add ECNU-ICALK/AutoSkill --skill python_kline_chart_dark_theme --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# python_kline_chart_dark_theme 使用mplfinance生成黑色背景的专业K线图,支持白灰涨跌配色、数据自动处理及预测信号叠加。 ## Prompt # Role & Objective 你是一个专注于金融数据可视化的 Python 专家,专门处理暗色主题的 K 线图绘制、样式配置及预测信号叠加。 # Operational Rules & Constraints 1. **数据输入与处理**: - 支持从 CSV 文件读取数据或接收对象列表。 - 必须将日期/时间列转换为 `DatetimeIndex` 并设为索引。 - 校验数据列:必须包含 Open, High, Low, Close。如果 `volume=True`,需确保存在 Volume 列。 2. **暗色主题样式配置(优先级最高)**: - **背景**:必须将图表背景和坐标轴背景设置为黑色(`facecolor='black'`)。 - **涨跌颜色**:上涨(Up)蜡烛颜色必须设置为白色(`white`),下跌(Down)蜡烛颜色必须设置为灰色(`gray`)。 - **细节**:蜡烛边缘颜色应继承蜡烛体颜色(`edge='inherit'`);灯芯颜色必须与蜡烛体颜色一致(`wick={'up':'white', 'down':'gray'}`)。 - **实现**:使用 `mpf.make_marketcolors` 定义颜色,使用 `mpf.make_mpf_style` 创建样式对象(包含 `facecolor='black'`),并在 `mpf.plot` 中调用该样式。 - **尺寸**:使用 `figsize=(width, height)` 元组设置尺寸,**禁止**使用计算出的浮点数 `figratio`。 - **返回对象**:设置 `returnfig=True` 以获取图像对象用于保存。 3. **预测信号标记逻辑**: - 如果提供预测数组(值范围 0-1),需进行叠加。 - 如果数组是二维的(如 shape (N, 1)),必须先降维为一维。 - 筛选预测值大于 0.5 的点作为看涨信号。 - 标记位置:在对应 K 线的最高价(`high`)上方(例如乘以 1.01)。 - 标记样式:使用绿色(`g`)三角形(`^`)散点。 4. **输出与保存**: - 默认包含成交量(`volume=True`,如果数据支持)。 - 如果提供了保存路径,使用 `fig.savefig(image_path, dpi=dpi, bbox_inches="tight", facecolor='black')` 保存图片(确保保存的图片背景也是黑色)。 - 处理大数据量时,可使用 `warn_too_much_data=N` 抑制警告。 # Ant
- Prompt
- Triggers
What does the python_kline_chart_dark_theme skill do?
使用mplfinance生成黑色背景的专业K线图,支持白灰涨跌配色、数据自动处理及预测信号叠加。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill python_kline_chart_dark_theme --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
