Skip to main content

Release Build PyPI - Downloads Coverage Status Codacy Badge

pytickersymbols

pytickersymbols provides access to google and yahoo ticker symbols for all stocks of the following indices:

  • AEX
  • BEL 20
  • CAC 40
  • CAC MID 60
  • DAX
  • DOW JONES
  • EURO STOXX 50
  • FTSE 100
  • IBEX 35
  • MDAX
  • NASDAQ 100
  • OMX Helsinki 25
  • OMX Stockholm 30
  • S&P 100
  • S&P 500
  • S&P 600
  • SDAX
  • Switzerland 20
  • TECDAX

install

pip3 install pytickersymbols

quick start

Get all countries, indices and industries as follows:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
countries = stock_data.get_all_countries()
indices = stock_data.get_all_indices()
industries = stock_data.get_all_industries()

You can select all stocks of an index as follows:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
german_stocks = stock_data.get_stocks_by_index('DAX')
uk_stocks = stock_data.get_stocks_by_index('FTSE 100')

print(list(uk_stocks))

If you are only interested in ticker symbols, then you should have a look at the following lines:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
# the naming conversation is get_{index_name}_{exchange_city}_{yahoo or google}_tickers
dax_google = stock_data.get_dax_frankfurt_google_tickers()
dax_yahoo = stock_data.get_dax_frankfurt_yahoo_tickers()
sp100_yahoo = stock_data.get_sp_100_nyc_yahoo_tickers()
sp500_google = stock_data.get_sp_500_nyc_google_tickers()
dow_yahoo = stock_data.get_dow_jones_nyc_yahoo_tickers()
# there are too many combination. Here is a complete list of all getters
all_ticker_getter_names = list(filter(
   lambda x: (
         x.endswith('_google_tickers') or x.endswith('_yahoo_tickers')
   ),
   dir(stock_data),
))
print(all_ticker_getter_names)

Iterator Examples

Use iterator-based APIs to stream results without building large lists:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()

# Stream indices
for index in stock_data.iter_all_indices():
   print(index)

# Stream all unique stocks
for company in stock_data.iter_all_stocks():
   print(company['name'])

# Stream industries and countries
for industry in stock_data.iter_all_industries():
   pass  # handle industry
for country in stock_data.iter_all_countries():
   pass  # handle country

# Stream Yahoo tickers for an index (flattened)
for tickers in stock_data.iter_yahoo_ticker_symbols_by_index('DAX'):
   for ticker in tickers:
      print(ticker)

# Stream tickers using exchange-specific dynamic methods
for ticker in stock_data._iter_tickers_by_index('DAX', ('FRA:',), 'yahoo'):
   print(ticker)

Development

Setting up the development environment

This project uses Poetry for dependency management. To set up your development environment:

# Install Poetry if you haven't already
curl -sSL https://install.python-poetry.org | python3 -

# Clone the repository
git clone https://github.com/portfolioplus/pytickersymbols.git
cd pytickersymbols

# Install dependencies (including dev dependencies)
poetry install

# Activate the virtual environment
poetry shell

Development Tools

The tools/ directory contains scripts for managing stock index data:

  • build_indices.py: End-to-end pipeline to parse Wikipedia, enrich with stocks.yaml, canonicalize names, and generate the Python data module.
  • wiki_table_parser.py: Utilities to parse Wikipedia tables configured via index_sources.yaml.
  • enrich_indices.py: Merge raw parsed data with stocks.yaml historical metadata and symbols.
  • canonicalize_names.py: Normalize company display names across indices using ISIN/Wikipedia.
  • sync_canonical_to_stocks.py: Propagate canonical names back to stocks.yaml.
  • enrich_with_yfinance.py: Optional enrichment helpers using Yahoo Finance.

See tools/README.md for detailed usage instructions.

Running Tests

poetry run pytest

Adding a New Index

