Skip to content
Eugene V. Palchukovsky edited this page Apr 28, 2026 · 10 revisions

Pit

Pit 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 accepts post-trade feedback so cumulative controls can update themselves from realized outcomes.

Versioning Policy (Pre‑1.0)

Until Pit reaches a stable 1.0 release, the project follows a relaxed interpretation of Semantic Versioning.

During this phase:

  • PATCH releases are used for bug fixes and small internal corrections.
  • MINOR releases may introduce new features and may also change the public interface.

This means that breaking API changes can appear in minor releases before 1.0. Consumers of the library should take this into account when declaring dependencies and consider using version constraints that tolerate API evolution during the pre‑stable phase.

Current SDKs

Core Flow

  1. Build an Engine.
  2. Run the start stage.
  3. If the order passes, execute request.
  4. If the main stage passes, finalize reservation.
  5. Feed realized outcomes back through execution report.

What Pit 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
  • Pre-trade Pipeline: Lifecycle, result handling, and finalization rules
  • Account Adjustments: Non-trade (NTO) adjustment model, atomic batch validation, and policy hooks
  • Policies: Start-stage and main-stage behavior, built-ins, and custom policies
  • 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
  • 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
  • Architecture: Public integration model and current SDK surfaces

Clone this wiki locally