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 API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: 1.2.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.GoClientCodegen
Put the package under your project folder and add the following in import:
import "./swagger"
All URIs are relative to https://www.bitmex.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
APIKeyApi | APIKeyGet | Get /apiKey | Get your API Keys. |
AddressApi | AddressGet | Get /address | Get your addresses. |
AddressApi | AddressNew | Post /address | Creates a new saved address. |
AnnouncementApi | AnnouncementGet | Get /announcement | Get site announcements. |
AnnouncementApi | AnnouncementGetUrgent | Get /announcement/urgent | Get urgent (banner) announcements. |
ChatApi | ChatGet | Get /chat | Get chat messages. |
ChatApi | ChatGetChannels | Get /chat/channels | Get available channels. |
ChatApi | ChatGetConnected | Get /chat/connected | Get connected users. |
ChatApi | ChatGetPinnedMessage | Get /chat/pinned | Get pinned message for a channel. |
ChatApi | ChatNew | Post /chat | Send a chat message. |
ExecutionApi | ExecutionGet | Get /execution | Get all raw executions for your account. |
ExecutionApi | ExecutionGetTradeHistory | Get /execution/tradeHistory | Get all balance-affecting executions. |
FundingApi | FundingGet | Get /funding | Get funding history. |
GlobalNotificationApi | GlobalNotificationGet | Get /globalNotification | Get your current GlobalNotifications. |
GuildApi | GuildArchive | Post /guild/archive | Archive a guild |
GuildApi | GuildEdit | Put /guild | Edit guild new guild |
GuildApi | GuildGet | Get /guild | Get all guilds |
GuildApi | GuildJoin | Post /guild/join | Request to Join a private guild or join a public guild |
GuildApi | GuildKick | Post /guild/kick | Kick member from guild |
GuildApi | GuildLeave | Post /guild/leave | Leave guild or cancel guild join request |
GuildApi | GuildNew | Post /guild | Creates a new guild |
GuildApi | 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 |
InstrumentApi | InstrumentGet | Get /instrument | Get instruments. |
InstrumentApi | InstrumentGetActive | Get /instrument/active | Get all active instruments and instruments that have expired in <24hrs. |
InstrumentApi | InstrumentGetActiveAndIndices | Get /instrument/activeAndIndices | Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active. |
InstrumentApi | InstrumentGetActiveIntervals | Get /instrument/activeIntervals | Return all active contract series and interval pairs. |
InstrumentApi | InstrumentGetCompositeIndex | Get /instrument/compositeIndex | Show constituent parts of an index. |
InstrumentApi | InstrumentGetIndices | Get /instrument/indices | Get all price indices. |
InstrumentApi | InstrumentGetUsdVolume | Get /instrument/usdVolume | Get a summary of exchange statistics in USD. |
InsuranceApi | InsuranceGet | Get /insurance | Get insurance fund history. |
LeaderboardApi | LeaderboardGet | Get /leaderboard | Get current leaderboard. |
LeaderboardApi | LeaderboardGetName | Get /leaderboard/name | Get your alias on the leaderboard. |
LiquidationApi | LiquidationGet | Get /liquidation | Get liquidation orders. |
OrderApi | OrderAmend | Put /order | Amend the quantity or price of an open order. |
OrderApi | OrderCancel | Delete /order | Cancel order(s). Send multiple order IDs to cancel in bulk. |
OrderApi | OrderCancelAll | Delete /order/all | Cancels all of your orders. |
OrderApi | OrderCancelAllAfter | Post /order/cancelAllAfter | Automatically cancel all your orders after a specified timeout. |
OrderApi | OrderClosePosition | Post /order/closePosition | Close a position. [Deprecated, use POST /order with execInst: 'Close'] |
OrderApi | OrderGetOrders | Get /order | Get your orders. |
OrderApi | OrderNew | Post /order | Create a new order. |
OrderBookApi | OrderBookGetL2 | Get /orderBook/L2 | Get current orderbook in vertical format. |
PorlApi | PorlGetNonce | Get /porl/nonce | Get your Proof of Reserves nonce and data. |
PorlApi | PorlGetSnapshots | Get /porl/snapshots | Get Proof of Reserves historical snapshots |
PositionApi | PositionGet | Get /position | Get your positions. |
PositionApi | PositionIsolateMargin | Post /position/isolate | Enable isolated margin or cross margin per-position. |
PositionApi | PositionTransferIsolatedMargin | Post /position/transferMargin | Transfer equity in or out of a position. |
PositionApi | PositionUpdateLeverage | Post /position/leverage | Choose leverage for a position. |
PositionApi | PositionUpdateRiskLimit | Post /position/riskLimit | Update your risk limit. |
QuoteApi | QuoteGet | Get /quote | Get Quotes. |
QuoteApi | QuoteGetBucketed | Get /quote/bucketed | Get previous quotes in time buckets. |
SchemaApi | SchemaGet | Get /schema | Get model schemata for data objects returned by this API. |
SchemaApi | SchemaWebsocketHelp | Get /schema/websocketHelp | Returns help text & subject list for websocket usage. |
SettlementApi | SettlementGet | Get /settlement | Get settlement history. |
StatsApi | StatsGet | Get /stats | Get exchange-wide and per-series turnover and volume statistics. |
StatsApi | StatsHistory | Get /stats/history | Get historical exchange-wide and per-series turnover and volume statistics. |
StatsApi | StatsHistoryUSD | Get /stats/historyUSD | Get a summary of exchange statistics in USD. |
TradeApi | TradeGet | Get /trade | Get Trades. |
TradeApi | TradeGetBucketed | Get /trade/bucketed | Get previous trades in time buckets. |
UserApi | UserCancelPendingWithdrawal | Delete /user/withdrawal | Cancel pending withdrawal |
UserApi | UserCancelWithdrawal | Post /user/cancelWithdrawal | Cancel a withdrawal. |
UserApi | UserCheckReferralCode | Get /user/checkReferralCode | Check if a referral code is valid. |
UserApi | UserCommunicationToken | Post /user/communicationToken | Register your communication token for mobile clients |
UserApi | UserConfirm | Post /user/confirmEmail | Confirm your email address with a token. |
UserApi | UserConfirmWithdrawal | Post /user/confirmWithdrawal | Confirm a withdrawal. |
UserApi | UserCreateSubAccount | Post /user/addSubaccount | Creates a new sub-account. |
UserApi | UserCreateUnstakingRequests | Post /user/unstakingRequests | Create unstaking request |
UserApi | UserDeleteUnstakingRequests | Delete /user/unstakingRequests | Cancel unstaking request |
UserApi | UserGet | Get /user | Get your user model. |
UserApi | UserGetAffiliateStatus | Get /user/affiliateStatus | Get your current affiliate/referral status. |
UserApi | UserGetCSA | Get /user/csa | Get your account's CSA status. |
UserApi | UserGetCommission | Get /user/commission | Get your account's commission status. |
UserApi | UserGetDepositAddress | Get /user/depositAddress | Get a deposit address. |
UserApi | UserGetDepositAddressInformation | Get /user/depositAddressInformation | Get a deposit address. |
UserApi | UserGetExecutionHistory | Get /user/executionHistory | Get the execution history by day. |
UserApi | UserGetMargin | Get /user/margin | Get your account's margin status. Send a currency of "all" to receive an array of all supported currencies. |
UserApi | UserGetQuoteFillRatio | Get /user/quoteFillRatio | Get 7 days worth of Quote Fill Ratio statistics. |
UserApi | UserGetQuoteValueRatio | Get /user/quoteValueRatio | Get Quote Value Ratio statistics over the last 3 days |
UserApi | UserGetStaking | Get /user/staking | Get the current user staking amount. |
UserApi | UserGetStakingInstruments | Get /user/staking/instruments | List staking instruments |
UserApi | UserGetStakingTiers | Get /user/staking/tiers | List staking tiers for a given currency |
UserApi | UserGetTradingVolume | Get /user/tradingVolume | Get your 30 days USD average trading volume |
UserApi | UserGetUnstakingRequests | Get /user/unstakingRequests | Get the current user unstaking requests |
UserApi | UserGetWallet | Get /user/wallet | Get your current wallet information. |
UserApi | UserGetWalletHistory | Get /user/walletHistory | Get a history of all of your wallet transactions (deposits, withdrawals, PNL). |
UserApi | UserGetWalletSummary | Get /user/walletSummary | Get a summary of all of your wallet transactions (deposits, withdrawals, PNL). |
UserApi | UserGetWalletTransferAccounts | Get /user/getWalletTransferAccounts | Get the list of accounts you can transfer funds between. |
UserApi | UserLogout | Post /user/logout | Log out of BitMEX. |
UserApi | UserRequestWithdrawal | Post /user/requestWithdrawal | Request a withdrawal to an external wallet. |
UserApi | UserSavePreferences | Post /user/preferences | Save user preferences. |
UserApi | UserUpdateSubAccount | Post /user/updateSubaccount | Updates the sub-account name. |
UserApi | UserWalletTransfer | Post /user/walletTransfer | Execute a transfer to a paired account. |
UserAffiliatesApi | UserAffiliatesGet | Get /userAffiliates | Get user's affiliates to a given depth |
UserEventApi | UserEventGet | Get /userEvent | Get your user events |
WalletApi | WalletGetAssetsConfig | Get /wallet/assets | Get Assets Config |
WalletApi | WalletGetNetworksConfig | Get /wallet/networks | Get Networks Config |
- AccessToken
- Address
- Affiliate
- Announcement
- ApiKey
- AssetsConfig
- AssetsConfigNetworkItem
- Chat
- ChatChannel
- CollateralSupportAgreement
- CommunicationToken
- ConnectedUsers
- DepositAddress
- ErrorError
- Execution
- Funding
- GlobalNotification
- Guild
- IndexComposite
- InlineResponse200
- Instrument
- InstrumentInterval
- Insurance
- Leaderboard
- Liquidation
- Margin
- ModelError
- NetworksConfig
- Order
- OrderBookL2
- PinnedMessage
- Porl
- Position
- Quote
- QuoteFillRatio
- QuoteValueRatio
- Settlement
- StakingRecord
- Stats
- StatsHistory
- StatsUsd
- StatsUsdbySymbol
- Trade
- TradeBin
- TradingVolume
- Transaction
- User
- UserCommissionsBySymbol
- UserEvent
- UserPreferences
- Wallet
- WalletSummaryRecord
- XAny
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)