摘要: Sentiment Analysis on Stock Market Data

 


images/20210913_3_1.jpg

▲圖片來源:Adeolu Eletu on Unsplash

Using python code to prioritize news articles to read based on how good or bad the news is with respect to various companies or assets in a portfolio.

I will show you how I am able to analyze news headlines across many asset in my stock portfolio using web scrapping techniques and natural language processing (NLP) .

What is a Stock Portfolio?

Stock portfolio is a collection of stocks that you invest in with the hope of making a profit. By putting together a diverse portfolio that spans various sectors you’re able to become a more resilient investor. That’s because if one sector takes a hit, the investments you hold in other sectors aren’t necessarily affected.

What is Web Scraping?

Web scraping refers to the extraction of data from a website. This information is collected and then exported into a format that is more useful for the user. Be it a spreadsheet or an API.

What is Natural Language Processing?

Natural language processing (NLP) is a branch of artificial intelligence that helps computers understand, interpret and manipulate human language. NLP draws from many disciplines, including computer science and computational linguistics, in its pursuit to fill the gap between human communication and computer understanding.

images/20210913_3_2.jpg

Next, we want to extract news articles for the different assets in our portfolio from a news source, here we use www.finviz.com. Then we store it in a python dictionary.

images/20210913_3_3.jpg

Extract features we want from the webpage we copied from finviz

images/20210913_3_4.jpg

Here we apply Natural Language Processing with the help of the Sentiment Intensity Analyzer from the NLP toolkit. A positive value means it is a good news and the value shows how strong the good news is and vice versa

images/20210913_3_5.jpg

images/20210913_3_6.jpg

Finally, let’s make a plot to visualize the sentiments for our companies over a defined period.

images/20210913_3_7.jpg

images/20210913_3_8.png

▲圖片來源:dhimar058.medium.com

With the help of a few lines of code, we have been able to visualize sentiments extracted from news headlines.

This helps us make informed decisions about buying or selling an asset from our portfolio.

It also saves us time from having to read through every news headline

● ● ●

Sentiment analysis (or opinion mining) is a natural language processing technique used to determine whether data is positive, negative or neutral. Its application ranges from various domains, Sentiment analysis is often performed on textual data to help businesses monitor brand and product sentiment in customer feedback, and understand customer needs.

轉貼自Source: dhimar058.medium.com

若喜歡本文,請關注我們的臉書 Please Like our Facebook Page:    Big Data In Finance

 


留下你的回應

以訪客張貼回應

0
  • 找不到回應