top of page
Nikhil Adithyan

Get Stock Data using APIs without Coding!

Updated: Jun 11

An exciting alternative to programming




Introduction

Though the coding burden involved in extracting data using APIs has been drastically reduced in recent days, there is still a huge gap between non-technical people and APIs. However, this gap is slowly being shut down with the introduction of numerous no-code tools that effectively bridge programming and non-technical people.


In this article, we are going to explore one such interesting no-code interface developed by FinancialModelingPrep (FMP) which gives users the luxury to access their API endpoints and get stock data without coding. Exciting, isn’t it?!


So without further ado, let’s dive right into it dive deep into this no-code tool!


FMP’s API Viewer: Get Stock Data without Coding

FinancialModelingPrep (FMP) has recently introduced a cool feature within its platform called API Viewer. The idea was to create a no-code interface where users can choose the data they are interested in, change the query fields according to their needs, and download the output data in any comfortable format. And I have to say, FMP’s API Viewer has really excelled at this task.


The platform allows for seamless extraction and downloading of data without demanding much effort from the users’ end. All it requires is just a few clicks and everything else will be taken care of. The best part is, that every API endpoint can be accessed via the API Viewer, i.e., from historical data to financial news data, everything can be accessed through this no-code interface.


This is the interface of FMP’s API Viewer:



The interface can be divided into three parts: side navigation, top navigation, and the main element of API Viewer which is something called the playground.


The top navigation is the main navigation bar which is fixed throughout FMP’s website. The side navigation bar is for choosing the API endpoint that we want to use in the API Viewer. The final element is the playground where users can customize the query parameters, extract and refresh the data, obtain the API URL for the data, and download the end output in various formats.


Now that we have a good understanding of the platform, let’s try to use it to extract some data.


1. Setting up an FMP developer account

Before using the API viewer to extract data, it’s essential to have an FMP developer account.


To create an account, first, head over to FinancialModelingPrep’s developer website: https://site.financialmodelingprep.com/ and then select the “Sign Up” button on the top right side. It will direct you to the registration page which looks like this:



Once you create an FMP developer account, you will be given a secret API key which is crucial to access the API endpoints and extract data. Also, some endpoints might be locked behind some subscription plans. So in order to access them, make sure to opt-in for that specific subscription plan. You can view their pricing page to get more insights on the different plans they offer.


Fetching Data using API Viewer

In this section, we are going to extract different types of data using the API Viewer.


1. Historical Data

Let’s start off with one of the basic ones which is historical data which can be easily extracted using the Daily Chart EOD API endpoint. The following image features the extraction of historical data of Apple from the start of April 2023 to April 2024:



We can now easily download this data and use it for various purposes. I’m going to save this as a CSV file and import it into my Python environment for further analysis. The following code creates a simple graph out of the downloaded data:



import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (9,5)

aapl_eod = pd.read_csv('aapl_eod.csv').drop(['date', ' changeOverTime'], axis = 1).iloc[::-1]

aapl_eod[' close'].plot()plt.title('AAPL CLOSE APR 2023-2024')

The code is pretty simple. We are first importing the required packages into our environment which are Pandas and Matplotlib. Then we import the downloaded data followed by some data manipulations. After that, we use Matplotlib to create a simple line chart which looks like this:



Since the article’s notion is no-code solutions, let’s try analyzing the extracted data without the aid of programming.


We can use Power BI, a business analytics tool by Microsoft, which doesn't require any coding to analyze and visualize data. This is the process you can follow to create a simple line chart in Power BI:


  • Create a new Power BI file and import the downloaded data

  • Select Line chart from the available options for visuals

  • Drag and drop the “date” column in the X-axis field

  • Drag and drop the “close” column in the Y-axis field

  • Customize the look of the graph according to your wish


This is the final line chart created with the help of Power BI:



Pretty cool, right?! Now let’s move on to extracting another basic type of data which is the intraday data.


2. Intraday Data

Intraday data proves to be one of the most important data for day trading as well as for backtesting trading strategies. Just like how we extracted historical data, the intraday data can also be extracted with much ease with the help of the Chart Intraday API endpoint.


The following image showcases the extraction of 5-minute intraday data of Apple from the start of April 1 till 12:



