Skip to main content

OKX

A leading cryptocurrency exchange with a unified trading account that supports spot, margin, perpetuals, futures, and options.

Overview​

PropertyValue
Websiteokx.com
Account ModelUnified account
Passphrase RequiredYes
API DocumentationOKX API Docs

Credential Requirements​

FieldRequiredDescription
apiKey✓API Key from OKX
apiSecret✓Secret Key from OKX
apiPassphrase✓Passphrase set during API creation
note

OKX requires a passphrase that you set when creating the API key. Store it securely as you'll need it when creating credentials in Cadenza.

Account Types​

OKX uses a unified account model. All trading products share the same collateral.

External IDAccount TypeDescription
tradingUNIFIEDUnified trading account (spot, margin, derivatives)
fundingFUNDINGFunding account for deposits/withdrawals

Trading Features​

FeatureSupportedNotes
Spot Trading✓
Cross Margin✓Unified account margin
Isolated Margin✓Per-position margin
Perpetual Swaps✓USDT and Crypto margined
Expiring Futures✓Weekly, bi-weekly, quarterly
Options✓European-style options

Margin Modes​

OKX unified account supports multiple margin modes:

ModeDescription
CrossAll positions share account margin
IsolatedEach position has dedicated margin
PortfolioCross-product margining with correlation benefits

Supported Order Types​

Order TypeSpotMarginDerivatives
Market✓✓✓
Limit✓✓✓
Stop Limit✓✓✓
Stop Market✓✓✓
Trailing Stop--✓
Iceberg✓✓✓
TWAP✓✓✓

API Key Setup​

Step 1: Access API Management​

  1. Log in to OKX
  2. Click on your profile icon
  3. Select API from the dropdown

Step 2: Create API Key​

  1. Click Create API Key
  2. Select Trading as the purpose
  3. Set a Passphrase (required, save it securely!)
  4. Complete verification

Step 3: Configure Permissions​

PermissionDescriptionRequired For
ReadRead account info, balances, ordersAll operations
TradeExecute ordersTrading
warning

Never enable "Withdraw" - Cadenza does not require withdrawal permissions.

  1. Enable IP restriction
  2. Add all of Cadenza's IP addresses:
34.80.181.33,34.80.30.227,35.234.57.233,35.185.174.159,34.81.236.114,35.201.166.55

You must add all 6 IP addresses. Cadenza routes requests through multiple outbound IPs, and missing any address will cause intermittent connection failures.

  1. Click Confirm

Step 5: Save Credentials​

Save all three values securely:

  1. API Key
  2. Secret Key
  3. Passphrase

Rate Limits​

Endpoint TypeLimit
Order placement60 requests/2 seconds
Order cancellation60 requests/2 seconds
Order query20 requests/2 seconds

Example: Create OKX Credential​

response = credential_api.create_trading_account_credential(
cadenza_client.CreateTradingAccountCredentialRequest(
venue=cadenza_client.Venue.OKX,
credential_type=cadenza_client.CredentialType.EXCHANGE,
api_key="your-okx-api-key",
api_secret="your-okx-secret-key",
api_passphrase="your-okx-passphrase", # Required for OKX
nickname="My OKX API"
)
)

Example: Connect OKX Account​

# Connect unified trading account
response = trading_account_api.connect_trading_account(
cadenza_client.ConnectTradingAccountRequest(
credential_ids=[credential_id],
external_trading_account_id="trading",
nickname="OKX Trading"
)
)
trading_account_id = response.data.trading_account_id
print(f"Connected: {trading_account_id}")

Instrument ID Format​

OKX instruments use the format: OKX:{BASE}/{QUOTE}

Instrument TypeExample
SpotOKX:BTC/USDT
Perpetual (USDT)OKX:BTC/USDT:USDT
Perpetual (Crypto)OKX:BTC/USD:BTC
FuturesOKX:BTC/USD:BTC-240329
OptionsOKX:BTC/USD:BTC-240329-50000-C

Unified Account Benefits​

  • Single margin pool - All positions share collateral
  • Cross-product hedging - Offset risk across products
  • No transfers needed - Trade any product instantly
  • Better capital efficiency - Lower margin requirements