OpenPit: Pre-trade Integrity Toolkit
openpit is an embeddable pre-trade risk SDK for integrating policy-driven
risk checks into trading systems.
For an overview and links to all resources, see the project website openpit.dev. For full project documentation, see the repository README. For conceptual and architectural pages, see the project wiki.
Versioning Policy (Pre‑1.0)
Before the 1.0 release OpenPit follows a relaxed Semantic Versioning:
PATCHreleases carry bug fixes and small internal corrections.MINORreleases may introduce new features and may also change the public interface.
Breaking API changes can appear in minor releases before 1.0. Pick
version constraints that tolerate API evolution during the pre-stable
phase.
Getting Started
Visit the crate page on crates.io and the API documentation on docs.rs.
Install
Run the following Cargo command in your project directory:
Quick Start
use ;
use ;
use NoLocking;
use ;
// One fat-finger control, wired once at startup.
let engine =
.no_sync
.pre_trade
.build?;
let order = OrderOperation ;
// The verdict: either a reservation to finalize once the venue answers,
// or the rejects that stopped the order.
match engine.execute_pre_trade
The explicit two-stage flow, drop copy, and post-trade reports are described on the Pre-trade Pipeline page.
What Is Inside
SpotFundsPolicy- per-account solvency gate over spendable fundsOrderValidationPolicy- structural integrity checks on every orderRateLimitPolicy- throttle order flow per broker, asset, or accountOrderSizeLimitPolicy- fat-finger caps on quantity and notionalPnlBoundsKillSwitchPolicy- halt an account when realized P&L breaches bounds- Custom Rust policies - the primary integration model.
- Account Blocking, Account Groups, Account Adjustments, and Balance Reconciliation.
- Drop Copy - record already executed orders without pre-trade enforcement.
- Market Data.
- Dynamic Reconfiguration of a live policy.
- Storage for policy state, with the synchronization mode selected once at engine construction - see the Threading Contract.
- Rejects and errors with stable reject codes.