OKX.Net AI API Quick Map

July 21, 2026 ยท View on GitHub

Use this file to route common user intents to the correct OKX.Net client member. If a method name or parameter is not listed here, inspect OKX.Net/Interfaces/Clients/UnifiedApi/** before generating code.

Client Roots

IntentUse
REST callsnew OKXRestClient()
WebSocket streams and socket API requestsnew OKXSocketClient()
API key authenticationoptions.ApiCredentials = new OKXCredentials("key", "secret", "passphrase")
Live environmentOKXEnvironment.Live
Demo / test environmentOKXEnvironment.Demo
Europe environmentOKXEnvironment.Europe
Dependency injectionservices.AddOKX(options => { ... })

Unified REST Roots

User intentOKX.Net member
Public market dataclient.UnifiedApi.ExchangeData
Account, balances, funding, withdrawals, leverageclient.UnifiedApi.Account
Orders, fills, algo orders, order historyclient.UnifiedApi.Trading
Sub-account managementclient.UnifiedApi.SubAccounts
Copy tradingclient.UnifiedApi.CopyTrading
Shared REST abstractionclient.UnifiedApi.SharedClient

Market Data REST

User intentOKX.Net member
Get server timeclient.UnifiedApi.ExchangeData.GetServerTimeAsync()
Get one tickerclient.UnifiedApi.ExchangeData.GetTickerAsync("BTC-USDT")
Get tickers by product typeclient.UnifiedApi.ExchangeData.GetTickersAsync(InstrumentType.Spot)
Get order bookclient.UnifiedApi.ExchangeData.GetOrderBookAsync("BTC-USDT", depth: 20)
Get recent tradesclient.UnifiedApi.ExchangeData.GetRecentTradesAsync("BTC-USDT")
Get trade historyclient.UnifiedApi.ExchangeData.GetTradeHistoryAsync("BTC-USDT")
Get klines/candlesclient.UnifiedApi.ExchangeData.GetKlinesAsync("BTC-USDT", KlineInterval.OneMinute)
Get historical klinesclient.UnifiedApi.ExchangeData.GetKlineHistoryAsync("BTC-USDT", KlineInterval.OneMinute)
Get instruments/symbolsclient.UnifiedApi.ExchangeData.GetSymbolsAsync(InstrumentType.Spot)
Get underlying valuesclient.UnifiedApi.ExchangeData.GetUnderlyingAsync(InstrumentType.Futures)
Get mark pricesclient.UnifiedApi.ExchangeData.GetMarkPricesAsync(InstrumentType.Swap, symbol: "BTC-USDT-SWAP")
Get mark price klinesclient.UnifiedApi.ExchangeData.GetMarkPriceKlinesAsync("BTC-USDT-SWAP", KlineInterval.OneMinute)
Get index tickersclient.UnifiedApi.ExchangeData.GetIndexTickersAsync(symbol: "BTC-USD")
Get index klinesclient.UnifiedApi.ExchangeData.GetIndexKlinesAsync("BTC-USD", KlineInterval.OneMinute)
Get funding ratesclient.UnifiedApi.ExchangeData.GetFundingRatesAsync("BTC-USDT-SWAP")
Get funding rate historyclient.UnifiedApi.ExchangeData.GetFundingRateHistoryAsync("BTC-USDT-SWAP")
Get open interestclient.UnifiedApi.ExchangeData.GetOpenInterestsAsync(InstrumentType.Swap, symbol: "BTC-USDT-SWAP")
Get price limitsclient.UnifiedApi.ExchangeData.GetPriceLimitsAsync("BTC-USDT-SWAP")
Get position tiersclient.UnifiedApi.ExchangeData.GetPositionTiersAsync(InstrumentType.Swap, MarginMode.Cross, "BTC-USDT")
Get insurance fundclient.UnifiedApi.ExchangeData.GetInsuranceFundAsync(InstrumentType.Swap)
Get 24h platform volumeclient.UnifiedApi.ExchangeData.Get24HourVolumeAsync()
Get announcementsclient.UnifiedApi.ExchangeData.GetAnnouncementsAsync()
Get announcement typesclient.UnifiedApi.ExchangeData.GetAnnouncementTypesAsync()

Trading Statistics REST

User intentOKX.Net member
Contract open interest and volumeclient.UnifiedApi.ExchangeData.GetTradeStatsContractSummaryAsync("BTC")
Long/short account ratioclient.UnifiedApi.ExchangeData.GetTradeStatsLongShortRatioAsync("BTC")
Margin lending ratioclient.UnifiedApi.ExchangeData.GetTradeStatsMarginLendingRatioAsync("BTC")
Options open interest and volumeclient.UnifiedApi.ExchangeData.GetTradeStatsOptionsSummaryAsync("BTC")
Options expiry open interest/volumeclient.UnifiedApi.ExchangeData.GetTradeStatsInterestVolumeExpiryAsync("BTC")
Options strike open interest/volumeclient.UnifiedApi.ExchangeData.GetTradeStatsInterestVolumeStrikeAsync("BTC", "20260626")
Put/call ratioclient.UnifiedApi.ExchangeData.GetTradeStatsPutCallRatioAsync("BTC")
Taker volumeclient.UnifiedApi.ExchangeData.GetTradeStatsTakerVolumeAsync("BTC", InstrumentType.Spot)
Taker flowclient.UnifiedApi.ExchangeData.GetTradeStatsTakerFlowAsync("BTC")
Supported trading-stat assetsclient.UnifiedApi.ExchangeData.GetTradeStatsSupportedAssetsAsync()

Account And Funding REST

User intentOKX.Net member
Get account balanceclient.UnifiedApi.Account.GetAccountBalanceAsync()
Get balance for one assetclient.UnifiedApi.Account.GetAccountBalanceAsync("USDT")
Get account configurationclient.UnifiedApi.Account.GetAccountConfigurationAsync()
Get positionsclient.UnifiedApi.Account.GetPositionsAsync(InstrumentType.Swap, "BTC-USDT-SWAP")
Get position historyclient.UnifiedApi.Account.GetPositionHistoryAsync(...)
Get position riskclient.UnifiedApi.Account.GetPositionRiskAsync(...)
Get account risk stateclient.UnifiedApi.Account.GetAccountRiskStateAsync()
Set leverageclient.UnifiedApi.Account.SetLeverageAsync(leverage, MarginMode.Cross, symbol: "BTC-USDT-SWAP")
Get leverageclient.UnifiedApi.Account.GetLeverageAsync("BTC-USDT-SWAP", MarginMode.Cross)
Set position modeclient.UnifiedApi.Account.SetPositionModeAsync(PositionMode.LongShortMode)
Set account modeclient.UnifiedApi.Account.SetAccountModeAsync(AccountLevel.Simple)
Precheck account mode switchclient.UnifiedApi.Account.PrecheckAccountModeSwitchAsync(AccountLevel.Simple)
Transfer fundsclient.UnifiedApi.Account.TransferAsync(...)
Get transferclient.UnifiedApi.Account.GetTransferAsync(...)
Get funding balanceclient.UnifiedApi.Account.GetFundingBalanceAsync()
Get assetsclient.UnifiedApi.Account.GetAssetsAsync()
Get deposit addressclient.UnifiedApi.Account.GetDepositAddressAsync("USDT")
Get deposit historyclient.UnifiedApi.Account.GetDepositHistoryAsync(...)
Get withdrawal historyclient.UnifiedApi.Account.GetWithdrawalHistoryAsync(...)
Withdraw assetclient.UnifiedApi.Account.WithdrawAsync(...)
Cancel withdrawalclient.UnifiedApi.Account.CancelWithdrawalAsync(withdrawalId)
Get fee ratesclient.UnifiedApi.Account.GetFeeRatesAsync(...)
Get maximum amountclient.UnifiedApi.Account.GetMaximumAmountAsync(...)
Get maximum available amountclient.UnifiedApi.Account.GetMaximumAvailableAmountAsync(...)
Get maximum loan amountclient.UnifiedApi.Account.GetMaximumLoanAmountAsync(...)
Get maximum withdrawalsclient.UnifiedApi.Account.GetMaximumWithdrawalsAsync()
Get saving balancesclient.UnifiedApi.Account.GetSavingBalancesAsync()
Purchase/redeem savingsclient.UnifiedApi.Account.SavingPurchaseRedemptionAsync(...)
Manual borrow/repayclient.UnifiedApi.Account.ManualBorrowRepay(...)
Set auto repayclient.UnifiedApi.Account.SetAutoRepayAsync(true)
Get borrow/repay historyclient.UnifiedApi.Account.GetBorrowRepayHistoryAsync(...)

Trading REST

User intentOKX.Net member
Place spot orderclient.UnifiedApi.Trading.PlaceOrderAsync("BTC-USDT", OrderSide.Buy, OrderType.Limit, quantity, price, tradeMode: TradeMode.Cash)
Place swap/futures orderclient.UnifiedApi.Trading.PlaceOrderAsync("BTC-USDT-SWAP", OrderSide.Buy, OrderType.Market, quantity, positionSide: PositionSide.Long, tradeMode: TradeMode.Cross)
Place multiple ordersclient.UnifiedApi.Trading.PlaceMultipleOrdersAsync(IEnumerable<OKXOrderPlaceRequest>)
Precheck orderclient.UnifiedApi.Trading.CheckOrderAsync(...)
Get open ordersclient.UnifiedApi.Trading.GetOrdersAsync(...)
Get order detailsclient.UnifiedApi.Trading.GetOrderDetailsAsync(symbol, orderId)
Get order historyclient.UnifiedApi.Trading.GetOrderHistoryAsync(InstrumentType.Spot, symbol: "BTC-USDT")
Get order archiveclient.UnifiedApi.Trading.GetOrderArchiveAsync(InstrumentType.Spot, symbol: "BTC-USDT")
Cancel orderclient.UnifiedApi.Trading.CancelOrderAsync(symbol, orderId)
Cancel multiple ordersclient.UnifiedApi.Trading.CancelMultipleOrdersAsync(...)
Amend orderclient.UnifiedApi.Trading.AmendOrderAsync(...)
Amend multiple ordersclient.UnifiedApi.Trading.AmendMultipleOrdersAsync(...)
Close positionclient.UnifiedApi.Trading.ClosePositionAsync("BTC-USDT-SWAP", MarginMode.Cross, PositionSide.Long)
Get user tradesclient.UnifiedApi.Trading.GetUserTradesAsync(...)
Get user trade archiveclient.UnifiedApi.Trading.GetUserTradesArchiveAsync(...)
Place algo orderclient.UnifiedApi.Trading.PlaceAlgoOrderAsync(...)
Get algo orderclient.UnifiedApi.Trading.GetAlgoOrderAsync(...)
Get algo order listclient.UnifiedApi.Trading.GetAlgoOrderListAsync(...)
Get algo order historyclient.UnifiedApi.Trading.GetAlgoOrderHistoryAsync(...)
Cancel algo orderclient.UnifiedApi.Trading.CancelAlgoOrderAsync(...)
Amend algo orderclient.UnifiedApi.Trading.AmendAlgoOrderAsync(...)
Cancel all after timeoutclient.UnifiedApi.Trading.CancelAllAfterAsync(timeout)
Get account rate limitsclient.UnifiedApi.Trading.GetAccountRateLimitAsync()

Sub-Accounts REST

User intentOKX.Net member
Get sub-accountsclient.UnifiedApi.SubAccounts.GetSubAccountsAsync()
Create sub-accountclient.UnifiedApi.SubAccounts.CreateSubAccountAsync(...)
Get sub-account billsclient.UnifiedApi.SubAccounts.GetSubAccountBillsAsync(...)
Get sub-account funding balancesclient.UnifiedApi.SubAccounts.GetSubAccountFundingBalancesAsync(...)
Get sub-account trading balancesclient.UnifiedApi.SubAccounts.GetSubAccountTradingBalancesAsync(...)
Transfer between sub-accountsclient.UnifiedApi.SubAccounts.TransferBetweenSubAccountsAsync(...)
Create sub-account API keyclient.UnifiedApi.SubAccounts.CreateSubAccountApiKeyAsync(...)
Get sub-account API keysclient.UnifiedApi.SubAccounts.GetSubAccountApiKeysAsync(...)
Reset sub-account API keyclient.UnifiedApi.SubAccounts.ResetSubAccountApiKeyAsync(...)
Delete sub-account API keyclient.UnifiedApi.SubAccounts.DeleteSubAccountApiKeyAsync(...)
Set sub-account transfer outclient.UnifiedApi.SubAccounts.SetSubAccountTransferOutAsync(...)

Copy Trading REST

User intentOKX.Net member
Get copy trading account configurationclient.UnifiedApi.CopyTrading.GetAccountConfigurationAsync()
Get lead positionsclient.UnifiedApi.CopyTrading.GetLeadPositionsAsync(...)
Get lead position historyclient.UnifiedApi.CopyTrading.GetLeadPositionHistoryAsync(...)
Get lead trader current positionsclient.UnifiedApi.CopyTrading.GetLeadTraderCurrentLeadPositionsAsync(...)
Place lead stop orderclient.UnifiedApi.CopyTrading.PlaceLeadStopOrderAsync(...)
Close lead positionclient.UnifiedApi.CopyTrading.CloseLeadPositionAsync(...)
Get leading instrumentsclient.UnifiedApi.CopyTrading.GetLeadingInstrumentsAsync(...)
Amend leading instrumentsclient.UnifiedApi.CopyTrading.AmendLeadingInstrumentsAsync(...)

WebSocket Exchange Data

User intentOKX.Net member
Subscribe ticker updatessocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync(symbol, handler)
Subscribe many ticker updatessocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync(symbols, handler)
Subscribe tradessocketClient.UnifiedApi.ExchangeData.SubscribeToTradeUpdatesAsync(symbol, handler)
Subscribe many tradessocketClient.UnifiedApi.ExchangeData.SubscribeToTradeUpdatesAsync(symbols, handler)
Subscribe klinessocketClient.UnifiedApi.ExchangeData.SubscribeToKlineUpdatesAsync(symbol, interval, handler)
Subscribe many klinessocketClient.UnifiedApi.ExchangeData.SubscribeToKlineUpdatesAsync(symbols, interval, handler)
Subscribe order booksocketClient.UnifiedApi.ExchangeData.SubscribeToOrderBookUpdatesAsync(symbol, OrderBookType.OrderBook, handler)
Subscribe many order bookssocketClient.UnifiedApi.ExchangeData.SubscribeToOrderBookUpdatesAsync(symbols, OrderBookType.OrderBook, handler)
Subscribe funding ratessocketClient.UnifiedApi.ExchangeData.SubscribeToFundingRateUpdatesAsync(symbol, handler)
Subscribe mark pricessocketClient.UnifiedApi.ExchangeData.SubscribeToMarkPriceUpdatesAsync(symbol, handler)
Subscribe mark price klinessocketClient.UnifiedApi.ExchangeData.SubscribeToMarkPriceKlineUpdatesAsync(symbol, interval, handler)
Subscribe index tickersocketClient.UnifiedApi.ExchangeData.SubscribeToIndexTickerUpdatesAsync(symbol, handler)
Subscribe index klinessocketClient.UnifiedApi.ExchangeData.SubscribeToIndexKlineUpdatesAsync(symbol, interval, handler)
Subscribe open interestsocketClient.UnifiedApi.ExchangeData.SubscribeToOpenInterestUpdatesAsync(symbol, handler)
Subscribe price limitssocketClient.UnifiedApi.ExchangeData.SubscribeToPriceLimitUpdatesAsync(symbol, handler)
Subscribe symbol updatessocketClient.UnifiedApi.ExchangeData.SubscribeToSymbolUpdatesAsync(InstrumentType.Spot, handler)
Subscribe system statussocketClient.UnifiedApi.ExchangeData.SubscribeToSystemStatusUpdatesAsync(handler)
Subscribe option summarysocketClient.UnifiedApi.ExchangeData.SubscribeToOptionSummaryUpdatesAsync(instrumentFamily, handler)

WebSocket Account And Trading

User intentOKX.Net member
Subscribe account balance updatessocketClient.UnifiedApi.Account.SubscribeToAccountUpdatesAsync(asset, regularUpdates, handler)
Subscribe balance and position updatessocketClient.UnifiedApi.Account.SubscribeToBalanceAndPositionUpdatesAsync(handler)
Subscribe deposit updatessocketClient.UnifiedApi.Account.SubscribeToDepositUpdatesAsync(handler)
Subscribe withdrawal updatessocketClient.UnifiedApi.Account.SubscribeToWithdrawalUpdatesAsync(handler)
Subscribe order updatessocketClient.UnifiedApi.Trading.SubscribeToOrderUpdatesAsync(InstrumentType.Spot, symbol, instrumentFamily, handler)
Subscribe user trade updatessocketClient.UnifiedApi.Trading.SubscribeToUserTradeUpdatesAsync(...)
Subscribe position updatessocketClient.UnifiedApi.Trading.SubscribeToPositionUpdatesAsync(...)
Subscribe liquidation warningssocketClient.UnifiedApi.Trading.SubscribeToLiquidationWarningUpdatesAsync(...)
Subscribe algo order updatessocketClient.UnifiedApi.Trading.SubscribeToAlgoOrderUpdatesAsync(...)
Subscribe advanced algo order updatessocketClient.UnifiedApi.Trading.SubscribeToAdvanceAlgoOrderUpdatesAsync(...)
Socket API place ordersocketClient.UnifiedApi.Trading.PlaceOrderAsync(...)
Socket API place multiple orderssocketClient.UnifiedApi.Trading.PlaceMultipleOrdersAsync(...)
Socket API cancel ordersocketClient.UnifiedApi.Trading.CancelOrderAsync(...)
Socket API cancel multiple orderssocketClient.UnifiedApi.Trading.CancelMultipleOrdersAsync(...)
Socket API amend ordersocketClient.UnifiedApi.Trading.AmendOrderAsync(...)
Socket API amend multiple orderssocketClient.UnifiedApi.Trading.AmendMultipleOrdersAsync(...)

WebSocket subscription methods return WebSocketResult<UpdateSubscription>. Socket API request/response methods return QueryResult<T>.

SharedApis

User intentOKX.Net member or interface
Shared REST clientnew OKXRestClient().UnifiedApi.SharedClient
Shared socket clientnew OKXSocketClient().UnifiedApi.SharedClient
Discover shared capabilitiesclient.UnifiedApi.SharedClient.Discover()
Shared spot symbols and catalogISpotSymbolRestClient.GetSpotSymbolsAsync(...) and ISpotSymbolRestClient.SpotSymbolCatalog
Shared futures symbols and catalogIFuturesSymbolRestClient.GetFuturesSymbolsAsync(...) and IFuturesSymbolRestClient.FuturesSymbolCatalog
Shared spot ticker RESTISpotTickerRestClient.GetSpotTickerAsync(new GetTickerRequest(symbol))
Shared spot order RESTISpotOrderRestClient.PlaceSpotOrderAsync(...)
Shared futures order RESTIFuturesOrderRestClient.PlaceFuturesOrderAsync(...)
Shared balances RESTIBalanceRestClient.GetBalancesAsync(...)
Shared klines RESTIKlineRestClient.GetKlinesAsync(...)
Shared order book RESTIOrderBookRestClient.GetOrderBookAsync(...)
Shared funding rate RESTIFundingRateRestClient.GetFundingRateAsync(...)
Shared leverage RESTILeverageRestClient.SetLeverageAsync(...)
Shared ticker socketITickerSocketClient.SubscribeToTickerUpdatesAsync(...)
Shared trade socketITradeSocketClient.SubscribeToTradeUpdatesAsync(...)
Shared order book socketIOrderBookSocketClient.SubscribeToOrderBookUpdatesAsync(...)
Shared balance socketIBalanceSocketClient.SubscribeToBalanceUpdatesAsync(...)
Shared position socketIPositionSocketClient.SubscribeToPositionUpdatesAsync(...)

Shared REST methods return HttpResult<T> or HttpResult. Shared socket subscriptions return WebSocketResult<UpdateSubscription>. Shared symbol/cache helper methods can return ExchangeCallResult<T>.

Shared spot and futures symbols populate DisplayName, BaseAssetType, BaseAssetSubType, QuoteAssetType, and QuoteAssetSubType. Use this metadata for crypto, fiat, TradFi, stablecoin, equity, and commodity classification instead of parsing symbol strings.

For shared socket subscriptions, keep the concrete socket client and unsubscribe with await socketClient.UnsubscribeAsync(subscription.Data).

Result Handling

SituationPattern
REST success checkREST methods return HttpResult<T> or HttpResult; use if (!result.Success) { Console.WriteLine(result.Error); return; }
Socket subscription success checkSocket subscriptions return WebSocketResult<UpdateSubscription>; use if (!sub.Success) { Console.WriteLine(sub.Error); return; }
Socket API request success checkSocket request/response methods return QueryResult<T>; use the same .Success and .Error pattern
Read result dataRead result.Data or sub.Data only after .Success
Shared helper success checkShared symbol/cache helpers can return ExchangeCallResult<T>; use the same .Success and .Error pattern
Retry decisionRetry only when result.Error?.IsTransient == true
CancellationPass ct: cancellationToken

Common Routing Pitfalls

Do not useUse instead
OKXClientOKXRestClient
ApiCredentials in examplesOKXCredentials("key", "secret", "passphrase")
SpotApiUnifiedApi with InstrumentType.Spot or spot symbol
FuturesApi / SwapApiUnifiedApi with futures/swap symbol and InstrumentType
Binance-style BTCUSDTOKX symbol format BTC-USDT
.Data without .Success checkCheck .Success first
Recreating clients per requestReuse clients or use services.AddOKX(...)
Forgetting WebSocket teardownStore UpdateSubscription and call UnsubscribeAsync