{"uid":"cap_p6SXG-qfXcOmthN9dQjbX","slug":"x402-gateway-production-up-railway-app-faff7440","name":"Wallet PnL (Realized & Unrealized) Lookup","description":"Realized and unrealized profit & loss per token for any wallet","url":"https://x402-gateway-production.up.railway.app/api/wallet/pnl","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","bodyType","body","method"],"properties":{"body":{"type":"object","required":["chain","address"],"properties":{"chain":{"type":"string","example":"ethereum","description":"Chain name (ethereum, polygon, base, arbitrum, etc.)"},"address":{"type":"string","example":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","description":"Wallet address"}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":{"request":{"chain":"solana","address":"5ZWj7a1f8tWkjBESHKgrLmXshuXxqeY9SYcfbshpAqPG"},"response":{"items":[{"chain":"solana","tokens":[{"attributes":{"total_liquidity_usd":{"details":"LIQUIDITY_TOO_HIGH"}},"raw_balance":"0.001447680","average_cost":{"amount":"132.252120333981929054","currency":"USD"},"realized_pnl":{"amount":"-27.950675862863990491","currency":"USD"},"current_price":{"amount":"81.980605666959846189","currency":"USD"},"token_address":"So11111111111111111111111111111111111111112","unrealized_pnl":{"amount":"-0.072777066353154529","currency":"USD"},"current_balance":{"amount":"0.118681683211944430","currency":"USD"},"unrealized_pnl_ratio_change":-0.3801187802514567},{"attributes":{"total_liquidity_usd":{"details":"LIQUIDITY_TOO_HIGH"}},"raw_balance":"0.0","realized_pnl":{"amount":"0.000331070965851166","currency":"USD"},"current_price":{"amount":"0.999599123628202468","currency":"USD"},"token_address":"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","current_balance":{"amount":"0E-18","currency":"USD"}}],"address":"5ZWj7a1f8tWkjBESHKgrLmXshuXxqeY9SYcfbshpAqPG","total_balance":{"amount":"0.118681683211944430","currency":"USD"},"total_realized_pnl":{"amount":"-27.950344791898139326","currency":"USD"},"total_unrealized_pnl":{"amount":"-0.072777066353154529","currency":"USD"},"total_unrealized_pnl_ratio_change":-0.3801187802514567}]}},"exampleRequest":{"chain":"solana","address":"5ZWj7a1f8tWkjBESHKgrLmXshuXxqeY9SYcfbshpAqPG"},"tags":["x402"],"displayCostAmount":"0.010000","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.010000/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_3xsrC8uwuOnNX135OnGeU","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns realized and unrealized profit & loss per token for a given wallet address","exampleAgentPrompt":"What are my realized and unrealized profits and losses broken down by token for wallet address 0x1234abcd...?","exampleUseCases":null,"resultDescription":"A breakdown of realized and unrealized PnL per token held or traded by the specified wallet, showing how much profit or loss has been locked in versus what remains on paper.","failureModes":["Invalid or malformed wallet address returns an error","Wallet with no transaction history may return empty or zero PnL","Unsupported chain or token may be omitted from results","Network timeouts if on-chain data indexing is slow","Rate limiting or payment failure if USDC balance insufficient"],"whenToPreferThis":"Use this endpoint when you need per-token realized and unrealized profit/loss analytics for a specific crypto wallet, especially in DeFi portfolio tracking, tax reporting prep, or trading performance review contexts. Prefer this over general balance endpoints when the user needs gain/loss figures rather than raw holdings.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T12:56:34.122Z","isFirstParty":false}