Search for Yahoo Finance Symbols

This package currently provides two ways to get tickers.

  • you know the company/security name but are unsure about the ticker use get_symbols()
  • you simply want all tickers listed on the NASDAQ, NYSE, AMEX, ARCA, or BATS use get_all_symbols()

get_all_symbols reads the official Nasdaq Trader symbol directory and returns the symbols already translated to Yahoo Finance's convention, so they can be passed straight to get_prices:

Security typeExchange symbolYahoo symbol
Share classBRK.ABRK-A
PreferredABR-DABR-PD
UnitAAC=AAC-UN
WarrantACHR+ACHR-WT
RightJACS^JACS-RI

Pass yahoo=false to get the raw exchange symbols instead.

Structs

The Items returned by get_symbols

YahooSearch

Basically is a custom Array of YahooSearchItems returned by get_symbols.

mutable struct YahooSearch{YahooSearchItem,N} <: AbstractArray{YahooSearchItem,N}
   arr::Array{YahooSearchItem,N}
end

YahooSearchItem

This is an individual search item in YahooSearch. It contains the following fields:

  • symbol: The Symbol (Ticker)
  • shortname: The short name of the instrument/company
  • quoteType: The type of asset (e.g. EQUITY)
  • sector: The Sector (only if quotetype==EQUITY, otherwise "")
  • industry: The Industry (only if quotetype==EQUITY, otherwise "")
mutable struct YahooSearchItem
   symbol::String
   shortname::String
   exchange::String
   quoteType::String
   sector::String
   industry::String
end

Search Functions

YFinance.get_symbolsFunction
get_symbols(search_term::String)

Allows searches for specific securities.

Arguments

  • search_term::String: Typically a company/security name (e.g. microsoft)

Returns

  • A YahooSearch <: AbstractArray containing YahooSearchItems containing the following fields: symbol::String, shortname::String, exchange::String, quoteType::String, sector::String, industry::String

Example

julia> get_symbols("micro")
7-element YahooSearch{YahooSearchItem, 1}:
 
Symbol:  MGC=F
Name:    Micro Gold Futures,Jun-2023
Type:    FUTURE
Exch.:   New York Commodity Exchange (CMX)


Symbol:  MSFT
Name:    Microsoft Corporation
Type:    EQUITY
Exch.:   NASDAQ (NMS)
Sec.:    Technology
Ind.:    Software—Infrastructure


Symbol:  AMD
Name:    Advanced Micro Devices, Inc.
Type:    EQUITY
Exch.:   NASDAQ (NMS)
Sec.:    Technology
Ind.:    Semiconductors


Symbol:  MU
Name:    Micron Technology, Inc.
Type:    EQUITY
Exch.:   NASDAQ (NMS)
Sec.:    Technology
Ind.:    Semiconductors


Symbol:  MSTR
Name:    MicroStrategy Incorporated
Type:    EQUITY
Exch.:   NASDAQ (NMS)
Sec.:    Technology
Ind.:    Software—Application


Symbol:  SMCI
Name:    Super Micro Computer, Inc.
Type:    EQUITY
Exch.:   NASDAQ (NMS)
Sec.:    Technology
Ind.:    Computer Hardware


Symbol:  FNGU
Name:    MicroSectors FANG  Index 3X Lev
Type:    ETF
Exch.:   NYSEArca (PCX)
source
YFinance.get_all_symbolsFunction
get_all_symbols(market::AbstractString; yahoo::Bool=true)::Vector{String}

Fetch all the symbols from a given market.

Arguments

  • market::AbstractString: The market to fetch the symbols from (case insensitive).

Currently supported markets are:

  • AMEX (NYSE American)
  • ARCA (NYSE Arca)
  • BATS (Cboe BZX)
  • NASDAQ
  • NYSE

Keyword Arguments

  • yahoo::Bool: If true (the default) symbols are translated to Yahoo Finance's convention (e.g. BRK.A becomes BRK-A, the preferred share ABR-D becomes ABR-PD, the warrant ACHR+ becomes ACHR-WT, the right JACS^ becomes JACS-RI, the unit AAC= becomes AAC-UN). Set to false to get the raw exchange symbols instead.

Uses the official Nasdaq Trader symbol directory (nasdaqtrader.com/dynamic/SymDir).

Returns

  • Vector{String}: A vector of strings containing the symbols.

Example

julia> get_all_symbols("NYSE")
2925-element Vector{String}:
 "A"
 "AA"
 "AAC-UN"
 "AADX"
 ⋮
 "ZTR"
 "ZTS"
 "ZVIA"
 "ZWS"
source