The Quant's Compiler: From Alpha Idea to Production in Minutes
A type-safe DSL and high-performance runtime for quantitative trading strategies.
Write signals like sentences. Backtest in milliseconds. Deploy with confidence.
Documentation | Crates.io | GitHub
Every quant team that scales past a handful of researchers eventually builds the same thing: a typed, reproducible signal language. We've seen it at every major desk. sigc is that system — open-sourced.
| Problem | sigc Solution |
|---|---|
| Ad-hoc notebooks with mismatched calendars | Type-safe DSL with compile-time shape checking |
| Non-deterministic backtests | Content-addressed caching, identical inputs = identical outputs |
| Fragile pandas joins at 3am | 120+ vectorized operators, SIMD-optimized |
| "It worked in research" → fails in prod | Same binary: sigc run → sigc daemon |
| Factor code copy-pasted across teams | Macros, functions, importable signal libraries |
# Install from crates.io
cargo install sigc
# Or build from source
git clone https://github.com/skelf-Research/sigc.git
cd sigc && cargo build --releaseCreate 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-31Run it:
$ sigc run momentum.sig
=== Backtest Results ===
Total Return: 15.23%
Sharpe Ratio: 1.45
Max Drawdown: 8.12%
Turnover: 312.00%Write signals that read like your research notes:
// Momentum with skip-month
signal momentum:
total_ret = ret(prices, 252)
skip_ret = ret(prices, 21)
mom = total_ret - skip_ret
emit zscore(mom)
// Mean reversion on residuals
signal stat_arb:
beta = rolling_beta(stock, market, 60)
residual = stock - beta * market
z = (residual - rolling_mean(residual, 20)) / rolling_std(residual, 20)
emit -z
// Combine factors with explicit weights
signal multi_factor:
emit 0.4 * momentum + 0.3 * value + 0.3 * quality120+ operators built-in: zscore, rank, rolling_mean, ema, rsi, macd, atr, vwap, neutralize, winsor, and more.
use sigc::{Strategy, Backtest};
// Embed in your systems
let strategy = Strategy::from_file("alpha.sig")?;
let results = strategy
.with_param("lookback", 60)
.with_param("threshold", 1.5)
.run()?;
println!("Sharpe: {:.2}", results.sharpe_ratio());
// Access raw data
let weights: Vec<f64> = results.weights();
let returns: Vec<f64> = results.daily_returns();Architecture:
- Single binary — compiler, runtime, daemon, CLI in one executable
- Polars/Arrow columnar execution with Rayon parallelism
- SIMD kernels for factor math (AVX2/AVX-512 where available)
- Content-addressed cache (sled + blake3) for reproducibility
- nng RPC for daemon mode, sub-millisecond latency
# sigc.yaml - Production configuration
mode: production
safety:
circuit_breakers:
max_drawdown: 0.15
max_position: 0.10
kill_switch: true
rate_limits:
orders_per_minute: 100
alerts:
slack:
webhook: ${SLACK_WEBHOOK}
channels: ["#trading-alerts"]
schedule:
jobs:
- name: rebalance
cron: "0 9 * * 1-5"
strategy: momentumEnterprise features:
- Circuit breakers with automatic position flattening
- Prometheus metrics (
/metricsendpoint) - Structured audit logging (JSON, compliance-ready)
- Slack/email alerting on anomalies
- Docker & Kubernetes ready (
ghcr.io/skelf-Research/sigc)
| Crate | Purpose |
|---|---|
sigc |
CLI and main entry point |
sig_compiler |
DSL parser and type checker |
sig_runtime |
Execution engine with 120+ operators |
sig_types |
Core type definitions |
sig_cache |
Deterministic caching layer |
sig_lsp |
Language server for IDE support |
VS Code Extension with full language server:
- Real-time error diagnostics
- Hover documentation for all operators
- Code completion with signatures
- Go-to-definition for signals/functions
- 25+ snippets for common patterns
code --install-extension skelf-Research.sigc-vscode| Integration | Status | Description |
|---|---|---|
| Alpaca | ✅ | Paper & live trading |
| Yahoo Finance | ✅ | Free market data |
| PostgreSQL | ✅ | Async connection pooling |
| S3/GCS | ✅ | Cloud data sources |
| Python | ✅ | pysigc bindings for notebooks |
Benchmarked on 5 years of daily data, 500 securities:
| Operation | Time |
|---|---|
| Parse + compile | 2ms |
| Full backtest | 45ms |
| Incremental update | 3ms |
Memory-mapped data loading. Warm cache hits in microseconds.
- Full Documentation — Tutorials, API reference, deployment guides
- Quant Guide — 9-chapter deep dive for researchers
- Strategy Library — 23 ready-to-use strategies
- Operator Reference — All 120+ operators documented
We welcome contributions. Please open an issue to discuss before submitting large PRs.
# Development setup
git clone https://github.com/skelf-Research/sigc.git
cd sigc
cargo build
cargo testSee CONTRIBUTING.md for guidelines.
MIT License — see LICENSE for details.
Built by quants, for quants.
Get Started | View Strategies | Join Discussions
Skelf Research — skelfresearch.com