pybit


Namepybit JSON
Version 5.6.2 PyPI version JSON
download
home_pagehttps://github.com/bybit-exchange/pybit
SummaryPython3 Bybit HTTP/WebSocket API Connector
upload_time2023-10-27 14:22:36
maintainer
docs_urlNone
authorDexter Dickinson
requires_python>=3.6
licenseMIT License
keywords bybit api connector
VCS
bugtrack_url
requirements requests websocket-client pycryptodome
Travis-CI
coveralls test coverage No coveralls.
            # pybit
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

[![Build Status](https://img.shields.io/pypi/pyversions/pybit)](https://www.python.org/downloads/)
[![Build Status](https://img.shields.io/pypi/v/pybit)](https://pypi.org/project/pybit/)
![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)

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

## Table of Contents

- [About](#about)
- [Development](#development)
- [Installation](#installation)
- [Usage](#usage)
- [Contact](#contact)
- [Contributors](#contributors)
- [Donations](#donations)

## 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](https://github.com/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](https://pypi.org/project/pybit/) with `pip`:
```
pip install pybit
```

## Usage
You can retrieve a specific market like so:
```python
from pybit.unified_trading import HTTP
```
Create an HTTP session and connect via WebSocket for Inverse on mainnet:
```python
session = HTTP(
    testnet=False,
    api_key="...",
    api_secret="...",
)
```
Information can be sent to, or retrieved from, the Bybit APIs:

```python
# 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](https://github.com/bybit-exchange/pybit/tree/master/examples).


## Contact
You can reach out for support on the [BybitAPI Telegram](https://t.me/BybitAPI) group chat.

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tr>
    <td align="center"><a href="https://github.com/dextertd"><img src="https://avatars.githubusercontent.com/u/54495183?v=4" width="100px;" alt=""/><br /><sub><b>dextertd</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=dextertd" title="Code">💻</a> <a href="https://github.com/bybit-exchange/pybit/commits?author=dextertd" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/ervuks"><img src="https://avatars.githubusercontent.com/u/17198438?v=4" width="100px;" alt=""/><br /><sub><b>ervuks</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=ervuks" title="Code">💻</a> <a href="https://github.com/bybit-exchange/pybit/commits?author=ervuks" title="Documentation">📖</a></td></td>
    <td align="center"><a href="https://github.com/verata-veritatis"><img src="https://avatars0.githubusercontent.com/u/9677388?v=4" width="100px;" alt=""/><br /><sub><b>verata-veritatis</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=verata-veritatis" title="Code">💻</a> <a href="https://github.com/bybit-exchange/pybit/commits?author=verata-veritatis" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/APF20"><img src="https://avatars0.githubusercontent.com/u/74583612?v=4" width="100px;" alt=""/><br /><sub><b>APF20</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=APF20" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/cameronhh"><img src="https://avatars0.githubusercontent.com/u/30434979?v=4" width="100px;" alt=""/><br /><sub><b>Cameron Harder-Hutton</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=cameronhh" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/tomcru"><img src="https://avatars0.githubusercontent.com/u/35841182?v=4" width="100px;" alt=""/><br /><sub><b>Tom Rumpf</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=tomcru" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/sheungon"><img src="https://avatars.githubusercontent.com/u/13306724?v=4" width="100px;" alt=""/><br /><sub><b>OnJohn</b></sub></a><br /><a href="https://github.com/bybit-exchange/pybit/commits?author=sheungon" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/tconley"><img src="https://avatars1.githubusercontent.com/u/1893207?v=4" width="100px;" alt=""/><br /><sub><b>Todd Conley</b></sub></a><br /><a href="https://github.com/tconley/pybit/commits?author=tconley" title="Ideas">🤔</a></td>
  </tr>
</table>

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bybit-exchange/pybit",
    "name": "pybit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "bybit api connector",
    "author": "Dexter Dickinson",
    "author_email": "dexter.dickinson@bybit.com",
    "download_url": "https://files.pythonhosted.org/packages/9f/3a/f355c18110d4ac2cce1a4a275980ada8759f9d7398c85bc4d1022f6ea5a4/pybit-5.6.2.tar.gz",
    "platform": null,
    "description": "# pybit\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n[![Build Status](https://img.shields.io/pypi/pyversions/pybit)](https://www.python.org/downloads/)\n[![Build Status](https://img.shields.io/pypi/v/pybit)](https://pypi.org/project/pybit/)\n![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)\n\nOfficial Python3 API connector for Bybit's HTTP and WebSockets APIs.\n\n## Table of Contents\n\n- [About](#about)\n- [Development](#development)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Contact](#contact)\n- [Contributors](#contributors)\n- [Donations](#donations)\n\n## About\nPut simply, `pybit` (Python + Bybit) is the official lightweight one-stop-shop module for the Bybit HTTP and WebSocket APIs. Originally created by [Verata Veritatis](https://github.com/verata-veritatis), it's now maintained by Bybit employees \u2013 however, you're still welcome to contribute!\n\nIt was designed with the following vision in mind:\n\n> 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.\n\n## Development\n`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.\n\n## Installation\n`pybit` requires Python 3.9.1 or higher. The module can be installed manually or via [PyPI](https://pypi.org/project/pybit/) with `pip`:\n```\npip install pybit\n```\n\n## Usage\nYou can retrieve a specific market like so:\n```python\nfrom pybit.unified_trading import HTTP\n```\nCreate an HTTP session and connect via WebSocket for Inverse on mainnet:\n```python\nsession = HTTP(\n    testnet=False,\n    api_key=\"...\",\n    api_secret=\"...\",\n)\n```\nInformation can be sent to, or retrieved from, the Bybit APIs:\n\n```python\n# Get the orderbook of the USDT Perpetual, BTCUSDT\nsession.get_orderbook(category=\"linear\", symbol=\"BTCUSDT\")\n\n# Create five long USDC Options orders.\n# (Currently, only USDC Options support sending orders in bulk.)\npayload = {\"category\": \"option\"}\norders = [{\n  \"symbol\": \"BTC-30JUN23-20000-C\",\n  \"side\": \"Buy\",\n  \"orderType\": \"Limit\",\n  \"qty\": \"0.1\",\n  \"price\": i,\n} for i in [15000, 15500, 16000, 16500, 16600]]\n\npayload[\"request\"] = orders\n# Submit the orders in bulk.\nsession.place_batch_order(payload)\n```\nCheck out the example python files or the list of endpoints below for more information on available\nendpoints and methods. Usage examples on the `HTTP` methods can\nbe found in the [examples folder](https://github.com/bybit-exchange/pybit/tree/master/examples).\n\n\n## Contact\nYou can reach out for support on the [BybitAPI Telegram](https://t.me/BybitAPI) group chat.\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://github.com/dextertd\"><img src=\"https://avatars.githubusercontent.com/u/54495183?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>dextertd</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=dextertd\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/bybit-exchange/pybit/commits?author=dextertd\" title=\"Documentation\">\ud83d\udcd6</a></td>\n    <td align=\"center\"><a href=\"https://github.com/ervuks\"><img src=\"https://avatars.githubusercontent.com/u/17198438?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>ervuks</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=ervuks\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/bybit-exchange/pybit/commits?author=ervuks\" title=\"Documentation\">\ud83d\udcd6</a></td></td>\n    <td align=\"center\"><a href=\"https://github.com/verata-veritatis\"><img src=\"https://avatars0.githubusercontent.com/u/9677388?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>verata-veritatis</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=verata-veritatis\" title=\"Code\">\ud83d\udcbb</a> <a href=\"https://github.com/bybit-exchange/pybit/commits?author=verata-veritatis\" title=\"Documentation\">\ud83d\udcd6</a></td>\n    <td align=\"center\"><a href=\"https://github.com/APF20\"><img src=\"https://avatars0.githubusercontent.com/u/74583612?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>APF20</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=APF20\" title=\"Code\">\ud83d\udcbb</a></td>\n    <td align=\"center\"><a href=\"https://github.com/cameronhh\"><img src=\"https://avatars0.githubusercontent.com/u/30434979?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Cameron Harder-Hutton</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=cameronhh\" title=\"Code\">\ud83d\udcbb</a></td>\n    <td align=\"center\"><a href=\"https://github.com/tomcru\"><img src=\"https://avatars0.githubusercontent.com/u/35841182?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Tom Rumpf</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=tomcru\" title=\"Code\">\ud83d\udcbb</a></td>\n    <td align=\"center\"><a href=\"https://github.com/sheungon\"><img src=\"https://avatars.githubusercontent.com/u/13306724?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>OnJohn</b></sub></a><br /><a href=\"https://github.com/bybit-exchange/pybit/commits?author=sheungon\" title=\"Code\">\ud83d\udcbb</a></td>\n    <td align=\"center\"><a href=\"https://github.com/tconley\"><img src=\"https://avatars1.githubusercontent.com/u/1893207?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Todd Conley</b></sub></a><br /><a href=\"https://github.com/tconley/pybit/commits?author=tconley\" title=\"Ideas\">\ud83e\udd14</a></td>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Python3 Bybit HTTP/WebSocket API Connector",
    "version": "5.6.2",
    "project_urls": {
        "Homepage": "https://github.com/bybit-exchange/pybit"
    },
    "split_keywords": [
        "bybit",
        "api",
        "connector"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f3af355c18110d4ac2cce1a4a275980ada8759f9d7398c85bc4d1022f6ea5a4",
                "md5": "8b4068bc8ae9eccaa72ae5fdfa431742",
                "sha256": "4ac4b57ef7a2e5d5663535c6ea2c6a14155df36c7d9f678574a516fa0e6924d3"
            },
            "downloads": -1,
            "filename": "pybit-5.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8b4068bc8ae9eccaa72ae5fdfa431742",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 56645,
            "upload_time": "2023-10-27T14:22:36",
            "upload_time_iso_8601": "2023-10-27T14:22:36.656504Z",
            "url": "https://files.pythonhosted.org/packages/9f/3a/f355c18110d4ac2cce1a4a275980ada8759f9d7398c85bc4d1022f6ea5a4/pybit-5.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-27 14:22:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bybit-exchange",
    "github_project": "pybit",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.22.0"
                ]
            ]
        },
        {
            "name": "websocket-client",
            "specs": [
                [
                    "==",
                    "1.5.0"
                ]
            ]
        },
        {
            "name": "pycryptodome",
            "specs": [
                [
                    "==",
                    "3.19.0"
                ]
            ]
        }
    ],
    "lcname": "pybit"
}
        
Elapsed time: 0.16107s