---
title: "OpenPit"
description: "OpenPit is an embeddable pre-trade risk toolkit for trading systems. It evaluates orders before they leave the host application, lets the caller commit."
---

# 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.

Start with the [integration route](Getting-Started.md#integration-route) for SDK
installation, first examples, lifecycle contracts, and a coding-assistant prompt.

## 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](https://github.com/openpitkit/pit/tree/main/examples/)
directory of the main repository.

## Community And Support

- Ask questions and discuss integration ideas in
  [GitHub Discussions](https://github.com/openpitkit/pit/discussions).
- Report confirmed bugs and scoped feature requests in
  [GitHub Issues](https://github.com/openpitkit/pit/issues).
- Read the
  [contribution guide](https://github.com/openpitkit/pit/blob/main/CONTRIBUTING.md)
  before opening a pull request.
- Report vulnerabilities privately through the
  [security policy](https://github.com/openpitkit/pit/blob/main/SECURITY.md).
- Follow the
  [Code of Conduct](https://github.com/openpitkit/pit/blob/main/CODE_OF_CONDUCT.md)
  in community spaces.

## Current SDKs

- Project website [openpit.dev](https://openpit.dev/)
- Go [module `go.openpit.dev/openpit`](https://go.openpit.dev/openpit)
- Python [package `openpit`](https://pypi.org/project/openpit/)
- JavaScript / TypeScript [package `@openpit/engine`](https://www.npmjs.com/package/@openpit/engine)
- C++ [SDK header `<openpit/openpit.hpp>` and docs](https://docs.openpit.dev/cpp-api/)
- Rust [crate `openpit`](https://crates.io/crates/openpit)
- C [API header and docs](https://docs.openpit.dev/c-api/)

## 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
- Supplying reconciled fills, fees, and other inputs required for P&L
  calculation; [Spot Funds](Spot-Funds.md) derives position and account P&L from
  those inputs
- Concurrency coordination around one shared engine instance

## Wiki Map

- [Getting Started](Getting-Started.md): Install the SDK and run a first end-to-end
  flow
- [Building From Source](Building-From-Source.md): Contributor-facing build and
  test recipes for every language in the repository
- [Runtime Delivery](Runtime-Delivery.md): How each SDK obtains and loads the
  native runtime, plus the environment overrides
- [Architecture](Architecture.md): Public integration model and current SDK surfaces
- [Pre-trade Pipeline](Pre-trade-Pipeline.md): Lifecycle, result handling, and
  finalization rules
- [Account Adjustments](Account-Adjustments.md): Non-trade (NTO) adjustment model,
  atomic batch validation, and policy hooks
- [Account Groups](Account-Groups.md): Compact account-group identifiers, the
  engine membership registry, and the lazy per-context `account group` accessor
- [Account Blocking](Account-Blocking.md): Admin API for blocking and unblocking
  accounts and account groups from outside a policy, including group-level live
  predicate semantics, the engine-wide block, and the mutation finalizer
  contract
- [Account Retirement](Account-Retirement.md): Remove zero, unused account state
  and learn when retirement is refused
- [Policies](Policies.md): Start-stage and main-stage behavior, built-ins, and
  custom policies
- [Spot Funds](Spot-Funds.md): Per-account funds policy - holdings lifecycle,
  limit-only mode, and market-order pricing
- [Pre-Trade Lock](Pre-Trade-Lock.md): Persist the reservation lock price, replay it
  on execution reports, and survive restarts
- [Market Data](Market-Data.md): Per-account, per-group, and default-bucket quote
  cache with resolution modes; provides prices for price-related policies
- [Market Data TTL](Market-Data-TTL.md): Quote freshness and the eight-tier,
  multi-axis TTL cascade
- [Market Data Pricing](Market-Data-Pricing.md): Market-order pricing from the quote
  cache via the spot funds policy
- [Balance Reconciliation](Balance-Reconciliation.md): Delta-versus-absolute
  outcomes and keeping your own ledger aligned with the engine
- [Policy API](Policy-API.md): Custom policy hooks, language interfaces, and
  rollback patterns
- [Dynamic Policy Reconfiguration](Dynamic-Policy-Reconfiguration.md): Retune
  built-in policies at runtime without rebuilding the engine
- [Non-Mutating Dry-Run](Non-Mutating-Dry-Run.md): Probe the pre-trade pipeline
  without spending budget, creating reservations, or recording account blocks
- [Reject Codes](Reject-Codes.md): Standard business reject codes and their
  meanings
- [Errors](Errors.md): Per-language split between business rejects returned as
  values and failures raised as errors
- [Threading Contract](Threading-Contract.md): Single-threaded-per-call execution,
  thread-portable sequential usage, and `user data` ownership contract
- [Storage](Storage.md): Built-in synchronization-aware key-value storage for
  custom policy state - selectable no-sync, full-sync, and caller-sharded
  policies
- [Domain Types](Domain-Types.md): Public value types, meanings, sign conventions,
  and leverage range
- [Custom Go Types](Custom-Go-Types.md): Go ClientEngine and typed model composition
- [Custom Python Types](Custom-Python-Types.md): Python model subclasses and
  custom-policy callback typing
- [Custom JS Types](Custom-JS-Types.md): Typed JavaScript policy payloads on the
  public SDK surface
- [Custom Cpp Types](Custom-Cpp-Types.md): C++ typed model composition and
  policy adapters
- [Custom Rust Types](Custom-Rust-Types.md): Rust capability traits and
  derive-based wrapper composition
- [Async Engine (Go and C++)](Async-Engine.md): Optional SDK helpers that turn an
  `AccountSync` engine into a future-based concurrent facade with
  per-account ordering, observer hooks, and graceful or hard stop modes
