# crypto-analyst

An agent skill for crypto market analysis using pay-per-call x402 APIs (USDC on Base, no account needed).
Provider: Mekong Trade Intelligence — https://api.mekongtradeintel.com/tools/store/

## When to use
User asks about a token: price, funding rates, yields, contract risk, prediction markets, or on-chain data.
Trigger phrases: "is this token a rug", "funding rate BTC", "best DeFi yields", "Polymarket odds".

## Tools (in recommended call order)
1. **tokenprice** — token price by chain+address. POST https://api.mekongtradeintel.com/tokenprice — $0.001/call
   Body: `{"chain":"base","address":"0x..."}`
2. **chain** — on-chain token/contract intelligence (supply, verification, proxy, risk flags). POST https://api.mekongtradeintel.com/chain — $0.002/call
   Body: `{"address":"0x..."}`
3. **rugcheck** — heuristic rug-risk scan. POST https://api.mekongtradeintel.com/rugcheck — $0.005/call
   Body: `{"address":"0x..."}` (see /openapi for fields)
4. **perpfunding** — perpetual funding rates. POST https://api.mekongtradeintel.com/perpfunding — $0.001/call
   Body: `{"symbol":"BTC"}`
5. **defiyield** — top DeFi yield pools by APY. GET https://api.mekongtradeintel.com/defiyield/api/yield?chain=ethereum&limit=10 — $0.001/call
6. **polymarket** — prediction market odds. POST https://api.mekongtradeintel.com/polymarket/api/polymarket — $0.006/call
   Body: `{"query":"Fed rate cut December"}`

## Payment (x402 v2, exact scheme, USDC on Base)
1. Send the request UNPAID first. You get HTTP 402 with a `PAYMENT-REQUIRED` header (base64 JSON) describing amount, asset (USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`), payTo, network `eip155:8453`.
2. Sign the payment with the user's wallet (via the x402 client lib — never ask the user to paste a private key).
3. Retry the SAME request with the `X-PAYMENT` (v1) or `PAYMENT-SIGNATURE` (v2) header.
4. A small free daily trial quota applies before payment is required — use it for smoke tests.

## Workflow
- Token safety check (cheap): tokenprice → chain → rugcheck. Total ~$0.008.
- Market read: perpfunding → polymarket. Total ~$0.007.
- Yield hunt: defiyield, filter by TVL > $1M to avoid dust pools.
- ALWAYS run the cheap tools first and ask the user before spending >$0.10 in one turn.
- Risk flags are heuristics, not financial advice — say so in the answer.

## Example prompts
- "Is 0x... on Base a rug? Check price, contract and risk."
- "Where are BTC perp funding rates right now, and what is Polymarket saying about a December rate cut?"
- "Find me the best stablecoin yields above $5M TVL."
