MCPcopy
hub / github.com/JerBouma/FinanceDatabase

github.com/JerBouma/FinanceDatabase @2.4.0 sqlite

repository ↗ · DeepWiki ↗ · release 2.4.0 ↗
123 symbols 401 edges 19 files 84 documented · 68%
README

Logo

GitHub Sponsors Buy Me a Coffee LinkedIn Documentation Supported Python Versions PYPI Version PYPI Downloads

Call for Contributors to the FinanceDatabase
The FinanceDatabase serves the role of providing anyone with any type of financial product categorization entirely for free. To achieve this, the FinanceDatabase relies on community involvement to add, edit, and remove tickers over time. This is made easy enough that anyone, even those with a lack of coding experience, can contribute because of the use of CSV files that can be manually edited with ease.
I'd like to invite you to go to the Contributing Guidelines to understand how you can help. Thank you!

As a private investor, the sheer amount of information that can be found on the internet is rather daunting. Trying to understand what types of companies or ETFs are available is incredibly challenging, with millions of companies and 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&P 500 ETF, or an All-World ETF). However, what else is out there is often unknown.

This database tries to solve that. It features 300,000+ symbols containing Equities, ETFs, Funds, Indices, 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 the Finance Toolkit 🛠️. Instead, it gives insights into the products that exist in each country, industry, and sector and provides the most essential information about each product. With this information, you can analyze specific areas of the financial world and/or find a product that is hard to find. For examples of how you can combine this database with the earlier mentioned packages, see the Usage section.

Some key statistics of the database:

Product Quantity Sectors Industries Countries Exchanges
Equities 160.869 11 68 117 84
Product Quantity Families Categories Exchanges
ETFs 36.483 320 51 51
Funds 57.853 1.540 74 33
Product Quantity Category
Currencies 2.556 175 Currencies
Cryptocurrencies 3.367 351 Cryptocurrencies
Indices 91.181 63 Exchanges
Money Markets 1.367 2 Exchanges

Installation

Before installation, consider starring the project on GitHub, which helps others find the project as well.

image

To install the FinanceDatabase, simply use the following:

pip install financedatabase -U

Then within Python use:

import financedatabase as fd

Usage

This section explains in detail how the database can be queried with the related financedatabase package. Note that examples here are purposely cut off to a maximum of 10 entries due to the sheer size of the database. Furthermore, the summary column is also omitted for readability. For the full detailed results, see the Notebook here. Let's start by importing the package:

import financedatabase as fd

Initialization of each asset class is only required once. It is therefore important that you save the class to a variable so that you can query the database much more quickly. A simple example is shown below.

equities = fd.Equities()

equities.select()

A sample of the output is shown below:

symbol name currency sector industry_group industry exchange market country state city zipcode website market_cap isin cusip figi composite_figi shareclass_figi
PMTA.DU PTC Inc. EUR Information Technology Software & Services Software DUS Dusseldorf Stock Exchange United States MA Boston 2210 http://www.ptc.com Large Cap US69370C1009 69370C100 BBG000FC6SC5 BBG000FC5PS5 BBG001S6DNK6
VAW.F VAALCO Energy, Inc. EUR Energy Energy Oil, Gas & Consumable Fuels FRA Frankfurt Stock Exchange United States TX Houston 77042 http://www.vaalco.com Micro Cap US91851C2017 91851C201 BBG000CN15Y5 BBG000CN15F6 BBG001S76ZS7
ORC.DE Oracle Corporation EUR Information Technology Software & Services Software GER XETRA United States TX Austin 78741 http://www.oracle.com Mega Cap US68389X1054 68389X105 BBG000C0RY38 BBG000C0RWW0 BBG001S5SJG6
PAYX Paychex, Inc. USD Industrials Commercial & Professional Services Professional Services NMS NASDAQ Global Select United States NY Rochester 14625-2396 http://www.paychex.com Large Cap US7043261079 704326107 BBG000BQT1J5 BBG000BQSQ38 BBG001S5V135
RI2A.F Rigel Pharmaceuticals, Inc. EUR Health Care Pharmaceuticals, Biotechnology & Life Sciences Biotechnology FRA Frankfurt Stock Exchange United States CA South San Francisco 94080 http://www.rigel.com Small Cap US7665596034 766559603 BBG000BKZNR4 BBG000BKZNC0 BBG001SD33Z0
PGEN Precigen, Inc. USD Health Care Pharmaceuticals, Biotechnology & Life Sciences Biotechnology NMS NASDAQ Global Select United States MD Germantown 20876 http://www.precigen.com Small Cap US74017N1054 74017N105 BBG004TDDJ32 BBG000QL8VH9 BBG001SSB3T5
GOGO Gogo Inc. USD Communication Services Telecommunication Services Diversified Telecommunication Services NMS NASDAQ Global Select United States IL Chicago 60606 http://www.gogoair.com Small Cap US38046C1099 38046C109 BBG002CN8Y71 BBG002CN8XN5 BBG002CN8YD4
CRK Comstock Resources, Inc. USD Energy Energy Oil, Gas & Consumable Fuels NYQ New York Stock Exchange United States TX Frisco 75034 http://www.comstockresources.com Mid Cap US2057683029 205768302 BBG000DNBMJ3 BBG000DNBK89 BBG001S8FX55
OIS Oil States International, Inc. USD Energy Energy Energy Equipment & Services NYQ New York Stock Exchange United States TX Houston 77002 http://www.oilstatesintl.com Small Cap US6780261052 678026105 BBG000BDDQ06 BBG000BDDN94 BBG001S7WK56
CVLC.BE Vale S.A. EUR Materials Materials Metals & Mining BER Berlin Stock Exchange Brazil RJ Rio De Janeiro 22250-145 http://www.vale.com Large Cap US91912E1055 9.19E+109 BBG000HCJTN5 BBG000HCJNQ5 BBG001S7RS91

With show_options, all possible options are given per column. This is useful as it doesn't require loading the larger data files. For example, obtaining all options for equities is done as follows:

fd.show_options("equities")

This returns all available options for each column.

{'currency': array(['ARS', 'AUD', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CZK',
    'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'IDR', 'ILA', 'ILS', 'INR',
    'ISK', 'JPY', 'KES', 'KRW', 'LKR', 'MXN', 'MYR', 'NOK', 'NZD',
    'PEN', 'PHP', 'PLN', 'QAR', 'RUB', 'SAR', 'SEK', 'SGD', 'THB',
    'TRY', 'TWD', 'USD', 'ZAC', 'ZAR'], dtype=object),
 'sector': array(['Communication Services', 'Consumer Discretionary',
    'Consumer Staples', 'Energy', 'Financials', 'Health Care',
    'Industrials', 'Information Technology', 'Materials',
    'Real Estate', 'Utilities'], dtype=object),
 'industry_group': array(['Automobiles & Components', 'Banks', 'Capital Goods',
    'Commercial & Professional Services',
    'Consumer Durables & Apparel', 'Consumer Services',
    'Diversified Financials', 'Energy', 'Food & Staples Retailing',
    'Food, Beverage & Tobacco', 'Health Care Equipment & Services',
    'Household & Personal Products', 'Insurance', 'Materials',
    'Media & Entertainment',
    'Pharmaceuticals, Biotechnology & Life Sciences', 'Real Estate',
    'Retailing', 'Semiconductors & Semiconductor Equipment',
    'Software & Services', 'Technology Hardware & Equipment',
    'Telecommunication Services', 'Transportation', 'Utilities'],
       dtype=object)}

Since the equities database has already been loaded, it is also possible to use similar functionality from within the class as follows. The main difference is that this functionality allows you to see the options based on specific filtering. For example:

equities.show_options(country='Netherlands')

This shows a more concise list of parameters given the focus on the Netherlands.

{'currency': array(['ARS', 'AUD', 'BRL', 'CHF', 'CZK', 'EUR', 'GBP', 'ILA', 'MXN',
    'NOK', 'RUB', 'USD', 'ZAC'], dtype=object),
 'sector': array(['Communication Services', 'Consumer Discretionary',
    'Consumer Staples', 'Energy', 'Financials', 'Health Care',
    'Industrials', 'Information Technology', 'Materials',
    'Real Estate', 'Utilities'], dtype=object),
 'industry_group': array(['Automobiles & Components', 'Banks', 'Capital Goods',
    'Commercial & Professional Services',
    'Consumer Durables & Apparel', 'Consumer Services',
    'Diversified Financials', 'Energy', 'Food & Staples Retailing',
    'Food, Beverage & Tobacco', 'Health Care Equipment & Services',
    'Household & Personal Products', 'Insurance', 'Materials',
    'Media & Entertainment',
    'Pharmaceuticals, Biotechnology & Life Sciences', 'Real Estate',
    'Retailing', 'Semiconductors & Semiconductor Equipment',
    'Software & Services', 'Technology Hardware & Equipment',
    'Telecommunication Services', 'Transportation', 'Utilities'],
       dtype=object)}

Or only showing one specific parameter:

equities.show_options(
    selection='industry',
    sector='Financials',
    country='Netherlands')

Which returns:

array(['Banks', 'Capital Markets', 'Consumer Finance',
       'Diversified Financial Services', 'Insurance'], dtype=object)

Given this information, it then becomes possible to filter the database based on the parameters you are interested in. For example, if you are interested in 'Insurance' companies in the 'Netherlands', you can use the following. Note that I omit the sector here, given that the selection I make is on a deeper level and therefore it is a given that the sector is 'Financials'.

```python equities.select( country='Netherland

Core symbols most depended-on inside this repo

show_options
called by 72
financedatabase/ETFs.py
select
called by 69
financedatabase/ETFs.py
search
called by 47
financedatabase/helpers.py
show_options
called by 9
financedatabase/Equities.py
show_options
called by 6
financedatabase/Funds.py
show_options
called by 5
financedatabase/Indices.py
show_options
called by 2
financedatabase/Currencies.py
show_options
called by 2
financedatabase/Cryptos.py

Shape

Function 66
Method 44
Class 13

Languages

Python100%

Modules by API surface

tests/conftest.py43 symbols
tests/test_equities.py22 symbols
financedatabase/helpers.py7 symbols
tests/test_indices.py5 symbols
tests/test_funds.py5 symbols
tests/test_etfs.py5 symbols
tests/test_moneymarkets.py4 symbols
tests/test_currencies.py4 symbols
tests/test_cryptos.py4 symbols
tests/test_invariants.py3 symbols
financedatabase/Moneymarkets.py3 symbols
financedatabase/Indices.py3 symbols

For agents

$ claude mcp add FinanceDatabase \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact