{
  "tool_id": "pair-trading-tester",
  "slug": "pair-trading-tester",
  "path": "/pair-trading-tester/",
  "mode": "client_side",
  "usage": "Client-side tester. Open https://aifinhub.io/pair-trading-tester/ and paste a two-asset price CSV. Engle-Granger + ADF + OU half-life + z-score all in-browser.",
  "methodology": "https://aifinhub.io/methodology/pair-trading-tester/",
  "sample_input": {
    "tool": "pair-trading-tester",
    "a": [
      100,
      98.5874,
      97.8259,
      98.015,
      97.6033,
      97.5598,
      97.4391,
      95.4593,
      96.8625,
      97.6213,
      96.884,
      97.9378,
      96.7864,
      96.052,
      96.7539,
      97.0884,
      96.2998,
      96.8609,
      96.4113,
      94.7817,
      94.0908,
      95.2396,
      94.912,
      95.9782,
      94.1185,
      94.1316,
      95.6987,
      94.2103,
      94.2116,
      95.9806,
      95.3522,
      94.9435,
      93.114,
      94.4138,
      93.5007,
      92.7732,
      93.5529,
      92.4435,
      91.7068,
      91.0294,
      89.8526,
      90.4241,
      89.7977,
      88.3319,
      90.5591,
      91.0151,
      90.6968,
      90.7679,
      89.7283,
      90.0064,
      90.209,
      92.9212,
      92.3561,
      91.9658,
      89.6928,
      89.0712,
      89.7689,
      89.4756,
      89.6975,
      89.6835,
      89.6376,
      90.0946,
      90.1572,
      90.8464,
      93.7497,
      92.1072,
      93.1928,
      94.5939,
      91.9662,
      94.5231,
      95.2861,
      95.7917,
      95.5093,
      94.1203,
      93.5651,
      92.9154,
      94.495,
      94.4734,
      94.3377,
      95.4258
    ],
    "b": [
      151.141,
      149.3602,
      148.5811,
      149.3006,
      149.0083,
      149.3586,
      148.3213,
      145.2459,
      146.8073,
      148.1455,
      147.1322,
      148.4226,
      147.5568,
      146.0558,
      145.4098,
      146.5035,
      146.4691,
      147.5213,
      145.983,
      144.2597,
      142.6992,
      144.0918,
      143.485,
      145.0805,
      142.3363,
      141.9733,
      144.8319,
      143.6638,
      144.3719,
      147.3897,
      146.2313,
      146.8656,
      144.1777,
      145.6877,
      143.6726,
      142.1663,
      144.0035,
      140.4674,
      140.1333,
      139.8269,
      138.2176,
      137.391,
      137.1818,
      134.8946,
      138.3316,
      138.8633,
      138.7863,
      139.4953,
      137.8307,
      138.0143,
      138.1207,
      141.8669,
      140.5081,
      139.9323,
      136.2529,
      135.6546,
      137.3739,
      137.2101,
      138.5398,
      139.4239,
      138.4136,
      138.4121,
      138.646,
      137.7651,
      142.8305,
      140.5458,
      142.8138,
      145.3761,
      141.5616,
      144.592,
      146.166,
      146.9859,
      146.5194,
      144.7299,
      144.0425,
      142.9379,
      144.9803,
      145.411,
      144.2937,
      146.1881
    ],
    "lags": 1,
    "z_window": 30
  },
  "input_schema": {
    "type": "object",
    "properties": {
      "tool": {
        "type": "string"
      },
      "a": {
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "b": {
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "lags": {
        "type": "number"
      },
      "z_window": {
        "type": "number"
      }
    },
    "required": [
      "tool",
      "a",
      "b",
      "lags",
      "z_window"
    ]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "hedge_ratio_beta": {
        "type": "number"
      },
      "ols_r2": {
        "type": "number"
      },
      "adf_t_stat": {
        "type": "number"
      },
      "adf_p_value_band": {
        "type": "string"
      },
      "is_stationary_5pct": {
        "type": "boolean"
      },
      "ou_half_life_days": {
        "type": "number"
      },
      "entry_events": {
        "type": "integer"
      },
      "exit_events": {
        "type": "integer"
      },
      "verdict": {
        "type": "string"
      }
    }
  }
}
