mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* move old example notebooks to v3 folder, update loadHistoricalPriceData and add findSymbols * Create README.md * Update README.md * Update README.md * Update README.md * Vertical diagram instead * important classes * core dependencies * folder structure * devtools * swap order * fix github pages deploy issue * development index * delete expectations for developers * devtools * obbject stuff * add * installation * hub sync * idk if i committed already * add usage page for financial statements * add link to reference page * syntax * numbers * nearly --> more than * easier to read code blocks * codespell * removing mention to provider * add 'orientation' for to_dict * info card for output user preference * put it in a code block * correct user_settings.json example * syntax corrections * fix sentence * get rid of floating point mathc * get rid of other floating point math * add companion example notebook for financial statements, and new section * historical prices usage page * codespell * add commitment of traders section to usage * add a note * codespell * get rid of equals sign * Cleanup docs. with @the-praxs * install * obbject extend * spell * HeadTitle thingies * Update obbject_extensions.md * Update obbject_extensions.md * typo * Update architectural_considerations.md * point to the TET pattern * optional vs required * reviewing the patterns. removed the --pre flag under the assumption this will be the final docs for the release cc @deeleeramone * add a walkthrough * spelling * Add more in the introduction * validator examples * update Copper-to-Gold notebook example for V4 * Update README.md * QA Caveats w @the-praxs * info on class outputs * merge add data sources and add data points * disclaimer on cookiecutter * add missing import to example * slight syntax change * missing code block * missing import * update intrinio example syntax * intrinio syntax update * urls * core and provider merged * example syntax * grammar * Update API banner link * quick-fix-docs cc @minhhoang1023 * Update pip install command for v3 * remove --pre note block * update landing image --------- Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: Luqman <luqazino@gmail.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com> Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
1410 lines
47 KiB
Plaintext
Vendored
1410 lines
47 KiB
Plaintext
Vendored
{
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>symbol</th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>cik</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>AAPL</td>\n",
|
|
" <td>Apple Inc.</td>\n",
|
|
" <td>320193</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>MSFT</td>\n",
|
|
" <td>MICROSOFT CORP</td>\n",
|
|
" <td>789019</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>GOOGL</td>\n",
|
|
" <td>Alphabet Inc.</td>\n",
|
|
" <td>1652044</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>AMZN</td>\n",
|
|
" <td>AMAZON COM INC</td>\n",
|
|
" <td>1018724</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>NVDA</td>\n",
|
|
" <td>NVIDIA CORP</td>\n",
|
|
" <td>1045810</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>META</td>\n",
|
|
" <td>Meta Platforms, Inc.</td>\n",
|
|
" <td>1326801</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>BRK-B</td>\n",
|
|
" <td>BERKSHIRE HATHAWAY INC</td>\n",
|
|
" <td>1067983</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>TSLA</td>\n",
|
|
" <td>Tesla, Inc.</td>\n",
|
|
" <td>1318605</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>LLY</td>\n",
|
|
" <td>ELI LILLY & Co</td>\n",
|
|
" <td>59478</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>9</th>\n",
|
|
" <td>V</td>\n",
|
|
" <td>VISA INC.</td>\n",
|
|
" <td>1403161</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>cik</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY ENERGY CO</td>\n",
|
|
" <td>0001081316</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY FINANCE CORP</td>\n",
|
|
" <td>0001274791</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY HOMESTATE INSURANCE CO.</td>\n",
|
|
" <td>0000829771</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY INC /DE/</td>\n",
|
|
" <td>0000109694</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY INC/DE</td>\n",
|
|
" <td>0000109694</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY INC</td>\n",
|
|
" <td>0001067983</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>BERKSHIRE HATHAWAY LIFE INSURANCE CO OF NEBRASKA</td>\n",
|
|
" <td>0001015867</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>LMZ & BERKSHIRE HATHAWAY CO</td>\n",
|
|
" <td>0001652795</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>symbol</th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>market_cap</th>\n",
|
|
" <th>sector</th>\n",
|
|
" <th>industry</th>\n",
|
|
" <th>beta</th>\n",
|
|
" <th>price</th>\n",
|
|
" <th>last_annual_dividend</th>\n",
|
|
" <th>volume</th>\n",
|
|
" <th>exchange</th>\n",
|
|
" <th>exchange_name</th>\n",
|
|
" <th>country</th>\n",
|
|
" <th>is_etf</th>\n",
|
|
" <th>actively_trading</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>RELIANCE.NS</td>\n",
|
|
" <td>Reliance Industries Limited</td>\n",
|
|
" <td>15895961017165</td>\n",
|
|
" <td>Energy</td>\n",
|
|
" <td>Oil & Gas Refining & Marketing</td>\n",
|
|
" <td>0.721409</td>\n",
|
|
" <td>2349.35</td>\n",
|
|
" <td>9</td>\n",
|
|
" <td>2244671</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>TCS.NS</td>\n",
|
|
" <td>Tata Consultancy Services Limited</td>\n",
|
|
" <td>12878392323686</td>\n",
|
|
" <td>Technology</td>\n",
|
|
" <td>Information Technology Services</td>\n",
|
|
" <td>0.528</td>\n",
|
|
" <td>3519.6</td>\n",
|
|
" <td>36</td>\n",
|
|
" <td>1473232</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>HDFCBANK.NS</td>\n",
|
|
" <td>HDFC Bank Limited</td>\n",
|
|
" <td>11345550050918</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Banks—Regional</td>\n",
|
|
" <td>0.714285</td>\n",
|
|
" <td>1505.2</td>\n",
|
|
" <td>19</td>\n",
|
|
" <td>9665132</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>ICICIBANK.NS</td>\n",
|
|
" <td>ICICI Bank Limited</td>\n",
|
|
" <td>6456176076595</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Banks—Regional</td>\n",
|
|
" <td>0.808</td>\n",
|
|
" <td>921.45</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>10561389</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>INFY.NS</td>\n",
|
|
" <td>Infosys Limited</td>\n",
|
|
" <td>5945857635942</td>\n",
|
|
" <td>Technology</td>\n",
|
|
" <td>Information Technology Services</td>\n",
|
|
" <td>0.596</td>\n",
|
|
" <td>1436.6</td>\n",
|
|
" <td>36</td>\n",
|
|
" <td>3584088</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>symbol</th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>market_cap</th>\n",
|
|
" <th>sector</th>\n",
|
|
" <th>industry</th>\n",
|
|
" <th>beta</th>\n",
|
|
" <th>price</th>\n",
|
|
" <th>last_annual_dividend</th>\n",
|
|
" <th>volume</th>\n",
|
|
" <th>exchange</th>\n",
|
|
" <th>exchange_name</th>\n",
|
|
" <th>country</th>\n",
|
|
" <th>is_etf</th>\n",
|
|
" <th>actively_trading</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>HDFCBANK.NS</td>\n",
|
|
" <td>HDFC Bank Limited</td>\n",
|
|
" <td>11345550050918</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Banks—Regional</td>\n",
|
|
" <td>0.714285</td>\n",
|
|
" <td>1505.2</td>\n",
|
|
" <td>19.0</td>\n",
|
|
" <td>9665132</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>ICICIBANK.NS</td>\n",
|
|
" <td>ICICI Bank Limited</td>\n",
|
|
" <td>6456176076595</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Banks—Regional</td>\n",
|
|
" <td>0.808</td>\n",
|
|
" <td>921.45</td>\n",
|
|
" <td>8.0</td>\n",
|
|
" <td>10561389</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>SBIN.NS</td>\n",
|
|
" <td>State Bank of India</td>\n",
|
|
" <td>5031248625920</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Banks—Regional</td>\n",
|
|
" <td>0.74</td>\n",
|
|
" <td>563.75</td>\n",
|
|
" <td>11.3</td>\n",
|
|
" <td>12710950</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>BAJFINANCE.NS</td>\n",
|
|
" <td>Bajaj Finance Limited</td>\n",
|
|
" <td>4282998873754</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Credit Services</td>\n",
|
|
" <td>0.947</td>\n",
|
|
" <td>7068.6</td>\n",
|
|
" <td>30.0</td>\n",
|
|
" <td>1901753</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>LICI.NS</td>\n",
|
|
" <td>Life Insurance Corporation of India</td>\n",
|
|
" <td>3870900117504</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Insurance—Life</td>\n",
|
|
" <td><NA></td>\n",
|
|
" <td>612.0</td>\n",
|
|
" <td>3.0</td>\n",
|
|
" <td>500820</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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 <NA> 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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>symbol</th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>market_cap</th>\n",
|
|
" <th>sector</th>\n",
|
|
" <th>industry</th>\n",
|
|
" <th>beta</th>\n",
|
|
" <th>price</th>\n",
|
|
" <th>last_annual_dividend</th>\n",
|
|
" <th>volume</th>\n",
|
|
" <th>exchange</th>\n",
|
|
" <th>exchange_name</th>\n",
|
|
" <th>country</th>\n",
|
|
" <th>is_etf</th>\n",
|
|
" <th>actively_trading</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>PAGEIND.NS</td>\n",
|
|
" <td>Page Industries Limited</td>\n",
|
|
" <td>418555116755</td>\n",
|
|
" <td>Consumer Cyclical</td>\n",
|
|
" <td>Apparel Manufacturing</td>\n",
|
|
" <td>0.462</td>\n",
|
|
" <td>37525.45</td>\n",
|
|
" <td>300.0</td>\n",
|
|
" <td>11199</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>KPRMILL.NS</td>\n",
|
|
" <td>K.P.R. Mill Limited</td>\n",
|
|
" <td>284132900800</td>\n",
|
|
" <td>Consumer Cyclical</td>\n",
|
|
" <td>Apparel Manufacturing</td>\n",
|
|
" <td>0.689</td>\n",
|
|
" <td>831.25</td>\n",
|
|
" <td>4.15</td>\n",
|
|
" <td>342210</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>ABFRL.NS</td>\n",
|
|
" <td>Aditya Birla Fashion and Retail Limited</td>\n",
|
|
" <td>203500974285</td>\n",
|
|
" <td>Consumer Cyclical</td>\n",
|
|
" <td>Apparel Manufacturing</td>\n",
|
|
" <td>0.152</td>\n",
|
|
" <td>214.4</td>\n",
|
|
" <td><NA></td>\n",
|
|
" <td>1363689</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>TRIDENT.NS</td>\n",
|
|
" <td>Trident Limited</td>\n",
|
|
" <td>189060118374</td>\n",
|
|
" <td>Consumer Cyclical</td>\n",
|
|
" <td>Textile Manufacturing</td>\n",
|
|
" <td>0.532</td>\n",
|
|
" <td>37.1</td>\n",
|
|
" <td>0.36</td>\n",
|
|
" <td>7863777</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>WELSPUNIND.NS</td>\n",
|
|
" <td>Welspun India Limited</td>\n",
|
|
" <td>157481652339</td>\n",
|
|
" <td>Consumer Cyclical</td>\n",
|
|
" <td>Textile Manufacturing</td>\n",
|
|
" <td>0.423</td>\n",
|
|
" <td>162.05</td>\n",
|
|
" <td>0.1</td>\n",
|
|
" <td>3348644</td>\n",
|
|
" <td>NSE</td>\n",
|
|
" <td>National Stock Exchange of India</td>\n",
|
|
" <td>IN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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 <NA> 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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>symbol</th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>market_cap</th>\n",
|
|
" <th>sector</th>\n",
|
|
" <th>industry</th>\n",
|
|
" <th>beta</th>\n",
|
|
" <th>price</th>\n",
|
|
" <th>volume</th>\n",
|
|
" <th>exchange</th>\n",
|
|
" <th>exchange_name</th>\n",
|
|
" <th>country</th>\n",
|
|
" <th>is_etf</th>\n",
|
|
" <th>actively_trading</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>AMBO</td>\n",
|
|
" <td>Ambow Education Holding Ltd.</td>\n",
|
|
" <td>4314134</td>\n",
|
|
" <td>Consumer Defensive</td>\n",
|
|
" <td>Education & Training Services</td>\n",
|
|
" <td>0.448</td>\n",
|
|
" <td>0.1521</td>\n",
|
|
" <td>54634</td>\n",
|
|
" <td>AMEX</td>\n",
|
|
" <td>American Stock Exchange</td>\n",
|
|
" <td>CN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>ITP</td>\n",
|
|
" <td>IT Tech Packaging, Inc.</td>\n",
|
|
" <td>2922131</td>\n",
|
|
" <td>Basic Materials</td>\n",
|
|
" <td>Paper & Paper Products</td>\n",
|
|
" <td>-0.1</td>\n",
|
|
" <td>0.2903</td>\n",
|
|
" <td>17827</td>\n",
|
|
" <td>AMEX</td>\n",
|
|
" <td>American Stock Exchange</td>\n",
|
|
" <td>CN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>DXF</td>\n",
|
|
" <td>Dunxin Financial Holdings Limited</td>\n",
|
|
" <td>1232011</td>\n",
|
|
" <td>Financial Services</td>\n",
|
|
" <td>Credit Services</td>\n",
|
|
" <td>1.632</td>\n",
|
|
" <td>0.31</td>\n",
|
|
" <td>259614</td>\n",
|
|
" <td>AMEX</td>\n",
|
|
" <td>American Stock Exchange</td>\n",
|
|
" <td>CN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>CPHI</td>\n",
|
|
" <td>China Pharma Holdings, Inc.</td>\n",
|
|
" <td>1084973</td>\n",
|
|
" <td>Healthcare</td>\n",
|
|
" <td>Drug Manufacturers—Specialty & Generic</td>\n",
|
|
" <td>0.875</td>\n",
|
|
" <td>0.0949</td>\n",
|
|
" <td>483393</td>\n",
|
|
" <td>AMEX</td>\n",
|
|
" <td>American Stock Exchange</td>\n",
|
|
" <td>CN</td>\n",
|
|
" <td>False</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>name</th>\n",
|
|
" <th>code</th>\n",
|
|
" <th>symbol</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>88</th>\n",
|
|
" <td>S&P/ASX 200 Index (AUD)</td>\n",
|
|
" <td>au_asx200</td>\n",
|
|
" <td>^AXJO</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>90</th>\n",
|
|
" <td>S&P/ASX 200 Energy Sector Index (AUD)</td>\n",
|
|
" <td>au_energy</td>\n",
|
|
" <td>^AXEJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>91</th>\n",
|
|
" <td>S&P/ASX 200 Resources Sector Index (AUD)</td>\n",
|
|
" <td>au_resources</td>\n",
|
|
" <td>^AXJR</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>92</th>\n",
|
|
" <td>S&P/ASX 200 Materials Sector Index (AUD)</td>\n",
|
|
" <td>au_materials</td>\n",
|
|
" <td>^AXMJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>94</th>\n",
|
|
" <td>S&P/ASX 200 Industrials Sector Index (AUD)</td>\n",
|
|
" <td>au_industrials</td>\n",
|
|
" <td>^AXNJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>95</th>\n",
|
|
" <td>S&P/ASX 200 Consumer Discretionary Sector Inde...</td>\n",
|
|
" <td>au_discretionary</td>\n",
|
|
" <td>^AXDJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>96</th>\n",
|
|
" <td>S&P/ASX 200 Consumer Staples Sector Index (AUD)</td>\n",
|
|
" <td>au_staples</td>\n",
|
|
" <td>^AXSJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>97</th>\n",
|
|
" <td>S&P/ASX 200 Health Care Sector Index (AUD)</td>\n",
|
|
" <td>au_health</td>\n",
|
|
" <td>^AXHJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>98</th>\n",
|
|
" <td>S&P/ASX 200 Financials Sector Index (AUD)</td>\n",
|
|
" <td>au_financials</td>\n",
|
|
" <td>^AXFJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>99</th>\n",
|
|
" <td>S&P/ASX 200 A-REIT Industry Index (AUD)</td>\n",
|
|
" <td>au_reit</td>\n",
|
|
" <td>^AXPJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>100</th>\n",
|
|
" <td>S&P/ASX 200 Info Tech Sector Index (AUD)</td>\n",
|
|
" <td>au_tech</td>\n",
|
|
" <td>^AXIJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>101</th>\n",
|
|
" <td>S&P/ASX 200 Communications Sector Index (AUD)</td>\n",
|
|
" <td>au_communications</td>\n",
|
|
" <td>^AXTJ</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>102</th>\n",
|
|
" <td>S&P/ASX 200 Utilities Sector Index (AUD)</td>\n",
|
|
" <td>au_utilities</td>\n",
|
|
" <td>^AXUJ</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>open</th>\n",
|
|
" <th>high</th>\n",
|
|
" <th>low</th>\n",
|
|
" <th>close</th>\n",
|
|
" <th>volume</th>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>date</th>\n",
|
|
" <th></th>\n",
|
|
" <th></th>\n",
|
|
" <th></th>\n",
|
|
" <th></th>\n",
|
|
" <th></th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>2023-11-17</th>\n",
|
|
" <td>True</td>\n",
|
|
" <td>True</td>\n",
|
|
" <td>True</td>\n",
|
|
" <td>True</td>\n",
|
|
" <td>True</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"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
|
|
}
|