Appendix B — The yahooquery Package

B.1 Single Company

from yahooquery import Ticker

ticker = Ticker("NFLX")

Company information:

ticker.summary_profile
{'NFLX': {'address1': '121 Albright Way',
  'city': 'Los Gatos',
  'state': 'CA',
  'zip': '95032',
  'country': 'United States',
  'phone': '(408) 540-3700',
  'website': 'https://www.netflix.com',
  'industry': 'Entertainment',
  'industryKey': 'entertainment',
  'industryDisp': 'Entertainment',
  'sector': 'Communication Services',
  'sectorKey': 'communication-services',
  'sectorDisp': 'Communication Services',
  'longBusinessSummary': 'Netflix, Inc. provides entertainment services. The company offers television (TV) series, documentaries, feature films, and games across various genres and languages. It also provides members the ability to receive streaming content through a host of internet-connected devices, including TVs, digital video players, TV set-top boxes, and mobile devices. The company operates approximately in 190 countries. Netflix, Inc. was incorporated in 1997 and is headquartered in Los Gatos, California.',
  'fullTimeEmployees': 14000,
  'companyOfficers': [],
  'executiveTeam': [],
  'maxAge': 86400}}

Historical prices:

df = ticker.history(start="2024-01-01", end="2024-01-31", adj_ohlc=True)
df.head()
open high low volume close
symbol date
NFLX 2024-01-02 48.319000 48.465000 46.186001 50494000 46.849998
2024-01-03 46.731998 47.505001 46.577000 34437000 47.026001
2024-01-04 47.298000 48.074001 46.653000 36365000 47.466999
2024-01-05 47.650002 47.955002 47.180000 26313000 47.405998
2024-01-08 47.389000 48.523998 47.365002 36758000 48.502998

B.2 Multiple Companies

from yahooquery import Ticker

tickers = Ticker( ["MSFT", "AAPL", "GOOGL"])

Company information:

tickers.summary_profile
{'MSFT': {'address1': 'One Microsoft Way',
  'city': 'Redmond',
  'state': 'WA',
  'zip': '98052-6399',
  'country': 'United States',
  'phone': '425 882 8080',
  'website': 'https://www.microsoft.com',
  'industry': 'Software - Infrastructure',
  'industryKey': 'software-infrastructure',
  'industryDisp': 'Software - Infrastructure',
  'sector': 'Technology',
  'sectorKey': 'technology',
  'sectorDisp': 'Technology',
  'longBusinessSummary': "Microsoft Corporation develops and supports software, services, devices, and solutions worldwide. The company's Productivity and Business Processes segment offers Microsoft 365 Commercial, Enterprise Mobility + Security, Windows Commercial, Power BI, Exchange, SharePoint, Microsoft Teams, Security and Compliance, and Copilot; Microsoft 365 Commercial products, such as Windows Commercial on-premises and Office licensed services; Microsoft 365 Consumer products and cloud services, such as Microsoft 365 Consumer subscriptions, Office licensed on-premises, and other consumer services; LinkedIn; Dynamics products and cloud services, such as Dynamics 365, cloud-based applications, and on-premises ERP and CRM applications. Its Intelligent Cloud segment provides Server products and cloud services, such as Azure and other cloud services, GitHub, Nuance Healthcare, virtual desktop offerings, and other cloud services; Server products, including SQL and Windows Server, Visual Studio and System Center related Client Access Licenses, and other on-premises offerings; Enterprise and partner services, including Enterprise Support and Nuance professional Services, Industry Solutions, Microsoft Partner Network, and Learning Experience. The company's Personal Computing segment provides Windows and Devices, such as Windows OEM licensing and Devices and Surface and PC accessories; Gaming services and solutions, such as Xbox hardware, content, and services, first- and third-party content Xbox Game Pass, subscriptions, and Cloud Gaming, advertising, and other cloud services; search and news advertising services, such as Bing and Copilot, Microsoft News and Edge, and third-party affiliates. It sells its products through OEMs, distributors, and resellers; and online and retail stores. The company was founded in 1975 and is headquartered in Redmond, Washington.",
  'fullTimeEmployees': 228000,
  'companyOfficers': [],
  'irWebsite': 'http://www.microsoft.com/investor/default.aspx',
  'executiveTeam': [],
  'maxAge': 86400},
 'AAPL': {'address1': 'One Apple Park Way',
  'city': 'Cupertino',
  'state': 'CA',
  'zip': '95014',
  'country': 'United States',
  'phone': '(408) 996-1010',
  'website': 'https://www.apple.com',
  'industry': 'Consumer Electronics',
  'industryKey': 'consumer-electronics',
  'industryDisp': 'Consumer Electronics',
  'sector': 'Technology',
  'sectorKey': 'technology',
  'sectorDisp': 'Technology',
  'longBusinessSummary': 'Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. The company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; and wearables, home, and accessories comprising AirPods, Apple Vision Pro, Apple TV, Apple Watch, Beats products, and HomePod, as well as Apple branded and third-party accessories. It also provides AppleCare support and cloud services; and operates various platforms, including the App Store that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts, as well as advertising services include third-party licensing arrangements and its own advertising platforms. In addition, the company offers various subscription-based services, such as Apple Arcade, a game subscription service; Apple Fitness+, a personalized fitness service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV, which offers exclusive original content and live sports; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It distributes third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers and resellers. The company was formerly known as Apple Computer, Inc. and changed its name to Apple Inc. in January 2007. Apple Inc. was founded in 1976 and is headquartered in Cupertino, California.',
  'fullTimeEmployees': 166000,
  'companyOfficers': [],
  'irWebsite': 'http://investor.apple.com/',
  'executiveTeam': [],
  'maxAge': 86400},
 'GOOGL': {'address1': '1600 Amphitheatre Parkway',
  'city': 'Mountain View',
  'state': 'CA',
  'zip': '94043',
  'country': 'United States',
  'phone': '650-253-0000',
  'website': 'https://abc.xyz',
  'industry': 'Internet Content & Information',
  'industryKey': 'internet-content-information',
  'industryDisp': 'Internet Content & Information',
  'sector': 'Communication Services',
  'sectorKey': 'communication-services',
  'sectorDisp': 'Communication Services',
  'longBusinessSummary': 'Alphabet Inc. offers various products and platforms in the United States, Europe, the Middle East, Africa, the Asia-Pacific, Canada, and Latin America. It operates through Google Services, Google Cloud, and Other Bets segments. The Google Services segment provides products and services, including ads, Android, Chrome, devices, Gmail, Google Drive, Google Maps, Google Photos, Google Play, Search, and YouTube. It is also involved in the sale of apps and in-app purchases and digital content in the Google Play and YouTube; and devices, as well as the provision of YouTube consumer subscription services, such as YouTube TV, YouTube Music and Premium, NFL Sunday Ticket, and Google One. The Google Cloud segment provides consumption-based fees and subscriptions for AI solutions, including AI infrastructure, Vertex AI platform, and Gemini for Google Cloud. It also provides cybersecurity, and data and analytics services; Google Workspace that include cloud-based communication and collaboration tools for enterprises, such as Calendar, Gmail, Docs, Drive, and Meet; and other services for enterprise customers. The Other Bets segment sells healthcare-related and internet services. Alphabet Inc. was incorporated in 1998 and is headquartered in Mountain View, California.',
  'fullTimeEmployees': 190167,
  'companyOfficers': [],
  'executiveTeam': [],
  'maxAge': 86400}}

