Stock price forecasting is a widespread research issue in the field of finance. Stock price prediction can give investors more accurate advice and yield higher returns. With the popularity of social media, more and more people choose to express their opinions, and more and more media outlets published news on social media. This paper mainly conducts stock analysis and prediction by presenting the RoBERTa-BiLSTM model with the Bahdanau attention mechanism. It consists of two existing models: the RoBERTa and bidirectional LSTM models. The experimental results show that this model is more accurate in predicting stock prices than the Multi-Layer Perception (MLP) and LSTM models. Inputs to the model include historical AAPL stock price data and sentiment data analysed by news and Twitter tweet sentiment. In this paper, the high-precision RoBERTa-BiLSTM model for stock prediction was proposed, which provides a solution for stock prediction. The practical applications and the typical problem of most studies about stock prediction called the time-shifted problem, are provided in this paper and also have research value.