本文以台灣地區上市公司為研究對象,採用 2008 年 1 月至 2023 年 4 月期間的類股指數丶期貨指數資料及金融股個股股價,建立股價預測模型。本研究希望可以先從類股中發掘相關的輪動趨勢,以此預測下一批資金將投入的類股,在產業類股起漲前,可以提前佈局。主要使用 Transformer 模型探討股價預測問題,希望藉由模型的預測,預先得知股票漲跌趨勢,提供投資人做為交易的參考,能夠讓投資人降低投資風險,增加投資報價率。除了使用 Transformer 模型之外,並嘗試將類股輪動因素加入實驗中,驗證是否可以有效的增進股價預測正確性。;This article focuses on listed companies in Taiwan and establishes a stock price prediction model using sector index data, futures index data, and financial stock prices from January 2008 to April 2023. The study aims to explore the relevant sector rotation trends first to predict which sectors will receive the next batch of funds. It′s possible to make advance arrangements before the stocks rise. The main model used in this study is the Transformer model to explore stock price prediction problems. Through the model′s predictions, investors can obtain advance knowledge of the stock′s trend, reduce investment risks, and increase investment returns. In addition to using the Transformer model, the study also attempts to incorporate sector rotation factors to verify whether they can effectively improve the accuracy of stock price predictions.