Works with the AI Agents you already use

    Stat Arb Pairs Trading

    by BanditXBT

    1

    Design and audit pairs and stat-arb strategies: cointegration, OU half-life, Kalman hedge ratios, rules, breaks, costs.

    $29

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    About this skill

    A pair is tradable only if the spread is mean-reverting out of sample, fast enough relative to costs, and robust to structural breaks. Treat formation-period fit as a hypothesis, not evidence.

    • Start from economic linkage (same industry, ETF vs. constituents, same asset on two venues, spot vs. perp, wrapped vs. underlying). Mining N^2 pairs guarantees false positives; correct for multiple testing (FDR/Bonferroni; see strategy-statistical-validation).

    • Literature: Gatev, Goetzmann, Rouwenhorst (2006), "Pairs Trading: Performance of a Relative-Value Arbitrage Rule", Review of Financial Studies 19(3) (distance method; abstract reports excess returns up to ~11% annualized, 1962-2002). Do and Faff (2010), "Does Simple Pairs Trading Still Work?", Financial Analysts Journal 66(4) (profits kept declining through 2009). Avellaneda and Lee (2010), "Statistical arbitrage in the US equities market", Quantitative Finance 10(7) (PCA/ETF residuals).

    • Prefer residual-vs-factor (sector/PCA) spreads in equities to control factor exposure (see factor-exposure-attribution).

    • Engle-Granger: regress y on x (log prices), test the residual. Use statsmodels.tsa.stattools.coint(y0, y1, trend='c', maxlag=None, autolag='aic'): null = no cointegration (small p = evidence for it); it uses MacKinnon p-values/critical values for residual-based tests, which plain adfuller on residuals does not. Results can differ by choice of regressand; run both orderings (y0/y1 swapped).

    • Johansen: multivariate, gives rank and several vectors: statsmodels.tsa.vector_ar.vecm.coint_johansen(endog, det_order, k_ar_diff) (det_order -1 none, 0 constant, 1 linear trend; trace and max-eigenvalue stats) and select_coint_rank. Choose deterministic term and lag order deliberately; sensitive in short samples.

    • Power is low on short windows: with a 30-day half-life, one trading year (~252 days) holds only ~8 half-lives. Require stability across rolling subsamples, not one p-value.

    dS = θ(μ - S)dt + σ dW. Discretize as AR(1): S_t = a + φ S_{t-1} + ε, θ = -ln(φ)/Δt, half-life = ln2/θ, stationary sd σ_eq = σ_ε/sqrt(1-φ²). Regressing ΔS on S_{t-1} gives b = φ - 1.

    Educational analysis, not investment advice. Entry and exit thresholds are starting heuristics to be tuned out of sample.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    Software
    Python 3statsmodelspandas
    Optional
    pykalman

    Permissions

    No special permissions declared or detected

    Listed13 days ago

    What's inside

    Frequently Asked Questions

    Design and audit pairs and stat-arb strategies: cointegration, OU half-life, Kalman hedge ratios, rules, breaks, costs.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use stat-arb-pairs-trading on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.