edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

can't get a company's icon when the company's ticker contains the - character

Open byqpzs opened this issue 1 year ago • 2 comments

    c = Company("BRK-B")
    print(len(c.icon))

the output:

Traceback (most recent call last):
  File "/Users/hingmed/Documents/GitHub/mine/pythonProject/ticker_info.py", line 50, in <module>
    main()
  File "/Users/hingmed/Documents/GitHub/mine/pythonProject/ticker_info.py", line 28, in main
    print(len(c.icon))
              ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/edgar/entities.py", line 612, in icon
    return get_icon_from_ticker(self.tickers[0])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/edgar/reference/tickers.py", line 409, in get_icon_from_ticker
    raise ValueError("The ticker must only contain alphabetic characters.")
ValueError: The ticker must only contain alphabetic characters.

there are a few tickers that contain non-alpha characters.

Image

byqpzs avatar Mar 12 '25 09:03 byqpzs

We use NVSTLY icons to get the ticker. These don't return anything

https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/BRK.png https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/BRK-A.png https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/BRK.A.png

If we can figure out how to get from that source then the validation can be changed

dgunning avatar Mar 12 '25 13:03 dgunning

If we can figure out how to get from that source then the validation can be changed

If you're getting these from NVSTLY then may need company-specific validation for specific data sources (e.g. NVSTLY) (i.e. a mapping). Here's an updated URL list for the tickers that were listed in this ticket:

BRK-A: https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/BRKA.png BRK-B: https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/BRKB.png USB-PA: https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/USB.png TSMWF: https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/TSM.png SAPGF: https://raw.githubusercontent.com/nvstly/icons/main/ticker_icons/SAP.png NONOF: 404 (truly doesn't exist on NVSTLY)

This touches on a problem that the entire universe of financial tooling struggles with, which is ticker/symbol (mis)matches between different exchanges and tools.

kalavrcom avatar Mar 17 '25 18:03 kalavrcom