📊 dash-tvlwc
Financial charts for Dash, written in Python.
A Dash component that wraps TradingView Lightweight Charts, so you can build candlestick, line, area and volume charts without writing any JavaScript.
Why this and not a general plotting library
Lightweight Charts is built for one job: price series that stay smooth while you pan, zoom and stream into them. It handles very large series at 60fps, which general-purpose plotting libraries are not designed for.
This package makes it an ordinary Dash component. You describe the chart with Python dictionaries, and you read and drive it with ordinary Dash callbacks.
Install
pip install dash_tvlwc
Your first chart
import dash
from dash import html
import dash_tvlwc
candles = [
{'time': '2026-01-01', 'open': 100, 'high': 101.3, 'low': 95.1, 'close': 97.6},
{'time': '2026-01-02', 'open': 97.6, 'high': 99.1, 'low': 95.2, 'close': 96.1},
{'time': '2026-01-03', 'open': 96.1, 'high': 98.4, 'low': 90.7, 'close': 92.1},
]
app = dash.Dash(__name__)
app.layout = html.Div([
dash_tvlwc.Tvlwc(
series=[{'id': 'price', 'type': 'candlestick', 'data': candles}],
width='100%',
height=400,
),
])
if __name__ == '__main__':
app.run()
Each series is one dictionary carrying its own id, type and data. Put several in the list to draw several series on one chart.
What you can do
Each of these is an ordinary prop, set or read from a callback.
| Six series types | candlestick, bar, line, area, baseline, histogram |
| Sub-plots | stack panes that share one time axis, for price over volume over an indicator |
| Live streaming | append or revise a single bar without resending the whole series |
| Mouse events | crosshair, click and double-click, reported with the time and price under the cursor |
| Drive the view | set the visible range, scroll, fit to content, or place the crosshair from Python |
| Sync two charts | point them at each other so hovering one moves the other |
| Infinite history | be told when the user scrolls past the start of the data, and send more |
| Markers and price lines | anchored to a bar or to a price |
| Read data back | ask a series for one bar, or for its last value, without shipping the dataset |
| Screenshots | capture the canvas as a PNG |
| Three chart types | a time axis (Tvlwc), a price axis (Tvlwo), a maturity axis (Tvlwy) |
What it cannot do
This is a bridge between Python and a JavaScript charting library, and some things do not survive the crossing:
- Anything that has to be a function - custom scaling logic, colour parsers, axis formatters written in Python. Formatters are still possible, but you write them in a small JavaScript file and refer to them by name.
- Plugins, custom series types and drawing tools. These are JavaScript classes in the underlying library, and a class cannot be expressed as a Dash prop.
- Anything that must react within a single frame, such as dragging a trendline. Every interaction routed through a Python callback costs a network round trip.
- Reading a whole dataset back out of the chart. You can ask for one point at a time; you cannot ask for all of them.
The documentation has a page on each of these and what to do instead.
Documentation
- Documentation site - how to express a chart in Python, with worked examples.
- Lightweight Charts v5 API - the full list of chart and series options. Whatever the library accepts, this component passes through.
demo/app.py- source of the live demo; every panel shows the settings behind it.examples/- runnable apps for styling, callbacks and each capability.
Compatibility
| Python | 3.9 or newer |
| Dash | 3.0 or newer, tested to 4.4 |
| Lightweight Charts | 5.2.1, bundled |
Version 0.2.0 changes the prop schema. Upgrading from 0.1.x is covered by the migration guide.
Contributing
Bug reports and pull requests are welcome. See CONTRIBUTING.md, and DEVELOPMENT.md for building the component from source.
License
MIT. Charts by TradingView, used under the Apache 2.0 license of Lightweight Charts.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dash_tvlwc-0.2.0.tar.gz.
File metadata
- Download URL: dash_tvlwc-0.2.0.tar.gz
- Upload date:
- Size: 279.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21664b8dcfe908f1bbb36e288152eb36fdbdf7d4b787415ebb134ea69c64c032
|
|
| MD5 |
55ac2d72cd9934e96925c369a70fa9d9
|
|
| BLAKE2b-256 |
8e0c5eff5929d3ff8fbbd5ba99d36a4a70c350e49d0a35d190e11ddae6d70826
|
File details
Details for the file dash_tvlwc-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dash_tvlwc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 293.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d04ec6da9dc897804f1d9b8033198da3d294dbb4598f1bcd162d009c2dc21f76
|
|
| MD5 |
ff008559e4d1c257fc2e769f3eab6643
|
|
| BLAKE2b-256 |
964c43018312cd03880a005f95d940a237f16a42343c4ea0c7f153e84c43c28a
|