pakshaljain05 / Stock-Market-Prediction

Created a hybrid model for stock price/performance prediction using numerical analysis of historical stock prices, and sentimental analysis of news headlines. Stock used to analyze and predict - SENSEX (S&P BSE SENSEX). Downloaded historical stock prices from finance.yahoo.com. Downloaded textual (news) data from https://bit.ly/36fFPI6
1 stars 3 forks source link

Predicting Stock prices for 'n' given days in the future #1

Open ghost opened 3 years ago

ghost commented 3 years ago

Sir,do you have any idea how to implement this?I have a pseudocode but Im not able to use it on this model.Can you help?

ghost commented 3 years ago

init_ip=test_data[215:] update_ip=list(init_ip) final_pred=[] i=0 pred_days=30 while(i<pred_days): if len(update_ip)>100: x_input=update_ip[1:] x_input=np.array(x_input).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] print("{}day prediction is {}".format(i,new_pred)) final_pred.append(new_pred) update_ip=update_ip[1:] i+=1

else: x_input=np.array(init_ip).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] final_pred.append(new_pred) print(new_pred) i+=1

This is the sample code sir,any idea on how to edit this to suit our model and dataset?

pakshaljain05 commented 3 years ago

You can only predict closed price on the next day based on the input to my model, since it takes the numerical stock data as well as the data got from news headlines of the previous day

On Thu, May 13, 2021, 19:58 NocturnalSlob @.***> wrote:

init_ip=test_data[215:] update_ip=list(init_ip) final_pred=[] i=0 pred_days=30 while(i<pred_days): if len(update_ip)>100: x_input=update_ip[1:] x_input=np.array(x_input).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] print("{}day prediction is {}".format(i,new_pred)) final_pred.append(new_pred) update_ip=update_ip[1:] i+=1

else: x_input=np.array(init_ip).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] final_pred.append(new_pred) print(new_pred) i+=1

This is the sample code sir,any idea on how to edit this to suit our model and dataset?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pakshaljain05/Stock-Market-Prediction/issues/1#issuecomment-840598797, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSIKQMTZ4NWVMBTQX54AXDTNPOXLANCNFSM442UYCNQ .

ghost commented 3 years ago

Does the model take the numerical stock data of the previous day only or the days before that too to predict the next day's stock price?And it considers the news headlines of the previous day to get the next day's price?

ghost commented 3 years ago

Also,why do we use shifted close price here sir?