Skip to main content

pybit

All Contributors

Build Status Build Status contributions welcome

Official Python3 API connector for Bybit's HTTP and WebSockets APIs.

Table of Contents

About

Put simply, pybit (Python + Bybit) is the official lightweight one-stop-shop module for the Bybit HTTP and WebSocket APIs. Originally created by Verata Veritatis, it's now maintained by Bybit employees – however, you're still welcome to contribute!

It was designed with the following vision in mind:

I was personally never a fan of auto-generated connectors that used a mosh-pit of various modules you didn't want (sorry, bravado) and wanted to build my own Python3-dedicated connector with very little external resources. The goal of the connector is to provide traders and developers with an easy-to-use high-performing module that has an active issue and discussion board leading to consistent improvements.

Development

pybit is being actively developed, and new Bybit API changes should arrive on pybit very quickly. pybit uses requests and websocket-client for its methods, alongside other built-in modules. Anyone is welcome to branch/fork the repository and add their own upgrades. If you think you've made substantial improvements to the module, submit a pull request and we'll gladly take a look.

Installation

pybit requires Python 3.9.1 or higher. The module can be installed manually or via PyPI with pip:

pip install pybit_proxy

Usage

You can retrieve a specific market like so:

from pybit.unified_trading import HTTP

Create an HTTP session and connect via WebSocket for Inverse on mainnet:

session = HTTP(
    testnet=False,
    api_key="...",
    api_secret="...",
)

Information can be sent to, or retrieved from, the Bybit APIs:

# Get the orderbook of the USDT Perpetual, BTCUSDT
session.get_orderbook(category="linear", symbol="BTCUSDT")

# Create five long USDC Options orders.
# (Currently, only USDC Options support sending orders in bulk.)
payload = {"category": "option"}
orders = [{
  "symbol": "BTC-30JUN23-20000-C",
  "side": "Buy",
  "orderType": "Limit",
  "qty": "0.1",
  "price": i,
} for i in [15000, 15500, 16000, 16500, 16600]]

payload["request"] = orders
# Submit the orders in bulk.
session.place_batch_order(payload)

Check out the example python files or the list of endpoints below for more information on available endpoints and methods. Usage examples on the HTTP methods can be found in the examples folder.

Contact

You can reach out for support on the BybitAPI Telegram group chat.

Contributors

Thanks goes to these wonderful people (emoji key):


dextertd

💻 📖

ervuks

💻 📖

verata-veritatis

💻 📖

APF20

💻

Cameron Harder-Hutton

💻

Tom Rumpf

💻

OnJohn

💻

Todd Conley

🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Metadata

Release files for pybit-proxy 5.6.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybit-proxy 5.6.1.1
File Size Uploaded
pybit_proxy-5.6.1.1.tar.gz 55.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pybit-proxy 5.6.1.1
File Interpreter ABI Platform
pybit_proxy-5.6.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 108.5 kB

Release files / pybit_proxy-5.6.1.1.tar.gz

Download URL pybit_proxy-5.6.1.1.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
49b3ad73dc511836249c52215a202bf18a53ce54e91772acbae0d34bcd046900
BLAKE2b-256 checksum
How to use checksums
e713d07de100a9517a6c2ce27a8dbd31824d2a1a381521e4a9f89add874a6856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / pybit_proxy-5.6.1.1-py2.py3-none-any.whl

Download URL pybit_proxy-5.6.1.1-py2.py3-none-any.whl
Size 53.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ffc8a594740de228fcb37f004cb57f2acf0448792f0d1a608c861565846af4b6
BLAKE2b-256 checksum
How to use checksums
6c4cf4542d61a4aecceb9b97b731423f6a99c509ebb763aeb33c472234d38711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

5.6.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page