top of page
Nikhil Adithyan

FMP: An alternative to Yahoo Finance to download historical data in CSV format

To all the Yahoo Finance enthusiasts, here’s a reliable alternative to check out



In a significant shift for traders and financial enthusiasts, Yahoo Finance, once a go-to platform for freely downloading historical stock data, has recently restricted this service to premium membership users. For years, Yahoo Finance provided invaluable access to historical market data, helping individuals and professionals alike conduct analysis without any financial barriers. However, the introduction of this paywall has left many searching for reliable alternatives.


Thankfully, FinancialModelingPrep (FMP) offers a robust and affordable solution for downloading historical data. Whether you’re a casual investor or an experienced trader, FMP provides flexible access to stock data in formats like CSV, allowing for easy integration with your analytical tools. In this article, we’ll explore why FMP is an excellent alternative to Yahoo Finance, and how you can download historical data using three different methods.


FinancialModelingPrep: A Yahoo Finance Alternative

FMP is quickly emerging as a top contender in the API market, despite being one of the newest players in the space. It has gained traction by offering high-quality, reliable financial data through its comprehensive APIs, helping both individual investors and businesses make data-driven decisions. With its intuitive design and easy-to-navigate interface, FMP simplifies the process of accessing critical financial information.


One of FMP’s standout features is the wide range of data it provides. Whether you’re looking for stock prices, financial statements, or industry-specific metrics, it offers a rich data set that covers major global exchanges. The platform also allows users to customize their data retrieval, making it easy to focus on specific time periods or financial metrics. This flexibility is particularly beneficial for those performing in-depth financial analysis or building custom trading systems.


What sets FMP apart is not only its rich dataset but also its affordability and ease of integration. With well-documented APIs, developers can quickly integrate its offerings into various platforms, whether you’re working on a small project or a large-scale application. Additionally, the platform offers educational resources and tools to help users make the most out of their APIs, ensuring that FMP is an excellent go-to solution for anyone in need of financial data.


Different ways of extracting data from FMP

FinancialModelingPrep provides multiple ways for users to extract the data they need, catering to a wide range of user preferences and requirements. Whether you’re a developer looking for seamless API integration or someone who prefers a more hands-on approach through spreadsheets, FMP offers the flexibility to access data in the way that works best for you.


In this section, we will explore three key methods for extracting data from FMP: 


  • using the FMP Playground 

  • Making API requests via their endpoints

  • Leveraging Google Sheets and Excel add-ons. 


These options ensure that users of all technical backgrounds can efficiently retrieve the historical financial data they need in various formats.


1. FMP Playground



FinancialModelingPrep has introduced an exciting feature known as FMP Playground. This tool provides a no-code interface where users can easily select the data they are interested in, adjust query fields to suit their specific needs, and download the data in their preferred format. The Playground is designed to simplify the data extraction process, making it user-friendly even for those without technical expertise.


What makes the Playground stand out is how effortlessly it allows users to obtain and download financial data. With just a few clicks, you can customize your queries and retrieve data without any coding required. The process is incredibly intuitive and efficient, streamlining access to valuable financial information.


The real strength of FMP Playground lies in its versatility. Every API endpoint available on FMP, from historical data to financial news, can be accessed through this interface. It’s an ideal solution for users looking for a quick, hassle-free way to explore and download data.

This is the interface of FMP Playground:



The FMP Playground interface is organized into three key sections: the side navigation, the top navigation, and the central API Viewer, which is referred to as the playground.


The top navigation bar is fixed across FMP’s website, providing easy access to the main features. The side navigation is where users can browse and select the API endpoints they want to interact with in the API Viewer. Finally, the playground itself is where users can adjust query parameters, extract or refresh data, generate the API URL for the selected data, and download the results in different formats.


With this clear understanding of the platform’s layout, we can now explore how to use the playground to extract data.


The following image features the extraction of historical data of Apple from the start of April 2023 to April 2024:



In the example above, we extracted Apple’s historical data from April 2023 to April 2024 using the FMP Playground. The process was straightforward: simply input the desired ticker symbol, set the date range, and customize the query as needed. With just a few clicks, the data was readily available, and users can easily export it in various formats, such as CSV, JSON, or text, making it an efficient and flexible way to obtain data in the format that suits their needs.


2. FMP API Endpoints

