-
Notifications
You must be signed in to change notification settings - Fork 1
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.
| 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 |
| Code | Meaning |
|---|---|
TooLateToEnter |
The request arrived after the allowed entry window |
ExchangeClosed |
The venue or market is closed for the requested action |
| 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 |
| 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 |
| 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 |
| 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 |
| Code | Meaning |
|---|---|
Custom |
Reject code defined by a custom policy. Use the user data reject field for an extended payload. |
| 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.
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.
- 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