-
Notifications
You must be signed in to change notification settings - Fork 3
Examples
Examples are available in the Examples folder. Simple scripts provide some code snipets on how to call module features/functions. Please run examples from your root folder so all packages can be loaded properly.
Example #1 [ .images\symbols_sp500.py ]
Grab symbols from WIKIPEDIA's S&P500 page listing all companies in the indice.
symbols.grab_SP500_from_wikipedia()
Returns a Pandas Dataframe containing the following columns:
Symbol Security GICS Sector GICS Sub-Industry Headquarters Location Date added CIK Founded Yahoo
498 YUM Yum! Brands Consumer Discretionary Restaurants Louisville, Kentucky 1997-10-06 1041061 1997 YUM
499 ZBRA Zebra Technologies Information Technology Electronic Equipment & Instruments Lincolnshire, Illinois 2019-12-23 877212 1969 ZBRA
500 ZBH Zimmer Biomet Health Care Health Care Equipment Warsaw, Indiana 2001-08-07 1136869 1927 ZBH
501 ZION Zions Bancorporation Financials Regional Banks Salt Lake City, Utah 2001-06-22 109380 1873 ZION
502 ZTS Zoetis Health Care Pharmaceuticals Parsippany, New Jersey 2013-06-21 1555280 1952 ZTS
The example prints the column names, part of the Pandas Dataframe (see code block above), a formated printout of all the company information and a python list of the stock symbols to be used in other function calls.
Example #2 [ .images\symbols_github.py ]
Grab symbols from Maple Frog Studio's github DATASET repository. These are static CSV files that contain lists of stock symbols.
Remove the comment character (#) in of the appropriate lines to run the specific demo you are interested in.
...
if __name__ == '__main__':
#demo_sp500(symbols)
#demo_tsx(symbols)
demo_nasdaq(symbols)