API Reference¶
Programmatic interfaces for sigc.
Overview¶
| API | Language | Use Case |
|---|---|---|
| Rust API | Rust | Core development, extensions |
| Python API | Python | Research, analysis, ML integration |
Rust API¶
The core sigc library is written in Rust and can be used as a library:
Rust
use sigc::{Strategy, Backtest, Results};
// Load and run a strategy
let strategy = Strategy::from_file("momentum.sig")?;
let results = strategy.run()?;
println!("Sharpe: {:.2}", results.sharpe_ratio());
Crates¶
| Crate | Purpose |
|---|---|
sigc |
Main entry point |
sig_parser |
DSL parser |
sig_runtime |
Computation engine |
sig_types |
Type definitions |
Python API (pysigc)¶
Python bindings for research and analysis:
Python
import pysigc
# Run a strategy
results = pysigc.run("momentum.sig")
print(f"Sharpe: {results.sharpe_ratio:.2f}")
# Access data
weights = results.weights # pandas DataFrame
returns = results.daily_return # pandas Series
Features¶
- Run strategies from Python
- Access results as pandas DataFrames
- Parameter optimization
- Custom data integration
- Jupyter notebook support
Choosing an API¶
Use Rust When¶
- Building sigc extensions
- Performance-critical applications
- Contributing to sigc core
- Building production systems
Use Python When¶
- Research and exploration
- Jupyter notebooks
- Integration with ML frameworks
- Custom analysis
Quick Comparison¶
Running a Strategy¶
Rust:
Rust
use sigc::Strategy;
let strategy = Strategy::from_file("momentum.sig")?;
let results = strategy.run()?;
Python:
Accessing Results¶
Rust:
Python:
With Parameters¶
Rust:
Python:
API Stability¶
| Version | Status |
|---|---|
| 0.x | API may change |
| 1.0+ | Stable, backwards compatible |
Current version: 0.10.0 (pre-1.0)
Documentation¶
- Rust API - Complete Rust documentation
- Python API - Complete Python documentation
- Examples - Code examples