Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug Report: Inconsistent Volume Bar Border Colors Between v0.12.9b7 and v0.12.10b0 When Using make_marketcolors

未关闭
#676 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
matplotlib, python

调研方向

首先使用 mplfinance v0.12.9b7 和 v0.12.10b0 运行最小测试代码,重点关注启用 volume 时的 make_marketcolors、make_mpf_style 和 mpf.plot。跟踪反转后的 volume 颜色如何传递到 volume 柱,并比较渲染出的边框。完成的标准是:较新版本使用请求的 market colors 生成颜色一致的 volume 柱边框。

由索引模型根据 Issue 内容生成。

描述

bug

Description
When changing the volume colors using make_marketcolors, the results differ between versions v0.12.9b7 and v0.12.10b0. The older version looks fine, but in the newer version, the border color of the volume bars appears inconsistent.

Minimal Test Code

import mplfinance as mpf
import pandas as pd

# Sample data
dates = pd.date_range('2023-01-01', periods=10)
data = {
    'Open': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'High': [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
    'Low': [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5],
    'Close': [2, 1, 4, 3, 6, 5, 8, 7, 10, 9],
    'Volume': [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
}
df = pd.DataFrame(data, index=dates)

# Get the 'yahoo' style
yahoo_style = mpf.make_mpf_style(base_mpf_style='yahoo')

# Access the 'yahoo' style market colors
yahoo_market_colors = yahoo_style['marketcolors']

# Reverse the colors
reversed_market_colors = mpf.make_marketcolors(
    up=yahoo_market_colors['candle']['down'],
    down=yahoo_market_colors['candle']['up'],
    edge={'up': yahoo_market_colors['edge']['down'], 'down': yahoo_market_colors['edge']['up']},
    wick={'up': yahoo_market_colors['wick']['down'], 'down': yahoo_market_colors['wick']['up']},
    ohlc={'up': yahoo_market_colors['ohlc']['down'], 'down': yahoo_market_colors['ohlc']['up']},
    volume={'up': yahoo_market_colors['volume']['down'], 'down': yahoo_market_colors['volume']['up']}
)

# Define a new style with reversed colors
reversed_style = mpf.make_mpf_style(base_mpf_style='yahoo', marketcolors=reversed_market_colors)

# Plot the candlestick chart
mpf.plot(df, type='candle', volume=True, style=reversed_style)

Screenshots
v0.12.9b7 (looks fine):
download

v0.12.10b0 (the border color of the volume bars appears inconsistent):
download-1

主要语言
Python
星标
4.4k
派生
678
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

matplotlib/mplfinance 的其他 Issue

查看 matplotlib/mplfinance 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。