Skip to content

Reject Codes

Eugene Palchukovsky edited this page Aug 1, 2026 · 8 revisions

Reject Codes

OpenPit uses stable reject codes for standard business reject conditions. Each code names a class of failure; the reason and details fields carry the human-readable context for the specific case.

The vocabulary is standardized in the core and identical in every binding - Go, Python, JavaScript, C++, Rust, and C - so a code observed in one language means the same thing in all of them. Application logic should branch on the code rather than on reason or details text.

Validation and Shape

Code Meaning
MissingRequiredField A required field is absent
InvalidFieldFormat A field exists but has an invalid format
InvalidFieldValue A field exists but its value is not allowed
UnsupportedOrderType The order type is not supported by the current policy set
UnsupportedTimeInForce The time-in-force value is not supported
UnsupportedOrderAttribute The request contains an unsupported order attribute
DuplicateClientOrderId The client order ID is already in use

Timing and Venue State

Code Meaning
TooLateToEnter The request arrived after the allowed entry window
ExchangeClosed The venue or market is closed for the requested action

Reference Data and Configuration

Code Meaning
UnknownInstrument The instrument is not recognized
UnknownAccount The account is not recognized
UnknownVenue The venue is not recognized
UnknownClearingAccount The clearing account is not recognized
UnknownCollateralAsset The collateral asset is not recognized
RiskConfigurationMissing Required risk configuration is missing
ReferenceDataUnavailable Required reference data is unavailable
MarkPriceUnavailable A required mark price is missing or stale

Funds, Margin, and Exposure

Code Meaning
InsufficientFunds Available cash is not enough
InsufficientMargin Available margin is not enough
InsufficientPosition Available position is not enough
CreditLimitExceeded A credit limit would be exceeded
RiskLimitExceeded A general risk limit would be exceeded
OrderExceedsLimit More than one order-size limit would be exceeded
OrderQtyExceedsLimit The requested quantity exceeds its limit
OrderNotionalExceedsLimit The requested notional exceeds its limit
PositionLimitExceeded A position limit would be exceeded
ConcentrationLimitExceeded A concentration limit would be exceeded
LeverageLimitExceeded A leverage limit would be exceeded
OrderValueCalculationFailed The policy could not evaluate notional, cash flow, or derived quantity safely; this includes missing price when the policy needs it
AccountAdjustmentBoundsExceeded An account adjustment would violate its configured bounds

Rate, Account, and Blocking State

Code Meaning
RateLimitExceeded Too many requests were submitted inside the configured window
PnlKillSwitchTriggered A configured P&L kill switch (PnlBoundsKillSwitchPolicy or the self-computed PnL axis in SpotFundsPolicy) either found accumulated P&L outside its configured bounds, or could not keep accumulating it and halted that P&L. Both conditions stop the account the same way, so they share one code
AccountBlocked The account is blocked from new requests
AccountNotAuthorized The account is not authorized for the requested action

Compliance and Market Conduct

Code Meaning
ComplianceRestriction A compliance rule blocks the request
InstrumentRestricted The instrument is restricted
JurisdictionRestriction The request is blocked by jurisdiction rules
WashTradePrevention The request would violate wash-trade prevention
SelfMatchPrevention The request would self-match
ShortSaleRestriction The request violates a short-sale restriction

Custom Policy

Code Meaning
Custom Reject code defined by a custom policy. Use the user data reject field for an extended payload.

System Fallback

Code Meaning
SystemUnavailable The system cannot process the request right now
ArithmeticOverflow Exact decimal arithmetic exceeded the supported range during evaluation
Other A standard code does not describe the case precisely enough

SystemUnavailable is also the engine's own code for a failed mutation finalizer, under policy Engine and reason mutation finalizer failed. That is how a caller learns its kill switch is armed, since the finalizing commit or rollback call itself is void; see Account Blocking - Mutation Finalizer Contract.

Evaluation Failures and Drop Copy

Drop copy distinguishes a policy verdict from a failure to calculate or apply the historical order. An evaluation failure makes apply compensate the collected mutations and return the rejects instead of an operation. Ordinary risk and compliance rejects do not enforce admission because the order already happened.

Use the binding-native classifier instead of copying this list into application code:

  • Go: Code.IsEvaluationFailure()
  • Python: RejectCode.is_evaluation_failure()
  • JavaScript: isEvaluationFailure(code)
  • C++: IsEvaluationFailure(code)
  • Rust: RejectCode::is_evaluation_failure()

The current evaluation-failure codes are MissingRequiredField, UnknownInstrument, UnknownAccount, UnknownVenue, UnknownClearingAccount, UnknownCollateralAsset, RiskConfigurationMissing, ReferenceDataUnavailable, OrderValueCalculationFailed, SystemUnavailable, MarkPriceUnavailable, and ArithmeticOverflow. AccountAdjustmentBoundsExceeded, Custom, and Other are ordinary verdicts and are not evaluation failures.

Related Pages

  • Pre-trade Pipeline: How rejects are returned
  • Errors: Which failures are returned as rejects and which are raised as errors in each language
  • Policies: Which built-in policies emit standard reject codes
  • Account Blocking: Blocking causes, the engine-wide block, and the mutation finalizer contract

Clone this wiki locally