Skip to main content

Streamlit wrapper for TradingView's lightweight-charts with ultra-simplified API and performance optimizations

Project description

Streamlit Lightweight Charts Pro

PyPI version Python 3.10+ License: MIT

Professional-grade financial charting library for Streamlit applications

Streamlit Lightweight Charts Pro is a comprehensive Streamlit wrapper that brings TradingView's powerful lightweight-charts library to Streamlit with an intuitive, fluent API. Built on top of lightweight-charts-pro, it provides seamless integration with Streamlit's component system.

📚 Documentation

This project has comprehensive, multi-layered documentation:

Quick Links

✨ Features

🎯 Core Capabilities

  • Interactive Financial Charts: Candlestick, line, area, bar, histogram, and baseline charts
  • Fluent API: Method chaining for intuitive chart creation
  • Multi-Pane Charts: Synchronized charts with multiple series and timeframes
  • Trade Visualization: Built-in support for displaying trades with markers and annotations
  • Advanced Annotations: Text, arrows, and shape annotations with layering
  • Responsive Design: Auto-sizing charts that adapt to container dimensions
  • Pandas Integration: Seamless DataFrame to chart data conversion

🚀 Advanced Features

  • Price-Volume Charts: Pre-built candlestick + volume combinations
  • Range Switchers: Professional time range selection (1D, 1W, 1M, 3M, 6M, 1Y, ALL)
  • Auto-Sizing: Responsive charts with min/max constraints
  • Custom Styling: Full control over colors, fonts, and visual elements
  • Performance Optimized: Handles large datasets efficiently
  • Type Safety: Comprehensive type hints and validation

🔧 Developer Experience

  • Production Ready: Comprehensive logging, error handling, and security
  • Well Documented: Complete API documentation with examples
  • Tested: 450+ unit tests with 95%+ coverage
  • Code Quality: Black formatting, type hints, and linting compliance

📦 Installation

pip install streamlit-lightweight-charts-pro

This will automatically install the required dependency: lightweight-charts-pro

🚀 Quick Start

import streamlit as st
from streamlit_lightweight_charts_pro import renderChart
import pandas as pd

st.title("Simple Line Chart")

# Create sample data
data = pd.DataFrame({
    'time': pd.date_range('2024-01-01', periods=100, freq='D'),
    'value': pd.Series(range(100)) + pd.Series(range(100)).apply(lambda x: x**0.5)
})

# Render chart
renderChart([
    {
        'type': 'line',
        'data': data,
        'options': {}
    }
], {
    'layout': {
        'textColor': 'black',
        'background': {
            'type': 'solid',
            'color': 'white'
        }
    }
})

🏗️ Architecture

This package is a Streamlit-specific wrapper that:

  • Extends BaseChart and BaseChartManager from lightweight-charts-pro
  • Provides Streamlit component integration via custom React component
  • Manages session state and component lifecycle
  • Renders charts using Streamlit's bi-directional component system

The package consists of:

  • Python wrapper: Streamlit integration and session state management
  • React frontend: Custom TypeScript/React component built on TradingView's lightweight-charts
  • Core dependency: lightweight-charts-pro provides chart classes and utilities

📖 Examples

Check out the examples/ directory for comprehensive examples:

  • Getting Started: Basic chart types and configuration
  • Advanced Features: Multi-pane charts, annotations, legends
  • Trading Features: Trade visualization, signals, markers
  • Custom Styling: Themes, colors, and visual customization

🔄 Migration from v0.2.x to v0.3.x

Version 0.3.0 renames the core dependency from lightweight-charts-core to lightweight-charts-pro. See MIGRATION.md for details on updating your code.

📄 License

MIT

🤝 Contributing

Contributions are welcome! Please check the main repository for contribution guidelines.

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

streamlit_lightweight_charts_pro-0.3.0.tar.gz (275.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file streamlit_lightweight_charts_pro-0.3.0.tar.gz.

File metadata

File hashes

Hashes for streamlit_lightweight_charts_pro-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fc29bca53fb39bd68d333c8bf204e401fb0afb29f5be2f2f42a8935daceb365a
MD5 14e890f8aba1becadb951aad84ad7267
BLAKE2b-256 e47fae89b936ade32b8cad0c48233a4645285c76449f14675369a4404bda7bf4

See more details on using hashes here.

File details

Details for the file streamlit_lightweight_charts_pro-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_lightweight_charts_pro-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a3a9280836b1b42afaf04f2d4a9fd3b2fe292c4c96aeb19e165a647c2eeac56
MD5 e2e760df5b8779a642386f0ccba5a618
BLAKE2b-256 14255a7a67453454df2b9e912041bbde51adc5bde8af9276c710ea554a9e6bd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page