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

Latest commit

 

History

History

python

swagger-client

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

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 0.2.11
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.APIkeyApi(swagger_client.ApiClient(configuration))

try:
    # Get account api-key information.
    api_response = api_instance.a_p_ikey_info()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling APIkeyApi->a_p_ikey_info: %s\n" % e)

Documentation for API Endpoints

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

Class Method HTTP request Description
APIkeyApi a_p_ikey_info GET /open-api/api-key Get account api-key information.
CommonApi common_announcements GET /v2/public/announcement Get Bybit OpenAPI announcements in the last 30 days in reverse order.
CommonApi common_get_lcp GET /v2/private/account/lcp Query LCP info.
CommonApi common_get_time GET /v2/public/time Get bybit server time.
ConditionalApi conditional_cancel POST /v2/private/stop-order/cancel Cancel conditional order.
ConditionalApi conditional_cancel_all POST /v2/private/stop-order/cancelAll Cancel conditional order.
ConditionalApi conditional_get_orders GET /v2/private/stop-order/list Get my conditional order list.
ConditionalApi conditional_new POST /v2/private/stop-order/create Place a new conditional order.
ConditionalApi conditional_query GET /v2/private/stop-order Query real-time stop order information.
ConditionalApi conditional_replace POST /v2/private/stop-order/replace Replace conditional order. Only incomplete orders can be modified.
ExecutionApi execution_get_trades GET /v2/private/execution/list Get user’s trade records.
ExecutionApi positions_close_pnl_records GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
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.
FundingApi funding_predicted GET /open-api/funding/predicted-funding Get predicted funding rate and funding fee.
FundingApi funding_prev_rate GET /open-api/funding/prev-funding-rate Get predicted funding rate and funding fee.
KlineApi kline_get GET /v2/public/kline/list Query historical kline.
KlineApi kline_mark_price GET /v2/public/mark-price-kline Query mark price kline.
LinearConditionalApi linear_conditional_cancel POST /private/linear/stop-order/cancel Cancel Active Order
LinearConditionalApi linear_conditional_cancel_all POST /private/linear/stop-order/cancel-all Cancel all stop orders.
LinearConditionalApi linear_conditional_get_orders GET /private/linear/stop-order/list Get linear Stop Orders
LinearConditionalApi linear_conditional_new POST /private/linear/stop-order/create Create linear stop Order
LinearConditionalApi linear_conditional_query GET /private/linear/stop-order/search Get Stop Orders(real-time)
LinearConditionalApi linear_conditional_replace POST /private/linear/stop-order/replace Replace conditional order
LinearExecutionApi linear_execution_get_trades GET /private/linear/trade/execution/list Get user's trading records.
LinearFundingApi linear_funding_my_last_fee GET /private/linear/funding/prev-funding Get prev funding
LinearFundingApi linear_funding_predicted GET /private/linear/funding/predicted-funding Get predicted funding rate and funding fee.
LinearFundingApi linear_funding_prev_rate GET /public/linear/funding/prev-funding-rate Get prev funding
LinearKlineApi linear_kline_get GET /public/linear/kline Get kline
LinearKlineApi linear_kline_mark_price GET /public/linear/mark-price-kline Get kline
LinearMarketApi linear_market_trading GET /public/linear/recent-trading-records Get recent trades
LinearOrderApi linear_order_cancel POST /private/linear/order/cancel Cancel Active Order
LinearOrderApi linear_order_cancel_all POST /private/linear/order/cancel-all Cancel all active orders.
LinearOrderApi linear_order_get_orders GET /private/linear/order/list Get linear Active Orders
LinearOrderApi linear_order_new POST /private/linear/order/create Create Active Order
LinearOrderApi linear_order_query GET /private/linear/order/search Get Active Orders(real-time)
LinearOrderApi linear_order_replace POST /private/linear/order/replace Replace Active Order
LinearPositionsApi linear_positions_change_margin POST /private/linear/position/add-margin Add/Reduce Margin
LinearPositionsApi linear_positions_close_pnl_records GET /private/linear/trade/closed-pnl/list Get user's closed profit and loss records.
LinearPositionsApi linear_positions_my_position GET /private/linear/position/list Get my position list.
LinearPositionsApi linear_positions_save_leverage POST /private/linear/position/set-leverage Set leverage
LinearPositionsApi linear_positions_set_auto_add_margin POST /private/linear/position/set-auto-add-margin Set auto add margin
LinearPositionsApi linear_positions_switch_isolated POST /private/linear/position/switch-isolated Switch isolated
LinearPositionsApi linear_positions_switch_mode POST /private/linear/tpsl/switch-mode Switch Mode
LinearPositionsApi linear_positions_trading_stop POST /private/linear/position/trading-stop Set tradingStop
LinearWalletApi linear_wallet_get_risk_limit GET /public/linear/risk-limit Get risk limit.
LinearWalletApi linear_wallet_set_risk_limit POST /private/linear/position/set-risk This will set risk limit
MarketApi market_account_ratio GET /v2/public/account-ratio Query Account Long Short Ratio
MarketApi market_big_deal GET /v2/public/big-deal Query Big Deal
MarketApi market_liq_records GET /v2/public/liq-records Query liq records.
MarketApi market_open_interest GET /v2/public/open-interest Query Open Interest
MarketApi market_orderbook GET /v2/public/orderBook/L2 Get the orderbook.
MarketApi market_symbol_info GET /v2/public/tickers Get the latest information for symbol.
MarketApi market_trading_records GET /v2/public/trading-records Get recent trades
OrderApi order_cancel POST /v2/private/order/cancel Get my active order list.
OrderApi order_cancel_all POST /v2/private/order/cancelAll Get my active order list.
OrderApi order_get_orders GET /v2/private/order/list Get my active order list.
OrderApi order_new POST /v2/private/order/create Place active order
OrderApi order_query GET /v2/private/order Get my active order list.
OrderApi order_replace POST /v2/private/order/replace Replace active order. Only incomplete orders can be modified.
PositionsApi positions_change_margin POST /position/change-position-margin Update margin.
PositionsApi positions_close_pnl_records GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
PositionsApi positions_my_position GET /v2/private/position/list Get my position list.
PositionsApi positions_save_leverage POST /user/leverage/save Change user leverage.
PositionsApi positions_trading_stop POST /open-api/position/trading-stop Set Trading-Stop Condition.
SymbolApi symbol_get GET /v2/public/symbols Query Symbols.
WalletApi wallet_exchange_order GET /v2/private/exchange-order/list Asset Exchange Records
WalletApi wallet_get_balance GET /v2/private/wallet/balance get wallet balance info
WalletApi wallet_get_records GET /open-api/wallet/fund/records Get wallet fund records
WalletApi wallet_get_risk_limit GET /open-api/wallet/risk-limit/list Get risk limit.
WalletApi wallet_set_risk_limit POST /open-api/wallet/risk-limit Set risk limit
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

Author

[email protected]