{"uid":"cap_9Ed3mfpN5U5mV6Ep4Hvt8","slug":"win-rate-calculator-42fcafd0","name":"Win Rate Calculator","description":"Win rate from wins and total trades. Call when scorecards and expectancy inputs from closed trade counts. Returns win rate fraction and percent 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/win-rate","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"pnls":{"type":"array","description":"Input field: pnls."}}},"responseSchema":{"type":"json","example":{"n":5,"wins":3,"schema":"delx/util-win-rate/v1","win_rate":0.6}},"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_4Mqk0q3EkYeb0wNv1bYYN","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 win rate fraction and percentage from a list of trade PnLs, classifying wins vs total closed trades.","exampleAgentPrompt":"Calculate my win rate from these closed trade PnLs: [150, -80, 200, -30, 75, -50, 120, -90, 300, -10] — give me the fraction and percentage.","exampleUseCases":[{"title":"Trading scorecard win rate metric","prompt":"I closed 20 trades this week with these PnLs: [200, -150, 80, -40, 300, -90, 120, -60, 50, -20, 400, -110, 75, -30, 180, -70, 90, -45, 250, -100]. What's my win rate as a fraction and a percentage?"},{"title":"Expectancy calculation prerequisite","prompt":"Before I compute my trading expectancy, I need the win rate from these PnL results: [500, -200, 350, -150, 100, -80, 220, -60]. Can you calculate the win rate fraction and percent for me?"},{"title":"Strategy comparison win percentage","prompt":"I'm comparing two strategies — here are the PnLs for strategy A: [90, -40, 130, -20, 75, 60, -55, 110]. What fraction and percentage of those trades were winners?"}],"resultDescription":"Returns a deterministic JSON object containing the win rate as a decimal fraction (e.g. 0.65) and as a percentage (e.g. 65.0), computed from the count of positive PnLs divided by total trade count in the input array.","failureModes":["Empty or missing pnls array returns error or zero division result","Non-numeric values in the pnls array cause validation failure","Malformed JSON body results in 400 bad request","Insufficient USDC balance or x402 payment failure prevents execution","All-zero PnL values may be ambiguously classified as wins or losses depending on implementation"],"whenToPreferThis":"Choose this endpoint when you need a fast, cheap, deterministic win rate calculation from raw PnL data without any external dependencies, API keys, or live market data. Ideal for trading scorecard pipelines, expectancy calculations, and performance dashboards where you already have closed trade PnL arrays and need the win fraction and percent as structured JSON. Prefer this over general-purpose computation or custom code when you need a ready-made, pay-per-call microservice at $0.001 USDC.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T07:06:00.880Z","isFirstParty":false}