結合LSTM及基於Transformer模型對新聞分析的股價預測
Predicting Stock Prices from News: A Hybrid Model Combining LSTM and Transformer-based Models
摘要
近年來,由於美國持續印鈔的緣故導致通膨加劇,許多民眾面臨資金貶值的壓力,迫使他們尋求投資理財的方式來保值增值。各大投資理財的書籍及網路資訊因此大量產生,許多投資新手在缺乏充分了解的情況下紛紛投入股票市場,但常常因為缺乏專業知識和經驗,導致辛苦錢血本無歸。此外,我們經常可以聽到某個投顧或某家公司的新聞發表後,股價大幅波動的消息。因此,我們萌生了結合大型語言模型分析新聞並利用長短期記憶模型預測股價的想法,期望能夠透過這個模型幫助新手或老手當成一個參考購買股票的指標。
首先,我們利用了ChatGPT對紐約時報上的個股新聞進行分析,通過自然語言處理技術從新聞中提取對股價變動有影響的關鍵因子。這些因子可能包括公司財報、公佈的重大合作、政策變動、管理層變動等。我們將這些因子作為特徵輸入,進行量化處理,並與歷史股價數據結合,形成一個綜合的資料集。
接下來,我們使用長短期記憶模型對連續時間的股價數據進行分析。LSTM作為一種特殊的遞歸神經網絡,擅長處理和預測時間序列數據,能夠捕捉數據中的長期依賴關係。我們將處理過的新聞數據與歷史股價數據作為輸入,通過LSTM模型對未來的股價進行預測。
在模型的評估階段,我們挑選了兩篇具有代表性的論文進行比較,這些論文中所使用的方法在股價預測領域具有一定的權威性。經過實驗,我們的模型在預測精度和穩定性方面均取得了優於這些論文的結果,證明了我們所構建的模型對股價預測具有較高的可靠性和實用性。
我們的研究結果顯示,結合大型語言模型與長短期記憶模型的多模態分析方法在股價預測中有著顯著的優勢,能夠為投資者提供更準確的參考資訊。這不僅能幫助新手投資者在進行股票買賣時增加信心,也能為有經驗的投資者提供有價值的決策支持。未來,我們期望進一步優化模型,引入更多的資料來源和影響因子,以提升模型的預測精度和應用範圍。
首先,我們利用了ChatGPT對紐約時報上的個股新聞進行分析,通過自然語言處理技術從新聞中提取對股價變動有影響的關鍵因子。這些因子可能包括公司財報、公佈的重大合作、政策變動、管理層變動等。我們將這些因子作為特徵輸入,進行量化處理,並與歷史股價數據結合,形成一個綜合的資料集。
接下來,我們使用長短期記憶模型對連續時間的股價數據進行分析。LSTM作為一種特殊的遞歸神經網絡,擅長處理和預測時間序列數據,能夠捕捉數據中的長期依賴關係。我們將處理過的新聞數據與歷史股價數據作為輸入,通過LSTM模型對未來的股價進行預測。
在模型的評估階段,我們挑選了兩篇具有代表性的論文進行比較,這些論文中所使用的方法在股價預測領域具有一定的權威性。經過實驗,我們的模型在預測精度和穩定性方面均取得了優於這些論文的結果,證明了我們所構建的模型對股價預測具有較高的可靠性和實用性。
我們的研究結果顯示,結合大型語言模型與長短期記憶模型的多模態分析方法在股價預測中有著顯著的優勢,能夠為投資者提供更準確的參考資訊。這不僅能幫助新手投資者在進行股票買賣時增加信心,也能為有經驗的投資者提供有價值的決策支持。未來,我們期望進一步優化模型,引入更多的資料來源和影響因子,以提升模型的預測精度和應用範圍。
In recent years, continuous money printing by the United States has led to increased inflation, forcing many to seek investment methods to preserve their wealth. Consequently, numerous investment books and online resources have emerged. However, many novice investors, lacking sufficient understanding, have rushed into the stock market, often resulting in the loss of their hard-earned money. Additionally, significant stock price fluctuations often follow announcements by investment advisors or companies. To address this, we conceived the idea of combining large language models (LLMs) to analyze news and using long short-term memory (LSTM) models to predict stock prices. This model aims to serve as a reference for both novice and experienced investors in their stock purchasing decisions.
We first utilized ChatGPT to analyze individual stock news from The New York Times, extracting key factors affecting stock price movements through natural language processing techniques. These factors include financial reports, major partnerships, policy changes, and management changes. We quantified these factors as features and combined them with historical stock price data to create a comprehensive dataset.
Next, we used the LSTM model to analyze the continuous time series of stock price data. LSTM excels in handling and predicting time series data and can capture long-term dependencies. We input the processed news data and historical stock price data into the LSTM model to predict future stock prices.
In evaluating our model, we compared it with two representative papers in the field of stock price prediction. Our results showed that our model achieved better accuracy and stability, demonstrating its high reliability and practicality.
Our research indicates that combining large language models with long short-term memory models offers significant advantages in stock price prediction, providing more accurate reference information for investors. This helps novice investors gain confidence and offers valuable decision support for experienced investors. We aim to further optimize the model by incorporating more data sources and influencing factors to enhance its prediction accuracy and application scope.
We first utilized ChatGPT to analyze individual stock news from The New York Times, extracting key factors affecting stock price movements through natural language processing techniques. These factors include financial reports, major partnerships, policy changes, and management changes. We quantified these factors as features and combined them with historical stock price data to create a comprehensive dataset.
Next, we used the LSTM model to analyze the continuous time series of stock price data. LSTM excels in handling and predicting time series data and can capture long-term dependencies. We input the processed news data and historical stock price data into the LSTM model to predict future stock prices.
In evaluating our model, we compared it with two representative papers in the field of stock price prediction. Our results showed that our model achieved better accuracy and stability, demonstrating its high reliability and practicality.
Our research indicates that combining large language models with long short-term memory models offers significant advantages in stock price prediction, providing more accurate reference information for investors. This helps novice investors gain confidence and offers valuable decision support for experienced investors. We aim to further optimize the model by incorporating more data sources and influencing factors to enhance its prediction accuracy and application scope.