{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Finding Symbols\n",
"\n",
"\n",
"Finding the ticker symbol, security identifier, the sector, and other metadata is easy if you know where to look. This guide is intended to introduce some methods for searching, screening, and discovery.\n",
"\n",
"For maximum coverage and functionality, install OpenBB with `[all]` packages.\n",
"\n",
"The examples here will assume that the OpenBB Platform has been installed, the environment is active, and it has been imported into a Python session. If the installation is fresh, or an extension was just installed, the Python interface will need to be rebuilt. It will only take a few moments to complete."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from openbb import obb\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The simplest way to find tickers for a company is with a simple fuzzy query.\n",
"\n",
"## Search the SEC\n",
"\n",
"Perform a quick search using the `openbb-sec` provider.\n",
"\n",
"### Find a Company\n",
"\n",
"Use an empty string, `\"\"`, to return the complete list - over 10,000."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10840"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all_companies = obb.equity.search(\"\", provider=\"sec\")\n",
"\n",
"len(all_companies.results)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The SEC sorts this list by market cap. Applying the `to_df()` method to `all_companies` will show Apple on top"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" symbol | \n",
" name | \n",
" cik | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" AAPL | \n",
" Apple Inc. | \n",
" 320193 | \n",
"
\n",
" \n",
" | 1 | \n",
" MSFT | \n",
" MICROSOFT CORP | \n",
" 789019 | \n",
"
\n",
" \n",
" | 2 | \n",
" GOOGL | \n",
" Alphabet Inc. | \n",
" 1652044 | \n",
"
\n",
" \n",
" | 3 | \n",
" AMZN | \n",
" AMAZON COM INC | \n",
" 1018724 | \n",
"
\n",
" \n",
" | 4 | \n",
" NVDA | \n",
" NVIDIA CORP | \n",
" 1045810 | \n",
"
\n",
" \n",
" | 5 | \n",
" META | \n",
" Meta Platforms, Inc. | \n",
" 1326801 | \n",
"
\n",
" \n",
" | 6 | \n",
" BRK-B | \n",
" BERKSHIRE HATHAWAY INC | \n",
" 1067983 | \n",
"
\n",
" \n",
" | 7 | \n",
" TSLA | \n",
" Tesla, Inc. | \n",
" 1318605 | \n",
"
\n",
" \n",
" | 8 | \n",
" LLY | \n",
" ELI LILLY & Co | \n",
" 59478 | \n",
"
\n",
" \n",
" | 9 | \n",
" V | \n",
" VISA INC. | \n",
" 1403161 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" symbol name cik\n",
"0 AAPL Apple Inc. 320193\n",
"1 MSFT MICROSOFT CORP 789019\n",
"2 GOOGL Alphabet Inc. 1652044\n",
"3 AMZN AMAZON COM INC 1018724\n",
"4 NVDA NVIDIA CORP 1045810\n",
"5 META Meta Platforms, Inc. 1326801\n",
"6 BRK-B BERKSHIRE HATHAWAY INC 1067983\n",
"7 TSLA Tesla, Inc. 1318605\n",
"8 LLY ELI LILLY & Co 59478\n",
"9 V VISA INC. 1403161"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all_companies.to_df().head(10)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Find an Institution\n",
"\n",
"Some reporting companies, like invesment trusts and insurance companies, do not have a ticker symbol directly associated with them. Filers in the US will have a CIK number, used to retrieve documents from the SEC."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" cik | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" BERKSHIRE HATHAWAY ENERGY CO | \n",
" 0001081316 | \n",
"
\n",
" \n",
" | 1 | \n",
" BERKSHIRE HATHAWAY FINANCE CORP | \n",
" 0001274791 | \n",
"
\n",
" \n",
" | 2 | \n",
" BERKSHIRE HATHAWAY HOMESTATE INSURANCE CO. | \n",
" 0000829771 | \n",
"
\n",
" \n",
" | 3 | \n",
" BERKSHIRE HATHAWAY INC /DE/ | \n",
" 0000109694 | \n",
"
\n",
" \n",
" | 4 | \n",
" BERKSHIRE HATHAWAY INC/DE | \n",
" 0000109694 | \n",
"
\n",
" \n",
" | 5 | \n",
" BERKSHIRE HATHAWAY INC | \n",
" 0001067983 | \n",
"
\n",
" \n",
" | 6 | \n",
" BERKSHIRE HATHAWAY LIFE INSURANCE CO OF NEBRASKA | \n",
" 0001015867 | \n",
"
\n",
" \n",
" | 7 | \n",
" LMZ & BERKSHIRE HATHAWAY CO | \n",
" 0001652795 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name cik\n",
"0 BERKSHIRE HATHAWAY ENERGY CO 0001081316\n",
"1 BERKSHIRE HATHAWAY FINANCE CORP 0001274791\n",
"2 BERKSHIRE HATHAWAY HOMESTATE INSURANCE CO. 0000829771\n",
"3 BERKSHIRE HATHAWAY INC /DE/ 0000109694\n",
"4 BERKSHIRE HATHAWAY INC/DE 0000109694\n",
"5 BERKSHIRE HATHAWAY INC 0001067983\n",
"6 BERKSHIRE HATHAWAY LIFE INSURANCE CO OF NEBRASKA 0001015867\n",
"7 LMZ & BERKSHIRE HATHAWAY CO 0001652795"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"instututions = obb.regulators.sec.institutions_search(\"Berkshire Hathaway\").to_df()\n",
"instututions\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Find a Filing\n",
"\n",
"Search for filings by CIK or ticker symbol."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"type 13F-NT\n",
"link https://www.sec.gov/Archives/edgar/data/000082...\n",
"report_date 2023-09-30\n",
"accepted_date 2023-11-14 16:15:06+00:00\n",
"act 34\n",
"items \n",
"primary_doc_description \n",
"primary_doc xslForm13F_X02/primary_doc.xml\n",
"accession_number 0000950123-23-010929\n",
"file_number 028-02226\n",
"film_number 231406391\n",
"is_inline_xbrl 0\n",
"is_xbrl 0\n",
"size 2960\n",
"complete_submission_url https://www.sec.gov/Archives/edgar/data/000082...\n",
"filing_detail_url https://www.sec.gov/Archives/edgar/data/000082...\n",
"Name: 2023-11-14 00:00:00, dtype: object"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"homestate_filings = obb.equity.fundamental.filings(cik=\"0000829771\", provider=\"sec\")\n",
"\n",
"homestate_filings.to_df().iloc[-1]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Or, search by form type."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"type 4\n",
"link https://www.sec.gov/Archives/edgar/data/000032...\n",
"report_date 2023-11-10\n",
"accepted_date 2023-11-14 18:31:09+00:00\n",
"act \n",
"items \n",
"primary_doc_description FORM 4\n",
"primary_doc xslF345X05/wk-form4_1700004649.xml\n",
"accession_number 0000320193-23-000109\n",
"file_number \n",
"film_number \n",
"is_inline_xbrl 0\n",
"is_xbrl 0\n",
"size 5066\n",
"complete_submission_url https://www.sec.gov/Archives/edgar/data/000032...\n",
"filing_detail_url https://www.sec.gov/Archives/edgar/data/000032...\n",
"Name: 2023-11-14 00:00:00, dtype: object"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"aapl_filings = obb.equity.fundamental.filings(\"AAPL\", type=\"4\", provider=\"sec\")\n",
"\n",
"aapl_filings.to_df().iloc[-1]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Screen Markets\n",
"\n",
"Screeners provide a targeted search, a tool for comparison and discovery. Find stocks from around the world with the screener endpoint, and the `openbb-fmp` provider.\n",
"\n",
"### Find Stocks From India"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1822"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" symbol | \n",
" name | \n",
" market_cap | \n",
" sector | \n",
" industry | \n",
" beta | \n",
" price | \n",
" last_annual_dividend | \n",
" volume | \n",
" exchange | \n",
" exchange_name | \n",
" country | \n",
" is_etf | \n",
" actively_trading | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" RELIANCE.NS | \n",
" Reliance Industries Limited | \n",
" 15895961017165 | \n",
" Energy | \n",
" Oil & Gas Refining & Marketing | \n",
" 0.721409 | \n",
" 2349.35 | \n",
" 9 | \n",
" 2244671 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 1 | \n",
" TCS.NS | \n",
" Tata Consultancy Services Limited | \n",
" 12878392323686 | \n",
" Technology | \n",
" Information Technology Services | \n",
" 0.528 | \n",
" 3519.6 | \n",
" 36 | \n",
" 1473232 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 2 | \n",
" HDFCBANK.NS | \n",
" HDFC Bank Limited | \n",
" 11345550050918 | \n",
" Financial Services | \n",
" Banks—Regional | \n",
" 0.714285 | \n",
" 1505.2 | \n",
" 19 | \n",
" 9665132 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 3 | \n",
" ICICIBANK.NS | \n",
" ICICI Bank Limited | \n",
" 6456176076595 | \n",
" Financial Services | \n",
" Banks—Regional | \n",
" 0.808 | \n",
" 921.45 | \n",
" 8 | \n",
" 10561389 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 4 | \n",
" INFY.NS | \n",
" Infosys Limited | \n",
" 5945857635942 | \n",
" Technology | \n",
" Information Technology Services | \n",
" 0.596 | \n",
" 1436.6 | \n",
" 36 | \n",
" 3584088 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" symbol name market_cap \\\n",
"0 RELIANCE.NS Reliance Industries Limited 15895961017165 \n",
"1 TCS.NS Tata Consultancy Services Limited 12878392323686 \n",
"2 HDFCBANK.NS HDFC Bank Limited 11345550050918 \n",
"3 ICICIBANK.NS ICICI Bank Limited 6456176076595 \n",
"4 INFY.NS Infosys Limited 5945857635942 \n",
"\n",
" sector industry beta price \\\n",
"0 Energy Oil & Gas Refining & Marketing 0.721409 2349.35 \n",
"1 Technology Information Technology Services 0.528 3519.6 \n",
"2 Financial Services Banks—Regional 0.714285 1505.2 \n",
"3 Financial Services Banks—Regional 0.808 921.45 \n",
"4 Technology Information Technology Services 0.596 1436.6 \n",
"\n",
" last_annual_dividend volume exchange exchange_name \\\n",
"0 9 2244671 NSE National Stock Exchange of India \n",
"1 36 1473232 NSE National Stock Exchange of India \n",
"2 19 9665132 NSE National Stock Exchange of India \n",
"3 8 10561389 NSE National Stock Exchange of India \n",
"4 36 3584088 NSE National Stock Exchange of India \n",
"\n",
" country is_etf actively_trading \n",
"0 IN False True \n",
"1 IN False True \n",
"2 IN False True \n",
"3 IN False True \n",
"4 IN False True "
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"results = obb.equity.screener(country=\"IN\", provider=\"fmp\").to_df()\n",
"display(len(results))\n",
"results.head(5).convert_dtypes()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Search by Sector"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"190"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" symbol | \n",
" name | \n",
" market_cap | \n",
" sector | \n",
" industry | \n",
" beta | \n",
" price | \n",
" last_annual_dividend | \n",
" volume | \n",
" exchange | \n",
" exchange_name | \n",
" country | \n",
" is_etf | \n",
" actively_trading | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" HDFCBANK.NS | \n",
" HDFC Bank Limited | \n",
" 11345550050918 | \n",
" Financial Services | \n",
" Banks—Regional | \n",
" 0.714285 | \n",
" 1505.2 | \n",
" 19.0 | \n",
" 9665132 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 1 | \n",
" ICICIBANK.NS | \n",
" ICICI Bank Limited | \n",
" 6456176076595 | \n",
" Financial Services | \n",
" Banks—Regional | \n",
" 0.808 | \n",
" 921.45 | \n",
" 8.0 | \n",
" 10561389 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 2 | \n",
" SBIN.NS | \n",
" State Bank of India | \n",
" 5031248625920 | \n",
" Financial Services | \n",
" Banks—Regional | \n",
" 0.74 | \n",
" 563.75 | \n",
" 11.3 | \n",
" 12710950 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 3 | \n",
" BAJFINANCE.NS | \n",
" Bajaj Finance Limited | \n",
" 4282998873754 | \n",
" Financial Services | \n",
" Credit Services | \n",
" 0.947 | \n",
" 7068.6 | \n",
" 30.0 | \n",
" 1901753 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 4 | \n",
" LICI.NS | \n",
" Life Insurance Corporation of India | \n",
" 3870900117504 | \n",
" Financial Services | \n",
" Insurance—Life | \n",
" <NA> | \n",
" 612.0 | \n",
" 3.0 | \n",
" 500820 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" symbol name market_cap \\\n",
"0 HDFCBANK.NS HDFC Bank Limited 11345550050918 \n",
"1 ICICIBANK.NS ICICI Bank Limited 6456176076595 \n",
"2 SBIN.NS State Bank of India 5031248625920 \n",
"3 BAJFINANCE.NS Bajaj Finance Limited 4282998873754 \n",
"4 LICI.NS Life Insurance Corporation of India 3870900117504 \n",
"\n",
" sector industry beta price \\\n",
"0 Financial Services Banks—Regional 0.714285 1505.2 \n",
"1 Financial Services Banks—Regional 0.808 921.45 \n",
"2 Financial Services Banks—Regional 0.74 563.75 \n",
"3 Financial Services Credit Services 0.947 7068.6 \n",
"4 Financial Services Insurance—Life 612.0 \n",
"\n",
" last_annual_dividend volume exchange exchange_name \\\n",
"0 19.0 9665132 NSE National Stock Exchange of India \n",
"1 8.0 10561389 NSE National Stock Exchange of India \n",
"2 11.3 12710950 NSE National Stock Exchange of India \n",
"3 30.0 1901753 NSE National Stock Exchange of India \n",
"4 3.0 500820 NSE National Stock Exchange of India \n",
"\n",
" country is_etf actively_trading \n",
"0 IN False True \n",
"1 IN False True \n",
"2 IN False True \n",
"3 IN False True \n",
"4 IN False True "
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sector_results = obb.equity.screener(country=\"IN\", sector=\"Financial Services\", provider=\"fmp\").to_df()\n",
"display(len(sector_results))\n",
"sector_results.head(5).convert_dtypes()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Search by Industry"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"119"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" symbol | \n",
" name | \n",
" market_cap | \n",
" sector | \n",
" industry | \n",
" beta | \n",
" price | \n",
" last_annual_dividend | \n",
" volume | \n",
" exchange | \n",
" exchange_name | \n",
" country | \n",
" is_etf | \n",
" actively_trading | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" PAGEIND.NS | \n",
" Page Industries Limited | \n",
" 418555116755 | \n",
" Consumer Cyclical | \n",
" Apparel Manufacturing | \n",
" 0.462 | \n",
" 37525.45 | \n",
" 300.0 | \n",
" 11199 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 1 | \n",
" KPRMILL.NS | \n",
" K.P.R. Mill Limited | \n",
" 284132900800 | \n",
" Consumer Cyclical | \n",
" Apparel Manufacturing | \n",
" 0.689 | \n",
" 831.25 | \n",
" 4.15 | \n",
" 342210 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 2 | \n",
" ABFRL.NS | \n",
" Aditya Birla Fashion and Retail Limited | \n",
" 203500974285 | \n",
" Consumer Cyclical | \n",
" Apparel Manufacturing | \n",
" 0.152 | \n",
" 214.4 | \n",
" <NA> | \n",
" 1363689 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 3 | \n",
" TRIDENT.NS | \n",
" Trident Limited | \n",
" 189060118374 | \n",
" Consumer Cyclical | \n",
" Textile Manufacturing | \n",
" 0.532 | \n",
" 37.1 | \n",
" 0.36 | \n",
" 7863777 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 4 | \n",
" WELSPUNIND.NS | \n",
" Welspun India Limited | \n",
" 157481652339 | \n",
" Consumer Cyclical | \n",
" Textile Manufacturing | \n",
" 0.423 | \n",
" 162.05 | \n",
" 0.1 | \n",
" 3348644 | \n",
" NSE | \n",
" National Stock Exchange of India | \n",
" IN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" symbol name market_cap \\\n",
"0 PAGEIND.NS Page Industries Limited 418555116755 \n",
"1 KPRMILL.NS K.P.R. Mill Limited 284132900800 \n",
"2 ABFRL.NS Aditya Birla Fashion and Retail Limited 203500974285 \n",
"3 TRIDENT.NS Trident Limited 189060118374 \n",
"4 WELSPUNIND.NS Welspun India Limited 157481652339 \n",
"\n",
" sector industry beta price \\\n",
"0 Consumer Cyclical Apparel Manufacturing 0.462 37525.45 \n",
"1 Consumer Cyclical Apparel Manufacturing 0.689 831.25 \n",
"2 Consumer Cyclical Apparel Manufacturing 0.152 214.4 \n",
"3 Consumer Cyclical Textile Manufacturing 0.532 37.1 \n",
"4 Consumer Cyclical Textile Manufacturing 0.423 162.05 \n",
"\n",
" last_annual_dividend volume exchange exchange_name \\\n",
"0 300.0 11199 NSE National Stock Exchange of India \n",
"1 4.15 342210 NSE National Stock Exchange of India \n",
"2 1363689 NSE National Stock Exchange of India \n",
"3 0.36 7863777 NSE National Stock Exchange of India \n",
"4 0.1 3348644 NSE National Stock Exchange of India \n",
"\n",
" country is_etf actively_trading \n",
"0 IN False True \n",
"1 IN False True \n",
"2 IN False True \n",
"3 IN False True \n",
"4 IN False True "
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"industry_results = obb.equity.screener(country=\"IN\", industry=\"manufacturing\").to_df()\n",
"display(len(industry_results))\n",
"industry_results.head(5).convert_dtypes()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Search by Exchange\n",
"\n",
"Some countries, like America, have multiple exchanges. Narrow the search by combining two or more parameters. The example below finds the companies listed on the American Stock Exchange (AMEX) that are domiciled in China."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" symbol | \n",
" name | \n",
" market_cap | \n",
" sector | \n",
" industry | \n",
" beta | \n",
" price | \n",
" volume | \n",
" exchange | \n",
" exchange_name | \n",
" country | \n",
" is_etf | \n",
" actively_trading | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" AMBO | \n",
" Ambow Education Holding Ltd. | \n",
" 4314134 | \n",
" Consumer Defensive | \n",
" Education & Training Services | \n",
" 0.448 | \n",
" 0.1521 | \n",
" 54634 | \n",
" AMEX | \n",
" American Stock Exchange | \n",
" CN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 1 | \n",
" ITP | \n",
" IT Tech Packaging, Inc. | \n",
" 2922131 | \n",
" Basic Materials | \n",
" Paper & Paper Products | \n",
" -0.1 | \n",
" 0.2903 | \n",
" 17827 | \n",
" AMEX | \n",
" American Stock Exchange | \n",
" CN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 2 | \n",
" DXF | \n",
" Dunxin Financial Holdings Limited | \n",
" 1232011 | \n",
" Financial Services | \n",
" Credit Services | \n",
" 1.632 | \n",
" 0.31 | \n",
" 259614 | \n",
" AMEX | \n",
" American Stock Exchange | \n",
" CN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
" | 3 | \n",
" CPHI | \n",
" China Pharma Holdings, Inc. | \n",
" 1084973 | \n",
" Healthcare | \n",
" Drug Manufacturers—Specialty & Generic | \n",
" 0.875 | \n",
" 0.0949 | \n",
" 483393 | \n",
" AMEX | \n",
" American Stock Exchange | \n",
" CN | \n",
" False | \n",
" True | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" symbol name market_cap sector \\\n",
"0 AMBO Ambow Education Holding Ltd. 4314134 Consumer Defensive \n",
"1 ITP IT Tech Packaging, Inc. 2922131 Basic Materials \n",
"2 DXF Dunxin Financial Holdings Limited 1232011 Financial Services \n",
"3 CPHI China Pharma Holdings, Inc. 1084973 Healthcare \n",
"\n",
" industry beta price volume exchange \\\n",
"0 Education & Training Services 0.448 0.1521 54634 AMEX \n",
"1 Paper & Paper Products -0.1 0.2903 17827 AMEX \n",
"2 Credit Services 1.632 0.31 259614 AMEX \n",
"3 Drug Manufacturers—Specialty & Generic 0.875 0.0949 483393 AMEX \n",
"\n",
" exchange_name country is_etf actively_trading \n",
"0 American Stock Exchange CN False True \n",
"1 American Stock Exchange CN False True \n",
"2 American Stock Exchange CN False True \n",
"3 American Stock Exchange CN False True "
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exchange_results = obb.equity.screener(exchange=\"amex\", country=\"CN\").to_df()\n",
"display(len(exchange_results))\n",
"exchange_results.convert_dtypes()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Find an Index\n",
"\n",
"List all indices from a source with:"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"274"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"indices = obb.index.available(provider=\"yfinance\").to_df()\n",
"display(len(indices))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Filter the list down by querying the DataFrame."
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" code | \n",
" symbol | \n",
"
\n",
" \n",
" \n",
" \n",
" | 88 | \n",
" S&P/ASX 200 Index (AUD) | \n",
" au_asx200 | \n",
" ^AXJO | \n",
"
\n",
" \n",
" | 90 | \n",
" S&P/ASX 200 Energy Sector Index (AUD) | \n",
" au_energy | \n",
" ^AXEJ | \n",
"
\n",
" \n",
" | 91 | \n",
" S&P/ASX 200 Resources Sector Index (AUD) | \n",
" au_resources | \n",
" ^AXJR | \n",
"
\n",
" \n",
" | 92 | \n",
" S&P/ASX 200 Materials Sector Index (AUD) | \n",
" au_materials | \n",
" ^AXMJ | \n",
"
\n",
" \n",
" | 94 | \n",
" S&P/ASX 200 Industrials Sector Index (AUD) | \n",
" au_industrials | \n",
" ^AXNJ | \n",
"
\n",
" \n",
" | 95 | \n",
" S&P/ASX 200 Consumer Discretionary Sector Inde... | \n",
" au_discretionary | \n",
" ^AXDJ | \n",
"
\n",
" \n",
" | 96 | \n",
" S&P/ASX 200 Consumer Staples Sector Index (AUD) | \n",
" au_staples | \n",
" ^AXSJ | \n",
"
\n",
" \n",
" | 97 | \n",
" S&P/ASX 200 Health Care Sector Index (AUD) | \n",
" au_health | \n",
" ^AXHJ | \n",
"
\n",
" \n",
" | 98 | \n",
" S&P/ASX 200 Financials Sector Index (AUD) | \n",
" au_financials | \n",
" ^AXFJ | \n",
"
\n",
" \n",
" | 99 | \n",
" S&P/ASX 200 A-REIT Industry Index (AUD) | \n",
" au_reit | \n",
" ^AXPJ | \n",
"
\n",
" \n",
" | 100 | \n",
" S&P/ASX 200 Info Tech Sector Index (AUD) | \n",
" au_tech | \n",
" ^AXIJ | \n",
"
\n",
" \n",
" | 101 | \n",
" S&P/ASX 200 Communications Sector Index (AUD) | \n",
" au_communications | \n",
" ^AXTJ | \n",
"
\n",
" \n",
" | 102 | \n",
" S&P/ASX 200 Utilities Sector Index (AUD) | \n",
" au_utilities | \n",
" ^AXUJ | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name code \\\n",
"88 S&P/ASX 200 Index (AUD) au_asx200 \n",
"90 S&P/ASX 200 Energy Sector Index (AUD) au_energy \n",
"91 S&P/ASX 200 Resources Sector Index (AUD) au_resources \n",
"92 S&P/ASX 200 Materials Sector Index (AUD) au_materials \n",
"94 S&P/ASX 200 Industrials Sector Index (AUD) au_industrials \n",
"95 S&P/ASX 200 Consumer Discretionary Sector Inde... au_discretionary \n",
"96 S&P/ASX 200 Consumer Staples Sector Index (AUD) au_staples \n",
"97 S&P/ASX 200 Health Care Sector Index (AUD) au_health \n",
"98 S&P/ASX 200 Financials Sector Index (AUD) au_financials \n",
"99 S&P/ASX 200 A-REIT Industry Index (AUD) au_reit \n",
"100 S&P/ASX 200 Info Tech Sector Index (AUD) au_tech \n",
"101 S&P/ASX 200 Communications Sector Index (AUD) au_communications \n",
"102 S&P/ASX 200 Utilities Sector Index (AUD) au_utilities \n",
"\n",
" symbol \n",
"88 ^AXJO \n",
"90 ^AXEJ \n",
"91 ^AXJR \n",
"92 ^AXMJ \n",
"94 ^AXNJ \n",
"95 ^AXDJ \n",
"96 ^AXSJ \n",
"97 ^AXHJ \n",
"98 ^AXFJ \n",
"99 ^AXPJ \n",
"100 ^AXIJ \n",
"101 ^AXTJ \n",
"102 ^AXUJ "
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"indices[indices[\"name\"].str.contains(\"ASX 200\")]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the `openbb-yfinance` extension, index time series can be loaded using the ticker symbol or short code. Non-American indices have a code beginning with the two-letter country code."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" open | \n",
" high | \n",
" low | \n",
" close | \n",
" volume | \n",
"
\n",
" \n",
" | date | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" | 2023-11-17 | \n",
" True | \n",
" True | \n",
" True | \n",
" True | \n",
" True | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" open high low close volume\n",
"date \n",
"2023-11-17 True True True True True"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(\n",
" obb.index.market(\"au_utilities\", provider=\"yfinance\").to_df().tail(1)\n",
" == obb.index.market(\"^AXUJ\", provider=\"yfinance\").to_df().tail(1)\n",
")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "obb-sdk4",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}