Lightweight Charts vs mplfinance: interactive web charts or Python candlesticks?
Whatever bot or backtest you build, you will want to see the prices it traded on. Lightweight Charts and mplfinance both draw candlesticks, but in different worlds: Lightweight Charts is a JavaScript library that puts an interactive chart on a web page, while mplfinance is a Python package that turns a pandas DataFrame into a chart with one call. Neither one is a data source or a trading platform, so you bring the prices. This comparison uses only the facts on each tool's review page. Any chart you draw is an illustration of past data: it does not promise any result.
Short answer
- Lightweight Charts: Developers who want to show prices or bot results on their own dashboard or status page, with interactive charts and plugins (intermediate); Apache-2.0, with a required attribution to TradingView.
- mplfinance: Python users who want to check signals, add charts to reports or bot alerts, or inspect a backtest quickly from a DataFrame (beginner); free, under a custom Matplotlib licence.
Want the next comparison in your pocket? Follow our free channel.
| Lightweight Charts | mplfinance | |
|---|---|---|
| Price | Free and open source (Apache-2.0). Check the official website for details. | Free (custom Matplotlib Development Team license agreement, see the LICENSE file). |
| Cost model | Free | Free |
| Open source | Yes | No |
| License | Apache-2.0 | Custom license agreement (Matplotlib Development Team) |
| Level | Intermediate | Beginner |
| Best for | Developers who want to show prices or bot results on their own dashboard or status page, with interactive charts and plugins (intermediate); Apache-2.0, with a required attribution to TradingView. | Python users who want to check signals, add charts to reports or bot alerts, or inspect a backtest quickly from a DataFrame (beginner); free, under a custom Matplotlib licence. |
Lightweight Charts
Put a smooth, interactive price chart on your own dashboard or bot status page with one npm package, and extend it with plugins.
Best for: Developers who want to show prices or bot results on their own dashboard or status page, with interactive charts and plugins (intermediate); Apache-2.0, with a required attribution to TradingView.
Strengths
- Described by TradingView as one of the smallest and fastest financial HTML5 charts.
- Installs with npm, or loads from a CDN with a standalone build that needs no bundler.
- Extensible through custom plugins, with a plugin catalog and examples.
- Official guidance for AI coding assistants is provided for the v5 API.
Good to know
- The license requires identifying TradingView as the creator: include the NOTICE attribution and link to tradingview.com on any site or app you publish.
- It is a charting library, not a data source or trading platform: you must supply your own price data and write the code.
- Standalone builds bundle their dependencies; the other builds do not.
- The latest master build is installed from pkg.pr.new and has not been through a release, so use a tagged version for real projects.
mplfinance
Turn a price DataFrame into a clean candlestick chart with volume and moving averages in a single mpf.plot() call.
Best for: Python users who want to check signals, add charts to reports or bot alerts, or inspect a backtest quickly from a DataFrame (beginner); free, under a custom Matplotlib licence.
Strengths
- One call, mpf.plot(), draws OHLC bars, candles, line, Renko or Point and Figure charts from a DataFrame with a DatetimeIndex.
- Volume panel with volume=True and moving averages with the mav keyword.
- Custom studies and extra panels through addplot, with guides for styling, saving plots and real-time animation.
- Installs with pip install --upgrade mplfinance; it needs matplotlib and pandas.
Good to know
- The license is a custom agreement rather than a standard OSI license, so read it before commercial use.
- The last code change on GitHub was in August 2024, so check the repository for current activity.
- The old mpl_finance API is deprecated; old imports must move to mplfinance.original_flavor, which the README says may be removed someday.
- It draws static charts with matplotlib; it is not a data source or a backtesting engine.
Which one should you choose?
Pick by where the chart will live. Choose mplfinance if you work in Python and want a candlestick chart with volume and moving averages from a DataFrame in a single mpf.plot() call, for example to save an image for a report or an alert. Choose Lightweight Charts if you want a smooth, interactive chart on a web page you publish and are comfortable with JavaScript or TypeScript. Good to know: Lightweight Charts requires you to credit TradingView (NOTICE attribution and a link to tradingview.com) and its latest master build is not a tagged release, so use a tagged version. mplfinance uses a custom licence rather than a standard OSI one, so read it before commercial use, and its last code change on GitHub was in August 2024. Both need your own price data and neither promises profit, so test any rule on past data with trading costs included.
Quick answers
Which one is easiest to start with?
By our review level, mplfinance is rated beginner. Levels: mplfinance (beginner); Lightweight Charts (intermediate). Start in a simulated or demo mode whenever the tool has one.
How much do they cost and what licence do they use?
Lightweight Charts: Free and open source (Apache-2.0). Check the official website for details (licence: Apache-2.0). mplfinance: Free (custom Matplotlib Development Team license agreement, see the LICENSE file) (licence: Custom license agreement (Matplotlib Development Team)). Prices change, so check the official websites before you decide.
What should I know before choosing?
Lightweight Charts: The license requires identifying TradingView as the creator: include the NOTICE attribution and link to tradingview.com on any site or app you publish. mplfinance: The license is a custom agreement rather than a standard OSI license, so read it before commercial use.
Guides that use these tools
Want a bot like this when custom bots open? Get notified · more bot ideas
Coming soon: custom bots
We are preparing a service to code, backtest and automate trading and statistics bots to your own rules. It is not available yet: follow our Telegram channel to know when it opens.
Sources
- Lightweight Charts: https://raw.githubusercontent.com/tradingview/lightweight-charts/master/README.md
- mplfinance: https://raw.githubusercontent.com/matplotlib/mplfinance/master/README.md
- mplfinance: https://api.github.com/repos/matplotlib/mplfinance
- mplfinance: https://raw.githubusercontent.com/matplotlib/mplfinance/master/LICENSE