Skip to content

Latest commit

 

History

History
271 lines (218 loc) · 16.7 KB

README.md

File metadata and controls

271 lines (218 loc) · 16.7 KB
egui-charts

Financial charts for Rust applications built with egui 0.37.

This README and the guide follow main (0.3 in development), using egui/eframe 0.37. Browse the main API (rustdoc and symbol search). The published 0.2.0 crate uses egui/eframe 0.33.3 and has separate release API documentation.

Live demo Guide Released 0.2.0 API, egui 0.33.3 crates.io CI egui 0.37 MSRV 1.95 License MIT OR Apache-2.0 Examples

Intraday workspace with candles, volume, EMA overlays, VWAP, RSI, a long-position plan, working orders, an alert, watchlist and paper account

An intraday session: analysis, risk and orders on the same chart. Every image uses generated sample data and simulated trading.

Inside the demo

Liquidity and executions
Depth history and volume bubbles from the sample feed’s synthetic order book.
Depth history and volume bubbles from the sample feed’s synthetic order book.
Session volume
Candles, a session volume profile, point of control and value area.
Candles, a session volume profile, point of control and value area.
Plan an order
Limit ticket with take profit, stop loss and risk/reward beside the paper account.
Limit ticket with take profit, stop loss and risk/reward beside the paper account.
Work the ladder
Bid and ask sizes, bracket exits and working orders beside the paper account.
Bid and ask sizes, bracket exits and working orders beside the paper account.
Read several intervals
Four linked charts with candles, Heikin-Ashi, OHLC bars and area.
Four linked charts with candles, Heikin-Ashi, OHLC bars and area.
Mark the setup
Pitchfork, Fibonacci extension, XABCD pattern and a retest callout.
Pitchfork, Fibonacci extension, XABCD pattern and a retest callout.
Choose studies
The indicator catalog over Bollinger Bands, EMA, VWAP, RSI and MACD.
The indicator catalog over Bollinger Bands, EMA, VWAP, RSI and MACD.
Rehearse the session
Replay transport and a paper position with working orders.
Replay transport and a paper position with working orders.
Change the view
Heikin-Ashi, Renko, range bars and Kagi in a four-chart layout.
Heikin-Ashi, Renko, range bars and Kagi in a four-chart layout.
Read the footprint
Bid and ask volumes at each price level, from the sample feed’s trades.
Bid and ask volumes at each price level, from the sample feed’s trades.

Try a session
Open the live demo to draw, add studies, switch layouts and trade the paper account.

Light and dark appearances follow your colour scheme. Open an image for the full view.

egui-charts draws price series, computes studies and handles chart interaction inside your egui application. Start with a Chart, or assemble a workspace from the toolbars, panels and dialogs. Your application supplies market data, broker connections and durable storage.

The terminal package assembles them on your Datafeed and performs their actions; each component also works on its own, as the demo shows.

Status

chart drawings studies order flow options terminal builder api

Counts come from docs/progress/features.csv, and the status page lists each group's partial and missing features.

progress map

Start with a chart

For main (0.3 in development), use the Git dependency and Rust 1.95 or newer. Use egui and eframe 0.37 throughout your application so their types match.

[dependencies]
egui-charts = { git = "https://github.com/userFRM/egui-charts", branch = "main" }
eframe = "0.37"
use eframe::egui;
use egui_charts::{Chart, model::{Bar, BarData}};

fn main() -> eframe::Result {
    let bars = vec![
        Bar::new("2026-10-27T18:00:00Z".parse().unwrap(),
                 100.0, 102.0, 99.0, 101.0, 1_000.0),
        Bar::new("2026-10-27T18:01:00Z".parse().unwrap(),
                 101.0, 103.0, 100.0, 102.0, 1_200.0),
    ];
    let mut chart = Chart::new(BarData::from_bars(bars));
    eframe::run_ui_native("Price chart", Default::default(), move |ui, _| {
        egui::CentralPanel::default().show(ui, |ui| chart.show(ui));
    })
}

The widget handles pan, zoom and crosshair interaction. Use chart.set_data(SeriesId::MAIN, bars) to load history and chart.update(SeriesId::MAIN, bar) to merge a bar by its opening time. SeriesId is in egui_charts::widget.

Run the demo locally with:

cargo run --manifest-path examples/demo/Cargo.toml

Bring your data

For a feed-backed chart, implement Datafeed and pass it to ChartBuilder::with_feed. Only history is required. The chart requests older pages as the user scrolls back; subscribe supplies live updates through a Sink.

