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 C# SDK is automatically generated by the Swagger Codegen project:
- API version: 1.2.0
- SDK version: 1.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
- RestSharp - 105.1.0 or later
- Json.NET - 7.0.0 or later
- JsonSubTypes - 1.2.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure API key authorization: apiKey
Configuration.Default.ApiKey.Add("api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api-key", "Bearer");
// Configure API key authorization: apiNonce
Configuration.Default.ApiKey.Add("api-nonce", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api-nonce", "Bearer");
// Configure API key authorization: apiSignature
Configuration.Default.ApiKey.Add("api-signature", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api-signature", "Bearer");
var apiInstance = new APIKeyApi();
var apiKeyID = apiKeyID_example; // string | API Key ID (public component).
try
{
// Disable an API Key.
APIKey result = apiInstance.APIKeyDisable(apiKeyID);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling APIKeyApi.APIKeyDisable: " + e.Message );
}
}
}
}
All URIs are relative to https://localhost/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
APIKeyApi | APIKeyDisable | POST /apiKey/disable | Disable an API Key. |
APIKeyApi | APIKeyEnable | POST /apiKey/enable | Enable an API Key. |
APIKeyApi | APIKeyGet | GET /apiKey | Get your API Keys. |
APIKeyApi | APIKeyNew | POST /apiKey | Create a new API Key. |
APIKeyApi | APIKeyRemove | DELETE /apiKey | Remove an API Key. |
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 | 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. This includes each trade, insurance charge, and settlement. |
FundingApi | FundingGet | GET /funding | Get funding history. |
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. |
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. |
NotificationApi | NotificationGet | GET /notification | Get your current notifications. |
OrderApi | OrderAmend | PUT /order | Amend the quantity or price of an open order. |
OrderApi | OrderAmendBulk | PUT /order/bulk | Amend multiple orders for the same symbol. |
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. |
OrderApi | OrderNewBulk | POST /order/bulk | Create multiple new orders for the same symbol. |
OrderBookApi | OrderBookGetL2 | GET /orderBook/L2 | Get current orderbook in vertical format. |
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 | UserCancelWithdrawal | POST /user/cancelWithdrawal | Cancel a withdrawal. |
UserApi | UserCheckReferralCode | GET /user/checkReferralCode | Check if a referral code is valid. |
UserApi | UserConfirm | POST /user/confirmEmail | Confirm your email address with a token. |
UserApi | UserConfirmEnableTFA | POST /user/confirmEnableTFA | Confirm two-factor auth for this account. If using a Yubikey, simply send a token to this endpoint. |
UserApi | UserConfirmWithdrawal | POST /user/confirmWithdrawal | Confirm a withdrawal. |
UserApi | UserDisableTFA | POST /user/disableTFA | Disable two-factor auth for this account. |
UserApi | UserGet | GET /user | Get your user model. |
UserApi | UserGetAffiliateStatus | GET /user/affiliateStatus | Get your current affiliate/referral status. |
UserApi | UserGetCommission | GET /user/commission | Get your account's commission status. |
UserApi | UserGetDepositAddress | GET /user/depositAddress | Get a deposit address. |
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 | 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 | UserLogout | POST /user/logout | Log out of BitMEX. |
UserApi | 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. |
UserApi | UserMinWithdrawalFee | GET /user/minWithdrawalFee | Get the minimum withdrawal fee for a currency. |
UserApi | UserRequestEnableTFA | POST /user/requestEnableTFA | Get secret key for setting up two-factor auth. |
UserApi | UserRequestWithdrawal | POST /user/requestWithdrawal | Request a withdrawal to an external wallet. |
UserApi | UserSavePreferences | POST /user/preferences | Save user preferences. |
UserApi | UserUpdate | PUT /user | Update your password, name, and other attributes. |
- Model.APIKey
- Model.AccessToken
- Model.Affiliate
- Model.Announcement
- Model.Chat
- Model.ChatChannel
- Model.ConnectedUsers
- Model.Error
- Model.ErrorError
- Model.Execution
- Model.Funding
- Model.IndexComposite
- Model.InlineResponse200
- Model.InlineResponse2001
- Model.Instrument
- Model.InstrumentInterval
- Model.Insurance
- Model.Leaderboard
- Model.Liquidation
- Model.Margin
- Model.Notification
- Model.Order
- Model.OrderBookL2
- Model.Position
- Model.Quote
- Model.Settlement
- Model.Stats
- Model.StatsHistory
- Model.StatsUSD
- Model.Trade
- Model.TradeBin
- Model.Transaction
- Model.User
- Model.UserCommission
- Model.UserPreferences
- Model.Wallet
- Model.XAny
- 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