docs.rs failed to build algotrading-0.1.0-alpha.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
algotrading-0.1.0-alpha.2
Algotrading
A high-performance quantitative trading toolkit written in Rust, built for speed.
algotrading provides optimized statistical and econometric primitives for real-time algorithmic trading. It's designed to be fast, memory-efficient, and safe, making it suitable for both production systems and research environments.
Features
- Rolling statistics with compile-time window sizes (
RollingStats<const N: usize>) - Mahalanobis distance detector for anomaly and regime detection
- Kernel density estimation (KDE) for nonparametric probability modeling
- Markov regime switching model with built-in market presets (
MarkovSwitching::spy_default()) - Fully generic over
f64and small arrays—no heap allocations in critical paths - Built using Rust's const generics and SIMD-friendly math for nanosecond-level performance
Example
use *;
Benchmarks
Benchmarks are powered by Criterion.rs.
On an M2 Pro (Rust 1.81, release mode):
| Function | Average Time | Notes |
|---|---|---|
RollingStats::update() |
~10.6 ns | Constant-time O(1) update |
Mahalanobis::distance_sq() |
~4.4 ns | Pre-trained, inlined math |
MarkovSwitching::update() |
~16.6 ns | Stable regime transition |
Installation
Add to your Cargo.toml:
[]
= "0.1"
Or directly from GitHub:
[]
= { = "https://github.com/ndavidson19/algotrading.git" }
Then import via the prelude:
use *;
Design Philosophy
algotrading was built from the ground up for real-time trading systems:
- No dynamic allocation in the hot path
- Deterministic performance with stable nanosecond timings
- Rust safety guarantees for production deployment
- Suitable for on-exchange, colocated, or cloud-deployed strategies
Running Benchmarks
To benchmark your build:
Output includes detailed timing reports and Criterion plots in target/criterion/.
Modules
| Module | Description |
|---|---|
rolling |
Rolling mean, variance, std |
markov |
Regime switching model |
mahalanobis |
Outlier detection and distance metrics |
kde |
Kernel density estimation |
prelude |
Convenient re-exports for all core features |
Roadmap
- Add Hidden Markov Models with EM training
- Introduce Kalman filtering primitives
- Integrate basic backtesting utilities
- Add real-time streaming signals module
License
Licensed under the MIT License.
Created by Nicholas Davidson