@@ -329,11 +329,15 @@ def LIN_REG_ALGO(df):
329329 return df , lr_pred , forecast_set , mean , error_lr
330330 #**************** SENTIMENT ANALYSIS **************************
331331 def retrieving_tweets_polarity (symbol ):
332+ stock_ticker_map = pd .read_csv ('Yahoo-Finance-Ticker-Symbols.csv' )
333+ stock_full_form = stock_ticker_map [stock_ticker_map ['Ticker' ]== symbol ]
334+ symbol = stock_full_form ['Name' ].to_list ()[0 ][0 :14 ]
335+
332336 auth = tweepy .OAuthHandler (ct .consumer_key , ct .consumer_secret )
333337 auth .set_access_token (ct .access_token , ct .access_token_secret )
334338 user = tweepy .API (auth )
335339
336- tweets = tweepy .Cursor (user .search , q = str ( symbol ) , tweet_mode = 'extended' , lang = 'en' ,exclude_replies = True ).items (ct .num_of_tweets )
340+ tweets = tweepy .Cursor (user .search , q = symbol , tweet_mode = 'extended' , lang = 'en' ,exclude_replies = True ).items (ct .num_of_tweets )
337341
338342 tweet_list = [] #List of tweets alongside polarity
339343 global_polarity = 0 #Polarity of all tweets === Sum of polarities of individual tweets
@@ -424,7 +428,7 @@ def recommending(df, global_polarity,today_stock,mean):
424428 print ()
425429 print ("##############################################################################" )
426430 print ("According to the ML Predictions and Sentiment Analysis of Tweets, a" ,idea ,"in" ,quote ,"stock is expected => " ,decision )
427- elif global_polarity < 0 :
431+ elif global_polarity <= 0 :
428432 idea = "FALL"
429433 decision = "SELL"
430434 print ()
0 commit comments