{"uid":"cap_VAbzAd5dXvQQjkiHcBLuF","slug":"delx-commerce-realized-pnl-fifo-calculator-06ec333b","name":"Delx Commerce — Realized PnL FIFO Calculator","description":"Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.","url":"https://commerce.delx.ai/api/v1/x402/realized-pnl-fifo?utm_source=zero.xyz","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_CHe1Gs0jmtBBqvMVPtrix","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 realized profit and loss for a trade position using FIFO (first-in, first-out) accounting given entry price, exit price, and close size.","exampleAgentPrompt":"Calculate the realized PnL using FIFO for a trade where I entered at 100, exited at 110, and closed 2 contracts.","exampleUseCases":[{"title":"Algorithmic trading PnL tracking","prompt":"My bot just closed 5 contracts on a futures position — entry was 200, exit is 215. What's the realized PnL using FIFO accounting?"},{"title":"Crypto derivatives portfolio reconciliation","prompt":"I need to reconcile my realized gains: I entered a position at 50000, closed it at 52500, and the close size was 3 units. Compute the FIFO realized PnL for me."},{"title":"Partial position close accounting","prompt":"I partially closed my trade today — entry price 300, exit price 290, close size 10. Can you calculate the realized profit or loss on that close using FIFO?"}],"resultDescription":"Returns a JSON object containing the schema identifier ('delx/util-realized-pnl-fifo/v1'), the close_size used in the calculation, and the computed realized_pnl value representing the profit or loss realized on the closed portion of the position.","failureModes":["Missing required fields (entry, exit, or close_size) returns an error","Non-integer values for price or size fields may cause validation failure","Payment failure via x402 protocol results in 402 response and no computation","Negative or zero close_size may produce unexpected results"],"whenToPreferThis":"Choose this endpoint when you need a fast, pay-per-use, no-signup computation of realized PnL using FIFO accounting, especially in agentic or automated trading workflows where USDC micropayment settlement via x402 on Base or Solana is acceptable. Prefer this over building custom PnL logic when you need verifiable, deterministic results at $0.001 per call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:53:42.741Z","isFirstParty":false,"canonicalSlug":"delx-commerce-realized-pnl-fifo-calculator-06ec333b"}