P2p

From npc-live/clawfirm · View interactive version

P2p is an AI agent skill from the GitHub repository npc-live/clawfirm. Binance P2P trading assistant for natural-language queries about P2P/C2C market ads and (optionally) the user’s own P2P order history. Use when the user asks about P2P prices, searching/choosing ads, comparing payment methods, or reviewing their P2P order history (requires API key). Do NOT use for s

How to use this skill

Skill file

Binance P2P Trading Skill

Help users interact with Binance P2P (C2C) via natural-language queries.

When to Use / When NOT to Use

Use this skill when the user wants to:

Do NOT use this skill when the user asks about:

Ask clarifying questions (do not guess) if any key inputs are missing:

Core Concepts

`tradeType` mapping (avoid ambiguity)

Always reflect this mapping in responses when the user’s wording is ambiguous.

Capabilities

Phase 1 — Public Market (No Auth)

Phase 2 — Personal Orders (Requires API Key)

Security & Privacy Rules

Credentials

Never display full secrets

Permission minimization

Storage guidance

⚠️ CRITICAL: SAPI Signing (Different from Standard Binance API)

Parameter ordering

Example:

# ✅ Correct for SAPI: keep insertion order
params = {"page": 1, "rows": 20, "timestamp": 1710460800000}
query_string = urlencode(params)  # NO sorting

# ❌ Wrong (standard Binance API only): sorted
query_string = urlencode(sorted(params.items()))

Signing details

See: references/authentication.md for:

API Overview

Public Queries (MGS C2C Agent API — No Auth)

Base URL: https://www.binance.com

| Endpoint | Method | Params | Usage |

|----------|--------|--------|-------|

| /bapi/c2c/v1/public/c2c/agent/quote-price | GET | fiat, asset, tradeType | Quick price quote |

| /bapi/c2c/v1/public/c2c/agent/ad-list | GET | fiat, asset, tradeType, limit, order, tradeMethodIdentifiers | Search ads |

| /bapi/c2c/v1/public/c2c/agent/trade-methods | GET | fiat | Payment methods |

Parameter notes:

Workflow: Compare Prices by Payment Method

When the user wants to compare prices across payment methods (e.g., "Alipay vs WeChat"), follow this two-step flow:

Step 1 — Call trade-methods to get the correct identifiers for the target fiat:

GET /bapi/c2c/v1/public/c2c/agent/trade-methods?fiat=CNY
→ [{"identifier":"ALIPAY",...}, {"identifier":"WECHAT",...}, {"identifier":"BANK",...}]

Step 2 — Pass the identifier as a plain string into ad-list via tradeMethodIdentifiers, one payment method per request, then compare:

GET /bapi/c2c/v1/public/c2c/agent/ad-list?fiat=CNY&asset=USDT&tradeType=BUY&limit=5&tradeMethodIdentifiers=ALIPAY&tradeMethodIdentifiers=WECHAT

Compare the best price from each result set.

Important: Do not hardcode identifier values like "Alipay" or "BANK". Always call trade-methods first to get the exact identifier strings for the given fiat currency.

Personal Orders (Binance SAPI — Requires Auth)

Base URL: https://api.binance.com

| Endpoint | Method | Auth | Usage |

|----------|--------|------|-------|

| /sapi/v1/c2c/orderMatch/listUserOrderHistory | GET | Yes | Order history |

| /sapi/v1/c2c/orderMatch/getUserOrderSummary | GET | Yes | User statistics |

Authentication requirements:

Output Format Guidelines

Price quote

Example:

USDT/CNY (P2P)
- Buy USDT (you buy crypto): ¥7.20
- Sell USDT (you sell crypto): ¥7.18

Ad list

Return Top N items with a stable schema:

1) adNo (ad number / identifier)

2) price (fiat)

3) merchant name

4) completion rate

5) limits

6) payment methods (identifiers)

Avoid generating parameterized external URLs unless the API returns them.

Placing orders (when user requests):

```

https://c2c.binance.com/en/adv?code={adNo}

```

Example: https://c2c.binance.com/en/adv?code=123

Personal orders

Time field conversion (for createTime in listUserOrderHistory):

```

# Python example

from datetime import datetime, timezone

readable_time = datetime.fromtimestamp(createTime / 1000, tz=timezone.utc).strftime('%Y-%m-%d %H:%M (UTC+0)')

# JavaScript example

const readableTime = new Date(createTime).toISOString().replace('T', ' ').slice(0, 16) + ' (UTC+0)';

// Or more explicitly:

const date = new Date(createTime);

const readableTime = date.getUTCFullYear() + '-' +

String(date.getUTCMonth() + 1).padStart(2, '0') + '-' +

String(date.getUTCDate()).padStart(2, '0') + ' ' +

String(date.getUTCHours()).padStart(2, '0') + ':' +

String(date.getUTCMinutes()).padStart(2, '0') + ' (UTC+0)';

```

Error Handling (User-Facing)

Limitations (By Design)

This skill does NOT:

For in-app actions, guide users to the official P2P orders page (only as a general entry point).

Developer Notes

Version Check (First Invocation per Conversation)

On the first invocation of this skill per conversation, call:

Behavior:

Client-side operations

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.