Skip to main content

Interactive financial charting library with Polars support and TradingView-style aesthetics

Project description

wrchart

Interactive financial charting for Python with Polars support and TradingView-style aesthetics.

View Live Demo - See all chart types, indicators, GPU-accelerated million-point rendering, and high-frequency data visualization in action.

Features

  • Polars-native - Works directly with Polars DataFrames
  • Interactive - TradingView-style pan, zoom, and crosshair
  • Jupyter-ready - Renders inline in notebooks
  • Non-standard charts - Renko, Kagi, Point & Figure, Heikin-Ashi, Line Break, Range Bars
  • GPU-accelerated - WebGL rendering for millions of points at 60fps
  • Dynamic LOD - Level of Detail automatically adjusts based on zoom
  • High-frequency data - LTTB decimation for tick data visualization
  • Styled by default - Clean Wayy Research aesthetic

Install

pip install wrchart

For Jupyter support:

pip install wrchart[jupyter]

Quick Start

import wrchart as wrc
import polars as pl

# Create OHLCV data
df = pl.DataFrame({
    "time": [...],
    "open": [...],
    "high": [...],
    "low": [...],
    "close": [...],
    "volume": [...],
})

# Create chart
chart = wrc.Chart(width=800, height=600)
chart.add_candlestick(df)
chart.add_volume(df)
chart.show()

Chart Types

Standard Charts

# Candlestick
chart = wrc.Chart()
chart.add_candlestick(df)

# Line
chart.add_line(df, value_col="close")

# Area
chart.add_area(df, value_col="close")

Non-Standard Charts

# Heikin-Ashi (smoothed candles)
ha_data = wrc.to_heikin_ashi(df)
chart.add_candlestick(ha_data)

# Renko (price-based bricks)
renko_data = wrc.to_renko(df, brick_size=5.0)
chart.add_candlestick(renko_data)

# Kagi (reversal lines)
kagi_data = wrc.to_kagi(df, reversal_amount=2.0)

# Point & Figure (X's and O's)
pnf_data = wrc.to_point_and_figure(df, box_size=1.0)

# Three Line Break
lb_data = wrc.to_line_break(df, num_lines=3)

# Range Bars
rb_data = wrc.to_range_bars(df, range_size=2.0)

High-Frequency Data

# Downsample 1M ticks to 2000 points
display_data = wrc.lttb_downsample(tick_data, target_points=2000)
chart.add_line(display_data, value_col="price")

GPU-Accelerated Million Point Rendering

For tick-by-tick data with millions of points, use WebGLChart for GPU-accelerated rendering:

import wrchart as wrc
import polars as pl

# Create 1 million tick data points
df = pl.DataFrame({
    "time": range(1_000_000),
    "price": [...],  # Your tick prices
})

# WebGL chart with automatic LOD
chart = wrc.WebGLChart(width=800, height=400, title="Tick Data")
chart.add_line(df, time_col="time", value_col="price")
chart.show()

# Or save to HTML file
chart.to_html("tick_chart.html")

Features:

  • 60fps rendering of millions of points via WebGL
  • Dynamic LOD: Automatically switches between 7 detail levels (2K to 1M points)
  • Virtual viewport: Only renders visible data for maximum performance
  • Smooth interaction: Pan with drag, zoom with scroll wheel

Themes

# Wayy theme (default) - black/white/red
chart = wrc.Chart(theme=wrc.WayyTheme)

# Dark theme
chart = wrc.Chart(theme=wrc.DarkTheme)

# Light theme
chart = wrc.Chart(theme=wrc.LightTheme)

API Reference

Chart

wrc.Chart(
    width=800,          # Chart width in pixels
    height=600,         # Chart height in pixels
    theme=WayyTheme,    # Color theme
    title=None,         # Optional chart title
)

# Methods
chart.add_candlestick(df, time_col="time", open_col="open", ...)
chart.add_line(df, time_col="time", value_col="value", ...)
chart.add_area(df, time_col="time", value_col="value", ...)
chart.add_histogram(df, time_col="time", value_col="value", ...)
chart.add_volume(df, time_col="time", volume_col="volume", ...)
chart.add_marker(time, position="aboveBar", shape="circle", ...)
chart.show()

WebGLChart (GPU-Accelerated)

wrc.WebGLChart(
    width=800,          # Chart width in pixels
    height=400,         # Chart height in pixels
    theme=WayyTheme,    # Color theme
    title=None,         # Optional chart title
)

# Methods
chart.add_line(df, time_col="time", value_col="value")  # Add line data
chart.show()                                             # Display in notebook/browser
chart.to_html("chart.html")                             # Save to HTML file

Transforms

# Heikin-Ashi
wrc.to_heikin_ashi(df, time_col="time", open_col="open", ...)

# Renko
wrc.to_renko(df, brick_size=5.0, use_atr=False, ...)

# Kagi
wrc.to_kagi(df, reversal_amount=2.0, use_percentage=False, ...)

# Point & Figure
wrc.to_point_and_figure(df, box_size=1.0, reversal_boxes=3, ...)

# Line Break
wrc.to_line_break(df, num_lines=3, ...)

# Range Bars
wrc.to_range_bars(df, range_size=2.0, ...)

# LTTB Decimation
wrc.lttb_downsample(df, time_col="time", value_col="value", target_points=1000)

Integration with wrtrade

import wrtrade as wrt
import wrchart as wrc

# Backtest
portfolio = wrt.Portfolio(prices, signals)
results = portfolio.calculate_performance()

# Visualize
chart = wrc.Chart(title="Portfolio Performance")
chart.add_line(
    results['cumulative_returns'].to_frame(),
    value_col="cumulative_returns"
)
chart.show()

License

MIT License - see LICENSE file for details.

Links

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

wrchart-0.1.4.tar.gz (76.5 kB view details)

Uploaded Source

Built Distribution

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

wrchart-0.1.4-py3-none-any.whl (88.9 kB view details)

Uploaded Python 3

File details

Details for the file wrchart-0.1.4.tar.gz.

File metadata

  • Download URL: wrchart-0.1.4.tar.gz
  • Upload date:
  • Size: 76.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wrchart-0.1.4.tar.gz
Algorithm Hash digest
SHA256 26b528718442ab503baa8469c0ba88a34d7628ac0e84419bebeb0ff43d73e8e2
MD5 163b9508d6f3dc79d037e9388aacda9e
BLAKE2b-256 6d5d4d415369f48f597a83ced7c904476457c1975cdcfc3014fdacdf336852c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for wrchart-0.1.4.tar.gz:

Publisher: publish.yml on Wayy-Research/wrchart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wrchart-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: wrchart-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wrchart-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c8915b08e208be8ec6ff9ef22f1202d0876a89dc15bbc97421300ac2fb3a0d56
MD5 ace42a2327289632d4b0e7ba7928633a
BLAKE2b-256 295232e4536cb75fc33aa6dc2fbc55c11aeafd69813c005a70eadf1c1c3166f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for wrchart-0.1.4-py3-none-any.whl:

Publisher: publish.yml on Wayy-Research/wrchart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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