Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.4 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.4 KB

Finance Scrapers

A pypi package to scrape stock information from different finance sites. Currently supports Yahoo Finance.

Installation

To install, Download the PyPi package or,

pip install finance-scrapers

To upgrade to the latest version,

pip install --upgrade finance-scrapers

Usage

Scrape stock information:

from finance_scrapers import YahooFinance

# the tickers of the stocks you want to scrape
tickers = ['schb', 'googl', 'nflx']

# run the scraper
scraper = YahooFinance(tickers)
scraper.run()
all_stock_info = scraper.all_stock_info

Scrape stock information and download to a file:

from finance_scrapers import YahooFinance

# the tickers of the stocks you want to scrape
tickers = ['schb', 'googl', 'nflx']

# run the scraper
scraper = YahooFinance(tickers)
scraper.run()

# download data
Downloader.download_csv(data=scraper.all_stock_info, file_path='../samples/data.csv')
Downloader.download_excel(data=scraper.all_stock_info, file_path='../samples/data.xlsx')
Downloader.download_json(data=scraper.all_stock_info, file_path='../samples/data.json')
Downloader.download_md(data=scraper.all_stock_info, file_path='../samples/data.md')

Examples of these downloads can be found here