Skip to content

Latest commit

 

History

History
 
 

python

swagger-client

REST API for the Bybit Exchange.

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

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

Requirements.

Python 2.7 and 3.4+

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-testnet.bybit.com

Class Method HTTP request Description
APIkeyApi a_p_ikey_info GET /open-api/api-key Get account api-key information.
CommonApi common_get GET /v2/public/time Get bybit server time.
ConditionalApi conditional_cancel POST /open-api/stop-order/cancel Cancel conditional order.
ConditionalApi conditional_get_orders GET /open-api/stop-order/list Get my conditional order list.
ConditionalApi conditional_new POST /open-api/stop-order/create Place a new conditional order.
ConditionalApi conditional_replace POST /open-api/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.
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.
FundingApi funding_predicted GET /open-api/funding/predicted-funding Get predicted funding rate and funding fee.
FundingApi funding_predicted_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.
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.
OrderApi order_cancel POST /open-api/order/cancel Get my active order list.
OrderApi order_get_orders GET /open-api/order/list Get my active order list.
OrderApi order_new POST /open-api/order/create Place active order
OrderApi order_query GET /v2/private/order Get my active order list.
OrderApi order_replace POST /open-api/order/replace Replace active order. Only incomplete orders can be modified.
PositionsApi positions_change_margin POST /position/change-position-margin Update margin.
PositionsApi positions_my_position GET /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.
PositionsApi positions_user_leverage GET /user/leverage Get user leverage setting.
SymbolApi symbol_get GET /v2/public/symbols Query Symbols.
WalletApi wallet_get_records GET /open-api/wallet/fund/records Get wallet fund records
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

support@bybit.com