A Tool for collecting stock data, to do fundamental analysis and does not predict or recommend any stock in particular.
Project description
stockscraper
Introduction
Stock Ratio Scraper is a Python web scraping program designed to fetch financial ratios for various stocks from a specific website. It scrapes stock names and links and then retrieves financial ratios such as MarketCap, CurrentPrice, StockPE, and more. The fetched data is stored in separate text files for further analysis or reference.
Disclaimer
Please note that web scraping may have legal implications, and it is essential to ensure compliance with the website's terms of service and data usage policy. Respect the website's server load and bandwidth, and use this tool responsibly.
Data Source
The financial ratios and stock data in this project are scraped from https://www.screener.in/. Please review their terms of service and data usage policy for more information on data access and usage.
Requirements
- Python 3.x
requestslibraryBeautifulSouplibrarytqdmlibrary
How to Use
The code is divided into two classes: FetchStocks and FetchStocksData.
-
Import library or Clone it.
- To Import STEP-1:
pip install stockscraper - To Import STEP-2
Create a .py file and write
import stockscraperIn any case, above code don't work use,from stockscraper import *
- To Import STEP-1:
-
Creating an Object to Get Names and corresponding links of stocks
Do the above step only for firsttime
No need to run this again, as long as you see a StockLink.txt in your folder.
obj_1 = stockscraper.FetchStocks(stockname,stinfo)
once you get all the name and corresponding links of stocks, create a new object of class FetchStockData
It takes two arrays as an argument to store stock name and stockinfoobj_2 = stockscraper.FetchStockData(stinfo)
This will get data of each stock and store them in a comman array. It takes one array as an argument.stockscraper.FetchStockData.GetRatios()
It takes 8 array's as argument, to sort and store each data seperately obtained from above line individually.
The array arg's should be in order- MarketCap,
- CurrentPrice,
- StockPE,
- BookValue,
- DividendYield,
- ROCE,
- ROE,
- FaceValue.
stockscraper.FetchStockData.ExportRatios()
It Stores all the Ratios obtained earlier in a .txt file for furthur usage
It takes 8 arrays as an argument in order MarketCap,CurrentPrice,StockPE,BookValue,DividendYield,ROCE,ROE,FaceValue.
License
MIT License
Copyright (c) 2023 Pallav
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stockscraper-0.1.0.tar.gz.
File metadata
- Download URL: stockscraper-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0ab079e275f03b2756b5d6a5388ee700469043de727b40efd825f108e410d38
|
|
| MD5 |
3428e3a83a413f4dc66ce8673068b1a6
|
|
| BLAKE2b-256 |
282f459e4e4ae87841eb5e29273abbf9465af431cf73d5d86916e3c2a903a42e
|
File details
Details for the file stockscraper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stockscraper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d207b86072d3c24f2233123d483136f31869a9302cbef4a05a6e37113e460a0f
|
|
| MD5 |
23376f368938b3a478b887711dc69447
|
|
| BLAKE2b-256 |
e2ce27158f572288549c6c7cfe5ed1201175ee8883bd276e71a6a2316188f6cf
|