To add a new stock index to the library:

  1. Add the index to configuration
    Edit tools/index_sources.yaml and add a new entry:

    - name: NIKKEI 225
      source:
        type: wikipedia
        url: https://en.wikipedia.org/wiki/Nikkei_225
        table_title_regex: "Components"
        extract_company_info: true
        language_fallbacks: ["ja", "en"]
        columns:
          name: ["Company", "Name"]
          symbol: ["Ticker", "Symbol"]
          isin: ["ISIN"]
          sector: ["Sector", "Industry"]
        symbol_converter:
          - pattern: "^(.+)$"
            format: "{1}.T"  # Add .T suffix for Tokyo Stock Exchange
      match:
        by: symbol
    

    Configuration options:

    • name: Display name (must match stocks.yaml if merging with historical data)
    • url: Wikipedia page URL containing the index constituents table
    • table_title_regex: (Optional) Regex to match the table title
    • extract_company_info: Set to true to fetch additional details from company Wikipedia pages
    • language_fallbacks: List of Wikipedia language codes to try for ISIN lookup
    • symbol_converter: Rules to convert Wikipedia symbols to Yahoo Finance format
    • columns: Map Wikipedia table headers to data fields
    • match.by: Field to use for matching with historical data (symbol, isin, or name)
  2. Run the build pipeline
    This will parse Wikipedia, enrich the data, and generate the Python module:

    cd tools
    python build_indices.py
    

    This creates:

    • indices_raw/<index_name>.json - Raw parsed data from Wikipedia
    • indices/<index_name>.yaml - Enriched data merged with historical records
    • Updates src/pytickersymbols/indices_data.py - Generated Python module
  3. Test the new index
    Verify the index is accessible:

    from pytickersymbols import PyTickerSymbols
    
    stock_data = PyTickerSymbols()
    nikkei_stocks = stock_data.get_stocks_by_index('NIKKEI 225')
    print(list(nikkei_stocks))
    
  4. Run tests
    Ensure everything works:

    poetry run pytest
    
  5. Update the index list
    Add a checkbox entry to the supported indices list at the top of this README.

Note: The build pipeline automatically runs weekly via GitHub Actions to keep index data up to date.

Performance Tips

  • Lookups for stocks by symbol and aggregated lists/sets are internally cached for speed. After calling load_json() or load_yaml(), caches are automatically rebuilt.
  • For large results, prefer generator variants to avoid materializing lists: iter_all_indices(), iter_all_stocks(), iter_all_countries(), iter_all_industries(), and iter_yahoo_ticker_symbols_by_index() / iter_google_ticker_symbols_by_index().
  • Dynamic ticker getters follow the naming convention get_{index_name}_{exchange_city}_{yahoo|google}_tickers and return lists. Use _iter_tickers_by_index() for streaming if needed.

issue tracker

https://github.com/portfolioplus/pytickersymbols/issues

Metadata

Release files for pytickersymbols 1.17.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytickersymbols 1.17.10
File Size Uploaded Provenance
pytickersymbols-1.17.10.tar.gz 401.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytickersymbols 1.17.10
File Interpreter ABI Platform
pytickersymbols-1.17.10-py3-none-any.whl Python 3 none any Details

Total release size: 807.4 kB

Release files / pytickersymbols-1.17.10.tar.gz

Download URL pytickersymbols-1.17.10.tar.gz
Size 401.1 kB
Tags Source
SHA-256 checksum
How to use checksums
128bb5f2b91d0a57046375a1a996586b47f6631dba921498c669993319e6779a
BLAKE2b-256 checksum
How to use checksums
51c0876cb3a3c228bd9131f8bb9787c94e332c36b3d8ac1f8d9fa39d53ca1378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.

Transparency log

Release files / pytickersymbols-1.17.10-py3-none-any.whl

Download URL pytickersymbols-1.17.10-py3-none-any.whl
Size 406.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
126ba59039f62fbde99d02b49eb180f0eb7987120aa8daaa25fe4b1c1651eb57
BLAKE2b-256 checksum
How to use checksums
9f038ccdde11b5b997e4e9dfa4815171e398205eda699c8edc8dfc55f53fc165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.

Transparency log

Security for pytickersymbols 1.17.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytickersymbols-1.17.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.17.10 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page