In the previous lesson, you read one stock's daily market data. That table answered a time-series question: What happened to one symbol over time?
This lesson answers a different question: What symbols are available in a market?
To answer that question, FinanceDataReader gives us a different tool:
StockListing().
What you will finish: you will load a U.S. stock-market listing, inspect its columns, and print a short table showing ticker symbols and company names.
1. First, Understand the Goal
In Phase 1-2, we used:
fdr.DataReader("AAPL", "2025-01-02", "2025-01-10")
That returned daily price data for one symbol.
Now we want something different. We want a list of stocks in a market such as NASDAQ.
DataReader()
→ one symbol over time
StockListing()
→ many symbols in one market
So this lesson is not about prices yet. It is about the list of available stocks.
2. Create a New Python File
Open your alphesta-lab folder in Visual Studio Code and create:
get_us_stock_listing.py
Your folder can now look like this:
alphesta-lab/
├── hello_alphesta.py
├── check_packages.py
├── first_market_data.py
├── read_ohlcv.py
└── get_us_stock_listing.py
3. Import FinanceDataReader
import FinanceDataReader as fdr
This is the same package you already used before. The new part is the function we will call.
4. Choose One U.S. Market
We will start with NASDAQ.
market = "NASDAQ"
Think of this as the input that tells FinanceDataReader which market we want to inspect.
5. Request the Market Listing
Add:
listing = fdr.StockListing(market)
Read this in plain English:
fdr.StockListing("NASDAQ")
→ Give me the stock listing for NASDAQ.
The result is stored in a variable named listing.
6. Print the First Five Rows
Add:
print(listing.head())
As before, head() shows the first five rows.
But notice what the rows represent this time.
DataReader result
→ one row = one trading day
StockListing result
→ one row = one company or security
That difference is important.
7. Look at the Column Names
Add:
print(listing.columns)
You may see columns such as:
Symbol
Name
Industry
Sector
...
The exact columns can vary depending on the source and current package behavior. That is normal.
What matters is the structure:
one row
= one listed stock
one column
= one type of company or listing information
8. Show Only the Most Useful Two Columns
Large tables can feel overwhelming. So let us select only the two most beginner-friendly columns first:
print(listing[["Symbol", "Name"]].head(10))
Read that as:
listing[["Symbol", "Name"]]
→ select only the Symbol and Name columns
.head(10)
→ show the first ten rows
This usually gives a simple result such as:
Symbol Name
0 ... ...
1 ... ...
2 ... ...
Now the table is easier to read.
9. What Do Symbol and Name Mean?
Symbol is the ticker code used in the market.
AAPL
MSFT
NVDA
These are examples of ticker symbols.
Name is the company or security name written in a more readable form.
AAPL → Apple
MSFT → Microsoft
NVDA → NVIDIA
In many workflows, you use the listing table to discover the symbol,
and then you pass that symbol into DataReader() later.
10. Your Complete File
import FinanceDataReader as fdr
market = "NASDAQ"
listing = fdr.StockListing(market)
print("First five rows:")
print(listing.head())
print("\nColumns:")
print(listing.columns)
print("\nSymbol and Name:")
print(listing[["Symbol", "Name"]].head(10))
11. Change One Input Yourself
Change:
market = "NASDAQ"
to:
market = "NYSE"
Then run the file again.
Ask yourself:
same code
+ different market
→ different listing table
This small change helps you understand that the market name is an input, just like the symbol and dates were inputs in earlier lessons.
Check Your Understanding
- You understand that
StockListing()returns a market listing, not daily price data. - You understand that one row usually represents one listed stock or security.
- You can explain what
SymbolandNamemean. - You can explain what
listing[["Symbol", "Name"]]does. - You changed NASDAQ to NYSE and observed a different result.
What You Just Learned
StockListing("NASDAQ")
↓
market listing DataFrame
↓
one row = one stock
↓
columns such as Symbol and Name
This is a new kind of market-data table. It does not tell you how price moved over time. It tells you what securities exist in a market.
Where Do We Go Next?
Now that you can load a listing, the next natural question is: How do we find one company inside a large market table?
That will be the next step.
← Previous: How to Read OHLCV Market Data in a pandas DataFrame
Next: How to Find One Stock in a Market Listing with Python →
Reference note: FinanceDataReader supports market-listing workflows such as
StockListing(). The exact columns and ordering can vary by source and package version.