Skip to main content

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
  • requests library
  • BeautifulSoup library
  • tqdm library

How to Use

The code is divided into two classes: FetchStocks and FetchStocksData.

  1. Import library or Clone it.

    • To Import STEP-1: pip install stockscraper
    • To Import STEP-2 Create a .py file and write import stockscraper In any case, above code don't work use, from stockscraper import *
  2. Creating an Object to Get Names and corresponding links of stocks

    Do the above step only for firsttime

    obj_1 = stockscraper.fetchStocks(stockname,stinfo)

    No need to run the above line again, as long as you see a StockLink.txt in your folder.

    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 stockinfo

    obj_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stockscraper-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stockscraper-0.1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file stockscraper-0.1.1.tar.gz.

File metadata

  • Download URL: stockscraper-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for stockscraper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5ec40bf04c056d052eb8295d4e161d8ef386ab4d943badfc361b1843480f349b
MD5 31bb6e1f635d975c17d60851ed574e36
BLAKE2b-256 e737eeaf58b7751e6dc9f520cc4c0f3e298e4e162785eb240904b11f3a5dfef0

See more details on using hashes here.

File details

Details for the file stockscraper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: stockscraper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for stockscraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6796a814de2c5628b1afc79a551baa5df32daf8b944962f82b4fe8419adf96a7
MD5 055d9ea46c2d6673c076e8c115537183
BLAKE2b-256 716410344cb4add14aa5d450ab831b99a776744d1ad12629b69e7a4642b4a14b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page