FMP
May 17, 2024 8:39 AM - Sanzhi Kobzhan(Last modified: May 28, 2024 7:12 AM)
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.
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.
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.
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:
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.
Jul 10, 2024 6:34 AM - Parth Sanghvi
Capital budgeting is a critical financial process that companies use to evaluate and select long-term investments or projects. It involves assessing potential expenditures and determining their profitability to ensure that resources are allocated effectively. This comprehensive guide covers essentia...
Aug 7, 2024 7:53 AM - Parth Sanghvi
Interest rates play a crucial role in the economy and financial markets, influencing everything from consumer behavior to investment decisions. Understanding their impact is essential for making informed financial and investment decisions. This comprehensive analysis delves into how interest rates a...
Aug 31, 2024 2:27 PM - Sanzhi Kobzhan
Dear traders, how do you obtain stock market data? Everyone should access fresh and accurate data to analyze investments and define great trading strategies. As you may know, buying a stock based on its price level is not the best option because buying a stock is all about buying a company. You shou...