Python wrapper for TradingView Lightweight Charts
Project description
litecharts
Warning: This library is in alpha. The API may change unexpectedly between versions.
Thin Python wrapper for TradingView Lightweight Charts.
Installation
pip install litecharts
Quick Start
from litecharts import createChart, CandlestickSeries
# Create a chart
chart = createChart({"width": 800, "height": 600})
# Add a candlestick series
candles = chart.addSeries(CandlestickSeries)
candles.setData([
{"time": 1609459200, "open": 100, "high": 105, "low": 95, "close": 102},
{"time": 1609545600, "open": 102, "high": 110, "low": 100, "close": 108},
{"time": 1609632000, "open": 108, "high": 115, "low": 105, "close": 112},
])
# Display the chart
chart.show() # Auto-detects Jupyter or opens browser
Features
- Candlestick, Line, Area, Bar, Histogram, and Baseline series
- Multi-pane layouts with synced time scales
- Pandas DataFrame and NumPy array support
- Jupyter notebook integration
- Self-contained HTML output
Data Input
Accepts multiple formats:
# List of dicts
candles.setData([{"time": 1609459200, "open": 100, "high": 105, "low": 95, "close": 102}])
# Pandas DataFrame
import pandas as pd
df = pd.DataFrame({"open": [100], "high": [105], "low": [95], "close": [102]},
index=pd.to_datetime(["2021-01-01"]))
candles.setData(df)
# NumPy array (columns: time, open, high, low, close)
import numpy as np
arr = np.array([[1609459200, 100, 105, 95, 102]])
candles.setData(arr)
Multi-Pane Charts
from litecharts import createChart, CandlestickSeries, HistogramSeries
chart = createChart({"width": 800, "height": 600})
# Main pane
mainPane = chart.addPane({"heightRatio": 3})
candles = mainPane.addSeries(CandlestickSeries)
candles.setData(ohlcData)
# Volume pane
volumePane = chart.addPane({"heightRatio": 1})
volume = volumePane.addSeries(HistogramSeries)
volume.setData(volumeData)
chart.show()
License
MIT - see LICENSE
This package bundles Lightweight Charts by TradingView, Inc., licensed under Apache 2.0. See THIRD_PARTY_LICENSES.md.
Project details
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 litecharts-0.1.1.tar.gz.
File metadata
- Download URL: litecharts-0.1.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae83f68daf8c052ef86a6b585f49ff371f712300c13842a0d917f4cc23a34655
|
|
| MD5 |
808287dee0eaa9b7b49c2da085c31024
|
|
| BLAKE2b-256 |
3e375f7421603b2162c9e0cec1387dfd54b3db24235824decb17da0ae0a2bec2
|
File details
Details for the file litecharts-0.1.1-py3-none-any.whl.
File metadata
- Download URL: litecharts-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb102ff66332b8f766632e3913b7130e592a5733db56b20ac5489a206b2d0271
|
|
| MD5 |
35a547ae60c1649e21ebe12d85a95773
|
|
| BLAKE2b-256 |
bf64e2a0a961460471fa4726da6188e20c672d1e182d24c5391a56e97a27bab0
|