AnalyzePosition
Analyze why a Uniswap V2 or V3 LP position is gaining or losing money. Decomposes PnL into impermanent loss, accumulated fees, and net result, with optional real APR if a holding period is supplied. Returns current value, hold value, IL percentage, fee income, net PnL, real APR, and a diagnosis label.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpc_url | Yes | An Ethereum (or L2) JSON-RPC URL used to read live pool state. Required; supplied by you per call (BYO-RPC) and may carry your provider key. The endpoint stores and logs nothing — the URL is never persisted or written to logs. | |
| chain_id | No | Optional guard. If supplied and the RPC reports a different chain id, the call is rejected. Defaults to 1 (Ethereum mainnet) conceptually; omit to skip the check. | |
| lwr_tick | No | Lower tick of the position (V3 positions only; null for V2). | |
| upr_tick | No | Upper tick of the position (V3 positions only; null for V2). | |
| pool_type | Yes | Which protocol the pool at pool_address belongs to. This tool accepts uniswap_v2 | uniswap_v3. | |
| entry_x_amt | Yes | Amount of token0 originally deposited at position entry. | |
| entry_y_amt | Yes | Amount of token1 originally deposited at position entry. | |
| lp_init_amt | Yes | LP token amount held by the position (position size in human units). | |
| block_number | No | Optional block number to pin the read to a historical block. Omit to read the latest block. | |
| pool_address | Yes | On-chain address of the pool/pair to analyze (Uniswap V2/V3 pair, Balancer weighted pool, or Curve stableswap pool). Required. Lowercase, uppercase, or checksum casing all work. | |
| holding_period_days | No | Optional holding period in days. If supplied, real_apr is annualized from net_pnl. |