This is a database of 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets.

Overview

Finance Database

As a private investor, the sheer amount of information that can be found on the internet is rather daunting. Trying to understand what type of companies or ETFs are available is incredibly challenging with there being millions of companies amd derivatives available on the market. Sure, the most traded companies and ETFs can quickly be found simply because they are known to the public (for example, Microsoft, Tesla, S&P500 ETF or an All-World ETF). However, what else is out there is often unknown.

This database tries to solve that. It features 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets. It therefore allows you to obtain a broad overview of sectors, industries, types of investments and much more.

The aim of this database is explicitly not to provide up-to-date fundamentals or stock data as those can be obtained with ease (with the help of this database) by using FundamentalAnalysis or yfinance. Instead, it gives insights into the products that exist in each country, industry and sector and gives the most essential information about each product. With this information, you can analyse specific areas of the financial world and/or find a product that is hard to find. See for examples on how you can combine this database, and the earlier mentioned packages the section Examples.

Some key statistics of the database:

Product Quantity Sectors Industries Countries Exchanges
Equities 84.091 16 262 109 79
ETFs 15.892 268* 88* 100** 44
Funds 34.947 857* 416* 100** 25
Product Quantity Exchanges
Indices 24.548 62
Currencies 2.529 2
Cryptocurrencies 3.624 1
Options 13.819 1
Futures 1.173 7
Money Markets 1.384 2

* These numbers refer to families (iShares, Vanguard) and categories (World Stock, Real Estate) respectively.
** This is an estimation. Obtaining the country distribution can only be done by collecting data on the underlying or by manual search.

Usage

To access the database you can download the entire repository, but I strongly recommend making use of the package closely attached to the database. It allows you to select specific json files as well as search through collected data with a specific query.

You can install the package with the following steps:

  1. pip install FinanceDatabase
    • Alternatively, download the 'Searcher' directory.
  2. (within Python) import FinanceDatabase as fd

The package has the following functions:

  • show_options(product, equities_selection=None) - gives all available options from the functions below per product (i.e. Equities, Funds) which then can be used to collect data. You can select a sub selection of equities by entering 'countries', 'sectors' or 'industries' for equities_selection.
  • select_cryptocurrencies(cryptocurrency=None) - with no input gives all cryptocurrencies, with input gives the cryptocurrency of choice.
  • select_currencies(currency=None) - with no input gives all currencies, with input gives the currency of choice.
  • select_etfs(category=None) - with no input gives all etfs, with input gives all etfs of a specific category.
  • select_equities(country=None, sector=None, industry=None) - with no input gives all equities, with input gives all equities of a country, sector, industry or a combination of the three.
  • select_funds(category=None) - with no input gives all funds, with input gives all funds of a specific category.
  • select_indices(market=None) - with no input gives all indices, with input gives all indices of a specific market which usually refers to indices in a specific country (like de_market gives DAX).
  • select_other(product) - gives either all Futures, all Moneymarkets or all Options.
  • search_products(database, query, search='summary', case_sensitive=False, new_database=None) - with input from the above functions, this function searches for specific values (i.e. the query 'sustainable') in one of the keys of the dictionary (which is by default the summary). It also has the option to enable case-sensitive searching which is off by default.

For additional information about each function you can use the build-in help function of Python. For example help(show_options) returns a general description, the possible input parameters and what is returned as output.

For users of the broker DeGiro, you are able to find data on the tickers found in the Commission Free ETFs list by selecting either core_selection_degiro_filled (all data) or core_selection_degiro_filtered (filtered by summary) as category when using the function select_etfs.

Examples

This section gives a few examples of the possibilities with this package. These are merely a few of the things you can do with the package, and it only uses yfinance. As you can obtain a wide range of symbols, pretty much any package that requires symbols should work.

United States' Airlines

If I wish to obtain all companies within the United States listed under 'Airlines' I can write the following code:

import FinanceDatabase as fd

airlines_us = fd.select_equities(country='United States', industry='Airlines')

Then, I can use packages like yfinance to quickly collect data from Yahoo Finance for each symbol in the industry like this:

from yfinance.utils import get_json
from yfinance import download

airlines_us_fundamentals = {}
for symbol in airlines_us:
    airlines_us_fundamentals[symbol] = get_json("https://finance.yahoo.com/quote/" + symbol)

airlines_us_stock_data = download(list(airlines_us))

