This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # show a list of available index | |
| index_list = ss.index_list | |
| index_list | |
| ''' | |
| index_list | |
| [{'market': 'australia', | |
| 'abbreviation': 'au', | |
| 'indexId': 'XJO', | |
| 'indexName': 'S&P/ASX 200'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get symbol only | |
| symbol_only_list = ss.get_symbol_list(market="malaysia", symbols_only=True) | |
| symbol_only_list | |
| ''' | |
| ['5239PA.KL', | |
| '0103PA.KL', | |
| '7105.KL', | |
| '5075.KL', | |
| '5188.KL', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Market (abbr.) | Index Name (Index ID) | |
|---|---|---|
| America (us) | Dow Jones Composite Average (DJA) | |
| Dow Jones Industrial Average (DJI) | ||
| Dow Jones Transportation Average (DJT) | ||
| Dow Jones U.S. Coal (DJUSCL) | ||
| Dow Jones Utility Average (DJU) | ||
| NASDAQ 100 (NDX) | ||
| NASDAQ COMPOSITE (IXIC) | ||
| NASDAQ COMPUTER (IXCO) | ||
| NASDAQ INDUSTRIAL (INDS) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 9 columns, instead of 5 in line 9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Symbol,Security,SEC filings,GICS Sector,GICS Sub-Industry,Headquarters Location,Date first added,CIK,Founded | |
| MMM,3M,reports,Industrials,Industrial Conglomerates,"Saint Paul, Minnesota",1976-08-09,66740,1902 | |
| AOS,A. O. Smith,reports,Industrials,Building Products,"Milwaukee, Wisconsin",2017-07-26,91142,1916 | |
| ABT,Abbott,reports,Health Care,Health Care Equipment,"North Chicago, Illinois",1964-03-31,1800,1888 | |
| ABBV,AbbVie,reports,Health Care,Pharmaceuticals,"North Chicago, Illinois",2012-12-31,1551152,2013 (1888) | |
| ABMD,Abiomed,reports,Health Care,Health Care Equipment,"Danvers, Massachusetts",2018-05-31,815094,1981 | |
| ACN,Accenture,reports,Information Technology,IT Consulting & Other Services,"Dublin, Ireland",2011-07-06,1467373,1989 | |
| ATVI,Activision Blizzard,reports,Communication Services,Interactive Home Entertainment,"Santa Monica, California",2015-08-31,718877,2008 | |
| ADM,ADM,reports,Consumer Staples,Agricultural Products,"Chicago, Illinois",1981-07-29,7084,1902 | |
| ADBE,Adobe,reports,Information Technology,Application Softw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import packages | |
| import pandas as pd | |
| from pymongo import MongoClient | |
| # scrape the list of S&P 500 | |
| url = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' | |
| payload = pd.read_html(url) | |
| symbol_list = payload[0] | |
| # save to local csv file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import packages | |
| import pandas as pd | |
| from pymongo import MongoClient | |
| import os | |
| # scrape the list of S&P 500 | |
| url = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' | |
| payload = pd.read_html(url) | |
| symbol_list = payload[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update S&P500 Symbol List | |
| on: | |
| schedule: | |
| - cron: '0 0 1 * *' | |
| workflow_dispatch: | |
| jobs: | |
| update_symbol_list: | |
| name: Update S&P500 symbol list periodically |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import yfinance as yf | |
| import mplfinance as mpf | |
| # download stock price data | |
| symbol = 'AAPL' | |
| df = yf.download(symbol, period='6mo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # plot candlestick chart | |
| mpf.plot(df, type='candle') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add moving averages and volume | |
| mpf.plot(df, type='candle', mav=(5,20), volume=True) |