FinancialModelingPrep offers a wide variety of API endpoints that cater to every financial data need, from daily stock prices to complex financial ratios and more. These APIs are designed to be simple and user-friendly, ensuring that developers of all skill levels can integrate them seamlessly into their applications. FMP’s vast catalog of APIs covers everything from historical market data, company financials, and economic indicators to forex data, news, and earnings.


One of the most notable features of FMP’s API is its extensive and well-organized documentation, which provides all the information needed to navigate and utilize its endpoints effectively. The documentation includes detailed descriptions, clear examples, and easy-to-follow instructions, making it simple to find the right API and understand how to use it.


Let’s take a look at an example of how to extract historical data for Microsoft (MSFT) using FinancialModelingPrep’s EOD historical data endpoint. The following code pulls data starting from January 1st, 2014, to the present day:



api_key = 'YOUR API KEY' 
hist_json = requests.get(f'https://financialmodelingprep.com/api/v3/historical-price-full/MSFT?from=2014-01-01&apikey={api_key}').json()

msft = pd.DataFrame(hist_json['historical']).drop('label', axis = 1).set_index('date')
msft.index = pd.to_datetime(msft.index)
msft = msft.iloc[::-1]

msft.tail()

This code requests historical price data for Microsoft (MSFT) from FMP’s API. After receiving the JSON response, we convert it into a Pandas DataFrame for easy manipulation. The label column is dropped as it is not required, and the date column is set as the index, converted to a datetime format for proper time series analysis. Finally, the data is reversed to maintain chronological order.


Here’s a glimpse of the last few rows of the data extracted:



Now, instead of receiving the data in JSON format and converting it to a CSV file, FMP provides a more efficient option. It allows users to directly download data in CSV format by simply adjusting the API query. This feature significantly reduces the time spent in the data processing step, making the workflow smoother and quicker.


To download the same historical data for Microsoft (MSFT) directly in CSV format, you can use the following code:



hist = pd.read_csv(f'https://financialmodelingprep.com/api/v3/historical-price-full/MSFT?from=2014-01-01&datatype=csv&apikey={api_key}').set_index('date')

hist.tail()

Here, the only difference is the addition of the datatype=csv parameter in the API URL, which automatically formats the response as a CSV file. This eliminates the need for manual conversion from JSON to CSV. The resulting output will be identical to the previous example.


3. Google Sheets & Excel add-ons



FinancialModelingPrep has gone above and beyond to ensure that its services are accessible to a wide range of users, including those who may not have a background in coding or technical expertise. To cater to this audience, FMP offers seamless integrations with popular tools like Google Sheets and Microsoft Excel, allowing users to interact with financial data in a no-code environment.


FMP’s Google Sheets and Excel add-ons are designed for users who prefer working within familiar spreadsheet platforms. These add-ons provide easy access to FMP’s vast array of financial data without the need to write any code. With just a few clicks, users can pull historical data, stock prices, financial statements, and more directly into their spreadsheets. This makes FMP’s financial data services accessible to analysts, researchers, and investors who may not have the technical skills to work with APIs but still want to leverage high-quality financial data.


The benefits of these add-ons extend beyond ease of use. By using Google Sheets or Excel, users can easily perform in-depth analyses, create custom reports, and track real-time financial information. Moreover, the data pulled through the add-ons is always up to date, ensuring that users can rely on accurate and timely information without needing to manually refresh or update their datasets.


To make things even easier, FMP has created dedicated documentation for both Google Sheets and Excel add-ons. These documentation pages are thorough and hands-on, guiding users through installation, setup, and advanced features. This ensures that even users with little to no technical expertise can take full advantage of FMP’s offerings with ease and confidence.


Conclusion

In conclusion, with Yahoo Finance transitioning to a premium model for downloading historical stock data, FinancialModelingPrep (FMP) has emerged as a reliable and user-friendly alternative. Offering multiple methods to access and download financial data, from their intuitive FMP Playground to API endpoints and even Google Sheets and Excel add-ons, FMP caters to users of all technical backgrounds. Whether you are a developer looking for seamless API integration or someone more comfortable working in spreadsheets, FMP provides a robust solution that fits your needs.


FMP’s extensive data coverage, ease of use, and flexible formats like CSV make it an excellent choice for anyone looking for a new source of historical market data. With well-documented APIs and integrations that simplify workflows, FMP not only fills the gap left by Yahoo Finance but goes a step further by enhancing the overall user experience.

Bring information-rich articles and research works straight to your inbox (it's not that hard). 

Thanks for subscribing!

© 2023 by InsightBig. Powered and secured by Wix

bottom of page