Skip to content
sigc GitHub

Rust 1.70+ · MIT · on crates.io

The Quant's Compiler: alpha idea to production in minutes.

sigc is a type-safe DSL and high-performance Rust runtime for quantitative trading strategies. Write signals like sentences. Backtest in milliseconds. Deploy the same binary as a daemon.

momentum.sig
data:
  prices: load parquet from "prices.parquet"

params:
  lookback = 20
  top_pct  = 0.2

signal momentum:
  returns = ret(prices, lookback)
  score   = zscore(returns)
  emit winsor(score, p=0.01)

portfolio main:
  weights = rank(momentum).long_short(top=top_pct, bottom=top_pct)
  backtest from 2024-01-01 to 2024-12-31
$ sigc run momentum.sig // Sharpe 1.45 · MDD 8.12% · compiled in 2ms, backtested in 45ms

120+

vectorized operators built in

45ms

full backtest, 5y daily, 500 securities

MIT

license · fork it, embed it, ship it

What you get

The plumbing every quant team ends up rewriting

Compiler

Type-safe DSL with compile-time shape checking

Signals are declared in a four-block .sig file (data, params, signal, portfolio). The compiler checks shapes and calendars before a single row is read, so mismatched indices fail at compile time instead of three hours into a backtest.

Runtime

120+ vectorized operators, SIMD-optimized

zscore, rank, rolling_mean, ema, rsi, macd, atr, vwap, neutralize, winsor, lag, ret — the operator library is built on Polars/Arrow columnar execution with Rayon parallelism and AVX2/AVX-512 kernels where the CPU supports it.

Reproducibility

Content-addressed cache for deterministic backtests

IR and intermediate results are keyed by blake3 content hash and stored in a sled cache. Identical inputs return identical outputs, byte for byte. Warm cache hits land in microseconds.

Deploy

One binary: notebook to daemon

sigc run for ad-hoc backtests, sigc daemon for a long-running process that owns the cache and serves clients over nng REQ/REP on tcp://127.0.0.1:7240. Same compiler, same runtime, same artifact.

Backtester

Backtesting with rebal, costs, and a benchmark

portfolio blocks compile down to long-short or vol-targeted weight schemes with explicit rebalance cadence, transaction-cost models (basis points, square-root slippage), and benchmark attribution against an index like SPY.

Risk

Production safety baked into sigc.yaml

Circuit breakers (max drawdown, max position, kill switch), per-minute order rate limits, Prometheus /metrics, structured JSON audit logs, and Slack alerts on anomalies are configuration, not bespoke code.

Infra

Brokerless distributed architecture

No Redis, no Kafka, no RabbitMQ. The daemon is the single owner of the cache; clients reach it over nng with sub-millisecond local latency and exponential-backoff retry when a lock is held.

Pipeline

Notebook to production, four compiler stages

01 · parse

.sig text to AST

The DSL parser reads the four-block file and emits an abstract syntax tree. Shape and calendar errors surface here.

02 · type-check

Compile-time guarantees

sig_compiler validates that every operator gets the dtype and index it expects, and that signal references resolve.

03 · execute

Polars + Rayon

sig_runtime lazily evaluates the operator graph on Arrow columns, with SIMD kernels and a content-addressed result cache.

04 · serve

Daemon or embed

Same binary as sigc daemon for production, or call Strategy::from_file from your own Rust system.

Honest comparisons

How sigc fits next to the tools you already know

vectorbt and Lean each solve a real problem. sigc is opinionated about a different one: a type-safe DSL with a deterministic compile-cache-execute pipeline. Pick the right tool for the desk.

FAQ

Questions desks ask first

+ What exactly is sigc?

sigc is a domain-specific compiler and runtime for quantitative trading strategies, written in Rust. You write a .sig file declaring data sources, parameters, signal computations, and a portfolio. The compiler type-checks it, the runtime executes a backtest against Polars/Arrow data, and the same binary can run as a production daemon.

+ What ships in the box for backtesting?

The portfolio block compiles to a weight scheme (rank long_short with top/bottom percentiles and per-name caps, or scale_vol with an annualised volatility target), an explicit rebalance cadence, a transaction-cost model (bps or square-root slippage with a coefficient), a date range, and an optional benchmark such as SPY. sigc run prints Total Return, Sharpe, Max Drawdown, and Turnover.

+ What execution venues are supported?

The README lists Alpaca for paper and live trading, Yahoo Finance for free market data, PostgreSQL for async-pooled storage, S3 and GCS for cloud data, and a pysigc Python binding for notebooks. The repository also includes Docker and Kubernetes deploy configuration.

+ How is reproducibility actually enforced?

Every compile and run keys its outputs into a content-addressed cache backed by sled and blake3. Given the same .sig file, parameters, and input data, the cache returns the same intermediate frames, and the backtest emits the same numbers down to the last basis point.

+ Is the operator set fixed?

No. The runtime ships 120+ operators, but you can define your own signals as named blocks, combine them with explicit arithmetic (0.4 * momentum + 0.3 * value + 0.3 * quality), and import shared libraries of factors across teams.

+ How does the daemon differ from standalone?

Standalone mode opens the cache for the duration of one command. Daemon mode (sigc daemon) is a long-running process that owns the cache and answers compile and run requests over nng on port 7240. Multiple clients can hit the same daemon; sub-millisecond local RPC; no broker.

+ Can I embed sigc in a larger Rust system?

Yes. The Strategy and Backtest types are exported. You load a .sig file, override parameters with with_param, call run, and pull weights or daily returns as plain Vec<f64>. The compiler and runtime are also published as separate crates (sig_compiler, sig_runtime, sig_types, sig_cache, sig_lsp).

+ Where do I read the docs?

docs.skelfresearch.com/sigc has the quickstart, language reference, CLI reference, a nine-chapter quant guide, an operator reference, and a strategy library. The GitHub README is a tasting menu; the docs site is the full reference.

Stop rewriting the same backtester

Cargo install sigc, write one .sig file, and get a typed, cached, reproducible backtest. Then run the same binary as a daemon when you are ready to trade.