Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Latest commit

 

History

History

ruby

swagger_client

SwaggerClient - the Ruby gem for the Bybit API

REST API for the Bybit Exchange. Base URI: [https://api.bybit.com]

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 0.2.10
  • 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.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_announcements GET /v2/public/announcement Get Bybit OpenAPI announcements in the last 30 days in reverse order.
SwaggerClient::CommonApi common_get_lcp GET /v2/private/account/lcp Query LCP info.
SwaggerClient::CommonApi common_get_time GET /v2/public/time Get bybit server time.
SwaggerClient::ConditionalApi conditional_cancel POST /v2/private/stop-order/cancel Cancel conditional order.
SwaggerClient::ConditionalApi conditional_cancel_all POST /v2/private/stop-order/cancelAll Cancel conditional order.
SwaggerClient::ConditionalApi conditional_get_orders GET /v2/private/stop-order/list Get my conditional order list.
SwaggerClient::ConditionalApi conditional_new POST /v2/private/stop-order/create Place a new conditional order.
SwaggerClient::ConditionalApi conditional_query GET /v2/private/stop-order Query real-time stop order information.
SwaggerClient::ConditionalApi conditional_replace POST /v2/private/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::ExecutionApi positions_close_pnl_records GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
SwaggerClient::FundingApi funding_my_last_fee 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_prev_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::KlineApi kline_mark_price GET /v2/public/mark-price-kline Query mark price kline.
SwaggerClient::LinearConditionalApi linear_conditional_cancel POST /private/linear/stop-order/cancel Cancel Active Order
SwaggerClient::LinearConditionalApi linear_conditional_cancel_all POST /private/linear/stop-order/cancel-all Cancel all stop orders.
SwaggerClient::LinearConditionalApi linear_conditional_get_orders GET /private/linear/stop-order/list Get linear Stop Orders
SwaggerClient::LinearConditionalApi linear_conditional_new POST /private/linear/stop-order/create Create linear stop Order
SwaggerClient::LinearConditionalApi linear_conditional_query GET /private/linear/stop-order/search Get Stop Orders(real-time)
SwaggerClient::LinearConditionalApi linear_conditional_replace POST /private/linear/stop-order/replace Replace conditional order
SwaggerClient::LinearExecutionApi linear_execution_get_trades GET /private/linear/trade/execution/list Get user's trading records.
SwaggerClient::LinearFundingApi linear_funding_my_last_fee GET /private/linear/funding/prev-funding Get prev funding
SwaggerClient::LinearFundingApi linear_funding_predicted GET /private/linear/funding/predicted-funding Get predicted funding rate and funding fee.
SwaggerClient::LinearFundingApi linear_funding_prev_rate GET /public/linear/funding/prev-funding-rate Get prev funding
SwaggerClient::LinearKlineApi linear_kline_get GET /public/linear/kline Get kline
SwaggerClient::LinearKlineApi linear_kline_mark_price GET /public/linear/mark-price-kline Get kline
SwaggerClient::LinearMarketApi linear_market_trading GET /public/linear/recent-trading-records Get recent trades
SwaggerClient::LinearOrderApi linear_order_cancel POST /private/linear/order/cancel Cancel Active Order
SwaggerClient::LinearOrderApi linear_order_cancel_all POST /private/linear/order/cancel-all Cancel all active orders.
SwaggerClient::LinearOrderApi linear_order_get_orders GET /private/linear/order/list Get linear Active Orders
SwaggerClient::LinearOrderApi linear_order_new POST /private/linear/order/create Create Active Order
SwaggerClient::LinearOrderApi linear_order_query GET /private/linear/order/search Get Active Orders(real-time)
SwaggerClient::LinearOrderApi linear_order_replace POST /private/linear/order/replace Replace Active Order
SwaggerClient::LinearPositionsApi linear_positions_change_margin POST /private/linear/position/add-margin Add/Reduce Margin
SwaggerClient::LinearPositionsApi linear_positions_close_pnl_records GET /private/linear/trade/closed-pnl/list Get user's closed profit and loss records.
SwaggerClient::LinearPositionsApi linear_positions_my_position GET /private/linear/position/list Get my position list.
SwaggerClient::LinearPositionsApi linear_positions_save_leverage POST /private/linear/position/set-leverage Set leverage
SwaggerClient::LinearPositionsApi linear_positions_set_auto_add_margin POST /private/linear/position/set-auto-add-margin Set auto add margin
SwaggerClient::LinearPositionsApi linear_positions_switch_isolated POST /private/linear/position/switch-isolated Switch isolated
SwaggerClient::LinearPositionsApi linear_positions_switch_mode POST /private/linear/tpsl/switch-mode Switch Mode
SwaggerClient::LinearPositionsApi linear_positions_trading_stop POST /private/linear/position/trading-stop Set tradingStop
SwaggerClient::LinearWalletApi linear_wallet_get_risk_limit GET /public/linear/risk-limit Get risk limit.
SwaggerClient::MarketApi market_account_ratio GET /v2/public/account-ratio Query Account Long Short Ratio
SwaggerClient::MarketApi market_big_deal GET /v2/public/big-deal Query Big Deal
SwaggerClient::MarketApi market_liq_records GET /v2/public/liq-records Query liq records.
SwaggerClient::MarketApi market_open_interest GET /v2/public/open-interest Query Open Interest
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::MarketApi market_trading_records GET /v2/public/trading-records Get recent trades
SwaggerClient::OrderApi order_cancel POST /v2/private/order/cancel Get my active order list.
SwaggerClient::OrderApi order_cancel_all POST /v2/private/order/cancelAll Get my active order list.
SwaggerClient::OrderApi order_get_orders GET /v2/private/order/list Get my active order list.
SwaggerClient::OrderApi order_new POST /v2/private/order/create Place active order
SwaggerClient::OrderApi order_query GET /v2/private/order Get my active order list.
SwaggerClient::OrderApi order_replace POST /v2/private/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_close_pnl_records GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
SwaggerClient::PositionsApi positions_my_position GET /v2/private/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::SymbolApi symbol_get GET /v2/public/symbols Query Symbols.
SwaggerClient::WalletApi wallet_exchange_order GET /v2/private/exchange-order/list Asset Exchange Records
SwaggerClient::WalletApi wallet_get_balance GET /v2/private/wallet/balance get wallet balance info
SwaggerClient::WalletApi wallet_get_records GET /open-api/wallet/fund/records Get wallet fund records
SwaggerClient::WalletApi wallet_get_risk_limit GET /open-api/wallet/risk-limit/list Get risk limit.
SwaggerClient::WalletApi wallet_set_risk_limit POST /open-api/wallet/risk-limit Set risk limit
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