Feed methods run on the UI thread and must return promptly. Fetch data elsewhere and answer through Reply, or respond inline when the data is already in memory. live_feed.rs demonstrates paged history and a cancellable stream of sample trades. With the http feature, data::http::HttpDatafeed::new(address) supplies column history and live bar refresh from your server; run network_feed.rs with cargo run --features http --example network_feed, natively or with its documented browser setup.

Your application supplies The library consumes it through
Historical bars, live bars, trades and depth Datafeed
Instrument search results SymbolSearch
Orders, positions and account events Broker
Saved drawings, layouts and settings Storage
Alert rules and alert events Alerts

Order flow uses executions and depth from your feed. The library renders footprints, session volume profiles, volume bubbles and liquidity heatmaps. Footprints need a time-based interval and an instrument tick size; without them, or before the first bar whose executions are all retained, that chart style draws candles. OHLCV bars alone do not supply the aggressor side of trades.

The host also owns strategy execution and any scripting runtime. The builder guide covers these integration points and the service contracts.

Studies on the chart

Overlays share the price pane; oscillators get their own panes. The chart updates studies when its bars change. Built-in studies include moving averages, Bollinger Bands, RSI, MACD, Ichimoku and VWAP. Implement Indicator to supply your own calculation.

use egui_charts::studies::{BollingerBands, RSI};
fn add_studies(chart: &mut egui_charts::Chart) {
    chart.add_indicator(Box::new(BollingerBands::new(20, 2.0)));
    chart.add_indicator(Box::new(RSI::new(14)));
}

Draw on price and time

Add trend lines, channels, Fibonacci drawings, shapes and annotations. DrawingToolType lists 98 drawing tool types, including cursor modes. The chart retains drawing timestamps through pan, zoom and interval changes, with undo and redo for edits. Chart::save_drawings returns a DrawingStorage; call its to_json method to serialize it for your storage.

Build a workspace

The terminal package assembles the toolbars, menus and charts on your Datafeed and performs their actions, as an application on top of the library. Each component also works on its own: it returns an action for your app to apply, as the demo does. The library does not connect to a market data provider.

ChartLayout arranges charts in grids or tabs and can synchronize symbols, intervals, crosshairs, time ranges and drawings.

Choose a chart style with Chart::set_chart_type: candles, OHLC bars, line, area, baseline, Heikin-Ashi, Renko, Kagi, line break, point and figure, or range bars. See ChartType in the main API for the full set.

The UI components also include replay controls, an order ticket, a depth ladder and an account panel. Connect trading UI to your Broker implementation; the demo uses PaperAccount for simulated execution.

Fit your application

The default build includes the chart, studies, drawings and UI components, plus locale and named time zone support, CSV and PNG export. Select a smaller build with default-features = false:

Features Included
widget Chart widget and the Indicator extension point
widget, studies Chart widget and built-in studies
widget, drawings Chart widget and drawing interaction
studies Study calculations without egui
alert-engine AlertEngine, an alerts service that evaluates alerts on the bars the host feeds it, without egui
detectors OrderFlowDetectors, a signals service that finds order-flow events in the trades and depth the host feeds it, without egui
strategies Backtest, which runs a Strategy over bars and returns a StrategyReport, without egui
csv CSV import and export for bars, strategy reports and chart data
png-export Chart::export_png and image textures in SVG export; enables widget
http HttpDatafeed, HTTP column history, symbol search and live bar refresh, without egui
None Data types, scales and host service contracts without egui

For example:

egui-charts = { git = "https://github.com/userFRM/egui-charts", branch = "main", default-features = false, features = ["widget", "studies"] }

Theme::dark(), Theme::light() and Theme::high_contrast() provide starting palettes. A Theme exposes its UI colours, chart colours, typography, spacing and corner radii as public fields. Apply it at startup and after a theme change:

use eframe::egui::Color32;
use egui_charts::theme::{Theme, apply_to_egui};

fn apply_theme(ctx: &eframe::egui::Context) {
    let mut theme = Theme::dark().with_accent(Color32::from_rgb(70, 120, 240));
    theme.chart.candle_up = Color32::from_rgb(0, 160, 120);
    apply_to_egui(ctx, &theme);
}

Development and license

ROADMAP.md tracks implemented work and remaining tasks. For contributions, start with CONTRIBUTING.md and the Code of Conduct. Report security issues through the Security Policy; use Discussions for questions.

Licensed under MIT or Apache-2.0, at your option, for open source and commercial use. Bundled assets retain their own licenses; see THIRD-PARTY-NOTICES.md.

To support development, use the repository's Sponsor button. Feature requests and bug reports belong in the issue tracker.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.