Expand description
Core constants shared across the OKX adapter components.
Constants§
- OKX
- Venue identifier string.
- OKX_
ADVANCE_ ALGO_ ORDER_ TYPES - Advance algo order types that require
cancel-advance-algosfor cancellation. These cannot be cancelled via the standardcancel-algosendpoint. - OKX_
CONDITIONAL_ ORDER_ TYPES - Conditional order types that require the OKX algo order API.
- OKX_
FIELD_ CLORDID - JSON field key for client order ID in order operation responses.
- OKX_
FIELD_ SCODE - JSON field key for sub-error code in order operation responses.
- OKX_
FIELD_ SMSG - JSON field key for sub-error message in order operation responses.
- OKX_
FIELD_ SUBCODE - JSON field key for detailed sub-error code in order operation responses.
- OKX_
HTTP_ URL - OKX_
MAX_ CLORDID_ LEN - Maximum length of a
clOrdIdaccepted by OKX. - OKX_
NAUTILUS_ BROKER_ ID - See https://www.okx.com/docs-v5/en/#overview-broker-program for further details.
- OKX_
POST_ ONLY_ CANCEL_ REASON - Human-readable reason used when a post-only order is auto-cancelled for taking liquidity.
- OKX_
POST_ ONLY_ CANCEL_ SOURCE - OKX cancel source code used when a post-only order is auto-cancelled for taking liquidity.
- OKX_
POST_ ONLY_ ERROR_ CODE - OKX error code returned when a post-only order would immediately take liquidity.
- OKX_
SERVICE_ UPGRADE_ RECONNECT_ CODE - OKX WebSocket code indicating a service upgrade and required reconnect.
- OKX_
SLIPPAGE_ EXCEEDED_ ERROR_ CODE - OKX error code returned when a market order’s
slippagePctwould be exceeded by the projected fill, so the order is rejected. - OKX_
SLIPPAGE_ INVALID_ ERROR_ CODE - OKX error code returned when the supplied
slippagePctvalue is outside the venue-permitted range. - OKX_
SUCCESS_ CODE - OKX success response code for WebSocket operations.
- OKX_
SUPPORTED_ ORDER_ TYPES - OKX supported order types.
- OKX_
SUPPORTED_ TIME_ IN_ FORCE - OKX supported order time in force.
- OKX_
TARGET_ CCY_ BASE - Target currency literal for base currency.
- OKX_
TARGET_ CCY_ QUOTE - Target currency literal for quote currency.
- OKX_
WS_ BUSINESS_ URL - OKX_
WS_ DEMO_ BUSINESS_ URL - OKX_
WS_ DEMO_ PRIVATE_ URL - OKX_
WS_ DEMO_ PUBLIC_ URL - OKX_
WS_ HEARTBEAT_ SECS - WebSocket heartbeat (ping/pong) interval in seconds.
- OKX_
WS_ PRIVATE_ URL - OKX_
WS_ PUBLIC_ URL - OKX_
WS_ TOPIC_ DELIMITER
Statics§
- OKX_
CLIENT_ ID - Static client ID instance.
- OKX_
RETRY_ ERROR_ CODES - OKX error codes that should trigger retries.
- OKX_
VENUE - Static venue instance.
Functions§
- is_
slippage_ rejection - Returns
trueif the OKXsCodeidentifies a slippage-related rejection emitted in response to theslippagePctparameter on market orders. - resolve_
book_ depth - Clamps a requested book depth to the nearest OKX-supported value.
- resolve_
instrument_ families - Resolves instrument families for a given instrument type.
- should_
retry_ error_ code - Determines if an OKX error code should trigger a retry.
- validate_
okx_ client_ order_ id - Validates a
clOrdIdagainst OKX’s length and charset rules.