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. Y

social sentimen


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)

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

Nov 25, 2023 6:39 AM - Parth Sanghvi

DCF Valuation vs. Comparable Companies Analysis: Choosing the Right Valuation Method

Choosing the Right Valuation Method: DCF vs. Comparable Companies Analysis Introduction: Valuation methods play a pivotal role in determining the fair value of a company, aiding investors in making informed investment decisions. Two commonly used methods, DCF Valuation and Comparable Companies A...

blog post title

Dec 23, 2023 2:19 AM - Parth Sanghvi

Understanding the Limitations of DCF Analysis: A Guide to Overcoming Challenges

Introduction: Discounted Cash Flow (DCF) analysis stands as a cornerstone in valuing investments, yet its efficacy is contingent upon various assumptions and methodologies. While a powerful tool, DCF analysis comes with inherent limitations and challenges that investors must acknowledge to make i...

blog post title

Dec 25, 2023 2:28 AM - Parth Sanghvi

Integrating Sustainability into Valuations: Navigating ESG Factors within the Discounted Cash Flow (DCF) Model

Introduction: The investment landscape is undergoing a profound shift with a heightened emphasis on sustainability and responsible investing. In this blog post, we explore the intersection of Environmental, Social, and Governance (ESG) considerations within the Discounted Cash Flow (DCF) model, h...

blog post title


Financial Modeling Prep API provides real time stock price, company financial statements, major index prices, stock historical data, forex real time rate and cryptocurrencies. Financial Modeling Prep stock price API is in real time, the company reports can be found in quarter or annual format, and goes back 30 years in history.
2017-2024 © Financial Modeling Prep