Quickstart
You have two ways to run a backtest: in your browser (zero install) or natively in Rust. Start with whichever fits.
Option A — the browser playground (0 minutes)
Open the interactive playground. It loads the WASM build of the engine plus a small synthetic dataset and runs a real backtest locally — nothing is sent to a server. Edit the strategy, press Run, and read the equity curve and metrics. This is the fastest way to get a feel for lemon.
Option B — native Rust (a few minutes)
You need a recent stable Rust toolchain.
git clone https://github.com/citrusquant/citrusquantcd citrusquantcargo run -p yuzu-core --example basic_backtestThat example is self-contained and readable top to bottom: it builds a tiny price panel, authors a strategy in lemon, runs the backtest, and prints headline metrics. It’s the best 40 lines to read first.
Use it as a library
Add the core crate:
cargo add yuzu-core lemon-langThe top-level entry point is:
yuzu_core::run_backtest(spec_json, ctx, price_key, cfg) -> Result<Report, EngineError>spec_json— the JSONExprtree, produced bylemon::parse(source).ctx— anEvalContext: your numeric panels keyed by series name, plus an optional symbol → industry map.price_key— which series the backtest marks off (usually"close").cfg— aBacktestConfig(fees, slippage, stops, benchmark, …).
See Your first strategy to build the spec, and
Bring your own data to build the ctx.
What you get back
A Report — an equity curve (dates + equity), the trade list, and a large
metrics block. Everything the UI draws is computed
by the engine; the frontend only renders it.
Next steps
- Your first strategy — learn lemon by building one up.
- Reading a report — decode every metric.
- Lemon language reference — the complete DSL.