This Python script fetches P2P sellers from Binance's API for a given asset, fiat currency, trade type, and payment method. It processes and displays the fetched data in a readable format and saves it to a JSON file.
- π Python 3.x
- π¦
requestslibrary (install usingpip install requests)
- π‘ Sends requests to Binance's P2P API to fetch seller advertisements.
- π Collects and processes seller details.
- π₯οΈ Prints the sellers' information in a readable format.
- πΎ Saves the seller details to a JSON file.
- Install dependencies if not already installed:
pip install requests
- Run the script:
python script.py
The script uses the following parameters:
- π° asset: Cryptocurrency to trade (e.g.,
USDT) - π΅ fiat: Local currency (e.g.,
BDTfor Bangladeshi Taka) - π trade_type: Type of trade (
BUYorSELL) - π¦ pay_type: Payment method (e.g.,
bKash)
These parameters can be modified in the script as needed.
- π₯οΈ The script prints seller details to the console.
- π The data is saved as a JSON file in the format:
p2p_{asset}_{fiat}.json.
Fetching page 1...
Seller: JohnDoe
Price: 110.50 BDT
Available: 500.00 USDT
Min Amount: 10.00 BDT
Max Amount: 5000.00 BDT
Completion Rate: 98.75%
Payment Method: bKash
----------------------------------------
Saved to p2p_USDT_BDT.json
Total unique sellers fetched: 10
- β³ The script includes a delay (
time.sleep(1)) to avoid hitting Binance's rate limits. - β If no more sellers are found, the script stops fetching further pages.
This script is open-source and free to use.
π¨βπ» Author: Abir Arafat Chawdhury