本研究探討配對交易策略,旨在透過辨識具有長期均衡關係的資產,並利用其價差的均值回歸特性來實現交易獲利。首先,本研究提出一種新穎方法,整合 Engle-Granger 共整合檢定與階層式聚合分群技術。該方法用以識別具有統計顯著性且共整合關係穩定的資產配對,進而建構高品質的候選資產配對池,供後續交易決策使用。接著,本研究結合深度 Q 網路,設計客製化的狀態空間、獎勵函數與交易策略,使模型能夠逐月動態學習並優化地從配對池中挑選最具交易潛力與獲利能力的股票配對。實證分析以 S\&P 500 成分股為對象,使用 2015 年至 2024 年的歷史資料進行。研究先以樣本內資料進行參數調整與模型配適,並進一步以滾動視窗預測方法預測樣本外資料。實證結果顯示,本研究所提出的配對交易策略在平均報酬達 0.343、夏普比率達 2.040,展現了優異的獲利能力與風險調整後的表現。;This study explores pairs trading, aiming to achieve trading profitability by identifying assets with long-term equilibrium relationships and leveraging their mean-reverting price spread. First, this study proposes a novel method integrating the Engle-Granger cointegration test with hierarchical agglomerative clustering. The method is used to identify asset pairs with statistically significant and stable long-term equilibrium relationships, thereby constructing a high-quality candidate pair pool for subsequent trading decisions. Next, this study integrates the deep Q-network, designs a customized state space, reward function, and trading strategy to dynamically learn and optimize the selection of the most promising stock pairs from the pool month by month, in terms of trading potential and profitability. The empirical analysis focuses on the constituents of the S\&P 500, utilizing historical data from 2015 to 2024. This study uses the in-sample data for parameter tuning and model fitting. A rolling window forecasting method is then applied to predict the out-of-sample data. The proposed pairs trading strategy achieves a mean return of 0.343 and a Sharpe ratio of 2.040, demonstrating strong profitability and effective risk-adjusted performance.