With a few lines of code, I have collected all data from a specific industry within the United States. From here on you can compare pretty much any key statistic, fundamental- and stock data. For example, let's plot a simple bar chart that gives insights in the Quick Ratios (indicator of the overall financial strength or weakness of a company):

import matplotlib.pyplot as plt

for symbol in airlines_us_fundamentals:
    quick_ratio = airlines_us_fundamentals[symbol]['financialData']['quickRatio']
    long_name = airlines_us_fundamentals[symbol]['quoteType']['longName']

    if quick_ratio is None:
        continue

    plt.barh(long_name, quick_ratio)

plt.tight_layout()
plt.show()

Which results in the graph displayed below (as of the 3rd of February 2021). From this graph you can identify companies that currently lack enough assets to cover their liabilities (quick ratio < 1), and those that do have enough assets (quick ratio > 1). Both too low and too high could make you wonder whether the company adequately manages its assets.

FinanceDatabase

Semiconductors ETFs

If I wish to obtain all ETFs that have something to do with 'semiconductors' I can use the search function which can be used the following way:

import FinanceDatabase as fd

all_etfs = fd.select_etfs()
semiconductor_etfs = fd.search_products(all_etfs, 'semiconductor')

The variable semiconductor_etfs returns all etfs that have the word 'semiconductor' in their summary which usually also corresponds to the fact they are targeted around semiconductors. Next, I collect data:

semiconductor_etfs_fundamentals = {}
for symbol in semiconductor_etfs:
    semiconductor_etfs_fundamentals[symbol] = get_json("https://finance.yahoo.com/quote/" + symbol)

And lastly, I have a look at the YTD returns (as of the 3rd of February 2021) of each ETF to better understand the products that are available (for example levered products or specific bear and bull products):

for symbol in semiconductor_etfs_fundamentals:
    ytd_return = semiconductor_etfs_fundamentals[symbol]['fundPerformance']['trailingReturns']['ytd']
    long_name = semiconductor_etfs_fundamentals[symbol]['quoteType']['longName']

    if ytd_return is None:
        continue

    plt.barh(long_name, ytd_return)

plt.tight_layout()
plt.xticks([-1, -0.5, 0, 0.5, 1], ['-100%', '-50%', '0%', '50%', '100%'])
plt.show()

This results in the following graph which gives some insights in the available semiconductor ETFs. Then with the large amount of fundamentals data you can figure out how each ETF differs and what might be worthwhile to invest in.

FinanceDatabase

Q&A

  • How did you get your data?
  • Is there support for ?
    • Yes, most likely there is as the database includes 109 countries. Please check here.
  • When I collect data via yfinance I notice that not all tickers return output, why is that?
    • Some tickers are merely holdings of companies and therefore do not really have any data attached to them. Therefore, it makes sense that not all tickers return data. If you are still in doubt, search the ticker on Google to see if there is really no data available.
  • How frequently does the Database get updated?
    • I aim at doing this every few months. The database does not have to get updated frequently because the data collected is only general information. For example, a Sector name hardly changes and companies do not tend to move to another country every few months. Therefore, the data should stay up to date for several months. I you wish to contribute to updating the database then that is much appreciated. Please check the Methodology for guidance on how.
  • Do your sector and industry names use the same naming convention as GIC sector?
    • Not entirely but very similar, it's based on Yahoo Finance's sectors and industries. See industries and sectors. Perhaps a future adjustment could be to make them aligned with GICS.

Contribution

Projects are bound to have (small) errors and can always be improved. Therefore, I highly encourage you to submit issues and create pull requests to improve the package.

The last update to the database is the 3rd of February 2021. I always accept Pull Requests every few months to keep the database up to date. Extending the amount of tickers and data is also much appreciated.

