Skip to content

atibhis/webscrape_yfinance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Market Data

This repository fetches stick market data from Yahoo Finance for listed companies in Indian Stock Exchanges (NSE,BSE).

To fetch the data, run:

python webscrape/webscrape.py example.json

Here, webscrape/webscrape.py this is the python script that executes the webscraping and example.json is the system input. On running the command, two files will be saved - the historical data in a csv format (eg: INFY.csv) for the stock and the corresponding html file for the graph (eg: INFY.html).

The input should be in a JSON format.

The JSON objects should be:

  • symbol : Stock Symbol (eg: INFY)
  • exchange : NSE | BSE (default: NSE)
  • frequency : Daily | Weekly | Monthly (default: Daily)
  • start_date : Start date for data in YYYY-MM-DD format (eg: 2002-03-01)
  • end_date : End date for data in YYYY-MM-DD format (eg: 2012-03-01) (default: Present Day)
  • span : 1D, 5D, 3M, 6M, YTD, 1Y, 5Y, Max (default: 1Y)

Note: Either mention start_date (& end_date in case it should not default to present day) or span. If both are provided, start_date would be implemented.

Examples of system input example.json:

{
    "symbol": "INFY"
}
{
    "symbol": "INFY",
    "start_date": "2022-01-01"
}
{
    "symbol": "INFY",
    "frequency": "Weekly",
    "span": "6M" 
}
{
    "symbol": "INFY",
    "frequency": "Monthly",
    "span": "Max" 
}

Output of saved data:

Data Image

Output of saved graph:

Graph Image

About

Stock Market Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors