{ "info": { "author": "Zach Liu", "author_email": "zachliugis@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.4", "Topic :: Office/Business :: Financial" ], "description": "*****\nStock Extractor\n*****\n\nThis package includes a series of stock data extractor class from a few widely used sources, such as Yahoo Finance,\nBarchart.com, etc.\n\n\n=====\nInstallation\n=====\n\n``pip install stock_extractor``\n\nThe package has the following dependencies:\n\n\t* requests\n\t* pandas\n\t* beautifulsoup4\n\n\n=====\nUSAGE\n=====\n\nThe package currently has four extractor class\n\n\t* SP500Extractor\n\n\t It is used to extract stock data about S&P 500 companies\n\n\t* YahooFinanceInfoExtractor\n\n\t It is used to extract latest stock data and information from Yahoo Finance\n\n\t* YahooFinanceHistoryQuoteExtractor\n\n\t It is used to extract historical quote data for stocks from Yahoo Finance\n\n\t* YahooFinanceDivExtractor\n\n\t It is used to extract historical dividend data for stocks from Yahoo Finance\n\nSP500Extractor\n-----\n\n.. code-block:: python\n\n\t# import extractor class\n\tfrom stock_extractor import SP500Extractor\n\n\textractor = SP500Extractor()\n\n\t# get_sp500_symbol_list() returns all SP500 company symbols as a list\n\tsp500_symbols = extractor.get_sp500_symbol_list()\n\n\t# get_sp500_data_by_type(type) retrieves sp500 company stock infomation and store the result in a pandas dataframe\n\t# type can be 'main', 'technical', or 'performance'\n\t# 'main' includes fields: 'Symbol', 'Name', 'Last Price', 'Change', 'Percent', 'High', 'Low', 'Volume', 'Time'\n\t# 'technical' includes fields: 'Symbol', 'Name', 'Last Price', 'Opinion', '20D-Strength', '20D-Volty', '20D-AVol', '52W-Low', '52W-High'\n\t# 'performance' includes fields: 'Symbol', 'Name', 'Last Price', 'Weighted-Alpha', 'YTD-Pct', '1Month-Pct Change', '3Month-Pct Change', '1Year-Pct Change'\n\textractor.get_sp500_data_by_type('technical')\n\n\t# get_sp500_full_data() will retrieve all three types of data and combine them into the dataframe\n\textractor.get_sp500_full_data()\n\n\t# get_dataframe() will return the dataframe that stores retrieved data\n\textractor.get_dataframe()\n\n\t# save_to_csv(filepath) will save the dataframe as a csv file\n\textractor.save_to_csv('sp500_data.csv')\n\n\nYahooFinanceInfoExtractor\n-----\n\nThis extractor class extract latest stock data and stock information on Yahoo Finance\nThe fields that can be extracted from this class include:\n\n'Ask', 'AvgDVol', 'AskSize', 'Bid', 'AskRealTime', 'BidRealTime', 'BookValue', 'BidSize', 'Change&Pct', 'Change',\n'Commission', 'ChangeRealTime', 'AfterHourChangeRealTime', 'Dividend', 'LastTradeDate', 'TradeDate', 'EPS',\n'ErrorIndication', 'EPSE_CurrentYear', 'EPSE_NextYear', 'EPSE_NextQuarter', 'FloatShares', 'D-Low', 'D-High',\n'52W-Low', '52W-High', 'HoldingsGainPercent', 'AnnualizedGain', 'HoldingsGain', 'HoldingsGainPercentRealTime',\n'HoldingsGainRealTime', 'MoreInfo', 'OrderBookRealTime', 'MarketCap', 'MarketCapRealTime', 'EBITDA',\n'ChangeFrom52W-Low', 'PctChangeFrom52W-Low', 'LastTradeRealTime', 'PctChangeRealTime', 'LastTradeSize',\n'ChangeFrom52W-High', 'PctChangeFrom52W-High', 'LastTradeWithTime', 'LastTradePrice', 'HighLimit',\n'LowLimit', 'DayRange', 'DayRangeRealTime', '50MA', '200MA', 'ChangeFrom200MA', 'PctChangeFrom200MA',\n'ChangeFrom50MA', 'PctChangeFrom50MA', 'Name', 'Notes', 'Open', 'PreviousClose', 'PricedPaid', 'PctChange',\n'Price/Sales', 'Price/Book', 'Ex-DividendDate', 'P/E', 'DividendPayDate', 'P/E_RealTime', 'PEG',\n'P/E-EstCurrentYear', 'P/E-EstNextYear', 'Symbol', 'SharesOwned', 'ShortRatio', 'LastTradeTime', 'TradeLinks',\n'TickerTrend', '1YrTarget', 'Volume', 'HoldingsValue', 'HoldingsValueRealTime', '52W-Range', 'DayValueChange',\n'DayValueChangeRealTime', 'StockExchange', 'Yield'\n\nExample:\n\n.. code-block:: python\n\n\t# import extractor class\n\tfrom stock_extractor import YahooFinanceInfoExtractor\n\n\textractor = YahooFinanceInfoExtractor()\n\n\t# read a list of symbols from txt file.\n\t# extractor.set_symbol_list(symbol_list) can set symbol list as python list\n\textractor.read_symbol_list_from_txt('../sample_data/sample_symbol_list.txt')\n\n\t# set which fields are included in extraction\n\textractor.set_field_list([\n\t\t'Symbol', 'LastTradePrice', 'LastTradeDate', 'LastTradeTime', 'D-High', 'D-Low', '52W-High', '52W-Low',\n\t\t'50MA', '200MA', 'PctChangeFrom50MA', 'PctChangeFrom200MA', 'EBITDA', 'MarketCap',\n\t\t'Dividend', 'Yield', 'EPS', 'P/E', 'PEG', 'Price/Sales', 'Price/Book', 'Name'\n\t])\n\n\t# extract data from Yahoo Finance\n\textractor.load_yahoo_data()\n\n\t# save the result in a csv file\n\t# you can call extractor.get_dataframe() to return the result as pandas dataframe\n\textractor.save_to_csv('../output/sample_stock_info.csv')\n\nYahooFinanceHistoryQuoteExtractor\n-----\n\nThis extractor extract historical quote data for the input symbol list for a time span\n\nExample:\n\n.. code-block:: python\n\n\t# import extractor class\n\tfrom stock_extractor import YahooFinanceHistoryQuoteExtractor\n\n\textractor = YahooFinanceHistoryQuoteExtractor()\n\n\t# set start and end date for extraction\n\textractor.set_end_date('2016-01-01')\n\textractor.set_start_date('2015-01-01')\n\n\t# set symbol list, you can also set this from a txt file, see example above\n\textractor.set_symbol_list(['CAT', 'SPLS', 'ETP', 'HCP', 'T'])\n\n\t# the method that actually extracts data from Yahoo Finance\n\textractor.load_data_by_symbol_list()\n\n\t# filter out other fields, leave only adj price here since this field is usually what people need.\n\textractor.get_adj_price_only_dataframe()\n\n\t#return the result as a pandas dataframe\n\textractor.get_dataframe()\n\n\t# save the result as csv file\n\textractor.save_to_csv()\n\nYahooFinanceDivExtractor\n-----\n\nThis extractor extracts historical dividend data from Yahoo Finance.\nThe api is very similar to the previous one.\n\nExample:\n\n.. code-block:: python\n\n\t# import extractor class\n\tfrom stock_extractor import YahooFinanceDivExtractor\n\n\textractor = YahooFinanceDivExtractor()\n\textractor.set_end_date('2016-01-01')\n\textractor.set_start_date('2001-01-01')\n\textractor.read_symbol_list_from_txt('../sample_data/sample_symbol_list.txt')\n\textractor.load_data_by_symbol_list()\n\textractor.get_dataframe()\n\textractor.save_to_csv()\n\nTEST\n=====\n\nrun this code\n\n``$ python -m unittest discover``\n\n\nCONTACT\n=====\n\nThe package is created by Zach Liu. Please send email to zachliugis@gmail.com if you have questions or comments.\n\nLICENCE\n=====\n\nMIT", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ZachLiuGIS/stock_extractor", "keywords": "stock,finance,market", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "stock_extractor", "package_url": "https://pypi.org/project/stock_extractor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/stock_extractor/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ZachLiuGIS/stock_extractor" }, "release_url": "https://pypi.org/project/stock_extractor/0.2/", "requires_dist": null, "requires_python": null, "summary": "a general purpose stock data extractor", "version": "0.2" }, "last_serial": 1938801, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b78061c6b474738a6480afe992a82b76", "sha256": "13bf43890333baf20b12e45c0ddc72ff0df06260857a18ec1a04227b376547b6" }, "downloads": -1, "filename": "stock_extractor-0.1.tar.gz", "has_sig": false, "md5_digest": "b78061c6b474738a6480afe992a82b76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2213, "upload_time": "2016-02-03T03:43:51", "url": "https://files.pythonhosted.org/packages/b5/24/c27ab7be7851a9f7d79c44524cee562c1d31c64f88823f208e2f43e97250/stock_extractor-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "beb179b7f26d00f6886d6d084d1e1772", "sha256": "0d5a890603e170570c207c927ec54f343a3833cca01ece9f95b9d11852539492" }, "downloads": -1, "filename": "stock_extractor-0.2.tar.gz", "has_sig": false, "md5_digest": "beb179b7f26d00f6886d6d084d1e1772", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3757, "upload_time": "2016-02-04T04:30:56", "url": "https://files.pythonhosted.org/packages/0f/3b/695a93bd50b1cc98d70ef8d2df97d46e1423e22a1404baba0920484f861d/stock_extractor-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "beb179b7f26d00f6886d6d084d1e1772", "sha256": "0d5a890603e170570c207c927ec54f343a3833cca01ece9f95b9d11852539492" }, "downloads": -1, "filename": "stock_extractor-0.2.tar.gz", "has_sig": false, "md5_digest": "beb179b7f26d00f6886d6d084d1e1772", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3757, "upload_time": "2016-02-04T04:30:56", "url": "https://files.pythonhosted.org/packages/0f/3b/695a93bd50b1cc98d70ef8d2df97d46e1423e22a1404baba0920484f861d/stock_extractor-0.2.tar.gz" } ] }