Skip to content
/ finsent Public

Extract sentiment of every US public company from financial news headlines

License

Notifications You must be signed in to change notification settings

giuetr/finsent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

finsent

Extract sentiment from financial news headlines for every US public company


Finsent is a fast and seamless way to collect, classify and visualize sentiment polarity of financial news headlines for every US listed company.

Requirements:

  • requests
  • BeautifulSoup
  • nltk
  • Vader Corpus

Running:

The app uses a series of methods to perform different analysis and classification actions:

1. news_sent: A method that creates a DataFrame of all the headlines for a specific company and a classification of sentiment polarity. Just feed it a ticker and the df will be created:

#We define the ticker (Oracle Corp.):
ticker = 'ORCL'
#And call the method:
headlines_df = finsent(ticker).news_sent()
headlines_df

2. sentiment: A method that returns the aggregated sentiment of a given company:

#We define the ticker (Adobe Inc.):
ticker = 'ADBE'
#And call the method:
sentiment_df = finsent(ticker).sentiment()
sentiment_df

3. get_all_stocks: A method that returns a DataFrame with sentiment polarity scores for a given array of tickers:

#We define a list of tickers:
tickers = ['F','AMD','NVDA','MU','FB','AMZN']

#And call the method:
sentiment_companies = finsent.get_all_stocks(tickers)
sentiment_companies

Output:

The script took circa 2 seconds to capture and classify the sentiment embedded in over 600 key news headlines for a set of 6 companies, providing a convenient and time-efficient solution for a highly time-consuming practice.


Enjoy!

License:

GNU General Public License v3.0

Copyright © 2019 giuetr