Historical prices:

df = tickers.history()
df.head()
open high low close volume adjclose
symbol date
MSFT 2026-01-02 484.390015 484.660004 470.160004 472.940002 25571600 472.940002
2026-01-05 474.059998 476.070007 469.500000 472.850006 25250300 472.850006
2026-01-06 473.799988 478.739990 469.750000 478.510010 23037700 478.510010
2026-01-07 479.760010 489.700012 477.950012 483.470001 25564200 483.470001
2026-01-08 481.239990 482.660004 475.859985 478.109985 18162600 478.109985
df.tail()
open high low close volume adjclose
symbol date
GOOGL 2026-01-05 317.660004 319.019989 314.630005 316.540009 30195600 316.540009
2026-01-06 316.399994 320.940002 311.779999 314.339996 31212100 314.339996
2026-01-07 314.359985 326.149994 314.190002 321.980011 35104400 321.980011
2026-01-08 328.970001 330.320007 321.500000 325.440002 31896100 325.440002
2026-01-09 16:00:01-05:00 327.079987 330.829987 325.799988 328.570007 26015743 328.570007

Simplifying the multi-index:

df["symbol"] = df.index.get_level_values(0)
df["date"] = df.index.get_level_values(1)

df.reset_index(drop=True, inplace=True)

df[["date", "symbol", "adjclose"]].head()
date symbol adjclose
0 2026-01-02 MSFT 472.940002
1 2026-01-05 MSFT 472.850006
2 2026-01-06 MSFT 478.510010
3 2026-01-07 MSFT 483.470001
4 2026-01-08 MSFT 478.109985

Optionally converting dates to be datetime-aware:

from pandas import to_datetime

# fix date values (see: https://github.com/dpguthrie/yahooquery/issues/210)
df["date"] = df["date"].astype("str")
df["date"] = df["date"].str.split(" ").str[0]
# convert to datetime-aware values:
df["date"] = to_datetime(df["date"]).dt.date

df[["date", "symbol", "adjclose"]].head()
date symbol adjclose
0 2026-01-02 MSFT 472.940002
1 2026-01-05 MSFT 472.850006
2 2026-01-06 MSFT 478.510010
3 2026-01-07 MSFT 483.470001
4 2026-01-08 MSFT 478.109985

Pivoting the data:

prices_pivot = df.pivot(columns="symbol", values="adjclose", index="date")
prices_pivot.head()
symbol AAPL GOOGL MSFT
date
2026-01-02 271.010010 315.149994 472.940002
2026-01-05 267.260010 316.540009 472.850006
2026-01-06 262.359985 314.339996 478.510010
2026-01-07 260.329987 321.980011 483.470001
2026-01-08 259.040009 325.440002 478.109985