REST API for the BitMEX Trading Platform If you are building automated tools, please subscribe to the BitMEX API RSS Feed for changes. The feed will be updated regularly and is the most reliable way to get downtime and update announcements. View Changelog - #### Getting Started Base URI: https://www.bitmex.com/api/v1 ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept count
, start
, and reverse
params. Set reverse=true
to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in the main API documentation. All table data is available via the Websocket. We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send ?_format=csv
to get CSV data or ?_format=xml
to get XML data. ##### Trade Data Queries This is only a small subset of what is available, to get you started. Fill in the parameters and click the Try it out!
button to try any of these queries. - Pricing Data - Trade Data - OrderBook Data - Settlement Data - Exchange Statistics Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification ⇩ Download Swagger JSON - ## All API Endpoints Click to expand a section.
This ObjC package is automatically generated by the Swagger Codegen project:
- API version: 1.2.0
- Package version:
- Build package: io.swagger.codegen.languages.ObjcClientCodegen
The SDK requires ARC (Automatic Reference Counting) to be enabled in the Xcode project.
Install from Github using CocoaPods
Add the following to the Podfile:
pod 'SwaggerClient', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
To specify a particular branch, append , :branch => 'branch-name-here'
To specify a particular commit, append , :commit => '11aa22'
Install from local path using CocoaPods
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/SwaggerClient) and then add the following to the Podfile:
pod 'SwaggerClient', :path => 'Vendor/SwaggerClient'
Import the following:
#import <SwaggerClient/SWGApiClient.h>
#import <SwaggerClient/SWGDefaultConfiguration.h>
// load models
#import <SwaggerClient/SWGAPIKey.h>
#import <SwaggerClient/SWGAccessToken.h>
#import <SwaggerClient/SWGAddress.h>
#import <SwaggerClient/SWGAffiliate.h>
#import <SwaggerClient/SWGAnnouncement.h>
#import <SwaggerClient/SWGAssetsConfig.h>
#import <SwaggerClient/SWGAssetsConfigNetworkItem.h>
#import <SwaggerClient/SWGChat.h>
#import <SwaggerClient/SWGChatChannel.h>
#import <SwaggerClient/SWGCollateralSupportAgreement.h>
#import <SwaggerClient/SWGCommunicationToken.h>
#import <SwaggerClient/SWGConnectedUsers.h>
#import <SwaggerClient/SWGDepositAddress.h>
#import <SwaggerClient/SWGError.h>
#import <SwaggerClient/SWGErrorError.h>
#import <SwaggerClient/SWGExecution.h>
#import <SwaggerClient/SWGFunding.h>
#import <SwaggerClient/SWGGlobalNotification.h>
#import <SwaggerClient/SWGGuild.h>
#import <SwaggerClient/SWGIndexComposite.h>
#import <SwaggerClient/SWGInlineResponse200.h>
#import <SwaggerClient/SWGInstrument.h>
#import <SwaggerClient/SWGInstrumentInterval.h>
#import <SwaggerClient/SWGInsurance.h>
#import <SwaggerClient/SWGLeaderboard.h>
#import <SwaggerClient/SWGLiquidation.h>
#import <SwaggerClient/SWGMargin.h>
#import <SwaggerClient/SWGNetworksConfig.h>
#import <SwaggerClient/SWGOrder.h>
#import <SwaggerClient/SWGOrderBookL2.h>
#import <SwaggerClient/SWGPinnedMessage.h>
#import <SwaggerClient/SWGPorl.h>
#import <SwaggerClient/SWGPosition.h>
#import <SwaggerClient/SWGQuote.h>
#import <SwaggerClient/SWGQuoteFillRatio.h>
#import <SwaggerClient/SWGQuoteValueRatio.h>
#import <SwaggerClient/SWGSettlement.h>
#import <SwaggerClient/SWGStakingRecord.h>
#import <SwaggerClient/SWGStats.h>
#import <SwaggerClient/SWGStatsHistory.h>
#import <SwaggerClient/SWGStatsUSD.h>
#import <SwaggerClient/SWGStatsUSDBySymbol.h>
#import <SwaggerClient/SWGTrade.h>
#import <SwaggerClient/SWGTradeBin.h>
#import <SwaggerClient/SWGTradingVolume.h>
#import <SwaggerClient/SWGTransaction.h>
#import <SwaggerClient/SWGUser.h>
#import <SwaggerClient/SWGUserCommissionsBySymbol.h>
#import <SwaggerClient/SWGUserEvent.h>
#import <SwaggerClient/SWGUserPreferences.h>
#import <SwaggerClient/SWGWallet.h>
#import <SwaggerClient/SWGWalletSummaryRecord.h>
#import <SwaggerClient/SWGXAny.h>
// load API classes for accessing endpoints
#import <SwaggerClient/SWGAPIKeyApi.h>
#import <SwaggerClient/SWGAddressApi.h>
#import <SwaggerClient/SWGAnnouncementApi.h>
#import <SwaggerClient/SWGChatApi.h>
#import <SwaggerClient/SWGExecutionApi.h>
#import <SwaggerClient/SWGFundingApi.h>
#import <SwaggerClient/SWGGlobalNotificationApi.h>
#import <SwaggerClient/SWGGuildApi.h>
#import <SwaggerClient/SWGInstrumentApi.h>
#import <SwaggerClient/SWGInsuranceApi.h>
#import <SwaggerClient/SWGLeaderboardApi.h>
#import <SwaggerClient/SWGLiquidationApi.h>
#import <SwaggerClient/SWGOrderApi.h>
#import <SwaggerClient/SWGOrderBookApi.h>
#import <SwaggerClient/SWGPorlApi.h>
#import <SwaggerClient/SWGPositionApi.h>
#import <SwaggerClient/SWGQuoteApi.h>
#import <SwaggerClient/SWGSchemaApi.h>
#import <SwaggerClient/SWGSettlementApi.h>
#import <SwaggerClient/SWGStatsApi.h>
#import <SwaggerClient/SWGTradeApi.h>
#import <SwaggerClient/SWGUserApi.h>
#import <SwaggerClient/SWGUserAffiliatesApi.h>
#import <SwaggerClient/SWGUserEventApi.h>
#import <SwaggerClient/SWGWalletApi.h>
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issues.
Please follow the installation procedure and then run the following:
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure API key authorization: (authentication scheme: apiExpires)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api-expires"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api-expires"];
// Configure API key authorization: (authentication scheme: apiKey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api-key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api-key"];
// Configure API key authorization: (authentication scheme: apiSignature)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api-signature"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api-signature"];
NSNumber* *reverse = @false; // If true, will sort results newest first. (optional) (default to false)
SWGAPIKeyApi *apiInstance = [[SWGAPIKeyApi alloc] init];
// Get your API Keys.
[apiInstance aPIKeyGetWithReverse:reverse
completionHandler: ^(NSArray<SWGAPIKey>* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
All URIs are relative to https://www.bitmex.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
SWGAPIKeyApi | aPIKeyGet | GET /apiKey | Get your API Keys. |
SWGAddressApi | addressGet | GET /address | Get your addresses. |
SWGAddressApi | addressNew | POST /address | Creates a new saved address. |
SWGAnnouncementApi | announcementGet | GET /announcement | Get site announcements. |
SWGAnnouncementApi | announcementGetUrgent | GET /announcement/urgent | Get urgent (banner) announcements. |
SWGChatApi | chatGet | GET /chat | Get chat messages. |
SWGChatApi | chatGetChannels | GET /chat/channels | Get available channels. |
SWGChatApi | chatGetConnected | GET /chat/connected | Get connected users. |
SWGChatApi | chatGetPinnedMessage | GET /chat/pinned | Get pinned message for a channel. |
SWGChatApi | chatNew | POST /chat | Send a chat message. |
SWGExecutionApi | executionGet | GET /execution | Get all raw executions for your account. |
SWGExecutionApi | executionGetTradeHistory | GET /execution/tradeHistory | Get all balance-affecting executions. |
SWGFundingApi | fundingGet | GET /funding | Get funding history. |
SWGGlobalNotificationApi | globalNotificationGet | GET /globalNotification | Get your current GlobalNotifications. |
SWGGuildApi | guildArchive | POST /guild/archive | Archive a guild |
SWGGuildApi | guildEdit | PUT /guild | Edit guild new guild |
SWGGuildApi | guildGet | GET /guild | Get all guilds |
SWGGuildApi | guildJoin | POST /guild/join | Request to Join a private guild or join a public guild |
SWGGuildApi | guildKick | POST /guild/kick | Kick member from guild |
SWGGuildApi | guildLeave | POST /guild/leave | Leave guild or cancel guild join request |
SWGGuildApi | guildNew | POST /guild | Creates a new guild |
SWGGuildApi | guildShareTrades | POST /guild/shareTrades | Toggle share trades for your account, which controls whether your guild members can see your orders and positions in their UI |
SWGInstrumentApi | instrumentGet | GET /instrument | Get instruments. |
SWGInstrumentApi | instrumentGetActive | GET /instrument/active | Get all active instruments and instruments that have expired in <24hrs. |
SWGInstrumentApi | instrumentGetActiveAndIndices | GET /instrument/activeAndIndices | Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active. |
SWGInstrumentApi | instrumentGetActiveIntervals | GET /instrument/activeIntervals | Return all active contract series and interval pairs. |
SWGInstrumentApi | instrumentGetCompositeIndex | GET /instrument/compositeIndex | Show constituent parts of an index. |
SWGInstrumentApi | instrumentGetIndices | GET /instrument/indices | Get all price indices. |
SWGInstrumentApi | instrumentGetUsdVolume | GET /instrument/usdVolume | Get a summary of exchange statistics in USD. |
SWGInsuranceApi | insuranceGet | GET /insurance | Get insurance fund history. |
SWGLeaderboardApi | leaderboardGet | GET /leaderboard | Get current leaderboard. |
SWGLeaderboardApi | leaderboardGetName | GET /leaderboard/name | Get your alias on the leaderboard. |
SWGLiquidationApi | liquidationGet | GET /liquidation | Get liquidation orders. |
SWGOrderApi | orderAmend | PUT /order | Amend the quantity or price of an open order. |
SWGOrderApi | orderCancel | DELETE /order | Cancel order(s). Send multiple order IDs to cancel in bulk. |
SWGOrderApi | orderCancelAll | DELETE /order/all | Cancels all of your orders. |
SWGOrderApi | orderCancelAllAfter | POST /order/cancelAllAfter | Automatically cancel all your orders after a specified timeout. |
SWGOrderApi | orderClosePosition | POST /order/closePosition | Close a position. [Deprecated, use POST /order with execInst: 'Close'] |
SWGOrderApi | orderGetOrders | GET /order | Get your orders. |
SWGOrderApi | orderNew | POST /order | Create a new order. |
SWGOrderBookApi | orderBookGetL2 | GET /orderBook/L2 | Get current orderbook in vertical format. |
SWGPorlApi | porlGetNonce | GET /porl/nonce | Get your Proof of Reserves nonce and data. |
SWGPorlApi | porlGetSnapshots | GET /porl/snapshots | Get Proof of Reserves historical snapshots |
SWGPositionApi | positionGet | GET /position | Get your positions. |
SWGPositionApi | positionIsolateMargin | POST /position/isolate | Enable isolated margin or cross margin per-position. |
SWGPositionApi | positionTransferIsolatedMargin | POST /position/transferMargin | Transfer equity in or out of a position. |
SWGPositionApi | positionUpdateLeverage | POST /position/leverage | Choose leverage for a position. |
SWGPositionApi | positionUpdateRiskLimit | POST /position/riskLimit | Update your risk limit. |
SWGQuoteApi | quoteGet | GET /quote | Get Quotes. |
SWGQuoteApi | quoteGetBucketed | GET /quote/bucketed | Get previous quotes in time buckets. |
SWGSchemaApi | schemaGet | GET /schema | Get model schemata for data objects returned by this API. |
SWGSchemaApi | schemaWebsocketHelp | GET /schema/websocketHelp | Returns help text & subject list for websocket usage. |
SWGSettlementApi | settlementGet | GET /settlement | Get settlement history. |
SWGStatsApi | statsGet | GET /stats | Get exchange-wide and per-series turnover and volume statistics. |
SWGStatsApi | statsHistory | GET /stats/history | Get historical exchange-wide and per-series turnover and volume statistics. |
SWGStatsApi | statsHistoryUSD | GET /stats/historyUSD | Get a summary of exchange statistics in USD. |
SWGTradeApi | tradeGet | GET /trade | Get Trades. |
SWGTradeApi | tradeGetBucketed | GET /trade/bucketed | Get previous trades in time buckets. |
SWGUserApi | userCancelPendingWithdrawal | DELETE /user/withdrawal | Cancel pending withdrawal |
SWGUserApi | userCancelWithdrawal | POST /user/cancelWithdrawal | Cancel a withdrawal. |
SWGUserApi | userCheckReferralCode | GET /user/checkReferralCode | Check if a referral code is valid. |
SWGUserApi | userCommunicationToken | POST /user/communicationToken | Register your communication token for mobile clients |
SWGUserApi | userConfirm | POST /user/confirmEmail | Confirm your email address with a token. |
SWGUserApi | userConfirmWithdrawal | POST /user/confirmWithdrawal | Confirm a withdrawal. |
SWGUserApi | userCreateSubAccount | POST /user/addSubaccount | Creates a new sub-account. |
SWGUserApi | userCreateUnstakingRequests | POST /user/unstakingRequests | Create unstaking request |
SWGUserApi | userDeleteUnstakingRequests | DELETE /user/unstakingRequests | Cancel unstaking request |
SWGUserApi | userGet | GET /user | Get your user model. |
SWGUserApi | userGetAffiliateStatus | GET /user/affiliateStatus | Get your current affiliate/referral status. |
SWGUserApi | userGetCSA | GET /user/csa | Get your account's CSA status. |
SWGUserApi | userGetCommission | GET /user/commission | Get your account's commission status. |
SWGUserApi | userGetDepositAddress | GET /user/depositAddress | Get a deposit address. |
SWGUserApi | userGetDepositAddressInformation | GET /user/depositAddressInformation | Get a deposit address. |
SWGUserApi | userGetExecutionHistory | GET /user/executionHistory | Get the execution history by day. |
SWGUserApi | userGetMargin | GET /user/margin | Get your account's margin status. Send a currency of "all" to receive an array of all supported currencies. |
SWGUserApi | userGetQuoteFillRatio | GET /user/quoteFillRatio | Get 7 days worth of Quote Fill Ratio statistics. |
SWGUserApi | userGetQuoteValueRatio | GET /user/quoteValueRatio | Get Quote Value Ratio statistics over the last 3 days |
SWGUserApi | userGetStaking | GET /user/staking | Get the current user staking amount. |
SWGUserApi | userGetStakingInstruments | GET /user/staking/instruments | List staking instruments |
SWGUserApi | userGetStakingTiers | GET /user/staking/tiers | List staking tiers for a given currency |
SWGUserApi | userGetTradingVolume | GET /user/tradingVolume | Get your 30 days USD average trading volume |
SWGUserApi | userGetUnstakingRequests | GET /user/unstakingRequests | Get the current user unstaking requests |
SWGUserApi | userGetWallet | GET /user/wallet | Get your current wallet information. |
SWGUserApi | userGetWalletHistory | GET /user/walletHistory | Get a history of all of your wallet transactions (deposits, withdrawals, PNL). |
SWGUserApi | userGetWalletSummary | GET /user/walletSummary | Get a summary of all of your wallet transactions (deposits, withdrawals, PNL). |
SWGUserApi | userGetWalletTransferAccounts | GET /user/getWalletTransferAccounts | Get the list of accounts you can transfer funds between. |
SWGUserApi | userLogout | POST /user/logout | Log out of BitMEX. |
SWGUserApi | userRequestWithdrawal | POST /user/requestWithdrawal | Request a withdrawal to an external wallet. |
SWGUserApi | userSavePreferences | POST /user/preferences | Save user preferences. |
SWGUserApi | userUpdateSubAccount | POST /user/updateSubaccount | Updates the sub-account name. |
SWGUserApi | userWalletTransfer | POST /user/walletTransfer | Execute a transfer to a paired account. |
SWGUserAffiliatesApi | userAffiliatesGet | GET /userAffiliates | Get user's affiliates to a given depth |
SWGUserEventApi | userEventGet | GET /userEvent | Get your user events |
SWGWalletApi | walletGetAssetsConfig | GET /wallet/assets | Get Assets Config |
SWGWalletApi | walletGetNetworksConfig | GET /wallet/networks | Get Networks Config |
- SWGAPIKey
- SWGAccessToken
- SWGAddress
- SWGAffiliate
- SWGAnnouncement
- SWGAssetsConfig
- SWGAssetsConfigNetworkItem
- SWGChat
- SWGChatChannel
- SWGCollateralSupportAgreement
- SWGCommunicationToken
- SWGConnectedUsers
- SWGDepositAddress
- SWGError
- SWGErrorError
- SWGExecution
- SWGFunding
- SWGGlobalNotification
- SWGGuild
- SWGIndexComposite
- SWGInlineResponse200
- SWGInstrument
- SWGInstrumentInterval
- SWGInsurance
- SWGLeaderboard
- SWGLiquidation
- SWGMargin
- SWGNetworksConfig
- SWGOrder
- SWGOrderBookL2
- SWGPinnedMessage
- SWGPorl
- SWGPosition
- SWGQuote
- SWGQuoteFillRatio
- SWGQuoteValueRatio
- SWGSettlement
- SWGStakingRecord
- SWGStats
- SWGStatsHistory
- SWGStatsUSD
- SWGStatsUSDBySymbol
- SWGTrade
- SWGTradeBin
- SWGTradingVolume
- SWGTransaction
- SWGUser
- SWGUserCommissionsBySymbol
- SWGUserEvent
- SWGUserPreferences
- SWGWallet
- SWGWalletSummaryRecord
- SWGXAny
- Type: API key
- API key parameter name: api-expires
- Location: HTTP header
- Type: API key
- API key parameter name: api-key
- Location: HTTP header
- Type: API key
- API key parameter name: api-signature
- Location: HTTP header