If you've done serious Bybit P2P trading in Nigeria, you know the pain: a buyer pays, you check your bank app manually, confirm, release crypto. It works โ but it's slow, exhausting, and you can't do it while sleeping.
I built a system that reduced that from a ~20 minute manual process to automated release in under 30 seconds. Here's how it works and how you can build it too.
Why Automate P2P?
The P2P market on Bybit Nigeria is competitive. Faster release times = better merchant reputation = more orders. On top of that, manually confirming every transfer:
- Ties you to your phone 24/7
- Slows down your order throughput
- Introduces human error (wrong amount confirmed, duplicate orders)
Automation solves all three.
System Architecture
The system has three moving parts that talk to each other:
- Bank notification listener โ reads incoming transfer alerts from your bank
- Order matcher โ matches the bank credit to an open Bybit P2P order
- Auto-release trigger โ calls the Bybit SDK to release the crypto
Everything runs async so multiple orders can be processed simultaneously without blocking.
Step 1 โ Set Up the Project
# Install dependencies pip install pybit motor python-telegram-bot aiohttp # Project structure p2p-bot/ โโโ main.py # entry point โโโ bank.py # bank notification handler โโโ matcher.py # order matching logic โโโ bybit_client.py # Bybit SDK wrapper โโโ config.py # API keys, settings
Step 2 โ Listen for Bank Credits
Kuda sends email/SMS alerts for every credit. You parse these in real time. The cleanest approach is to forward Kuda alerts to a Telegram bot, then your Python script reads from Telegram:
import asyncio from telegram.ext import Application, MessageHandler, filters async def handle_bank_alert(update, context): text = update.message.text # Example Kuda alert format: # "Credit: NGN 50,000.00 from JOHN DOE" if "Credit:" in text: amount = parse_amount(text) # extract NGN amount sender = parse_sender(text) # extract sender name # hand off to order matcher await match_and_release(amount, sender) app = Application.builder().token(TELEGRAM_TOKEN).build() app.add_handler(MessageHandler(filters.TEXT, handle_bank_alert))
Step 3 โ Match Credit to Bybit Order
This is the critical part. You pull open orders from Bybit and find one that matches the credited amount:
from pybit.unified_trading import HTTP session = HTTP( api_key="YOUR_API_KEY", api_secret="YOUR_SECRET" ) async def match_and_release(credited_amount, sender_name): # Get pending P2P orders orders = session.get_p2p_order_list( status="10" # 10 = payment confirmed by buyer ) for order in orders["result"]["items"]: order_amount = float(order["amount"]) # Match within ยฑ1 NGN tolerance if abs(order_amount - credited_amount) <= 1: await release_order(order["orderId"]) return # No match โ alert manually await send_telegram_alert(f"โ ๏ธ Unmatched credit: NGN {credited_amount}")
Step 4 โ Auto Release
async def release_order(order_id: str): result = session.release_p2p_order( orderId=order_id ) if result["retCode"] == 0: await send_telegram_alert( f"โ Released order {order_id}" ) else: await send_telegram_alert( f"โ Release failed: {result['retMsg']}" )
โฑ Total time: 23 seconds from bank credit to crypto release
Safety Considerations
- Add a minimum amount threshold to ignore noise
- Log every action to MongoDB for audit trail
- Set up Telegram alerts for every release โ automated or not
- Test with small amounts first before going full volume
Results After Running This Live
After running this system live on Bybit P2P Nigeria:
- Average release time dropped from ~20 minutes to under 30 seconds
- Merchant rating improved due to faster confirmations
- Zero missed orders โ every bank credit gets logged and handled
- Can run overnight without manual checks
This is a simplified version of the system โ the production version includes MongoDB order logging, duplicate detection, and a Telegram-based manual override. If you want a deeper breakdown of any specific part, email us.