Metadata-Version: 2.4
Name: streamlit-lightweight-charts-v5
Version: 0.2.0
Summary: Streamlit component for viewing v5 Lightweight Charts
Project-URL: Homepage, https://github.com/locupleto/streamlit-lightweight-charts-v5
Project-URL: Changelog, https://github.com/locupleto/streamlit-lightweight-charts-v5/blob/main/CHANGELOG.md
Author-email: Urban Ottosson <urban@ottosson.org>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Requires-Dist: streamlit>=1.0
Provides-Extra: demo
Requires-Dist: numpy; extra == 'demo'
Requires-Dist: yfinance; extra == 'demo'
Provides-Extra: devel
Requires-Dist: pillow>=10; extra == 'devel'
Requires-Dist: playwright>=1.49; extra == 'devel'
Requires-Dist: pytest-playwright>=0.7; extra == 'devel'
Requires-Dist: pytest-rerunfailures>=14; extra == 'devel'
Requires-Dist: pytest>=8; extra == 'devel'
Requires-Dist: requests>=2.32; extra == 'devel'
Description-Content-Type: text/markdown

# 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
- Volume Profile overlay with pivot-based horizontal volume distribution
- Ichimoku Cloud overlay with regime-colored kumo fill between the Senkou spans
- Yield curve charts
- Supports Screenshots

![Screenshot](https://github.com/locupleto/streamlit-lightweight-charts-v5/raw/main/Screenshot_1.png)

![Screenshot](https://github.com/locupleto/streamlit-lightweight-charts-v5/raw/main/Screenshot_2.png)

![Screenshot](https://github.com/locupleto/streamlit-lightweight-charts-v5/raw/main/Screenshot_3.png)

![Volume Profile](https://github.com/locupleto/streamlit-lightweight-charts-v5/raw/main/Screenshot_4.png)

![Ichimoku Cloud](https://github.com/locupleto/streamlit-lightweight-charts-v5/raw/main/Screenshot_5.png?v=2)

## Installation

```bash
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 running into Yahoo Finance API rate limiting issues when running the demos.

## Quick Start

```python
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 data
- `chart_demo.py`: A slightly more advanced example with multiple indicators. Includes StockChart, Volume Profile, Ichimoku, Yield Curve, and Multi-Chart demos via a dropdown selector
- `volume_profile_demo.py`: Volume profile overlay with configurable pivot detection, price bins, and value area
- `ichimoku_demo.py`: Ichimoku Cloud overlay with the kumo filled between the forward-displaced Senkou spans, colored green/red by regime
- `chart_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](https://github.com/locupleto/streamlit-lightweight-charts-v5/tree/main/demo).

## Running the Demo Applications 

To test the two demo scripts, run them using **Streamlit**:

```bash
streamlit run demo/minimal_demo.py          # Minimal example
streamlit run demo/chart_demo.py            # Full demo with indicators
streamlit run demo/volume_profile_demo.py   # Volume profile overlay demo
streamlit run demo/ichimoku_demo.py         # Ichimoku Cloud overlay demo
```

## License

This project is licensed under the MIT License.
