{"uid":"cap_QYVsXe-PvI_6CKbysA1hz","slug":"unrealized-pnl-calculator-ab5c43b0","name":"Unrealized PnL Calculator","description":"Unrealized PnL versus mark from entry and size. Call when open position dashboards and liquidation preflight. Returns unrealized pnl at mark as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.","url":"https://api.delx.ai/api/v1/x402/unrealized-pnl","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"mark":{"type":"integer","description":"Input field: mark."},"size":{"type":"integer","description":"Input field: size."},"entry":{"type":"integer","description":"Input field: entry."}}},"responseSchema":{"type":"json","example":{"mark":95,"size":3,"entry":100,"schema":"delx/util-unrealized-pnl/v1","unrealized_pnl":-15}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_IOc7dGGKPlgFfkW9adqbf","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes unrealized profit and loss for an open position given entry price, mark price, and position size using local deterministic math.","exampleAgentPrompt":"What's my unrealized PnL on a position where I entered at 42000 with a size of 10 and the current mark price is 43500?","exampleUseCases":[{"title":"Open position dashboard refresh","prompt":"I have a long position I entered at 30000 with size 5, and the mark price is now 31200 — what's my unrealized PnL right now?"},{"title":"Liquidation preflight risk check","prompt":"Before I run my liquidation check, can you calculate the unrealized PnL for my position entered at 65000 with size 20 and a current mark of 62000?"},{"title":"Multi-fill position P&L snapshot","prompt":"I averaged into a position at an entry of 2800 with a total size of 15 and mark is now 3100 — compute my unrealized profit so I can update my dashboard."}],"resultDescription":"Returns a deterministic JSON object containing the unrealized PnL value calculated as the difference between mark price and entry price scaled by position size, with no external data sources or live feeds involved.","failureModes":["Missing required fields (mark, size, or entry) returns a validation error","Non-integer values for mark, size, or entry may cause a type error","Extremely large integers may cause overflow or precision issues","Payment failure via x402 protocol blocks the request","Malformed request body returns a 400-level error"],"whenToPreferThis":"Choose this endpoint when you need a fast, cheap, deterministic, first-party PnL calculation with no API keys or live data feeds — ideal for open position dashboards, liquidation preflights, or any scenario where you need pure local math on entry price, mark price, and size without relying on external market data providers.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T19:04:16.592Z","isFirstParty":false}