Skip to main content

bybit_p2p

Bybit P2P API integration library written in Python

pip package

Этот файл доступен на русском языке!

bybit_p2p is 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

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

bybit_p2p uses a number of projects and technologies to work:

  • requests & requests_toolbelt for HTTP request creation and processing, as well as multiform data requests
  • PyCrypto for HMAC and RSA operations

Installation

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 bybit-p2p

Usage

Upon installation, you can use bybit_p2p by importing it in your code:

from bybit_p2p import P2P

Here is a quickstart example to get some info from the exchange:

from bybit_p2p import P2P

api = P2P(
    testnet=True,
    api_key="x",
    api_secret="x"
)

# 1. Get current balance
print(api.get_current_balance(accountType="FUND", coin="USDC"))

# 2. Get account information
print(api.get_account_information())

# 3. Get ads list
print(api.get_ads_list())

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: bybit_p2p quickstart.

Documentation

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:

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:

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:

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:

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 bybit-p2p 1.3.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 bybit-p2p 1.3.1
File Size Uploaded
bybit_p2p-1.3.1.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bybit-p2p 1.3.1
File Interpreter ABI Platform
bybit_p2p-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / bybit_p2p-1.3.1.tar.gz

Download URL bybit_p2p-1.3.1.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
826a6b2ecc0c74689f722e985e17478a62abc1ded23517da1051261dc056a618
BLAKE2b-256 checksum
How to use checksums
0c219c1e93ed769d1e523863a152547cb21a21730d2351c2320dfc1d65fa7c87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / bybit_p2p-1.3.1-py3-none-any.whl

Download URL bybit_p2p-1.3.1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcc22f429ea4e998d7addbb3e1552bc59c3bbe5453c7f5a2ec462d4bc6ce5c7c
BLAKE2b-256 checksum
How to use checksums
a0ee1ebab729db88b7ef421a83c1ced6f3956fed5033a8b813938c02d4ea77c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.2

2 release files

0.0.1

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