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
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 wrchart-0.1.1.tar.gz.
File metadata
- Download URL: wrchart-0.1.1.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df5d107cd8dc8207b77e311a14f6c01e161e56707926fb0952955ac6a3c12e23
|
|
| MD5 |
acb3b7c7ced1e90929883dc7b031cd96
|
|
| BLAKE2b-256 |
8fd37e6bebab645cc0906c832a83f20cfe08b54678327e51d07492b2c30f54e0
|
Provenance
The following attestation bundles were made for wrchart-0.1.1.tar.gz:
Publisher:
publish.yml on Wayy-Research/wrchart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wrchart-0.1.1.tar.gz -
Subject digest:
df5d107cd8dc8207b77e311a14f6c01e161e56707926fb0952955ac6a3c12e23 - Sigstore transparency entry: 763337196
- Sigstore integration time:
-
Permalink:
Wayy-Research/wrchart@a0fd2dd568499d127bb1dab1789b6159051fa817 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Wayy-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a0fd2dd568499d127bb1dab1789b6159051fa817 -
Trigger Event:
release
-
Statement type:
File details
Details for the file wrchart-0.1.1-py3-none-any.whl.
File metadata
- Download URL: wrchart-0.1.1-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2d816569f78083f33aab5f842b9913b4c81af0d3a69cf7140ed25d25283a16f
|
|
| MD5 |
097e4d04cbd6891a57e759be80789304
|
|
| BLAKE2b-256 |
bf63b816b1b6cb48005fb21db722a2f1c838592e290713d66a5f60435e03b0dd
|
Provenance
The following attestation bundles were made for wrchart-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Wayy-Research/wrchart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wrchart-0.1.1-py3-none-any.whl -
Subject digest:
e2d816569f78083f33aab5f842b9913b4c81af0d3a69cf7140ed25d25283a16f - Sigstore transparency entry: 763337197
- Sigstore integration time:
-
Permalink:
Wayy-Research/wrchart@a0fd2dd568499d127bb1dab1789b6159051fa817 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Wayy-Research
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a0fd2dd568499d127bb1dab1789b6159051fa817 -
Trigger Event:
release
-
Statement type: