Skip to content

Latest commit

 

History

History

swagger_client

SwaggerClient - the Ruby gem for the BitMEX API

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

  • API version: 1.2.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build swagger_client.gemspec

Then either install the gem locally:

gem install ./swagger_client-1.0.0.gem

(for development, run gem install --dev ./swagger_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'swagger_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'swagger_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'swagger_client'

# Setup authorization
SwaggerClient.configure do |config|
  # Configure API key authorization: apiExpires
  config.api_key['api-expires'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-expires'] = 'Bearer'

  # Configure API key authorization: apiKey
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-key'] = 'Bearer'

  # Configure API key authorization: apiSignature
  config.api_key['api-signature'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['api-signature'] = 'Bearer'
end

api_instance = SwaggerClient::APIKeyApi.new

opts = { 
  reverse: false # BOOLEAN | If true, will sort results newest first.
}

begin
  #Get your API Keys.
  result = api_instance.a_pi_key_get(opts)
  p result
rescue SwaggerClient::ApiError => e
  puts "Exception when calling APIKeyApi->a_pi_key_get: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
SwaggerClient::APIKeyApi a_pi_key_get GET /apiKey Get your API Keys.
SwaggerClient::AddressApi address_get GET /address Get your addresses.
SwaggerClient::AddressApi address_new POST /address Creates a new saved address.
SwaggerClient::AnnouncementApi announcement_get GET /announcement Get site announcements.
SwaggerClient::AnnouncementApi announcement_get_urgent GET /announcement/urgent Get urgent (banner) announcements.
SwaggerClient::ChatApi chat_get GET /chat Get chat messages.
SwaggerClient::ChatApi chat_get_channels GET /chat/channels Get available channels.
SwaggerClient::ChatApi chat_get_connected GET /chat/connected Get connected users.
SwaggerClient::ChatApi chat_get_pinned_message GET /chat/pinned Get pinned message for a channel.
SwaggerClient::ChatApi chat_new POST /chat Send a chat message.
SwaggerClient::ExecutionApi execution_get GET /execution Get all raw executions for your account.
SwaggerClient::ExecutionApi execution_get_trade_history GET /execution/tradeHistory Get all balance-affecting executions.
SwaggerClient::FundingApi funding_get GET /funding Get funding history.
SwaggerClient::GlobalNotificationApi global_notification_get GET /globalNotification Get your current GlobalNotifications.
SwaggerClient::GuildApi guild_archive POST /guild/archive Archive a guild
SwaggerClient::GuildApi guild_edit PUT /guild Edit guild new guild
SwaggerClient::GuildApi guild_get GET /guild Get all guilds
SwaggerClient::GuildApi guild_join POST /guild/join Request to Join a private guild or join a public guild
SwaggerClient::GuildApi guild_kick POST /guild/kick Kick member from guild
SwaggerClient::GuildApi guild_leave POST /guild/leave Leave guild or cancel guild join request
SwaggerClient::GuildApi guild_new POST /guild Creates a new guild
SwaggerClient::GuildApi guild_share_trades POST /guild/shareTrades Toggle share trades for your account, which controls whether your guild members can see your orders and positions in their UI
SwaggerClient::InstrumentApi instrument_get GET /instrument Get instruments.
SwaggerClient::InstrumentApi instrument_get_active GET /instrument/active Get all active instruments and instruments that have expired in <24hrs.
SwaggerClient::InstrumentApi instrument_get_active_and_indices GET /instrument/activeAndIndices Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.
SwaggerClient::InstrumentApi instrument_get_active_intervals GET /instrument/activeIntervals Return all active contract series and interval pairs.
SwaggerClient::InstrumentApi instrument_get_composite_index GET /instrument/compositeIndex Show constituent parts of an index.
SwaggerClient::InstrumentApi instrument_get_indices GET /instrument/indices Get all price indices.
SwaggerClient::InstrumentApi instrument_get_usd_volume GET /instrument/usdVolume Get a summary of exchange statistics in USD.
SwaggerClient::InsuranceApi insurance_get GET /insurance Get insurance fund history.
SwaggerClient::LeaderboardApi leaderboard_get GET /leaderboard Get current leaderboard.
SwaggerClient::LeaderboardApi leaderboard_get_name GET /leaderboard/name Get your alias on the leaderboard.
SwaggerClient::LiquidationApi liquidation_get GET /liquidation Get liquidation orders.
SwaggerClient::OrderApi order_amend PUT /order Amend the quantity or price of an open order.
SwaggerClient::OrderApi order_cancel DELETE /order Cancel order(s). Send multiple order IDs to cancel in bulk.
SwaggerClient::OrderApi order_cancel_all DELETE /order/all Cancels all of your orders.
SwaggerClient::OrderApi order_cancel_all_after POST /order/cancelAllAfter Automatically cancel all your orders after a specified timeout.
SwaggerClient::OrderApi order_close_position POST /order/closePosition Close a position. [Deprecated, use POST /order with execInst: 'Close']
SwaggerClient::OrderApi order_get_orders GET /order Get your orders.
SwaggerClient::OrderApi order_new POST /order Create a new order.
SwaggerClient::OrderBookApi order_book_get_l2 GET /orderBook/L2 Get current orderbook in vertical format.
SwaggerClient::PorlApi porl_get_nonce GET /porl/nonce Get your Proof of Reserves nonce and data.
SwaggerClient::PorlApi porl_get_snapshots GET /porl/snapshots Get Proof of Reserves historical snapshots
SwaggerClient::PositionApi position_get GET /position Get your positions.
SwaggerClient::PositionApi position_isolate_margin POST /position/isolate Enable isolated margin or cross margin per-position.
SwaggerClient::PositionApi position_transfer_isolated_margin POST /position/transferMargin Transfer equity in or out of a position.
SwaggerClient::PositionApi position_update_leverage POST /position/leverage Choose leverage for a position.
SwaggerClient::PositionApi position_update_risk_limit POST /position/riskLimit Update your risk limit.
SwaggerClient::QuoteApi quote_get GET /quote Get Quotes.
SwaggerClient::QuoteApi quote_get_bucketed GET /quote/bucketed Get previous quotes in time buckets.
SwaggerClient::SchemaApi schema_get GET /schema Get model schemata for data objects returned by this API.
SwaggerClient::SchemaApi schema_websocket_help GET /schema/websocketHelp Returns help text & subject list for websocket usage.
SwaggerClient::SettlementApi settlement_get GET /settlement Get settlement history.
SwaggerClient::StatsApi stats_get GET /stats Get exchange-wide and per-series turnover and volume statistics.
SwaggerClient::StatsApi stats_history GET /stats/history Get historical exchange-wide and per-series turnover and volume statistics.
SwaggerClient::StatsApi stats_history_usd GET /stats/historyUSD Get a summary of exchange statistics in USD.
SwaggerClient::TradeApi trade_get GET /trade Get Trades.
SwaggerClient::TradeApi trade_get_bucketed GET /trade/bucketed Get previous trades in time buckets.
SwaggerClient::UserApi user_cancel_pending_withdrawal DELETE /user/withdrawal Cancel pending withdrawal
SwaggerClient::UserApi user_cancel_withdrawal POST /user/cancelWithdrawal Cancel a withdrawal.
SwaggerClient::UserApi user_check_referral_code GET /user/checkReferralCode Check if a referral code is valid.
SwaggerClient::UserApi user_communication_token POST /user/communicationToken Register your communication token for mobile clients
SwaggerClient::UserApi user_confirm POST /user/confirmEmail Confirm your email address with a token.
SwaggerClient::UserApi user_confirm_withdrawal POST /user/confirmWithdrawal Confirm a withdrawal.
SwaggerClient::UserApi user_create_sub_account POST /user/addSubaccount Creates a new sub-account.
SwaggerClient::UserApi user_create_unstaking_requests POST /user/unstakingRequests Create unstaking request
SwaggerClient::UserApi user_delete_unstaking_requests DELETE /user/unstakingRequests Cancel unstaking request
SwaggerClient::UserApi user_get GET /user Get your user model.
SwaggerClient::UserApi user_get_affiliate_status GET /user/affiliateStatus Get your current affiliate/referral status.
SwaggerClient::UserApi user_get_commission GET /user/commission Get your account's commission status.
SwaggerClient::UserApi user_get_csa GET /user/csa Get your account's CSA status.
SwaggerClient::UserApi user_get_deposit_address GET /user/depositAddress Get a deposit address.
SwaggerClient::UserApi user_get_deposit_address_information GET /user/depositAddressInformation Get a deposit address.
SwaggerClient::UserApi user_get_execution_history GET /user/executionHistory Get the execution history by day.
SwaggerClient::UserApi user_get_margin GET /user/margin Get your account's margin status. Send a currency of "all" to receive an array of all supported currencies.
SwaggerClient::UserApi user_get_quote_fill_ratio GET /user/quoteFillRatio Get 7 days worth of Quote Fill Ratio statistics.
SwaggerClient::UserApi user_get_quote_value_ratio GET /user/quoteValueRatio Get Quote Value Ratio statistics over the last 3 days
SwaggerClient::UserApi user_get_staking GET /user/staking Get the current user staking amount.
SwaggerClient::UserApi user_get_staking_instruments GET /user/staking/instruments List staking instruments
SwaggerClient::UserApi user_get_staking_tiers GET /user/staking/tiers List staking tiers for a given currency
SwaggerClient::UserApi user_get_trading_volume GET /user/tradingVolume Get your 30 days USD average trading volume
SwaggerClient::UserApi user_get_unstaking_requests GET /user/unstakingRequests Get the current user unstaking requests
SwaggerClient::UserApi user_get_wallet GET /user/wallet Get your current wallet information.
SwaggerClient::UserApi user_get_wallet_history GET /user/walletHistory Get a history of all of your wallet transactions (deposits, withdrawals, PNL).
SwaggerClient::UserApi user_get_wallet_summary GET /user/walletSummary Get a summary of all of your wallet transactions (deposits, withdrawals, PNL).
SwaggerClient::UserApi user_get_wallet_transfer_accounts GET /user/getWalletTransferAccounts Get the list of accounts you can transfer funds between.
SwaggerClient::UserApi user_logout POST /user/logout Log out of BitMEX.
SwaggerClient::UserApi user_request_withdrawal POST /user/requestWithdrawal Request a withdrawal to an external wallet.
SwaggerClient::UserApi user_save_preferences POST /user/preferences Save user preferences.
SwaggerClient::UserApi user_update_sub_account POST /user/updateSubaccount Updates the sub-account name.
SwaggerClient::UserApi user_wallet_transfer POST /user/walletTransfer Execute a transfer to a paired account.
SwaggerClient::UserAffiliatesApi user_affiliates_get GET /userAffiliates Get user's affiliates to a given depth
SwaggerClient::UserEventApi user_event_get GET /userEvent Get your user events
SwaggerClient::WalletApi wallet_get_assets_config GET /wallet/assets Get Assets Config
SwaggerClient::WalletApi wallet_get_networks_config GET /wallet/networks Get Networks Config

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