Skip to content
clusters: prooflayer · edgemarket · edgefinance · synthforge · mediakit · wordmint · webprobe · locale · comppoint · rollforge · bestiary · statline · matchpoint · retail · agentops · browserworkflow · modelrouter · compose
$ man wallet-pnl

/wallet-pnl

agentutility / edge-market / wallet-pnl
PRICE / CALL
$0.05
USDC · base mainnet · scheme: exact
METHOD
POST
CLUSTER
edgemarket
CATEGORY
uncategorized
STATUS
live
NAME
wallet-pnl computes wallet token p&l with fifo cost basis for any (wallet, erc-20, chain) triple
SYNOPSIS
POST https://x402.agentutility.ai/wallet-pnl
     Content-Type: application/json
     X-PAYMENT:    <signed-transferWithAuthorization>

     { ... }
↳ first call → 402 Payment Required. Sign USDCtransferWithAuthorization, retry with theX-PAYMENT header.
DESCRIPTION

Computes wallet token P&L with FIFO cost basis for any (wallet, ERC-20, chain) triple. Pulls all transfers from Etherscan v2, prices each one at the historical USD spot via CoinGecko, runs FIFO accounting, and reports cost basis, realized gain, unrealized gain, current balance, and tx count. Capped at the most recent 500 transfers. Use it as a realized + unrealized profit calculator or EVM portfolio analytics tool.

INPUTrequest schema
propertytypedescriptionreq?
walletstring0x-prefixed 20-byte wallet address.required
token_addressstring0x-prefixed 20-byte ERC-20 contract.required
chainstringEVM chain. Default 'ethereum'.
enum: base · ethereum · polygon · arbitrum · optimism
optional
OUTPUTresponse shape
fieldtypedescription
walletstringEVM wallet address whose token P&L was computed.
tokenstringERC-20 contract address of the token analyzed.
chainstringEVM chain the wallet and token live on (e.g. ethereum, base, polygon).
symbolstringTicker symbol of the ERC-20 token (e.g. USDC, WETH).
decimalsstringNumber of decimal places the ERC-20 contract uses to format balances.
tx_countstringTotal transfer count for this wallet/token pair included in the FIFO calculation.
transfers_instringCount of inbound transfers credited to the wallet's FIFO inventory.
transfers_outstringCount of outbound transfers consumed against FIFO inventory to realize gains.
current_balancestringWallet's current token balance after applying all in/out transfers, in human units.
current_price_usdstringLatest USD spot price per token from CoinGecko at query time.
cost_basis_usdstringFIFO cost basis in USD for the wallet's remaining token balance.
realized_pnl_usdstringUSD profit/loss already locked in by outbound transfers under FIFO accounting.
unrealized_pnl_usdstringUSD profit/loss on the current balance at current price vs remaining cost basis.
total_pnl_usdstringSum of realized and unrealized USD P&L for this wallet/token/chain triple.
capped_atstringMax transfer count the calculation considered (500 if the wallet exceeded the cap).
coingecko_idstringCoinGecko asset ID used to fetch historical and current USD prices for the token.
sourcestringOrigin of the underlying transfer + price data (e.g. etherscan_v2+coingecko).
EXAMPLEStwo ways to call
EXAMPLE 1 · curl
curl -X POST https://x402.agentutility.ai/wallet-pnl \
  -H 'Content-Type: application/json' \
  -d '{ }'
first response = 402 Payment Required with payment requirements; sign + retry with X-PAYMENT.
EXAMPLE 2 · mcp
# Install the MCP package for this endpoint's cluster
npx -y @agentutility/mcp-<cluster>

# Required: EVM private key with USDC on Base
export X402_PRIVATE_KEY=0x...

# Then call the wallet-pnl tool from your MCP-aware agent.
MCP server handles payment automatically — your coding agent just calls the tool by name.
METADATA
tags
edge-marketwallet-analyticsportfolio-trackingcost-basisfifo-accountingrealized-pnlerc-20wallet-pnl
methods
POST
cluster
edgemarket
price
$0.05 USDC per call
ADJACENTother endpoints in edgemarket
endpointdescriptionprice
honeypot-checkHoneypot.is buy/sell simulation for any Base or Ethereum ERC-20.$0.05
token-honeypotDetects whether an ERC-20 token is a honeypot by simulating a buy + sell via honeypot.is.$0.05
token-honeypot-apiChecks whether a token is a honeypot, testing sellability, buy tax, sell tax, proxy risk, owner risk, and token-trading warnings.$0.05
token-honeypot-checkChecks whether an ERC-20 token is a honeypot by simulating buy and sell behavior through honeypot.is.$0.05
crypto-tx-explainerEthereum/Base/Arbitrum/Optimism/Polygon transaction explainer.$0.04
bridge-ratesCompares cross-chain bridge quotes to find the cheapest route between chains, powered by LiFi.$0.03
dao-proposal-monitorMonitors DAO governance proposals on Snapshot.org for any space.$0.03
ens-resolveResolves ENS names in both directions: forward (vitalik.eth to address) and reverse (address to primary ENS).$0.03
SEE ALSO
agentutility · edgemarket · x402 · mcp · llms.txt · registry.json · bazaar.x402.org