Skip to content
Eugene Palchukovsky edited this page Jun 4, 2026 · 15 revisions

OpenPit

OpenPit is an embeddable pre-trade risk toolkit for trading systems. It evaluates orders before they leave the host application, lets the caller commit or roll back reserved state explicitly, and feeds realized outcomes back into cumulative controls.

Versioning Policy (Pre‑1.0)

Before the 1.0 release OpenPit follows a relaxed Semantic Versioning:

  • PATCH releases carry bug fixes and small internal corrections.
  • MINOR releases 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.

Examples

End-to-end runnable scenarios live in the examples directory of the main repository.

Current SDKs

Core Flow

  1. Build an engine once during application startup.
  2. Run the start stage for each order.
  3. If the start stage passes, execute request.
  4. If the main stage passes, finalize reservation (commit or rollback).
  5. Feed realized outcomes back through execution report.

What OpenPit Does Not Own

  • Order routing and venue connectivity
  • Persistence of balances, positions, or reservations
  • Market data normalization
  • P&L calculation from raw fills
  • Concurrency coordination around one shared engine instance

Wiki Map

  • Getting Started: Install the SDK and run a first end-to-end flow
  • Architecture: Public integration model and current SDK surfaces
  • Pre-trade Pipeline: Lifecycle, result handling, and finalization rules
  • Account Adjustments: Non-trade (NTO) adjustment model, atomic batch validation, and policy hooks
  • Account Groups: Compact account-group identifiers, the engine membership registry, and the lazy per-context account group accessor
  • Policies: Start-stage and main-stage behavior, built-ins, and custom policies
  • Spot Funds: Per-account funds policy - holdings lifecycle, limit-only mode, and market-order pricing
  • Pre-Trade Lock: Persist the reservation lock price, replay it on execution reports, and survive restarts
  • Market Data: Per-account, per-group, and default-bucket quote cache with resolution modes; provides prices for price-related policies
  • Market Data TTL: Quote freshness and the eight-tier, multi-axis TTL cascade
  • Market Data Pricing: Market-order pricing from the quote cache via the spot funds policy
  • Balance Reconciliation: Delta-versus-absolute outcomes and keeping your own ledger aligned with the engine
  • Policy API: Custom policy hooks, language interfaces, and rollback patterns
  • Reject Codes: Standard business reject codes and their meanings
  • Threading Contract: Single-threaded-per-call execution, thread-portable sequential usage, and user data ownership contract
  • Storage: Built-in synchronization-aware key-value storage for custom policy state - selectable no-sync, full-sync, and caller-sharded policies
  • Domain Types: Public value types, meanings, sign conventions, and leverage range
  • Custom Rust Types: Manual capability traits and derive-based wrapper composition
  • Custom Go Types: Go ClientEngine and typed model composition
  • Async Engine (Go): Optional Go helper that turns an AccountSync engine into a future-based concurrent facade with per-account ordering, observer hooks, and graceful or hard stop modes

Clone this wiki locally