# Finance Scrapers
A pypi package to scrape stock information from different finance sites. Currently supports [Yahoo Finance](finance.yahoo.com).
## Installation
To install, [Download the PyPi package](https://pypi.org/project/finance-scrapers/0.0.2/#files) _or_,
```
pip install finance-scrapers
```
To upgrade to the latest version,
```
pip install --upgrade finance-scrapers
```
## Usage
Scrape stock information:
```python
from finance_scrapers import YahooFinance
# the tickers of the stocks you want to scrape
tickers = ['schb', 'googl', 'nflx']
# run the scraper
scraper = YahooFinance(tickers)
all_stock_info = scraper.stock_info
```
<br>
Scrape stock information and __display__ to terminal:
```python
from finance_scrapers import YahooFinance
# the tickers of the stocks you want to scrape
tickers = ['schb', 'googl', 'nflx']
# display data found from stocks
scraper = YahooFinance(tickers)
scraper.display_data()
# display custom data
sample_data = {"name": "Mandy-cyber", "love": "food"}
scraper.display(sample_data)
```
<details>
<summary>Example</summary>
{
"AXP": {
"Ask": "171.39 x 800",
"PE Ratio (TTM)": "17.95",
"Open": "172.17",
"Earnings Date": "Jul 21, 2023",
"Volume": "Jul 06, 2023",
"Market Cap": "127.169B",
"Avg. Volume": "186.00",
"52 Week Range": "130.65 - 182.15",
"Forward Dividend & Yield": "2.40 (1.36%)",
"Day's Range": "167.42 - 173.34",
"Previous Close": "177.11",
"EPS (TTM)": "9.53",
"Bid": "171.28 x 1000"
},
"SCHB": {
"Ask": "53.07 x 1000",
"PE Ratio (TTM)": "21.73",
"Open": "53.12",
"YTD Daily Total Return": "18.99%",
"Volume": "0.03%",
"Net Assets": "23B",
"Avg. Volume": "2009-11-03",
"52 Week Range": "40.92 - 53.43",
"Beta (5Y Monthly)": "1.01",
"Day's Range": "52.88 - 53.12",
"Previous Close": "52.92",
"Yield": "1.47%",
"Bid": "53.06 x 2200"
},
"NKE": {
"Ask": "108.85 x 1800",
"PE Ratio (TTM)": "33.80",
"Open": "108.00",
"Earnings Date": "Sep 27, 2023 - Oct 02, 2023",
"Volume": "Jun 02, 2023",
"Market Cap": "167.816B",
"Avg. Volume": "127.70",
"52 Week Range": "82.22 - 131.31",
"Forward Dividend & Yield": "1.36 (1.26%)",
"Day's Range": "107.54 - 109.24",
"Previous Close": "107.53",
"EPS (TTM)": "3.23",
"Bid": "108.83 x 1200"
}
}
</details>
<br>
Scrape stock information and __download__ to a file:
```python
from finance_scrapers import YahooFinance
# the tickers of the stocks you want to scrape
tickers = ['schb', 'googl', 'nflx']
scraper = YahooFinance(tickers)
# download data
scraper.download_data(file_type="json", file_path="sample.json", overwrite=False) # or,
scraper.download_data("markdown", "sample.md") # or,
scraper.download_data("csv", "sample.csv") # or,
scraper.download_data("excel", "sample.xlsx")
```
<sub>Examples of these downloads can be found <a href="https://github.com/Mandy-cyber/Finance-Scrapers/tree/main/samples">here</a></sub>
<br>
Raw data
{
"_id": null,
"home_page": "https://github.com/Mandy-cyber/Yahoo-Finance",
"name": "finance-scrapers",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "python,selenium,stocks,stock-data,yahoofinance,finance",
"author": "Mandy-cyber",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/f9/3f/660675a7ad9e3d0e13f948fb262752035ad0f92af0e4b4ac31caa03cfa46/finance-scrapers-1.1.5.tar.gz",
"platform": null,
"description": "# Finance Scrapers\r\nA pypi package to scrape stock information from different finance sites. Currently supports [Yahoo Finance](finance.yahoo.com).\r\n\r\n## Installation\r\nTo install, [Download the PyPi package](https://pypi.org/project/finance-scrapers/0.0.2/#files) _or_,\r\n```\r\npip install finance-scrapers\r\n```\r\nTo upgrade to the latest version,\r\n```\r\npip install --upgrade finance-scrapers\r\n```\r\n\r\n## Usage\r\nScrape stock information:\r\n```python\r\nfrom finance_scrapers import YahooFinance\r\n\r\n# the tickers of the stocks you want to scrape\r\ntickers = ['schb', 'googl', 'nflx']\r\n\r\n# run the scraper\r\nscraper = YahooFinance(tickers)\r\nall_stock_info = scraper.stock_info\r\n```\r\n\r\n<br>\r\n\r\nScrape stock information and __display__ to terminal:\r\n```python\r\nfrom finance_scrapers import YahooFinance\r\n\r\n# the tickers of the stocks you want to scrape\r\ntickers = ['schb', 'googl', 'nflx']\r\n\r\n# display data found from stocks\r\nscraper = YahooFinance(tickers)\r\nscraper.display_data()\r\n\r\n# display custom data\r\nsample_data = {\"name\": \"Mandy-cyber\", \"love\": \"food\"}\r\nscraper.display(sample_data)\r\n```\r\n\r\n<details>\r\n <summary>Example</summary>\r\n\r\n\r\n {\r\n \"AXP\": {\r\n \"Ask\": \"171.39 x 800\",\r\n \"PE Ratio (TTM)\": \"17.95\",\r\n \"Open\": \"172.17\",\r\n \"Earnings Date\": \"Jul 21, 2023\",\r\n \"Volume\": \"Jul 06, 2023\",\r\n \"Market Cap\": \"127.169B\",\r\n \"Avg. Volume\": \"186.00\",\r\n \"52 Week Range\": \"130.65 - 182.15\",\r\n \"Forward Dividend & Yield\": \"2.40 (1.36%)\",\r\n \"Day's Range\": \"167.42 - 173.34\",\r\n \"Previous Close\": \"177.11\",\r\n \"EPS (TTM)\": \"9.53\",\r\n \"Bid\": \"171.28 x 1000\"\r\n },\r\n \"SCHB\": {\r\n \"Ask\": \"53.07 x 1000\",\r\n \"PE Ratio (TTM)\": \"21.73\",\r\n \"Open\": \"53.12\",\r\n \"YTD Daily Total Return\": \"18.99%\",\r\n \"Volume\": \"0.03%\",\r\n \"Net Assets\": \"23B\",\r\n \"Avg. Volume\": \"2009-11-03\",\r\n \"52 Week Range\": \"40.92 - 53.43\",\r\n \"Beta (5Y Monthly)\": \"1.01\",\r\n \"Day's Range\": \"52.88 - 53.12\",\r\n \"Previous Close\": \"52.92\",\r\n \"Yield\": \"1.47%\",\r\n \"Bid\": \"53.06 x 2200\"\r\n },\r\n \"NKE\": {\r\n \"Ask\": \"108.85 x 1800\",\r\n \"PE Ratio (TTM)\": \"33.80\",\r\n \"Open\": \"108.00\",\r\n \"Earnings Date\": \"Sep 27, 2023 - Oct 02, 2023\",\r\n \"Volume\": \"Jun 02, 2023\",\r\n \"Market Cap\": \"167.816B\",\r\n \"Avg. Volume\": \"127.70\",\r\n \"52 Week Range\": \"82.22 - 131.31\",\r\n \"Forward Dividend & Yield\": \"1.36 (1.26%)\",\r\n \"Day's Range\": \"107.54 - 109.24\",\r\n \"Previous Close\": \"107.53\",\r\n \"EPS (TTM)\": \"3.23\",\r\n \"Bid\": \"108.83 x 1200\"\r\n }\r\n }\r\n\r\n\r\n</details>\r\n\r\n<br>\r\n\r\nScrape stock information and __download__ to a file:\r\n```python\r\nfrom finance_scrapers import YahooFinance\r\n\r\n# the tickers of the stocks you want to scrape\r\ntickers = ['schb', 'googl', 'nflx']\r\n\r\nscraper = YahooFinance(tickers)\r\n\r\n# download data\r\nscraper.download_data(file_type=\"json\", file_path=\"sample.json\", overwrite=False) # or,\r\nscraper.download_data(\"markdown\", \"sample.md\") # or,\r\nscraper.download_data(\"csv\", \"sample.csv\") # or,\r\nscraper.download_data(\"excel\", \"sample.xlsx\")\r\n```\r\n\r\n<sub>Examples of these downloads can be found <a href=\"https://github.com/Mandy-cyber/Finance-Scrapers/tree/main/samples\">here</a></sub>\r\n\r\n<br>\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A tool to scrape and download publicly available stock information. Currently supports Yahoo Finance data.",
"version": "1.1.5",
"project_urls": {
"Homepage": "https://github.com/Mandy-cyber/Yahoo-Finance"
},
"split_keywords": [
"python",
"selenium",
"stocks",
"stock-data",
"yahoofinance",
"finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe6ec71594fcb4d9e5170f550b07c568b47e9bc960320edb7f74017eabc103f2",
"md5": "4eed6d175bddea07ec12326c2f43766a",
"sha256": "c5575c0a7e2f08009f93c50af02811d976781178aa4797e31ba2a31eaf77fa0f"
},
"downloads": -1,
"filename": "finance_scrapers-1.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4eed6d175bddea07ec12326c2f43766a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8877,
"upload_time": "2023-07-21T16:12:31",
"upload_time_iso_8601": "2023-07-21T16:12:31.563172Z",
"url": "https://files.pythonhosted.org/packages/fe/6e/c71594fcb4d9e5170f550b07c568b47e9bc960320edb7f74017eabc103f2/finance_scrapers-1.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f93f660675a7ad9e3d0e13f948fb262752035ad0f92af0e4b4ac31caa03cfa46",
"md5": "15055eb8a633c1c23fbc512b3b8d5fb0",
"sha256": "c3a70e23b7da25face6de448e531241002efaf0dc4372ca278753ab1102f355f"
},
"downloads": -1,
"filename": "finance-scrapers-1.1.5.tar.gz",
"has_sig": false,
"md5_digest": "15055eb8a633c1c23fbc512b3b8d5fb0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9101,
"upload_time": "2023-07-21T16:12:32",
"upload_time_iso_8601": "2023-07-21T16:12:32.507681Z",
"url": "https://files.pythonhosted.org/packages/f9/3f/660675a7ad9e3d0e13f948fb262752035ad0f92af0e4b4ac31caa03cfa46/finance-scrapers-1.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-21 16:12:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Mandy-cyber",
"github_project": "Yahoo-Finance",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "finance-scrapers"
}