FMP

FMP

social sentimen

sentiment

social mentions

stock mentions

stock market

stock analysis

equity analysis

How to understand what people think of your selected stock and whether your stock will be popular.

- (Last modified: May 28, 2024 7:12 AM)

twitterlinkedinfacebook
blog post cover photo

Image credit: social sentiment

I have already explained how to calculate a stock's target price and build a basic stock fair value calculator app, even if you don't have programming skills. You can read the article on stock target price calculation to follow step-by-step guidance and build that app. Read it before extracting the social sentiment because you need to understand how to create an HTML and JS file and download VSCode. Now, let's update our app and add more great functionality. We will add social sentiment. This is a great way to know what people think of your selected stock and track trader confidence. Social sentiment tracks social networks and observes positive and negative mentions of your selected stock. By analyzing the sentiment, you can get an idea of your stock's "popularity" among traders.

First, let's update our app and add sentiment functionality, and then I will explain how to read the extracted data. We already have a basic HTML body and JS files. First, let's update the HTML file called demo endpoint.html and add a sentiment field and also a text field where you can input your stock ticker. Copy the code from the picture below.

social sentiment

As you can see, I added social sentiment and a text field where the user can input a stock ticker.

Now let's update our script.js file. I divided the file into several sections so that you can see the changes we made. First screen is stock target price extraction.

stock target price extraction

The apiKey field is blank because you will have to input it manually. Register on the FMP website to obtain your unique API key. Then input your key in the field within the brackets. I have added the symbol, which will be extracted from our demo endpoint.html file, and put the "symbol" into our link provided by FMP to extract data. Other fields remain unchanged.

The next step is to add new fetch request to get social sentiment. Write the code in the same fie, its just a continuation of the above code.

social sentiment extraction

As you can see, a new request has been added. The link will fetch social sentiment API to extract the sentiment, and when we receive the 'data,' it will extract Twitter and Stock tweets sentiment into our application. In this step, we extract data and connect it with our app.

The next step is to check if the data is not empty. If it is empty, it will display the message 'Social sentiment data not available.' If data exists, it will fill in the data in our HTML file.

Now, save both files, demo endpoint.html and script.js. Open the browser and drag your demo endpoint.html file into the browser's open window. When you complete this step input the stock ticker in the field and press the "get data" button and you will see this:

stock target price and social sentiment

Sentiment indicates the overall sentiment on the social network. A sentiment of 0.46, as in our example, would also mean 46%. This indicates that it has almost equal positive and negative mentions on social networks. You should generally consider stocks with a sentiment above 0.6 or 60%, as they will have more positive mentions. To learn more about social sentiment, read the article on indicators that can identify stock direction. In this case, we also see the number of comments and posts on your selected stock for a single day.

Now you have two great functionalities in your app and can see the stock target price, calculate its growth potential from the current market price, and see what traders think of your selected stock. Thank you for reading the article.

Other Blogs

blog post title

Technical Analysis 101: Understanding Support and Resistance

Technical analysis is a fundamental approach used by traders to forecast price movements based on historical market data...

blog post title

How an Economic Moat Provides a Competitive Advantage

Introduction In the competitive landscape of modern business, companies that consistently outperform their peers ofte...

blog post title

Apple’s Slow Shift from China to India: Challenges and Geopolitical Risks

Introduction Apple (NASDAQ: AAPL) has been working to diversify its supply chain, reducing dependence on China due to...