{"id":21006,"date":"2023-03-26T20:53:22","date_gmt":"2023-03-26T20:53:22","guid":{"rendered":"https:\/\/algotrading101.com\/learn\/?p=21006"},"modified":"2023-05-10T16:02:53","modified_gmt":"2023-05-10T16:02:53","slug":"financedatabase-python-guide","status":"publish","type":"post","link":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/","title":{"rendered":"FinanceDatabase Guide &#8211; A Comprehensive Database of Financial Symbols (Python Package)"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_21006\" class=\"pvc_stats total_only  \" data-element-id=\"21006\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_logo-1024x341.webp\" alt=\"\" class=\"wp-image-20821\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_logo-1024x341.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_logo-300x100.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_logo-768x256.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_logo.webp 1500w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Table of contents:<\/h3>\n\n\n\n<ol>\n<li><a href=\"#what-is-finance-database\">What is FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-use\">What is FinanceDatabase used for?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-pros\">Why should I use FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-cons\">Why shouldn\u2019t I use FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-free\">Is FinanceDatabase free?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-alternatives\">What are some FinanceDatabase alternatives?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-data\">What kind of data does FinanceDatabase have?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-get-started\">How to get started with FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-general-data\">How to get general data with FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-advanced-search\">How to perform an advanced search on the FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-collect-data\">How to collect data from the FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-all-us-companies\">How to obtain all US companies from different sectors using the FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-technical-analysis\">How to perform technical analysis with FInanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-location\">How to store the FinanceDatabase in a different location?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-learn-more\">Where can I learn more about the FinanceDatabase?<\/a><\/li>\n\n\n\n<li><a href=\"#finance-database-full-code\">Full code<\/a><\/li>\n<\/ol>\n\n\n\n<a name=\"what-is-finance-database\"><\/a>\n\n\n\n<h2 class=\"wp-block-heading\">What is FinanceDatabase?<\/h2>\n\n\n\n<p>FinanceDatabase is a Python package of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets.<\/p>\n\n\n\n<p>Link: <a href=\"https:\/\/pypi.org\/project\/financedatabase\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/pypi.org\/project\/financedatabase\/<\/a><\/p>\n\n\n\n<a name=\"finance-database-use\"><\/a>\n\n\n\n<h2 class=\"wp-block-heading\">What is FinanceDatabase used for?<\/h2>\n\n\n\n<p>FinanceDatabase is mainly used for any type of financial product categorization. Moreover, it gives insights into the products that exist in each country, industry, and sector and gives the most essential information about each product.<\/p>\n\n\n\n<p>This allows algorithmic traders and investors to analyze specific financial segments and helps them find assets that are hard to uncover. For example, it is used within the <a href=\"https:\/\/algotrading101.com\/learn\/openbb-guide\/\">OpenBB<\/a> terminal.<\/p>\n\n\n\n<a name=\"finance-database-pros\"><\/a>\n\n\n\n<h2 class=\"wp-block-heading\">Why should I use FinanceDatabase?<\/h2>\n\n\n\n<ul>\n<li>The FinanceDatabase is comprehensive.<\/li>\n\n\n\n<li>The FinanceDatabase has over 300k assets.<\/li>\n\n\n\n<li>It is easy to use and beginner friendly.<\/li>\n\n\n\n<li>It is open-sourced.<\/li>\n\n\n\n<li>Has good filtering capabilities.<\/li>\n\n\n\n<li>Is actively maintained.<\/li>\n<\/ul>\n\n\n\n<a name=\"finance-database-cons\">\n\n\n\n<h2 class=\"wp-block-heading\">Why shouldn\u2019t I use FinanceDatabase?<\/h2>\n\n\n\n<ul>\n<li>The FinanceDatabase doesn&#8217;t provide up-to-date fundamentals or stock data (it doesn&#8217;t have that goal).<\/li>\n\n\n\n<li>The FinanceDatabase doesn&#8217;t hold all possible assets.<\/li>\n\n\n\n<li>It is maintained by an open-source community so some information might be outdated.<\/li>\n<\/ul>\n\n\n\n<a name=\"finance-database-free\">\n\n\n\n<h2 class=\"wp-block-heading\">Is FinanceDatabase free?<\/h2>\n\n\n\n<p>Yes, FinanceDatabase is open-sourced and thus it is completely free.<\/p>\n\n\n\n<a name=\"finance-database-alternatives\">\n\n\n\n<h2 class=\"wp-block-heading\">What are some FinanceDatabase alternatives?<\/h2>\n\n\n\n<p>The FinanceDatabase doesn&#8217;t have direct alternatives but some of them are:<\/p>\n\n\n\n<ul>\n<li>Marketstack<\/li>\n\n\n\n<li>MarketWatch<\/li>\n\n\n\n<li>Bloomberg Terminal<\/li>\n\n\n\n<li>Quandl<\/li>\n<\/ul>\n\n\n\n<a name=\"finance-database-data\">\n\n\n\n<h2 class=\"wp-block-heading\">What kind of data does FinanceDatabase have?<\/h2>\n\n\n\n<p>FinanceDatabase has approximately the following kind of data:<\/p>\n\n\n\n<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-kt9x{color:black;text-align:left;vertical-align:middle}\n.tg .tg-621a{color:white;font-weight:bold;text-align:center;vertical-align:middle}\n<\/style>\n<table class=\"tg\">\n<thead>\n  <tr>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Product<\/span><\/th>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Quantity<\/span><\/th>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Sectors<\/span><\/th>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Industries<\/span><\/th>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Countries<\/span><\/th>\n    <th class=\"tg-621a\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Exchanges<\/span><\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td class=\"tg-kt9x\">Equities<\/td>\n    <td class=\"tg-kt9x\">155.705<\/td>\n    <td class=\"tg-kt9x\">16<\/td>\n    <td class=\"tg-kt9x\">242<\/td>\n    <td class=\"tg-kt9x\">111<\/td>\n    <td class=\"tg-kt9x\">82<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-kt9x\">ETFs<\/td>\n    <td class=\"tg-kt9x\">36.727<\/td>\n    <td class=\"tg-kt9x\">364*<\/td>\n    <td class=\"tg-kt9x\">94*<\/td>\n    <td class=\"tg-kt9x\">100**<\/td>\n    <td class=\"tg-kt9x\">52<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-kt9x\">Funds<\/td>\n    <td class=\"tg-kt9x\">57.816<\/td>\n    <td class=\"tg-kt9x\">1678*<\/td>\n    <td class=\"tg-kt9x\">438*<\/td>\n    <td class=\"tg-kt9x\">100**<\/td>\n    <td class=\"tg-kt9x\">34<\/td>\n  <\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-58l7{border-color:inherit;color:white;font-weight:bold;text-align:center;vertical-align:top}\n.tg .tg-8rdm{border-color:inherit;color:black;text-align:left;vertical-align:top}\n<\/style>\n<table class=\"tg\">\n<thead>\n  <tr>\n    <th class=\"tg-58l7\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Product<\/span><\/th>\n    <th class=\"tg-58l7\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Quantity<\/span><\/th>\n    <th class=\"tg-58l7\"><span style=\"font-weight:var(--base-text-weight-semibold, 600)\">Category<\/span><\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td class=\"tg-8rdm\">Currencies<\/td>\n    <td class=\"tg-8rdm\">2.590<\/td>\n    <td class=\"tg-8rdm\">174 Currencies<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-8rdm\">Cryptocurrencies<\/td>\n    <td class=\"tg-8rdm\">3.624<\/td>\n    <td class=\"tg-8rdm\">299 Cryptocurrencies<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-8rdm\">Indices<\/td>\n    <td class=\"tg-8rdm\">86.353<\/td>\n    <td class=\"tg-8rdm\">49 Exchanges<\/td>\n  <\/tr>\n  <tr>\n    <td class=\"tg-8rdm\">Money Markets<\/td>\n    <td class=\"tg-8rdm\">1.384<\/td>\n    <td class=\"tg-8rdm\">2 Exchanges<\/td>\n  <\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<a name=\"finance-database-get-started\">\n\n\n\n<h2 class=\"wp-block-heading\">How to get started with FinanceDatabase?<\/h2>\n\n\n\n<p>To get started with FinanceDatabase, you will need to install its Python library with the following command:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>pip install financedatabase<\/code><\/pre><\/div>\n\n\n\n<p>In the following article sections, we will explore what the FinanceDatabase has to offer and how it can be used for conducting financial research.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import financedatabase as fd<\/code><\/pre><\/div>\n\n\n\n<a name=\"finance-database-general-data\">\n\n\n\n<h2 class=\"wp-block-heading\">How to get general data with FinanceDatabase?<\/h2>\n\n\n\n<p>To get general data with FinanceDatabase, you will need to initialize the part of the database you want to use (e.g. equities) and use the filtering methods such as <code>options,<\/code> <code>select<\/code> and <code>search<\/code>.<\/p>\n\n\n\n<p>For example, let&#8217;s initialize the equities database and obtain all industries from a specific country:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>equities = fd.Equities()\n\nequities_germany_industries = equities.options(&#39;industry&#39;, country=&#39;Singapore&#39;)\nequities_germany_industries<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>array([&#39;Aerospace & Defense&#39;, &#39;Air Freight & Logistics&#39;, &#39;Airlines&#39;,\n       &#39;Auto Components&#39;, &#39;Automobiles&#39;, &#39;Banks&#39;, &#39;Beverages&#39;, ...<\/code><\/pre><\/div>\n\n\n\n<p>We obtain all of the 55 industries in Singapore, feel free to experiment with other countries.<\/p>\n\n\n\n<p>Now, let&#8217;s obtain all equities from a specific country such as the USA:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>equities_united_states = equities.select(country=&quot;United States&quot;)\nequities_united_states.head()<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"245\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-1024x245.webp\" alt=\"\" class=\"wp-image-20822\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-1024x245.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-300x72.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-768x183.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-1536x367.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_us-2048x489.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<a name=\"finance-database-advanced-search\">\n\n\n\n<h2 class=\"wp-block-heading\">How to perform an advanced search on the FinanceDatabase?<\/h2>\n\n\n\n<p>To perform an advanced search on the Finance Databse, you can use the <code>search<\/code> method and pass multiple parameters to limit your search to a specific market segment. <\/p>\n\n\n\n<p>For example, let&#8217;s obtain all Swedish software companies that have the word &#8220;cloud&#8221; in their summary and are part of the FRA exchange:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>equities_sweden_software = equities.search(\n    country=&#39;Sweden&#39;,\n    industry=&#39;Software&#39;,\n    summary=&quot;cloud&quot;,\n    exchange=&quot;FRA&quot;\n)\nequities_sweden_software<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"245\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-1024x245.webp\" alt=\"\" class=\"wp-image-20823\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-1024x245.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-300x72.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-768x183.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-1536x367.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_databae_sweden-2048x489.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Feel free to try out other industries, sectors, and parameters to filter on.<\/p>\n\n\n\n<a name=\"finance-database-collect-data\">\n\n\n\n<h2 class=\"wp-block-heading\">How to collect data from the FinanceDatabase?<\/h2>\n\n\n\n<p>To collect data from the FinanceDatabase, you can initialize a specific part of it (e.g. Equities, Indices, Funds, etc.) and perform a <code>.select()<\/code> to obtain all available information. For example, let&#8217;s obtain all indices:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>indices = fd.Indices()\nindices.select()<\/code><\/pre><\/div>\n\n\n\n<a name=\"finance-database-all-us-companies\">\n\n\n\n<h2 class=\"wp-block-heading\">How to obtain all US companies from different sectors using the FinanceDatabase?<\/h2>\n\n\n\n<p>To obtain all US companies from different sectors using the FinanceDatabase, you can utilize the <code>options<\/code> and <code>select<\/code> features to loop over all the sectors and aggregate the companies per each of them.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>equities_sectors_us = {}\n\nfor sector in equities.options(selection=&#39;sector&#39;, country=&#39;United States&#39;):\n    try:\n        equities_sectors_us[sector] = len(equities.select(country=&#39;United States&#39;, sector=sector))\n    except ValueError as error:\n        print(error)<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{&#39;Communication Services&#39;: 444,\n &#39;Consumer Discretionary&#39;: 739,\n &#39;Consumer Staples&#39;: 402,\n &#39;Energy&#39;: 470,\n &#39;Financials&#39;: 3919,\n &#39;Health Care&#39;: 1559,\n &#39;Industrials&#39;: 1044,\n &#39;Information Technology&#39;: 1043,\n &#39;Materials&#39;: 424,\n &#39;Real Estate&#39;: 513,\n &#39;Utilities&#39;: 190}<\/code><\/pre><\/div>\n\n\n\n<a name=\"finance-database-technical-analysis\">\n\n\n\n<h2 class=\"wp-block-heading\">How to perform technical analysis with FinanceDatabase?<\/h2>\n\n\n\n<p>To perform technical analysis with FinanceDatabase, you will need to extend its features with other libraries such as yfinance, ta, talib, and similar. For example, let&#8217;s examine the french wine industry&#8217;s large caps in a post-covid market setting.<\/p>\n\n\n\n<p>The first thing that we want to do is to install the libraries that are missing:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>!pip install ta\n!pip install yfinance<\/code><\/pre><\/div>\n\n\n\n<p>Now, we import everything that we&#8217;ll be using:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import pandas as pd\nimport yfinance as yf\nfrom ta.volatility import BollingerBands\nimport matplotlib.pyplot as plt\n%matplotlib inline<\/code><\/pre><\/div>\n\n\n\n<p>The next step that we want to do is to obtain all the french beverage industry equities that have &#8220;wine&#8221; inside their summary and that are large caps. We will obtain the data from Match 2020 up to the beginning of 2023:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>french_wine_equities = equities.search(\n    country=&quot;France&quot;,\n    industry=&quot;Beverages&quot;,\n    summary=&quot;wine&quot;,\n    market_cap=&quot;Large Cap&quot;\n)\nfrench_wine_equities<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"279\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-1024x279.webp\" alt=\"\" class=\"wp-image-20824\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-1024x279.webp 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-300x82.webp 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-768x209.webp 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-1536x418.webp 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_3-2048x558.webp 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From the output, we can observe that Pernod Ricard SA is the main and only leader here. Now, let&#8217;s obtain the data on these tickers with yfinance to examine them further:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>tickers = list(french_wine_equities.index)\n\nstock_fr_wine = yf.download(tickers, start=&quot;2020-03-01&quot;, end=&quot;2023-01-01&quot;)[&#39;Adj Close&#39;]\nstock_fr_wine.drop([&quot;PER1.F&quot;, &quot;PDRDY&quot;], axis=1, inplace=True)\nstock_fr_wine.head()<\/code><\/pre><\/div>\n\n\n\n<p>As yfinance didn&#8217;t have the two tickers above, I removed them. Now, we will fill in the missing data and calculate the difference between the daily returns as I&#8217;d like to examine the difference in volatility, if any, between these tickers:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>stock_fr_wine.fillna(method = &#39;ffill&#39;, inplace = True)\nstock_fr_wine = stock_fr_wine.diff()<\/code><\/pre><\/div>\n\n\n\n<p>Now, I&#8217;ll add a Bollinger Bands indicator to help us gauge the volatility between the returns and only plot the upper and lower band. I&#8217;ll also add a straight line on the 0 y-axes.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>fig, axis = plt.subplots(3, 2)\nrow = 0\ncolumn = 0\n\nfor ticker in stock_fr_wine.columns:\n    data_plot = pd.DataFrame(stock_fr_wine[ticker])\n\n    indicator_bb = BollingerBands(close=stock_fr_wine[ticker], window=20, window_dev=2)\n\n    data_plot[&#39;bb_bbh&#39;] = indicator_bb.bollinger_hband()\n    data_plot[&#39;bb_bbl&#39;] = indicator_bb.bollinger_lband()\n\n    axis[row, column].plot(data_plot)\n    axis[row, column].set_title(ticker, fontsize=16)\n    axis[row, column].axhline(0, c=&quot;purple&quot;)\n\n    column += 1\n    if column == 2:\n        row += 1\n        column = 0\n        \nfig.suptitle(&#39;Technical Analysis of Pernod Ricard SA&#39;)\nfig.set_size_inches(18.5, 10.5)\nfig.tight_layout()<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_volatility-1024x575.png\" alt=\"\" class=\"wp-image-20825\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_volatility-1024x575.png 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_volatility-300x169.png 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_volatility-768x432.png 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/finance_database_volatility.png 1324w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>As you can see, there are differences in volatility between these assets and their respective exchanges. Knowing this, a trading strategy pattern or investment plan might start to sprout. Feel free to extend this simple analysis and try out other assets.<\/p>\n\n\n\n<a name=\"finance-database-location\">\n\n\n\n<h2 class=\"wp-block-heading\">How to store the FinanceDatabase in a different location?<\/h2>\n\n\n\n<p>To store the FinanceDatabase in a different location, for example, your own fork of the repository, you can do so with the variable<code>base_url<\/code>&nbsp;which can be found in each of the asset classes.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>fd.Equities(base_url=&lt;YOUR URL&gt;)<\/code><\/pre><\/div>\n\n\n\n<p>You can also store the database locally and point to your local location with the variable&nbsp;<code>base_url<\/code>&nbsp;and by setting<code>use_local_location<\/code>&nbsp;to True. For example:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>fd.Equities(base_url=&lt;YOUR PATH&gt;, use_local_location=True)<\/code><\/pre><\/div>\n\n\n\n<a name=\"finance-database-learn-more\">\n\n\n\n<h2 class=\"wp-block-heading\">Where can I learn more about the FinanceDatabase?<\/h2>\n\n\n\n<p>To learn more about the FinanceDatabase, I advise checking out its <a href=\"https:\/\/github.com\/JerBouma\/FinanceDatabase#questions--answers\">GitHub repository<\/a>. You can also find this <a href=\"https:\/\/github.com\/JerBouma\/FinanceDatabase\/blob\/main\/examples.ipynb\">Jupyter Notebook<\/a> of examples useful.<\/p>\n\n\n\n<a name=\"finance-database-full-code\">\n\n\n\n<h2 class=\"wp-block-heading\">Full Code<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/AlgoTrading101\/Finance-Database-AlgoTrading101\">GitHub link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_21006\" class=\"pvc_stats total_only  \" data-element-id=\"21006\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>Table of contents: What is FinanceDatabase? FinanceDatabase is a Python package of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets. Link: https:\/\/pypi.org\/project\/financedatabase\/ What is FinanceDatabase used for? FinanceDatabase is mainly used for any type of financial product categorization. Moreover, it gives insights into the products that exist in each country, industry, [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":21012,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[2],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FinanceDatabase Guide - A Comprehensive Database of Financial Symbols (Python Package) - AlgoTrading101 Blog<\/title>\n<meta name=\"description\" content=\"Finance Database is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FinanceDatabase Guide - A Comprehensive Database of Financial Symbols (Python Package) - AlgoTrading101 Blog\" \/>\n<meta property=\"og:description\" content=\"Finance Database is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets\" \/>\n<meta property=\"og:url\" content=\"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-26T20:53:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-10T16:02:53+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/Financedatabase-guide-python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"1200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Igor Radovanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Igor Radovanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FinanceDatabase Guide - A Comprehensive Database of Financial Symbols (Python Package) - AlgoTrading101 Blog","description":"Finance Database is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets","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:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/","og_locale":"en_US","og_type":"article","og_title":"FinanceDatabase Guide - A Comprehensive Database of Financial Symbols (Python Package) - AlgoTrading101 Blog","og_description":"Finance Database is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets","og_url":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/","og_site_name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","article_published_time":"2023-03-26T20:53:22+00:00","article_modified_time":"2023-05-10T16:02:53+00:00","og_image":[{"width":1440,"height":1200,"url":"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2023\/03\/Financedatabase-guide-python.png","type":"image\/png"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/#article","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae"},"headline":"FinanceDatabase Guide &#8211; A Comprehensive Database of Financial Symbols (Python Package)","datePublished":"2023-03-26T20:53:22+00:00","dateModified":"2023-05-10T16:02:53+00:00","mainEntityOfPage":{"@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/"},"wordCount":997,"publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"articleSection":["Trading"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/","url":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/","name":"FinanceDatabase Guide - A Comprehensive Database of Financial Symbols (Python Package) - AlgoTrading101 Blog","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/#website"},"datePublished":"2023-03-26T20:53:22+00:00","dateModified":"2023-05-10T16:02:53+00:00","description":"Finance Database is a database of 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies, and Money Markets","breadcrumb":{"@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/algotrading101.com\/learn\/financedatabase-python-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/algotrading101.com\/learn\/"},{"@type":"ListItem","position":2,"name":"FinanceDatabase Guide &#8211; A Comprehensive Database of Financial Symbols (Python Package)"}]},{"@type":"WebSite","@id":"https:\/\/algotrading101.com\/learn\/#website","url":"https:\/\/algotrading101.com\/learn\/","name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","description":"Authentic Stories about Algorithmic trading, coding and life.","publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/algotrading101.com\/learn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/algotrading101.com\/learn\/#organization","name":"AlgoTrading101","url":"https:\/\/algotrading101.com\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","contentUrl":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","width":1200,"height":627,"caption":"AlgoTrading101"},"image":{"@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae","name":"Igor Radovanovic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","caption":"Igor Radovanovic"},"sameAs":["https:\/\/igorradovanovic.com","https:\/\/www.linkedin.com\/in\/igor-radovanovic-profile"],"url":"https:\/\/algotrading101.com\/learn\/author\/igor\/"}]}},"modified_by":"Lucas Liew","_links":{"self":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21006"}],"collection":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/comments?post=21006"}],"version-history":[{"count":11,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21006\/revisions"}],"predecessor-version":[{"id":21739,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/21006\/revisions\/21739"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media\/21012"}],"wp:attachment":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media?parent=21006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/categories?post=21006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/tags?post=21006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}