matplotlib / matplotlib/mplfinance

Feature Request: New style called binance-dark

Open
#614 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.4k
Forks
678
PR merge metrics
No merged PRs in 30d

Description

I would like to suggest the addition of a new style for the mplfinance library. The addition of this feature will improve the plot styles since there isn't a good dark style plot yet and will provide a better user experience.

I have copied the binance dark theme color scheme and code it, so I would like to propose a new style called binance_dark or somethink similar in addition to the binance style. Nevetheless, the style could be definitely be improved even more yet I would like to make the first step.

Additional context
Here is an example code snippet that demonstrates how this feature can be implemented:

```python
binance_dark = {
"base_mpl_style": "dark_background",
"marketcolors": {
"candle": {"up": "#3dc985", "down": "#ef4f60"},
"edge": {"up": "#3dc985", "down": "#ef4f60"},
"wick": {"up": "#3dc985", "down": "#ef4f60"},
"ohlc": {"up": "green", "down": "red"},
"volume": {"up": "#247252", "down": "#82333f"},
"vcedge": {"up": "green", "down": "red"},
"vcdopcod": False,
"alpha": 1,
},
"mavcolors": ("#ad7739", "#a63ab2", "#62b8ba"),
"facecolor": "#1b1f24",
"gridcolor": "#2c2e31",
"gridstyle": "--",
"y_on_right": True,
"rc": {
"axes.grid": True,
"axes.grid.axis": "y",
"axes.edgecolor": "#474d56",
"axes.titlecolor": "red",
"figure.facecolor": "#161a1e",
"figure.titlesize": "x-large",
"figure.titleweight": "semibold",
},
"base_mpf_style": "binance-dark",
}

can = pd.read_csv("data1.csv", parse_dates=True, index_col=0)
# Plot the candlestick chart
mpf.plot(
can,
type="candle",
style=binance_dark,
title="BTCUSDT",
ylabel="Price ($)",
ylabel_lower="Volume",
volume=True,
mav=(2, 4, 6),
update_width_config=dict(candle_linewidth=0.5, candle_width=0.5),
)
````

### Here is a preview of how the style of the plot looks like ##
![output](https://user-images.githubusercontent.com/11527689/235334468-2b29f61a-f546-4e3f-9199-b1d3eb6a9e7c.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a proposed binance_dark style dictionary and an mpf.plot usage example, but names no source file or test. Start by locating how mplfinance defines and exposes existing styles such as binance, then compare a rendered chart with the attached preview. Done means the new style is available through the library and produces the requested dark candlestick plot.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.