{"uid":"cap_e6HwE8kZJ61YRECwcZ7UH","slug":"delx-commerce-peg-time-weighted-deviation-4b424a77","name":"Delx Commerce — Peg Time-Weighted Deviation","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/peg-tw-deviation?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"peg":{"type":"number","description":"Target peg price (usually 1.0)"},"prices":{"type":"array","description":"Market prices / samples depending on tool"},"weights":{"type":"array","description":"Optional sample weights"}}},"responseSchema":{"type":"json","example":{"schema":"delx/util-peg-tw-deviation/v1","tw_abs_deviation":0.005000000000000004}},"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_aptSELCAKCNITiEMBdyRr","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 the time-weighted absolute deviation of a set of market prices from a target peg value (e.g., 1.0 for stablecoins)","exampleAgentPrompt":"Calculate the time-weighted absolute deviation of these USDC market prices [0.998, 1.002, 0.995, 1.001, 0.997] from the peg of 1.0, using equal weights.","exampleUseCases":[{"title":"Stablecoin depeg risk monitoring","prompt":"I have these 10 recent USDC market prices sampled every minute: [0.999, 0.998, 0.997, 0.995, 0.993, 0.991, 0.989, 0.988, 0.987, 0.986]. Can you calculate the time-weighted absolute deviation from the 1.0 peg so I can assess depeg risk?"},{"title":"DeFi protocol peg health check","prompt":"Our algorithmic stablecoin had the following prices over the last hour: [1.002, 1.001, 0.999, 0.998, 1.000, 1.003, 1.001]. Compute the time-weighted deviation from the 1.0 peg — we need this for our on-chain health dashboard."},{"title":"Weighted oracle price deviation","prompt":"I have oracle price samples for a pegged asset with varying reliability weights — prices are [0.9985, 1.0012, 0.9978, 1.0005] and weights are [0.1, 0.3, 0.4, 0.2]. What's the time-weighted absolute deviation from the 1.0 peg?"}],"resultDescription":"Returns a JSON object with a schema identifier ('delx/util-peg-tw-deviation/v1') and a 'tw_abs_deviation' field containing the computed time-weighted absolute deviation of the provided prices from the target peg as a floating-point number (e.g., 0.005).","failureModes":["Missing or empty 'prices' array returns an error","Invalid data types (non-numeric prices or weights) cause a 400-level error","Mismatched lengths between 'prices' and 'weights' arrays may produce an error or unexpected result","Payment not included or insufficient USDC (x402) results in a 402 Payment Required response"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-call computation of time-weighted peg deviation without setting up infrastructure — ideal for DeFi agents, stablecoin monitors, or on-chain risk systems that need verifiable, cheap, single-call analytics on price samples. Prefer it over building custom math when you need reproducible results tied to a defined schema version.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:53:54.422Z","isFirstParty":false,"canonicalSlug":"delx-commerce-peg-time-weighted-deviation-4b424a77"}