Streamlit component for viewing v5 Lightweight Charts
Project description
Streamlit Lightweight Charts v5
A Streamlit component that integrates TradingView's Lightweight Charts v5 library, providing interactive financial charts with multi-pane support for technical analysis.
Overview
Streamlit Lightweight Charts v5 is built around version 5 of the TradingView Lightweight Charts library, which introduces powerful multi-pane capabilities perfect for technical analysis. This component allows you to create great looking financial charts with multiple indicators stacked vertically, similar to popular trading platforms.
Key features:
- Multi-pane chart layouts for price and indicators
- Customizable themes and styles
- Add your own favourite standalone technical indicators (RSI, MACD, Williams %R etc.)
- Use overlay indicators (Moving Averages, AVWAP, Pivot Points...)
- Support for drawing Rectangles for e.g. Support / Resistance areas from code
- Yield curve charts
- Supports Screenshots
Installation
python3 -m venv venv
source venv/bin/activate
pip install streamlit-lightweight-charts-v5
pip install yfinance>=1.0 # Required: v1.0+ to avoid rate limiting
Note: yfinance 1.0 or higher is required to avoid Yahoo Finance API rate limiting issues.
Quick Start
import streamlit as st
from lightweight_charts_v5 import lightweight_charts_v5_component
import yfinance as yf
# Load stock data
ticker = "AAPL"
data = yf.download(ticker, period="100d", interval="1d", auto_adjust=False)
# Convert data to Lightweight Charts format, ensuring values are proper floats
chart_data = [
{"time": str(date.date()), "value": float(row["Close"])}
for date, row in data.iterrows()
]
# Streamlit app
st.title(f"{ticker} Stock Price Line Chart")
# Render the chart
lightweight_charts_v5_component(
name=f"{ticker} Chart",
charts=[{
"chart": {"layout": {"background": {"color": "#FFFFFF"}}},
"series": [{
"type": "Line",
"data": chart_data,
"options": {"color": "#2962FF"}
}],
"height": 400
}],
height=400
)
Demos
The repository includes a demo/ directory with two example scripts that showcase how to use the component.
minimal_demo.py: A minimal example using Yahoo Finance stock datachart_demo.py: A slightly more advanced example with multiple indicatorschart_themes.py: Theme customization examples for the chart_demo module.indicators.py: Example indicators for the chart_demo module.yield_curve.py: Yield curve example chart for the chart_demo module.
You can find the demo files in the GitHub repository.
Running the Demo Applications
To test the two demo scripts, run them using Streamlit:
streamlit run demo/minimal_demo.py # Minimal example
streamlit run demo/chart_demo.py # Full demo with indicators
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 streamlit_lightweight_charts_v5-0.1.8.tar.gz.
File metadata
- Download URL: streamlit_lightweight_charts_v5-0.1.8.tar.gz
- Upload date:
- Size: 613.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58370f97b2e34bd2e434d3d2648604bb9c88df7c5f93979bf6c94cec9c1873ad
|
|
| MD5 |
f8bc1ad3c275ae05e780f5d63df6435a
|
|
| BLAKE2b-256 |
0f624193592c09de27ee68069259547e132729dab1f8b932e913ad92e29a8f63
|
File details
Details for the file streamlit_lightweight_charts_v5-0.1.8-py3-none-any.whl.
File metadata
- Download URL: streamlit_lightweight_charts_v5-0.1.8-py3-none-any.whl
- Upload date:
- Size: 617.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bd1dab82603887b1a4f72de046ac277dfbab2f0443f5dc13a15313426a539c
|
|
| MD5 |
a51124561bacfcbac9cf9cdde9f4dc08
|
|
| BLAKE2b-256 |
aff1358baba0119b81e71b13d10b892eb1d37469ab9e6d2fbcfc4494dfeab053
|