Code Monkey home page Code Monkey logo

pybit's Introduction

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

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!

pybit's People

Contributors

dextertd avatar verata-veritatis avatar apf20 avatar ervuks avatar allcontributors[bot] avatar blacksabbather avatar tomcru avatar cameronhh avatar sheungon avatar kamsby avatar addestromberg avatar kevinwon96 avatar daler-sz avatar cryptverse avatar joesham avatar leftcoastgeek avatar windhamwong avatar yusufsahinhamza avatar kuegi avatar lucilae avatar woodliang10 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.