Embed the runtime in a larger Rust system
Depend on the sigc crate, load a .sig file, override params, and pull weights or daily returns as plain Vec<f64> inside your own Rust trading stack.
The problem
You already have a Rust trading system — an execution layer, a data pipeline, a risk engine — and you want typed, cached signal computation inside it without shelling out to a separate process or reimplementing operators.
How sigc approaches it
- 01
Add the sigc crate as a dependency; the compiler and runtime are also published as sig_compiler, sig_runtime, sig_types, and sig_cache for finer-grained use.
- 02
Load a strategy with Strategy::from_file, override parameters at call time with with_param, and call run to execute the backtest.
- 03
Read daily returns and per-name weights back as plain Vec<f64> and hand them to your own execution or risk layer.
- 04
Share the same content-addressed cache directory across processes so embedded runs and CLI runs hit the same warm results.
use sigc::Strategy;
let strat = Strategy::from_file("momentum.sig")?
.with_param("lookback", 40.0);
let bt = strat.run()?;
let weights: Vec<f64> = bt.latest_weights();
let returns: Vec<f64> = bt.daily_returns(); What you get
- ✓Typed, cached signal computation lives inside your Rust process — no IPC, no second language.
- ✓The operator library and content-addressed cache come for free with the crate.
- ✓You keep full control of execution, data, and risk while sigc owns signal-to-portfolio.
More use cases
Cross-sectional factor research
Write momentum, value, and quality factors as typed .sig signals, combine them with explicit arithmetic, and get a reproducible ranked long-short backtest.
One binary from research to production
Backtest a strategy with sigc run, then serve the exact same compiler and runtime in production as sigc daemon over nng — no rewrite, no second codebase.