Skip to content

Latest commit

 

History

History
 
 

ruby

swagger_client

SwaggerClient - the Ruby gem for the Bybit API

REST API for the Bybit Exchange.

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.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: 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['sign'] = '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['sign'] = 'Bearer'

  # Configure API key authorization: timestamp
  config.api_key['timestamp'] = '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['timestamp'] = 'Bearer'
end

api_instance = SwaggerClient::APIkeyApi.new

begin
  #Get account api-key information.
  result = api_instance.a_p_ikey_info
  p result
rescue SwaggerClient::ApiError => e
  puts "Exception when calling APIkeyApi->a_p_ikey_info: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api-testnet.bybit.com

Class Method HTTP request Description
SwaggerClient::APIkeyApi a_p_ikey_info GET /open-api/api-key Get account api-key information.
SwaggerClient::CommonApi common_get GET /v2/public/time Get bybit server time.
SwaggerClient::ConditionalApi conditional_cancel POST /open-api/stop-order/cancel Cancel conditional order.
SwaggerClient::ConditionalApi conditional_get_orders GET /open-api/stop-order/list Get my conditional order list.
SwaggerClient::ConditionalApi conditional_new POST /open-api/stop-order/create Place a new conditional order.
SwaggerClient::ConditionalApi conditional_replace POST /open-api/stop-order/replace Replace conditional order. Only incomplete orders can be modified.
SwaggerClient::ExecutionApi execution_get_trades GET /v2/private/execution/list Get user’s trade records.
SwaggerClient::FundingApi funding_get_rate GET /open-api/funding/prev-funding Funding settlement occurs every 8 hours at 00:00 UTC, 08:00 UTC and 16:00 UTC. The current interval's fund fee settlement is based on the previous interval's fund rate. For example, at 16:00, the settlement is based on the fund rate generated at 8:00. The fund rate generated at 16:00 will be used at 0:00 on the next day.
SwaggerClient::FundingApi funding_predicted GET /open-api/funding/predicted-funding Get predicted funding rate and funding fee.
SwaggerClient::FundingApi funding_predicted_rate GET /open-api/funding/prev-funding-rate Get predicted funding rate and funding fee.
SwaggerClient::KlineApi kline_get GET /v2/public/kline/list Query historical kline.
SwaggerClient::MarketApi market_orderbook GET /v2/public/orderBook/L2 Get the orderbook.
SwaggerClient::MarketApi market_symbol_info GET /v2/public/tickers Get the latest information for symbol.
SwaggerClient::OrderApi order_cancel POST /open-api/order/cancel Get my active order list.
SwaggerClient::OrderApi order_get_orders GET /open-api/order/list Get my active order list.
SwaggerClient::OrderApi order_new POST /open-api/order/create Place active order
SwaggerClient::OrderApi order_query GET /v2/private/order Get my active order list.
SwaggerClient::OrderApi order_replace POST /open-api/order/replace Replace active order. Only incomplete orders can be modified.
SwaggerClient::PositionsApi positions_change_margin POST /position/change-position-margin Update margin.
SwaggerClient::PositionsApi positions_my_position GET /position/list Get my position list.
SwaggerClient::PositionsApi positions_save_leverage POST /user/leverage/save Change user leverage.
SwaggerClient::PositionsApi positions_trading_stop POST /open-api/position/trading-stop Set Trading-Stop Condition.
SwaggerClient::PositionsApi positions_user_leverage GET /user/leverage Get user leverage setting.
SwaggerClient::SymbolApi symbol_get GET /v2/public/symbols Query Symbols.
SwaggerClient::WalletApi wallet_get_records GET /open-api/wallet/fund/records Get wallet fund records
SwaggerClient::WalletApi wallet_withdraw GET /open-api/wallet/withdraw/list Get wallet fund records

Documentation for Models

Documentation for Authorization

apiKey

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

apiSignature

  • Type: API key
  • API key parameter name: sign
  • Location: URL query string

timestamp

  • Type: API key
  • API key parameter name: timestamp
  • Location: URL query string