REST API for the BitMEX Trading Platform 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/SWGAffiliate.h>
#import <SwaggerClient/SWGAnnouncement.h>
#import <SwaggerClient/SWGChat.h>
#import <SwaggerClient/SWGChatChannel.h>
#import <SwaggerClient/SWGConnectedUsers.h>
#import <SwaggerClient/SWGError.h>
#import <SwaggerClient/SWGErrorError.h>
#import <SwaggerClient/SWGExecution.h>
#import <SwaggerClient/SWGFunding.h>
#import <SwaggerClient/SWGIndexComposite.h>
#import <SwaggerClient/SWGInlineResponse200.h>
#import <SwaggerClient/SWGInlineResponse2001.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/SWGNotification.h>
#import <SwaggerClient/SWGOrder.h>
#import <SwaggerClient/SWGOrderBookL2.h>
#import <SwaggerClient/SWGPosition.h>
#import <SwaggerClient/SWGQuote.h>
#import <SwaggerClient/SWGSettlement.h>
#import <SwaggerClient/SWGStats.h>
#import <SwaggerClient/SWGStatsHistory.h>
#import <SwaggerClient/SWGStatsUSD.h>
#import <SwaggerClient/SWGTrade.h>
#import <SwaggerClient/SWGTradeBin.h>
#import <SwaggerClient/SWGTransaction.h>
#import <SwaggerClient/SWGUser.h>
#import <SwaggerClient/SWGUserCommission.h>
#import <SwaggerClient/SWGUserPreferences.h>
#import <SwaggerClient/SWGWallet.h>
#import <SwaggerClient/SWGXAny.h>
// load API classes for accessing endpoints
#import <SwaggerClient/SWGAPIKeyApi.h>
#import <SwaggerClient/SWGAnnouncementApi.h>
#import <SwaggerClient/SWGChatApi.h>
#import <SwaggerClient/SWGExecutionApi.h>
#import <SwaggerClient/SWGFundingApi.h>
#import <SwaggerClient/SWGInstrumentApi.h>
#import <SwaggerClient/SWGInsuranceApi.h>
#import <SwaggerClient/SWGLeaderboardApi.h>
#import <SwaggerClient/SWGLiquidationApi.h>
#import <SwaggerClient/SWGNotificationApi.h>
#import <SwaggerClient/SWGOrderApi.h>
#import <SwaggerClient/SWGOrderBookApi.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>
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: 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: apiNonce)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api-nonce"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api-nonce"];
// 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"];
NSString* *apiKeyID = @"apiKeyID_example"; // API Key ID (public component).
SWGAPIKeyApi *apiInstance = [[SWGAPIKeyApi alloc] init];
// Disable an API Key.
[apiInstance aPIKeyDisableWithApiKeyID:apiKeyID
completionHandler: ^(SWGAPIKey* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
All URIs are relative to https://localhost/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
SWGAPIKeyApi | aPIKeyDisable | POST /apiKey/disable | Disable an API Key. |
SWGAPIKeyApi | aPIKeyEnable | POST /apiKey/enable | Enable an API Key. |
SWGAPIKeyApi | aPIKeyGet | GET /apiKey | Get your API Keys. |
SWGAPIKeyApi | aPIKeyNew | POST /apiKey | Create a new API Key. |
SWGAPIKeyApi | aPIKeyRemove | DELETE /apiKey | Remove an API Key. |
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 | 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. This includes each trade, insurance charge, and settlement. |
SWGFundingApi | fundingGet | GET /funding | Get funding history. |
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. |
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. |
SWGNotificationApi | notificationGet | GET /notification | Get your current notifications. |
SWGOrderApi | orderAmend | PUT /order | Amend the quantity or price of an open order. |
SWGOrderApi | orderAmendBulk | PUT /order/bulk | Amend multiple orders for the same symbol. |
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. |
SWGOrderApi | orderNewBulk | POST /order/bulk | Create multiple new orders for the same symbol. |
SWGOrderBookApi | orderBookGetL2 | GET /orderBook/L2 | Get current orderbook in vertical format. |
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 | userCancelWithdrawal | POST /user/cancelWithdrawal | Cancel a withdrawal. |
SWGUserApi | userCheckReferralCode | GET /user/checkReferralCode | Check if a referral code is valid. |
SWGUserApi | userConfirm | POST /user/confirmEmail | Confirm your email address with a token. |
SWGUserApi | userConfirmEnableTFA | POST /user/confirmEnableTFA | Confirm two-factor auth for this account. If using a Yubikey, simply send a token to this endpoint. |
SWGUserApi | userConfirmWithdrawal | POST /user/confirmWithdrawal | Confirm a withdrawal. |
SWGUserApi | userDisableTFA | POST /user/disableTFA | Disable two-factor auth for this account. |
SWGUserApi | userGet | GET /user | Get your user model. |
SWGUserApi | userGetAffiliateStatus | GET /user/affiliateStatus | Get your current affiliate/referral status. |
SWGUserApi | userGetCommission | GET /user/commission | Get your account's commission status. |
SWGUserApi | userGetDepositAddress | GET /user/depositAddress | Get a deposit address. |
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 | 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 | userLogout | POST /user/logout | Log out of BitMEX. |
SWGUserApi | userLogoutAll | POST /user/logoutAll | Log all systems out of BitMEX. This will revoke all of your account's access tokens, logging you out on all devices. |
SWGUserApi | userMinWithdrawalFee | GET /user/minWithdrawalFee | Get the minimum withdrawal fee for a currency. |
SWGUserApi | userRequestEnableTFA | POST /user/requestEnableTFA | Get secret key for setting up two-factor auth. |
SWGUserApi | userRequestWithdrawal | POST /user/requestWithdrawal | Request a withdrawal to an external wallet. |
SWGUserApi | userSavePreferences | POST /user/preferences | Save user preferences. |
SWGUserApi | userUpdate | PUT /user | Update your password, name, and other attributes. |
- SWGAPIKey
- SWGAccessToken
- SWGAffiliate
- SWGAnnouncement
- SWGChat
- SWGChatChannel
- SWGConnectedUsers
- SWGError
- SWGErrorError
- SWGExecution
- SWGFunding
- SWGIndexComposite
- SWGInlineResponse200
- SWGInlineResponse2001
- SWGInstrument
- SWGInstrumentInterval
- SWGInsurance
- SWGLeaderboard
- SWGLiquidation
- SWGMargin
- SWGNotification
- SWGOrder
- SWGOrderBookL2
- SWGPosition
- SWGQuote
- SWGSettlement
- SWGStats
- SWGStatsHistory
- SWGStatsUSD
- SWGTrade
- SWGTradeBin
- SWGTransaction
- SWGUser
- SWGUserCommission
- SWGUserPreferences
- SWGWallet
- SWGXAny
- Type: API key
- API key parameter name: api-key
- Location: HTTP header
- Type: API key
- API key parameter name: api-nonce
- Location: HTTP header
- Type: API key
- API key parameter name: api-signature
- Location: HTTP header