{"id":63,"date":"2021-10-29T12:50:00","date_gmt":"2021-10-29T12:50:00","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=63"},"modified":"2025-06-19T19:38:25","modified_gmt":"2025-06-19T19:38:25","slug":"a-simple-way-to-get-a-stocks-fundamental-data","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data","title":{"rendered":"A Simple Way to Get a Stock\u2019s Fundamental Data"},"content":{"rendered":"\n<p>Retrieving or scraping stock fundamental data is sometimes easier said than done. It can be surprisingly difficult to find reliable resources or websites that provide clean, structured financial data. Over the past few years, I&#8217;ve worked on various data science projects that required in-depth stock data and analysis.<\/p>\n\n\n\n<p>In my experience, a stock\u2019s\u00a0price history\u00a0is one of the easiest types of data to retrieve &#8211; typically via platforms like Yahoo Finance using Python libraries such as Yfinance. However, when it comes to\u00a0fundamental stock analysis using Python APIs, the process becomes significantly more complex.<\/p>\n\n\n\n<p>Accessing comprehensive financial statements, earnings reports, and key valuation metrics often requires deep Google searches or labor-intensive web scraping. In one of my earlier projects, I was lucky to come across a now-defunct site called stockpup.com, which offered thousands of rows of clean, downloadable fundamental data in CSV format &#8211; ideal for machine learning workflows.<\/p>\n\n\n\n<p>But with that resource gone, I had to search for a new way to reliably gather\u00a0fundamental stock data for analysis &#8211; and preferably one that supports automation and scalability through APIs.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"d40f\">Financial Data APIs<\/h1>\n\n\n\n<p id=\"c708\">There are numerous financial data APIs out there that can give you access to a stock\u2019s fundamental data. Personally, I have found and use one website which is able to provide more than just fundamental data and it is free to sign up called \u2014&nbsp;<strong><a href=\"https:\/\/eodhd.com\/?ref=31CX3ILN&amp;utm_source=medium&amp;utm_medium=post&amp;utm_campaign=a_simple_way_to_get_a_stock_s_fundamental_data\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD APIs<\/a><\/strong>.&nbsp;<em>Disclosure: I earn a small commission from any purchases made through the link above<\/em>.<\/p>\n\n\n\n<p id=\"1a8a\">Using this financial data API, I was able to retrieve the fundamental data from thousands of companies. The data was ready and available but now I needed to organize and format it into a Pandas DataFrame that I\u2019ll be able to use. To do so, I utilized Python to get everything set up:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\"># Libraries\nimport pandas as pd\nfrom eod import EodHistoricalData\nfrom functools import reduce\nfrom datetime import datetime, timedelta\n\n# Importing and assigning the api key\nwith open(\"..\/eodHistoricalData-API.txt\", \"r\") as f:\n    api_key = f.read()\n    \n# EOD Historical Data client\nclient = EodHistoricalData(api_key)<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>With my provided API key and the code above, I was ready to begin retrieving and formatting the fundamental data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3b4a\">Getting Fundamental Data<\/h2>\n\n\n\n<p id=\"9604\">The API I used is able to provide me with quarterly fundamental data such as Balance Sheets, Income Statements, Cash Flow, and Earnings Reports but they are all neatly stored in their own sections within the API\u2019s return object. I needed to create function that is able to access, then consolidate all of this data into one large DataFrame.<\/p>\n\n\n\n<p id=\"f3e6\">So I created a function that is able to transform these separate pieces of data into their own DataFrame, then merge them together into one big DF:<\/p>\n\n\n\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist112640765\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-get_fundamental_data_function-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"get_fundamental_data_function.py content, created by marcosan93 on 10:49PM on October 27, 2021.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"get_fundamental_data_function.py\">\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC1\" class=\"blob-code blob-code-inner js-file-line\">def getFundamentals(ticker):<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">    Returns the fundamental data from the financial data API.  Combines the quarterly balance <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">    sheet, cash flow, income statement, and earnings for a specific stock ticker.<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">    # Getting data<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">    fund_data = client.get_fundamental_equity(ticker)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">    # Financials<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">    bal = pd.DataFrame(fund_data[&#39;Financials&#39;][&#39;Balance_Sheet&#39;][&#39;quarterly&#39;]).T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">    cf = pd.DataFrame(fund_data[&#39;Financials&#39;][&#39;Cash_Flow&#39;][&#39;quarterly&#39;]).T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">    inc = pd.DataFrame(fund_data[&#39;Financials&#39;][&#39;Income_Statement&#39;][&#39;quarterly&#39;]).T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC17\" class=\"blob-code blob-code-inner js-file-line\">    # Earnings<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">    earn = pd.DataFrame(fund_data[&#39;Earnings&#39;][&#39;History&#39;]).T<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">    # Merging them together<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC21\" class=\"blob-code blob-code-inner js-file-line\">    df = reduce(<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">        lambda left,right: pd.merge(<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">            left,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC24\" class=\"blob-code blob-code-inner js-file-line\">            right,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC25\" class=\"blob-code blob-code-inner js-file-line\">            left_index=True, <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC26\" class=\"blob-code blob-code-inner js-file-line\">            right_index=True, <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC27\" class=\"blob-code blob-code-inner js-file-line\">            how=&#39;outer&#39;,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC28\" class=\"blob-code blob-code-inner js-file-line\">            suffixes=(&#39;&#39;, &#39;_drop&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC29\" class=\"blob-code blob-code-inner js-file-line\">        ), <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC30\" class=\"blob-code blob-code-inner js-file-line\">        [bal, cf, inc, earn]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC31\" class=\"blob-code blob-code-inner js-file-line\">    )<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC32\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC33\" class=\"blob-code blob-code-inner js-file-line\">    # Dropping redundant date and duplicate columns<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC34\" class=\"blob-code blob-code-inner js-file-line\">    dup_cols = [i for i in df.columns if &quot;date&quot; in i or &quot;Date&quot; in i or &quot;_drop&quot; in i]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC35\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC36\" class=\"blob-code blob-code-inner js-file-line\">    df = df.drop(dup_cols, axis=1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC37\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_data_function-py-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-get_fundamental_data_function-py-LC38\" class=\"blob-code blob-code-inner js-file-line\">    return df<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/1a17d241540fc01bf178617c85f431d3\/raw\/a2e48163dbebb174a22ef036e7ebc7627ac6f789\/get_fundamental_data_function.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/1a17d241540fc01bf178617c85f431d3#file-get_fundamental_data_function-py\" class=\"Link--inTextBlock\">\n          get_fundamental_data_function.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<p>In this function, I was able to retrieve fundamental data from the given stock ticker. As you can see, each financial statement is stored within a specific attribute I needed to access. Once I have stored them into their own respective DataFrames, I was then able to consolidate them by merging them together. I also removed any redundant columns such as the \u201c<em>Date<\/em>\u201d column which was being repeated throughout before I dropped them and any duplicate columns as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"25bf\">Getting Historical Price Data<\/h2>\n\n\n\n<p id=\"2c6f\">One thing that I found that was missing from the returned fundamental data was the stock price at the time. I figured that would be an important piece of information to have. The API is able to retrieve historical prices fairly easy as well so that wasn\u2019t going to be a problem but I needed to combine those prices with the DataFrame I created above.<\/p>\n\n\n\n<p id=\"4ccc\">I created a function that was able to retrieve the daily historical prices and added them to the larger DataFrame:<\/p>\n\n\n\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist112640950\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-get_historical_prices_fundamental_function-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"get_historical_prices_fundamental_function.py content, created by marcosan93 on 11:05PM on October 27, 2021.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"get_historical_prices_fundamental_function.py\">\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC1\" class=\"blob-code blob-code-inner js-file-line\">def getPrices(df, ticker):<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">    Gets the stock price at the time for each date in the financial statements for<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">    the given ticker and dataframe of financial information.<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">    # Getting stock price at the time<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">    prices = client.get_prices_eod(ticker, period=&#39;d&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">    prices = pd.DataFrame(prices).set_index(&#39;date&#39;)[[&#39;adjusted_close&#39;, &#39;close&#39;, &#39;volume&#39;]]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">    # Converting to date time<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">    prices.index = pd.to_datetime(prices.index)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">    # Filling in missing price data<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">    prices = prices.reindex(<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">        pd.date_range(prices.index[0], prices.index[-1]),<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC17\" class=\"blob-code blob-code-inner js-file-line\">        method=&#39;ffill&#39;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">    )<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">    # Converting back to string for merging later<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC21\" class=\"blob-code blob-code-inner js-file-line\">    prices.index = prices.index.strftime(&quot;%Y-%m-%d&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">        <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">    price_dates = [i for i in prices.index if i in df.index]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC24\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC25\" class=\"blob-code blob-code-inner js-file-line\">    prices = prices.loc[price_dates]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC26\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC27\" class=\"blob-code blob-code-inner js-file-line\">    # Joining together<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC28\" class=\"blob-code blob-code-inner js-file-line\">    df = df.join(prices, how=&#39;outer&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC29\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_historical_prices_fundamental_function-py-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-get_historical_prices_fundamental_function-py-LC30\" class=\"blob-code blob-code-inner js-file-line\">    return df<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/a77c3f072fe5bf1c78cce709945bfa0f\/raw\/e8b34be915fd3feacc1876793cc6b5a0dc9e1164\/get_historical_prices_fundamental_function.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/a77c3f072fe5bf1c78cce709945bfa0f#file-get_historical_prices_fundamental_function-py\" class=\"Link--inTextBlock\">\n          get_historical_prices_fundamental_function.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<p id=\"aa67\">A problem I have found to occur when I was initially adding the prices to the DataFrame was that some price data was missing for certain dates on the larger DF. I assume those dates were sometimes either holidays, weekends, or something similar. Regardless, I just wanted to know what the stock price was around the reported date from the financial statements. It didn\u2019t need to be exact, and in fact it could be just a day or two before or after the reported date.<\/p>\n\n\n\n<p id=\"dd66\">As you can see in the function above, I was able to fill in weekends, holidays, etc. with the previous stock price. Afterwards, I added them to the larger DataFrame which was returned in the end.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Importance of High-Quality Data<\/h2>\n\n\n\n<p>High-quality data is essential for accurate analysis and reliable insights. Poor-quality data can lead to misguided decisions and potential financial losses. Therefore, choosing the right data sources can greatly impact your investment strategies and financial models.<\/p>\n\n\n\n<p class=\"has-text-align-center bordered_paragraph has-background\" style=\"background-color:#f6f6f7;font-size:16px;font-style:normal;font-weight:500\">Learn more about data reliability in our detailed comparison:<br><a href=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/reliability-of-free-stock-data\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Free vs Paid Stock Data: Which One Can You Trust?<\/strong><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"b963\">Getting Both Fundamental and Price Data<\/h2>\n\n\n\n<p id=\"404b\">Since I was able to create two functions to retrieve the fundamental and price data, I decided to condense them into one function:<\/p>\n\n\n\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist112641014\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-get_fundamental_price_data_function-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"get_fundamental_price_data_function.py content, created by marcosan93 on 11:13PM on October 27, 2021.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"get_fundamental_price_data_function.py\">\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC1\" class=\"blob-code blob-code-inner js-file-line\">def formatFundamentals(ticker, dropna=False):<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">    Formats the given ticker&#39;s fundamental and price data. Cleans up the data by dropping<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">    any empty\/nan values if requested.<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">    # Getting fundamental data<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">    fund_data = getFundamentals(ticker)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">    # Getting accompanying price data<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">    df = getPrices(fund_data, ticker)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">    # Dropping if all items are na in respective row<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">    df = df.dropna(how=&#39;all&#39;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">    if dropna:<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC17\" class=\"blob-code blob-code-inner js-file-line\">        # Dropping mostly nan columns and rows if requested<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">        df = df.dropna(<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">            axis=0,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">            thresh=round(df.shape[0]*.5) # If 50% of the values in the row are Nans, drop the whole row<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC21\" class=\"blob-code blob-code-inner js-file-line\">        ).dropna(<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">            axis=1,<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">            thresh=round(df.shape[1]*.5) # If 50% of the values in the columns are Nans, drop the whole column<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC24\" class=\"blob-code blob-code-inner js-file-line\">        )<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC25\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_fundamental_price_data_function-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-get_fundamental_price_data_function-py-LC26\" class=\"blob-code blob-code-inner js-file-line\">    return df<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/8c28210717d9446abe30cc4ef0978f3c\/raw\/8e87d93649694e76a8bab1fc90188a22c68c4193\/get_fundamental_price_data_function.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/8c28210717d9446abe30cc4ef0978f3c#file-get_fundamental_price_data_function-py\" class=\"Link--inTextBlock\">\n          get_fundamental_price_data_function.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<p>In this one function, I incorporated the previous two functions. I also added the option for additional cleaning of the data by providing choice to remove null values within the larger DF. This option could be useful if you needed to train a machine learning model on this data and couldn\u2019t use NA values in the dataset.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"94ba\">Getting Data from Multiple Stocks<\/h2>\n\n\n\n<p id=\"6ae7\">The previous functions are all useful in retrieving fundamental data from one given stock ticker but what if I wanted to retrieve data from more than just one stock? To do so, I created the following function which allows the retrieval of fundamental data from multiple stocks:<\/p>\n\n\n\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist112641073\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-get_multiple_fundamental_data-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"get_multiple_fundamental_data.py content, created by marcosan93 on 11:19PM on October 27, 2021.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"get_multiple_fundamental_data.py\">\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC1\" class=\"blob-code blob-code-inner js-file-line\">def getMultipleFunds(tickers, api_token):<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">    Gets fundamental data from multiple stock tickers given as a list. Returns<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">    a large dataframe containing the concatenated information for all the given<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">    tickers.<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">    &quot;&quot;&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">    # Verifying if the list of tickers is compatible<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">    available = client.get_exchange_symbols(&quot;US&quot;)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">    available = set(i[&#39;Code&#39;] for i in available)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">    tickers = [i for i in tickers if i in available]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">    # If no valid tickers<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">    if len(tickers)==0:<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC17\" class=\"blob-code blob-code-inner js-file-line\">        return &quot;No valid tickers found.&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">    # Iterating through the tickers<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">    dfs = {}<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC21\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">    for ticker in tickers:<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">        <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC24\" class=\"blob-code blob-code-inner js-file-line\">        dfs[ticker] = formatFundamentals(ticker)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC25\" class=\"blob-code blob-code-inner js-file-line\">        <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC26\" class=\"blob-code blob-code-inner js-file-line\">    return pd.concat(dfs, axis=0)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-get_multiple_fundamental_data-py-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-get_multiple_fundamental_data-py-LC27\" class=\"blob-code blob-code-inner js-file-line\">    <\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/5b0a86ce64e20afbd051e14bbe085cc0\/raw\/49265af6e8e0d85274174cb0078a8695ba349044\/get_multiple_fundamental_data.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/marcosan93\/5b0a86ce64e20afbd051e14bbe085cc0#file-get_multiple_fundamental_data-py\" class=\"Link--inTextBlock\">\n          get_multiple_fundamental_data.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<p>This is a relatively simple function that utilizes the functions above. The first thing I needed to do was cross-reference the given tickers with the available tickers from the API. This is done in case a given ticker doesn\u2019t exist or was improperly given. Afterwards, if the given tickers were valid, then it will retrieve the fundamental data from all the given stocks and combine them into a bigger DF containing the fundamental data from multiple stocks.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"b524\">Closing Thoughts<\/h2>\n\n\n\n<p id=\"bd24\">By using Python and this Financial Data API, I was able to easily retrieve the fundamental data of nearly any stock. Besides coding the formatting process, the overall task was fairly simple.<\/p>\n\n\n\n<p id=\"23a0\">With the fundamental data from multiple stocks ready to go, I can now apply this dataset to any future data science project. A classification or regression ML model could be used on this dataset. Or a simple analysis using Python\u2019s numerous visualization libraries. There are a never-ending assortment of projects that can use a dataset such as this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Retrieving or scraping stock fundamental data is sometimes easier said than done. It can be surprisingly difficult to find reliable resources or websites that provide clean, structured financial data. Over the past few years, I&#8217;ve worked on various data science projects that required in-depth stock data and analysis. In my experience, a stock\u2019s\u00a0price history\u00a0is one [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"coding-language":[30],"ready-to-go-solution":[],"qualification":[31,32],"financial-apis-category":[36],"financial-apis-manuals":[39,37],"class_list":["post-63","post","type-post","status-publish","format-standard","hentry","category-fundamental-analysis-examples","coding-language-python","qualification-experienced","qualification-guru","financial-apis-category-stock-market-prices","financial-apis-manuals-end-of-day","financial-apis-manuals-stocks-fundamentals"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.9 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A Simple Way to Get a Stock\u2019s Fundamental Data | EODHD APIs Academy<\/title>\n<meta name=\"description\" content=\"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Simple Way to Get a Stock\u2019s Fundamental Data\" \/>\n<meta property=\"og:description\" content=\"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\" \/>\n<meta property=\"og:site_name\" content=\"Financial Academy\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eodhistoricaldata\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-29T12:50:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-19T19:38:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2022\/03\/a-simple-way-to-get-a-stocks-fundamental-data.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"452\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Marco Santos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/_marco_santos_\" \/>\n<meta name=\"twitter:site\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marco Santos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\"},\"author\":{\"name\":\"Marco Santos\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/21a7f35c812f05fb7c4e60a624a3237d\"},\"headline\":\"A Simple Way to Get a Stock\u2019s Fundamental Data\",\"datePublished\":\"2021-10-29T12:50:00+00:00\",\"dateModified\":\"2025-06-19T19:38:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\"},\"wordCount\":1129,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"articleSection\":[\"Fundamental Analysis Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\",\"name\":\"A Simple Way to Get a Stock\u2019s Fundamental Data | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"datePublished\":\"2021-10-29T12:50:00+00:00\",\"dateModified\":\"2025-06-19T19:38:25+00:00\",\"description\":\"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A Simple Way to Get a Stock\u2019s Fundamental Data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"name\":\"Financial APIs Academy | EODHD\",\"description\":\"Financial Stock Market Academy\",\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\",\"name\":\"EODHD (EOD Historical Data)\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"width\":159,\"height\":82,\"caption\":\"EODHD (EOD Historical Data)\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/eodhistoricaldata\",\"https:\/\/x.com\/EOD_data\",\"https:\/\/www.reddit.com\/r\/EODHistoricalData\/\",\"https:\/\/eod-historical-data.medium.com\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/21a7f35c812f05fb7c4e60a624a3237d\",\"name\":\"Marco Santos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c176ca2898e90e41837f2fe073b4001074052c63f3559b29e7e4ae9d7a048a1b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c176ca2898e90e41837f2fe073b4001074052c63f3559b29e7e4ae9d7a048a1b?s=96&d=mm&r=g\",\"caption\":\"Marco Santos\"},\"description\":\"NYC Data Scientist specializing in AI\/ML with a passion for code\",\"sameAs\":[\"http:\/\/linkedin.com\/in\/marco-s-santos\",\"https:\/\/x.com\/https:\/\/twitter.com\/_marco_santos_\"],\"url\":\"https:\/\/eodhd.com\/financial-academy\/author\/marcosantos\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"A Simple Way to Get a Stock\u2019s Fundamental Data | EODHD APIs Academy","description":"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data","og_locale":"en_US","og_type":"article","og_title":"A Simple Way to Get a Stock\u2019s Fundamental Data","og_description":"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.","og_url":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2021-10-29T12:50:00+00:00","article_modified_time":"2025-06-19T19:38:25+00:00","og_image":[{"width":800,"height":452,"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2022\/03\/a-simple-way-to-get-a-stocks-fundamental-data.png","type":"image\/png"}],"author":"Marco Santos","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/_marco_santos_","twitter_site":"@EOD_data","twitter_misc":{"Written by":"Marco Santos","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data"},"author":{"name":"Marco Santos","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/21a7f35c812f05fb7c4e60a624a3237d"},"headline":"A Simple Way to Get a Stock\u2019s Fundamental Data","datePublished":"2021-10-29T12:50:00+00:00","dateModified":"2025-06-19T19:38:25+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data"},"wordCount":1129,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"articleSection":["Fundamental Analysis Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data","url":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data","name":"A Simple Way to Get a Stock\u2019s Fundamental Data | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"datePublished":"2021-10-29T12:50:00+00:00","dateModified":"2025-06-19T19:38:25+00:00","description":"Stock Fundamental Data. Using financial data API to retrieve the fundamental data from thousands of companies.","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/a-simple-way-to-get-a-stocks-fundamental-data#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"A Simple Way to Get a Stock\u2019s Fundamental Data"}]},{"@type":"WebSite","@id":"https:\/\/eodhd.com\/financial-academy\/#website","url":"https:\/\/eodhd.com\/financial-academy\/","name":"Financial APIs Academy | EODHD","description":"Financial Stock Market Academy","publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/eodhd.com\/financial-academy\/#organization","name":"EODHD (EOD Historical Data)","url":"https:\/\/eodhd.com\/financial-academy\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","width":159,"height":82,"caption":"EODHD (EOD Historical Data)"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/eodhistoricaldata","https:\/\/x.com\/EOD_data","https:\/\/www.reddit.com\/r\/EODHistoricalData\/","https:\/\/eod-historical-data.medium.com\/"]},{"@type":"Person","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/21a7f35c812f05fb7c4e60a624a3237d","name":"Marco Santos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c176ca2898e90e41837f2fe073b4001074052c63f3559b29e7e4ae9d7a048a1b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c176ca2898e90e41837f2fe073b4001074052c63f3559b29e7e4ae9d7a048a1b?s=96&d=mm&r=g","caption":"Marco Santos"},"description":"NYC Data Scientist specializing in AI\/ML with a passion for code","sameAs":["http:\/\/linkedin.com\/in\/marco-s-santos","https:\/\/x.com\/https:\/\/twitter.com\/_marco_santos_"],"url":"https:\/\/eodhd.com\/financial-academy\/author\/marcosantos"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-11","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":5,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":6422,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/63\/revisions\/6422"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=63"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=63"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=63"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=63"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=63"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}