We can still use Power BI to analyze the intraday data but, in my opinion, Python is more flexible in creating the appropriate graphs and other visualizations.


The following code imports the downloaded intraday data into the Python environment:



aapl_intra = pd.read_csv('aapl_intra.csv').iloc[::-1].shift(1, axis = 1).drop('date', axis = 1)
aapl_intra.index = pd.to_datetime(aapl_intra.index)
aapl_intra.columns = ['open','low','high','close','volume']
aapl_intra.tail()

Apart from importing the data, we are also performing some data manipulation and formatting tasks to clean the data and make it easy to work with. This is the final dataframe:



Visualizing the intraday data through a line chart doesn't make much sense. That’s why, we’re going to use Mplfinance which allows us to create advanced visualizations like OHLC charts, candlestick charts, etc.



# CANDLESTICK CHART
mplf.plot(aapl_intra[-75:], type = 'candle')

# OHLC CHART
vol_plot = [mplf.make_addplot(aapl_intra['volume'][-100:], panel = 1, ylabel = 'Volume', type = 'bar')]
mplf.plot(aapl_intra[-100:], addplot = vol_plot, figscale = 1.2)

The code generates two different charts. One is a candlestick chart and the other is an OHLC chart. Also, we’re only visualizing part of the data as it’s hard to view the chart when the entire data is used. The following images are the output of the above code:



The left one is a candlestick chart and the right one is an OHLC chart with a volume graph panel. Apart from these two, Mplfinance offers a wide range of options to choose from like Renko, P&F, line, etc. but that’s a topic for another day.


Now that we explored two basic API endpoints, let’s move on to extracting some interesting alternative data like stock news data.


3. Stock News Data

Stock news data can be used for a variety of purposes which include sentiment analysis, algo trading, etc.


There are two ways of extracting stock news data with API Viewer. The first is to extract a specific number of news for all stocks and the other is to extract a particular stock’s news. Let’s focus on the first method of obtaining the data which is to extract the news for all stocks. The following image shows the extraction of 1000 news:



One interesting way of utilizing this data is to see which stocks have appeared the most in the news. By that, we can know which stocks are picked by people the most and are active in the market. This analysis can be easily done with Python.


First, let’s import the downloaded news data into our environment.



stock_news = pd.read_csv('stock_news.csv', on_bad_lines = 'skip').iloc[::-1].reset_index().shift(1,axis=1).drop('index', axis = 1)
stock_news.tail()

After importing the data, we did some data formatting tasks to clean the data and this is the final output:



With the help of some of the basic functions provided by Pandas like value_counts() and nlargest(), we can easily get to know the most talked about stocks in the news.



plt.style.use('ggplot')

stock_news.symbol.value_counts().nlargest(7).plot(kind = 'bar', color = 'lightgrey', edgecolor = 'steelblue', linewidth = 3)
plt.title('Most mentioned stocks in the news')
plt.xlabel('Stock')plt.ylabel('Occurences')

The goal here is to plot the seven most appeared stocks in the news along with the number of occurrences. This is the graph generated by the above code:



Let’s interpret this bar chart. It’s evident that Goldman Sachs Physical Gold ETF (AAAU) and JP Morgan (JMP) are two of the most talked about securities in the market. Following that, we have Citigroup (C) and Nvidia (NVDA) sharing the same spot with around 20 appearances in the news. Then there are Amazon (AMZN), Tesla (TSLA), and Apple (AAPL), all with an identical number of appearances in the news which is 15 times. So these seven stocks are considered to be the most active from April 11 to 14.


Conclusion

No-code is a very promising field and FinancialModelingPrep has truly capitalized on it with the introduction of their very own no-code solution, API Viewer. Overall, it’s an incredibly useful platform that takes a lot of burden from developers and researchers in the extraction of the data.


FMP’s API Viewer also gives users the opportunity to worry less about the data extraction process and focus more on the data analysis side which, in my opinion, is greatly advantageous for traders and researchers. Since the platform helps circumvent the whole coding process, it can be a go-to place for non-technical people who are looking for reliable financial data.


With that being said, you’ve reached the end of the article. Hope you learned something new and useful today. Also, if you’ve used FMP’s API Viewer, let me know your experience using the platform in the comments. Thank you very much for your time.

Comments


bottom of page