async_bybit_p2p
An asynchronous fork of the official ByBit P2P API integration library written in Python.
async_bybit_p2p is an asynchronous fork of the official Python SDK for Bybit's P2P API, enabling seamless integration of your software solutions with Bybit's P2P trading platform.
- No need to implement signature (HMAC, RSA) logic yourself
- Easy & quick to work with
- Actively developed and maintained
originally developed by kolya5544 modified by TokenatorObmenator / herbalsomml
Features
bybit_p2p currently implements all methods available for P2P API. The library is in active development, so any newly released features will be added almost immediately. Here is a short list of what the library can do:
- Create, edit, delete, activate advertisements
- Get pending orders, mark orders as paid, release assets to the buyer
- Get and send text messages, upload files and send files to the chat
- Get all public advertisements for tokens
- ...and so much more! 🌟
All features are usually one method call away and do not require advanced API understanding to interact with.
Tech
async_bybit_p2p uses a number of projects and technologies to work:
aiohttp&aiofilesfor HTTP request creation and processingpycryptodomefor HMAC and RSA operations
Installation
async_bybit_p2p was tested on Python 3.11, but should work on all higher versions as well. The module can be installed manually or via PyPI with pip:
pip install async-bybit-p2p
Usage
Upon installation, you can use async_bybit_p2p by importing it in your code:
from async_bybit_p2p import P2P
Here is a quickstart example to get some info from the exchange:
from async_bybit_p2p import P2P
import asyncio
async def main()
api = P2P(
testnet=True,
api_key="x",
api_secret="x"
)
# 1. Get current balance
print(await api.get_current_balance(accountType="FUND", coin="USDC"))
# 2. Get account information
print(await api.get_account_information())
# 3. Get ads list
print(await api.get_ads_list())
await api.close_session()
asyncio.run(main())
P2P() class is used for P2P API interactions. Here, testnet refers to environment. For Mainnet (https://bybit.com/), you shall use testnet=False. For Testnet (https://testnet.bybit.com/), use testnet=True instead.
RSA users should also set rsa=True in the constructor. TR/KZ/NL/etc. users can manipulate domain and tld parameters, like tld="kz".
You can find the complete Quickstart example here: async_bybit_p2p quickstart.
Documentation
async_bybit_p2p library currently consists of just one module, which is used for direct REST API requests to Bybit P2P API.
You can access P2P API documentation using this link: P2P API documentation
Here is a breakdown of how API methods correspond to appropriate bybit_p2p methods:
Advertisements:
| async_bybit_p2p method name | P2P API method name | P2P API endpoint path |
|---|---|---|
| get_online_ads() | Get Ads | /v5/p2p/item/online |
| post_new_ad() | Post Ad | /v5/p2p/item/create |
| remove_ad() | Remove Ad | /v5/p2p/item/cancel |
| update_ad() | Update / Relist Ad | /v5/p2p/item/update |
| get_ads_list() | Get My Ads | /v5/p2p/item/personal/list |
| get_ad_details() | Get My Ad Details | /v5/p2p/item/info |
Orders:
| async_bybit_p2p method name | P2P API method name | P2P API endpoint path |
|---|---|---|
| get_orders() | Get All Orders | /v5/p2p/order/simplifyList |
| get_order_details() | Get Order Details | /v5/p2p/order/info |
| get_pending_orders() | Get Pending Orders | /v5/p2p/order/pending/simplifyList |
| mark_as_paid() | Mark Order as Paid | /v5/p2p/order/pay |
| release_assets() | Release Assets | /v5/p2p/order/finish |
| send_chat_message() | Send Chat Message | /v5/p2p/order/message/send |
| upload_chat_file() | Upload Chat File | /v5/p2p/oss/upload_file |
| get_chat_messages() | Get Chat Message | /v5/p2p/order/message/listpage |
User:
| async_bybit_p2p method name | P2P API method name | P2P API endpoint path |
|---|---|---|
| get_account_information() | Get Account Information | /v5/p2p/user/personal/info |
| get_counterparty_info() | Get Counterparty User Info | /v5/p2p/user/order/personal/info |
| get_user_payment_types() | Get User Payment | /v5/p2p/user/payment/list |
Misc:
| async_bybit_p2p method name | P2P API method name | P2P API endpoint path |
|---|---|---|
| get_current_balance() | Get Coin Balance | /v5/asset/transfer/query-account-coins-balance |
More methods will come soon, allowing for more advanced operations.
Development
All contributions are welcome.
License
MIT
Metadata
Release files for async-bybit-p2p 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_bybit_p2p-1.0.4.tar.gz | 11.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_bybit_p2p-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / async_bybit_p2p-1.0.4.tar.gz
| Download URL | async_bybit_p2p-1.0.4.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cd49d6889da95b4aa44cc3fde61a4f1dae639d08c09313e13c203bdf67a35d9
|
|
BLAKE2b-256 checksum How to use checksums |
69e228b161c44fe4c3224d0e69107aa9a93a9d1b1c55637d8fe3dc8c0f97630a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / async_bybit_p2p-1.0.4-py3-none-any.whl
| Download URL | async_bybit_p2p-1.0.4-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a180fdd6fb08b7c5eb87406f681331aa15ee40fd4ad123c9aaa4e6bca195bbc8
|
|
BLAKE2b-256 checksum How to use checksums |
b27b9f1ff27ca62e2a716a7ba5e485b9265819b686af8c51463f55b7626cb217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for async-bybit-p2p 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.