{"uid":"cap_Wbob7ZGWShfj6zcCM3sRt","slug":"pairs-hedge-ratio-ols-6bfa47a4","name":"Pairs Hedge Ratio OLS","description":"OLS hedge ratio beta of y on x (no intercept). Call when sizing the short leg in a pairs trade offline. Returns beta and n 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/pairs-hedge-ratio","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"x":{"type":"array","description":"Independent series for OLS hedge ratio"},"y":{"type":"array","description":"Dependent series for OLS hedge ratio"}}},"responseSchema":{"type":"json","example":{"n":5,"beta":1.98,"schema":"delx/util-pairs-hedge-ratio/v1"}},"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_lcNW5X2mwYjEvISyBOGi1","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 OLS (ordinary least squares) hedge ratio beta of y on x (no intercept) for sizing the short leg in a pairs trade.","exampleAgentPrompt":"Calculate the OLS hedge ratio for my pairs trade — here's the x series (independent): [100, 102, 101, 103, 105] and the y series (dependent): [200, 204, 202, 206, 210]. I need the beta so I can size the short leg.","exampleUseCases":[{"title":"Sizing a stat arb short leg","prompt":"I'm trading a pairs position in two correlated ETFs. Given these daily closes for the first ETF (x): [48.2, 48.5, 47.9, 48.8, 49.1] and the second ETF (y): [96.1, 97.0, 95.8, 97.5, 98.3], what's the OLS hedge ratio so I know how many shares of x to short against each share of y?"},{"title":"Updating hedge ratio after regime shift","prompt":"My pairs strategy had a beta of 0.95 but I think it's shifted after recent volatility. Can you recompute the OLS hedge ratio using my latest 20-day price series for x: [50,51,50.5,52,51.5,53,52,54,53.5,55,54,55.5,56,55,57,56.5,58,57,59,58] and y: [99,101,100,103,102,105,103,107,106,109,107,110,111,109,113,112,115,113,117,115]?"},{"title":"Validating a cointegrated pair before entry","prompt":"Before I enter this trade, run an OLS regression (no intercept) on these two price series so I can see the hedge ratio — x is [200,202,198,205,203] and y is [400,404,397,411,406]. Tell me the beta and how many data points were used."}],"resultDescription":"Returns a deterministic JSON object containing the OLS beta (hedge ratio) computed from the y-on-x regression without an intercept, and n (the number of observations used in the calculation). No external data sources or market feeds are used — the result is a pure function of the input arrays.","failureModes":["Mismatched array lengths between x and y — endpoint may return an error or undefined behavior","Empty or single-element arrays — insufficient data for regression","Arrays containing NaN or non-numeric values — may cause computation failure","All-zero x array — results in division by zero for beta","Extremely large arrays may increase latency slightly but endpoint is designed for offline/batch use"],"whenToPreferThis":"Use this endpoint when you need a fast, cheap, deterministic OLS hedge ratio computation for pairs trading and have no need for a live market feed or external data. Ideal for offline sizing calculations, backtesting pipelines, or any scenario where you already have the price series and need beta quickly. Prefer this over a general statistics library call when you need a paid, auditable, x402-compatible micro-transaction API in an agentic workflow on Base.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T01:14:45.107Z","isFirstParty":false}