dracula/bitmex

1.0.0 2020-10-15 04:26 UTC

This package is not auto-updated.

Last update: 2025-05-10 03:18:01 UTC


README

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 PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.2.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: apiExpires
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api-expires', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-expires', 'Bearer');
// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: apiSignature
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api-signature', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-signature', 'Bearer');

$apiInstance = new Swagger\Client\Api\APIKeyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$reverse = false; // bool | If true, will sort results newest first.

try {
    $result = $apiInstance->aPIKeyGet($reverse);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling APIKeyApi->aPIKeyGet: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://www.bitmex.com/api/v1

ClassMethodHTTP requestDescription
APIKeyApiaPIKeyGetGET /apiKeyGet your API Keys.
AnnouncementApiannouncementGetGET /announcementGet site announcements.
AnnouncementApiannouncementGetUrgentGET /announcement/urgentGet urgent (banner) announcements.
ChatApichatGetGET /chatGet chat messages.
ChatApichatGetChannelsGET /chat/channelsGet available channels.
ChatApichatGetConnectedGET /chat/connectedGet connected users.
ChatApichatNewPOST /chatSend a chat message.
ExecutionApiexecutionGetGET /executionGet all raw executions for your account.
ExecutionApiexecutionGetTradeHistoryGET /execution/tradeHistoryGet all balance-affecting executions. This includes each trade, insurance charge, and settlement.
FundingApifundingGetGET /fundingGet funding history.
GlobalNotificationApiglobalNotificationGetGET /globalNotificationGet your current GlobalNotifications.
InstrumentApiinstrumentGetGET /instrumentGet instruments.
InstrumentApiinstrumentGetActiveGET /instrument/activeGet all active instruments and instruments that have expired in <24hrs.
InstrumentApiinstrumentGetActiveAndIndicesGET /instrument/activeAndIndicesHelper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.
InstrumentApiinstrumentGetActiveIntervalsGET /instrument/activeIntervalsReturn all active contract series and interval pairs.
InstrumentApiinstrumentGetCompositeIndexGET /instrument/compositeIndexShow constituent parts of an index.
InstrumentApiinstrumentGetIndicesGET /instrument/indicesGet all price indices.
InsuranceApiinsuranceGetGET /insuranceGet insurance fund history.
LeaderboardApileaderboardGetGET /leaderboardGet current leaderboard.
LeaderboardApileaderboardGetNameGET /leaderboard/nameGet your alias on the leaderboard.
LiquidationApiliquidationGetGET /liquidationGet liquidation orders.
OrderApiorderAmendPUT /orderAmend the quantity or price of an open order.
OrderApiorderAmendBulkPUT /order/bulkAmend multiple orders for the same symbol.
OrderApiorderCancelDELETE /orderCancel order(s). Send multiple order IDs to cancel in bulk.
OrderApiorderCancelAllDELETE /order/allCancels all of your orders.
OrderApiorderCancelAllAfterPOST /order/cancelAllAfterAutomatically cancel all your orders after a specified timeout.
OrderApiorderClosePositionPOST /order/closePositionClose a position. [Deprecated, use POST /order with execInst: 'Close']
OrderApiorderGetOrdersGET /orderGet your orders.
OrderApiorderNewPOST /orderCreate a new order.
OrderApiorderNewBulkPOST /order/bulkCreate multiple new orders for the same symbol.
OrderBookApiorderBookGetL2GET /orderBook/L2Get current orderbook in vertical format.
PositionApipositionGetGET /positionGet your positions.
PositionApipositionIsolateMarginPOST /position/isolateEnable isolated margin or cross margin per-position.
PositionApipositionTransferIsolatedMarginPOST /position/transferMarginTransfer equity in or out of a position.
PositionApipositionUpdateLeveragePOST /position/leverageChoose leverage for a position.
PositionApipositionUpdateRiskLimitPOST /position/riskLimitUpdate your risk limit.
QuoteApiquoteGetGET /quoteGet Quotes.
QuoteApiquoteGetBucketedGET /quote/bucketedGet previous quotes in time buckets.
SchemaApischemaGetGET /schemaGet model schemata for data objects returned by this API.
SchemaApischemaWebsocketHelpGET /schema/websocketHelpReturns help text & subject list for websocket usage.
SettlementApisettlementGetGET /settlementGet settlement history.
StatsApistatsGetGET /statsGet exchange-wide and per-series turnover and volume statistics.
StatsApistatsHistoryGET /stats/historyGet historical exchange-wide and per-series turnover and volume statistics.
StatsApistatsHistoryUSDGET /stats/historyUSDGet a summary of exchange statistics in USD.
TradeApitradeGetGET /tradeGet Trades.
TradeApitradeGetBucketedGET /trade/bucketedGet previous trades in time buckets.
UserApiuserCancelWithdrawalPOST /user/cancelWithdrawalCancel a withdrawal.
UserApiuserCheckReferralCodeGET /user/checkReferralCodeCheck if a referral code is valid.
UserApiuserCommunicationTokenPOST /user/communicationTokenRegister your communication token for mobile clients
UserApiuserConfirmPOST /user/confirmEmailConfirm your email address with a token.
UserApiuserConfirmWithdrawalPOST /user/confirmWithdrawalConfirm a withdrawal.
UserApiuserGetGET /userGet your user model.
UserApiuserGetAffiliateStatusGET /user/affiliateStatusGet your current affiliate/referral status.
UserApiuserGetCommissionGET /user/commissionGet your account's commission status.
UserApiuserGetDepositAddressGET /user/depositAddressGet a deposit address.
UserApiuserGetExecutionHistoryGET /user/executionHistoryGet the execution history by day.
UserApiuserGetMarginGET /user/marginGet your account's margin status. Send a currency of \"all\" to receive an array of all supported currencies.
UserApiuserGetQuoteFillRatioGET /user/quoteFillRatioGet 7 days worth of Quote Fill Ratio statistics.
UserApiuserGetWalletGET /user/walletGet your current wallet information.
UserApiuserGetWalletHistoryGET /user/walletHistoryGet a history of all of your wallet transactions (deposits, withdrawals, PNL).
UserApiuserGetWalletSummaryGET /user/walletSummaryGet a summary of all of your wallet transactions (deposits, withdrawals, PNL).
UserApiuserLogoutPOST /user/logoutLog out of BitMEX.
UserApiuserMinWithdrawalFeeGET /user/minWithdrawalFeeGet the minimum withdrawal fee for a currency.
UserApiuserRequestWithdrawalPOST /user/requestWithdrawalRequest a withdrawal to an external wallet.
UserApiuserSavePreferencesPOST /user/preferencesSave user preferences.
UserEventApiuserEventGetGET /userEventGet your user events

Documentation For Models

Documentation For Authorization

apiExpires

  • Type: API key
  • API key parameter name: api-expires
  • Location: HTTP header

apiKey

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

apiSignature

  • Type: API key
  • API key parameter name: api-signature
  • Location: HTTP header

Author

support@bitmex.com