{"uid":"cap__HS8OSuuUEG7G35tfZXF5","slug":"realized-pnl-fifo-lite-17416951","name":"Realized PnL (FIFO Lite)","description":"Lite FIFO-style realized PnL from sequential buy/sell fills. Call when attributing closed PnL from a short fill tape without a full OMS. Returns realized pnl summary from fills 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/realized-pnl-fifo","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"exit":{"type":"integer","description":"Input field: exit."},"entry":{"type":"integer","description":"Input field: entry."},"close_size":{"type":"integer","description":"Input field: close size."}}},"responseSchema":{"type":"json","example":{"schema":"delx/util-realized-pnl-fifo/v1","close_size":2,"realized_pnl":10}},"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_nSyHjmWvEevEuR3WGLB20","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":"Calculates FIFO-style realized profit and loss from sequential buy/sell fills using local deterministic math, returning a PnL summary as JSON.","exampleAgentPrompt":"Calculate the realized PnL using FIFO on a position where I entered at 42000, exited at 43500, and closed 3 contracts.","exampleUseCases":[{"title":"Closing a long trade position","prompt":"I bought in at 38000 and just sold at 40500 with a close size of 5 — what's my realized PnL using FIFO?"},{"title":"Attributing PnL from a short fill tape","prompt":"I've got fills showing an entry at 1850 and an exit at 1790 for a close size of 10 contracts — can you compute the FIFO realized profit or loss on that?"},{"title":"Post-trade reconciliation without an OMS","prompt":"After the session I closed 2 units, entering at 3200 and exiting at 3450 — calculate my realized PnL in FIFO order so I can reconcile without pulling up the full order management system."}],"resultDescription":"A deterministic JSON object summarizing realized PnL computed via FIFO logic from the provided entry price, exit price, and close size. The output is advisory only and produced entirely through local math with no external data sources or storage.","failureModes":["Missing required fields (entry, exit, or close_size) result in a validation error","Non-integer values for price or size fields cause a schema rejection","Negative or zero close_size may produce unexpected or invalid PnL results","Payment failure via x402 results in a 402 response before computation occurs"],"whenToPreferThis":"Use this endpoint when you need a fast, deterministic, advisory FIFO realized PnL computation from raw fill data (entry price, exit price, close size) without access to a full OMS, live market feed, or external data source. Prefer this over more complex PnL services when the fill tape is simple and sequential and you do not need position tracking, multi-leg attribution, or persistent state.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T07:08:37.911Z","isFirstParty":false}