Comments
  • Error by:  core_selection = fd.select_etfs(

    Error by: core_selection = fd.select_etfs("core_selection_degiro_filtered")

    Hi,

    As I run the code: ... core_selection = fd.select_etfs("core_selection_degiro_filtered") ... I got error as follow: `JSONDecodeError Traceback (most recent call last) ~\anaconda3\lib\site-packages\FinanceDatabase\json_picker.py in select_etfs(category) 105 request = requests.get(json_file) --> 106 json_data = json.loads(request.text) 107 except json.decoder.JSONDecodeError:

    ~\anaconda3\lib\json_init_.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 347 parse_constant is None and object_pairs_hook is None and not kw): --> 348 return _default_decoder.decode(s) 349 if cls is None:

    ~\anaconda3\lib\json\decoder.py in decode(self, s, _w) 339 if end != len(s): --> 340 raise JSONDecodeError("Extra data", s, end) 341 return obj

    JSONDecodeError: Extra data: line 1 column 4 (char 3)

    During handling of the above exception, another exception occurred:

    ValueError Traceback (most recent call last) in ----> 1 core_selection = fd.select_etfs("core_selection_degiro_filtered") 2 # core_selection = fd.select_etfs("") 3 # core_selection

    ~\anaconda3\lib\site-packages\FinanceDatabase\json_picker.py in select_etfs(category) 106 json_data = json.loads(request.text) 107 except json.decoder.JSONDecodeError: --> 108 raise ValueError(f"Not able to find any data for {category}.") 109 else: 110 try:

    ValueError: Not able to find any data for core_selection_degiro_filtered.`

    opened by thomas2004ch 6
  • Display Industry set

    Display Industry set

    Hi,

    Thank you very much for this great module, I had been trying to do something similar for some time.

    I have been trying to query your database for the equity data for a specific industry and I have found out that it can be difficult to know which industries are available without looking into the json files at FinanceDatabase/Database/Categories/.

    Have I missed something here and there is already a function to display the industries ?

    If not, do you think that it would be a good idea to add a feature that would list the available industries or other sets of values that are available for the different arguments?

    As a solution, I would consider something that would just read the existing json files and display their contents as set objects.

    Maybe just a summary of the database structure would be ideal as it would encompass everything and seems like the most helpful feature overall.

    Thank you.

    PS: I'm keen to help with the implementation if it helps.

    opened by ProgrammingDao 4
  • Hosting the database .json files locally

    Hosting the database .json files locally

    Describe the solution you'd like The library always reaches out to the Internet to get the database .json files. This is not ideal for performance or for a program that might not have an Internet connection.

    I'd like a way to host the database files on my own local machine or intranet, and specify my own base URL for the .json database files. Perhaps it could be an optional parameter called base_url for the select_ series of methods in FinanceDatabase. I suppose the given base URL would just integrate and override the URLs you have hard-coded in json_picker.py.

    Describe alternatives you've considered Copying the files to my local machine and manually editing json_picker.py to use it.

    enhancement 
    opened by jstesta 3
  • ValueError: Not able to find the options for equities

    ValueError: Not able to find the options for equities

    Describe the bug Was trying to view all available equities, but I am getting a ValueError which follows a JSONDecodeError (see screenshot).

    To Reproduce Steps to reproduce the behavior: ` import FinanceDatabase as fd

    equities = fd.show_options('equities') print(equities) `

    Expected behavior show all available equities

    Screenshots grafik

    Desktop (please complete the following information):

    • OS: OSX El Capitan
    bug 
    opened by ALee008 3
  • some ETF symbols have non-alphabetic characters

    some ETF symbols have non-alphabetic characters

    Describe the bug some ETF symbols have non alphabetic characters

    To Reproduce Steps to reproduce the behavior: ` import financedatabase as fd

    res = fd.select_etfs()

    for k,v in res.items(): if k.isalpha() is False: print(k) `

    Screenshots

    image

    opened by HamidM6 2
  • Industry the company associated with

    Industry the company associated with

    Hi JerBouma,

    Thanks for this wonderful package. Very useful resource indeed. I was wondering is it possible to provide symbol of a company ans fish out the industry/sector that its associated with ? Some companies have mix of products that it woule be listed in two different Industry. It would be useful to get the associated industry given the symbol. Thanks

    opened by rajanprabu 2
  • add domain, state in the Equities

    add domain, state in the Equities

    Is your feature request related to a problem? Please describe. It would be nice to add domain like apple.com and the state: California, and zip code if possible

    enhancement 
    opened by shuaiwang88 2
  • Can't  import the package

    Can't import the package

    Describe the bug

    import FinanceDatabase as fd

    Traceback (most recent call last): File "<pyshell#5>", line 1, in import FinanceDatabase as fd File "C:\Python27\lib\site-packages\FinanceDatabase_init_.py", line 2, in from .json_picker import select_cryptocurrencies File "C:\Python27\lib\site-packages\FinanceDatabase\json_picker.py", line 41 raise ValueError(f"Not able to find any data for {cryptocurrency}.") ^ SyntaxError: invalid syntax

    Using Python 2.7

    Is it possible that json_picker .py has a 400 invalid URL?

    def select_cryptocurrencies(cryptocurrency=None, base_url="https://raw.githubusercontent.com/JerBouma/FinanceDatabase/master/" "Database/Cryptocurrencies/", use_local_location=False, all_cryptocurrencies_json="_Cryptocurrencies"):

    Or is this a me issue? lol

    Thanks!

    opened by medici89 2
  • AttributeError is raised when calling select_etfs() with no parameter given

    AttributeError is raised when calling select_etfs() with no parameter given

    Describe the bug AttributeError is raised when calling select_etfs() with no parameter given.

    Expected behavior Method returns all ETFs.

    Actual behavior The following error is raised:

    Traceback (most recent call last): File "..snip..\lib\site-packages\FinanceDatabase\json_picker.py", line 113, in select_etfs json_data = json.loads(request.text).decode("UTF-8") AttributeError: 'dict' object has no attribute 'decode'

    Additional context Version 0.1.9

    bug 
    opened by jstesta 2
  • No module named 'requests'

    No module named 'requests'

    After pip installing FinanceDatabase I attempt to import it in my python file, but I get this error: Traceback (most recent call last): File "/Users/usrname/PycharmProjects/stockScreener/main.py", line 1, in import FinanceDatabase as fd File "/Users/usrname/.virtualenvs/stockScreener/lib/python3.8/site-packages/FinanceDatabase/init.py", line 2, in from .json_picker import select_cryptocurrencies File "/Users/usrname/.virtualenvs/stockScreener/lib/python3.8/site-packages/FinanceDatabase/json_picker.py", line 1, in import requests ModuleNotFoundError: No module named 'requests'

    opened by kuba-wolf 2
  • industry field anomalies

    industry field anomalies

    https://github.com/JerBouma/FinanceDatabase/raw/master/Database/Equities/Countries/United%20States/United%20States.json

    "industry" field contains the following anomaly:

    
    "Banks\u2014Diversified",
    "Banks\u2014Regional",
    "Beverages\u2014Brewers",
    "Beverages\u2014Non-Alcoholic",
    "Beverages\u2014Wineries & Distilleries",
    
    "Drug Manufacturers\u2014General",
    "Drug Manufacturers\u2014Specialty & Generic",
    "Insurance\u2014Diversified",
    "Insurance\u2014Life",
    "Insurance\u2014Property & Casualty",
    "Insurance\u2014Reinsurance",
    "Insurance\u2014Specialty",
    "Real Estate\u2014Development",
    "Real Estate\u2014Diversified",
    
    

    these could use some normalization "Aerospace & Defense", "Aerospace/Defense - Major Diversified", "Aerospace/Defense Products & Services",

    It's a lot faster to work on offline database, cheers!

    opened by mrx23dot 2
  • Download ETF data by countries

    Download ETF data by countries

    Just an expectation for enhancement. I am currently working on analyzing ETFs issued in North America region (roughly America). While it is possible to download these data via selenium, I wish you could add another country option in the function "select_etfs" as well as the function "select_equities". I would appreciate it if you could consider this.

    opened by Soga-no-Tojiko 0
  • add product names

    add product names

    Here is an example where we extract products from summary field. Uses NLP to detect nouns, matches nouns to a product database. Requires some work to build up the DB, I added most common 3K items.

    Company description can be scraped from different places to have wide range of products. After we have products we can easily find precise competitors.

    Extracted products for MSFT ['console', 'server', 'software', 'tablet', 'window', 'windows', 'xbox'] Post filtering can be added.

    If anyone has time please pick this up. Install instruction on top. Would make sense to start with SP500, nasdaq, then rest of the symbols. products.zip

    enhancement 
    opened by mrx23dot 2
Releases(1.0.0)
Owner
Jeroen Bouma
With a MSc in Quantitative Finance and a Bachelor of Economics (BEc), my ambition is to continuously improve in the fields of Programming and Quant Finance
Jeroen Bouma
Height 2 LDraw With python

Height2Ldraw About This project aims to be able to make a full lego 3D model using the ldraw file format (.ldr) from a height and color map, currently

1 Dec 22, 2021
A small C compiler written in Python for learning purposes

A small C compiler written in Python. Generates x64 Intel-format assembly, which is then assembled and linked by nasm and ld.

Scattered Thoughts 3 Oct 22, 2021
Building an Investment Portfolio for Day Trade with Python

Montando um Portfólio de Investimentos para Day Trade com Python Instruções: Para reproduzir o projeto no Google Colab, faça o download do repositório

Paula Campigotto 9 Oct 26, 2021
Bookmarkarchiver - Python script that archives all of your bookmarks on the Internet Archive

bookmarkarchiver Python script that archives all of your bookmarks on the Internet Archive. Supports all major browsers. bookmarkarchiver uses the off

Anthony Chen 3 Oct 09, 2022
Collapse a set of redundant kmers to use IUPAC degenerate bases

kmer-collapse Collapse a set of redundant kmers to use IUPAC degenerate bases Overview Given an input set of kmers, find the smallest set of kmers tha

Alex Reynolds 3 Jan 06, 2022
Radiosonde Telemetry Decoders

Radiosonde Telemetry Frame Decoders This repository is an attempt to collate the various sources of information on how to decode radiosonde telemetry

Project Horus 3 Jan 04, 2022
Generate Gaussian 09 input files for the rotamers of an input compound.

Rotapy Purpose Generate Gaussian 09 input files for the rotamers of an input compound. Distance to the axis of rotation remains constant throughout th

1 Jul 16, 2021
一个可以自动生成PTGen,MediaInfo,截图,并且生成发布所需内容的脚本

Differential 差速器 一个可以自动生成PTGen,MediaInfo,截图,并且生成发种所需内容的脚本 为什么叫差速器 差速器是汽车上的一种能使左、右轮胎以不同转速转动的结构。使用同样的动力输入,差速器能够输出不同的转速。就如同这个工具之于PT资源,差速器帮你使用同一份资源,输出不同PT

Lei Shi 96 Dec 15, 2022
Easy way to build a SaaS application using Python and Dash

EasySaaS This project will be attempt to make a great starting point for your next big business as easy and efficent as possible. This project will cr

xianhu 3 Nov 17, 2022
Entitlement AND Hardened Runtime Check

Python3 script for macOS to recursively check /Applications and also check /usr/local/bin, /usr/bin, and /usr/sbin for binaries with problematic/interesting entitlements. Also checks for hardened run

Cedric Owens 79 Nov 16, 2022
Resizing using nnedi3/znedi3/nnedi3cl with center alignment and correct chroma placement

nnedi3_resample A VapourSynth script for easy resizing using nnedi3/znedi3/nnedi3cl with center alignment and correct chroma placement. Requirements n

Home Of VapourSynth Evolution 12 Sep 08, 2022
Open-source data observability for modern data teams

Use cases Monitor your data warehouse in minutes: Data anomalies monitoring as dbt tests Data lineage made simple, reliable, and automated dbt operati

889 Jan 01, 2023
Resources for the 2021 offering of COMP 598

comp598-2021 Resources for the 2021 offering of COMP 598 General submission instructions Important Please read these instructions located in the corre

Derek Ruths 23 May 18, 2022
Contains a Jupyter Notebook for calculating remaining plants required based on field/lathhouse data.

Davis-Sunflowers-Su21 Project goals: Plants influence their reproduction and mating system in many ways. Various factors such as time of flowering, ab

1 Feb 10, 2022
Let’s Play with Python3

Python3-FirstEdition a bunch of python programs and stuff Super Important Notice THIS IS LICENSED UNDER GNU PUBLIC LICENSE V3 also, refer to Contribut

Jym Patel 2 Nov 24, 2022
Standalone PyQGIS application for executing custom scripts without a QGIS GUI.

PyQGIS Standalone Script Executer Standalone PyQGIS application that is able to run a custom script, in this case Proximity.py without the need of a G

6 Sep 23, 2022
Um jogo para treinar COO em python

WAR DUCK Este joguinho bem simples tem como objetivo treinar um pouquinho de POO com python. Não é nada muito complexo mas da pra se divertir Como rod

Gabriel Jospin 3 Sep 19, 2021
Batch Python Program Verify

Batch Python Program Verify About As a TA(teaching assistant) of Programming Class, it is very annoying to test students' homework assignments one by

Han-Wei Li 7 Dec 20, 2022
rebalance is a simple Python 3.9+ library for rebalancing investment portfolios

rebalance rebalance is a simple Python 3.9+ library for rebalancing investment portfolios. It supports cash flow rebalancing with contributions and wi

Darik Harter 5 Feb 26, 2022
Short, introductory guide for the Python programming language

100 Page Python Intro This book is a short, introductory guide for the Python programming language.

Sundeep Agarwal 185 Dec 26, 2022