Skip to main content

Python wrapper for TradingView Lightweight Charts

Project description

litecharts

PyPI version Python 3.10+ License: MIT Ruff Typed Docs

Warning: This library is in alpha. The API may change unexpectedly between versions.

Thin Python wrapper for TradingView Lightweight Charts. Documentation

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({"stretchFactor": 3})
candles = mainPane.addSeries(CandlestickSeries)
candles.setData(ohlcData)

# Volume pane
volumePane = chart.addPane({"stretchFactor": 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

litecharts-0.1.2.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

litecharts-0.1.2-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file litecharts-0.1.2.tar.gz.

File metadata

  • Download URL: litecharts-0.1.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for litecharts-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86d5ce9b40d4fde62ca7c77aafba56f5cd5a7617eeda8cb9a547982b10c45f0d
MD5 83654e652447772903dbf314e01a1cce
BLAKE2b-256 2402b15bfcfbfbfacd9b9c795806487a6f2858042ad4a2e39665e792e9c3bf79

See more details on using hashes here.

File details

Details for the file litecharts-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: litecharts-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for litecharts-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40951e0828216c818e2168ff64d556efc2f2f90b0be97eac0adf36091b6720a3
MD5 120a990540d2a74b017c02dbc4f58543
BLAKE2b-256 4d8e0483187fca42104029966f2c13cb578b0d6c2114212f3239b14d1af97827

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