{"uid":"cap_De5Hb5v2PC5KqKBNlB-Tm","slug":"delx-commerce-roi-on-margin-calculator-d51e4dc3","name":"Delx Commerce — ROI on Margin 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/roi-on-margin?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"pnl":{"type":"integer","description":"Input field: pnl."},"margin":{"type":"integer","description":"Input field: margin."}}},"responseSchema":{"type":"json","example":{"pnl":50,"roi":0.1,"margin":500,"schema":"delx/util-roi-on-margin/v1","roi_pct":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_359DrzWkJnV-2kQIdw0lE","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 return on investment (ROI) as a ratio and percentage given a profit/loss (PnL) and margin (capital deployed).","exampleAgentPrompt":"Calculate the ROI for a trade where I made a profit of 50 and had a margin of 500 — give me both the ratio and the percentage.","exampleUseCases":[{"title":"Trading performance snapshot","prompt":"I closed a futures position with a PnL of 200 on a margin of 1000 — what's my ROI as a ratio and as a percentage?"},{"title":"Portfolio return reporting","prompt":"For my monthly report, calculate the ROI on a strategy that generated 150 profit against a 750 margin deployment."},{"title":"Live agent dashboard metric","prompt":"My algo just closed with PnL of -30 on a margin of 300 — compute the ROI so I can log it to the dashboard."}],"resultDescription":"Returns a JSON object containing the input pnl and margin echoed back, the ROI as a decimal ratio (e.g. 0.1), and the ROI as a percentage (e.g. 10), along with a schema identifier 'delx/util-roi-on-margin/v1'.","failureModes":["Missing pnl or margin fields returns an error response","margin of zero causes division-by-zero and likely a 400 or error JSON","Non-integer values for pnl or margin may be rejected or truncated","Network or payment failure (x402) if USDC payment is not properly submitted"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-call, no-signup computation of ROI from PnL and margin, particularly inside automated agent workflows where you want verifiable, on-chain micropayment billing via x402 and USDC on Base or Solana rather than a subscription or API key.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:53:51.462Z","isFirstParty":false,"canonicalSlug":"delx-commerce-roi-on-margin-calculator-d51e4dc3"}