Skip to main content

A python module to scrape the BSE INDIA website for all stock related data.

Reason this release was yanked:

Fixed bug in get_stock_data function

Project description

BSE Scraper Documentation

Version: 1.0.5
Description: A Python library to scrape data from the BSE India website

Get Started

  1. CLASS: BSE()
    • Example:
    • import bsescraper
      bs = bsescraper.BSE()
      bs.function()
      

Functions()

  1. get_corporate_ann

    • Description: Retrieves corporate announcements based on the provided parameters.
    • Parameters:
      • code: Security code of the company as an integer value.
      • category: Category of announcements (e.g., 'Board Meeting','Company Update','Corp. Action','AGM/EGM','New Listing','Results','Others').
      • startdate: Start date of the search period in the format 'dd/mm/yyyy'.
      • enddate: End date of the search period in the format 'dd/mm/yyyy'.
    • Returns: List of dictionaries containing headline, subject, and date of announcements.
  2. get_corporate_ann_keywords

    • Description: Retrieves corporate announcements with specific keywords.
    • Parameters:
      • keywords: List of keywords to filter announcements(e.g., ["allotment",".."]).
      • code: Security code of the company as an integer value.
      • category: Category of announcements (e.g., 'Board Meeting','Company Update','Corp. Action','AGM/EGM','New Listing','Results','Others').
      • startdate: Start date of the search period in the format 'dd/mm/yyyy'.
      • enddate: End date of the search period in the format 'dd/mm/yyyy'.
    • Returns: List of dictionaries containing headline, subject, and date of announcements that contain the specified keywords.
  3. GainerLoserDataMarket

    • Description: Retrieves gainer/loser data from the market.
    • Parameters:
      • type: Type of data to retrieve ('gainer', 'loser').
      • order: Sorting order for the data('0':upto to 2%, '2': 2-5%, '5':5-10%, '10':More than 10%, 'all':for all records).
    • Returns: List of dictionaries containing security code, name, open rate, high rate, low rate, last traded price (LTP), change, change percent, and date.
  4. GainerLoserDataGroup

    • Description: Retrieves gainer/loser data based on a specific group.
    • Parameters:
      • type: Type of data to retrieve (gainer, loser).
      • group: Group for filtering data(A,B,E,IF,M,MS,MT,P,T,X,XT,Z,ZP).
      • order: Sorting order for the data('0':upto to 2%, '2': 2-5%, '5':5-10%, '10':More than 10%, 'all':for all records).
    • Returns: List of dictionaries containing security code, name, open rate, high rate, low rate, LTP, change, change percent, and date.
  5. get_index

    • Description: Retrieves index data based on the provided category.
    • Parameters:
      • category: Category of the index ("MCB","S&I","THE","STR","SUS","VOL","COM","GOV","COR","MOM").
    • Returns: List of dictionaries containing index name, open rate, high rate, low rate, current value, change, change percentage, 52-week high, 52-week low, market cap, market cap percentage, net turnover, and turnover percentage.
  6. get_stock_data

    • Description: Retrieves historical stock prices based on the provided parameters.
    • Parameters:
      • code: Security code of the stock in integers.
      • startdate: Start date of the data in the format 'dd/mm/yyyy'.
      • enddate: End date of the data in the format 'dd/mm/yyyy'.
    • Returns: List of dictionaries containing date, open, high, low, close, weighted price, number of shares, number of trades, net turnover, delivery quantity, percentage delivery quantity, spread high-low, and spread open-close.
  7. get_code

    • Description: Retrieves the security code based on the provided Security name.
    • Parameters:
      • name: Name of the full company(e.g., "HDFC Bank Ltd").
    • Returns: Security code as an integer.
  8. top_turnovers

    • Description: Retrieves top turnovers data.
    • Parameters:
      • num: Number of top turnovers to retrieve as integer.
    • Returns: List of dictionaries containing security code, name, group, open rate, high rate, low rate, last traded price, previous day close, change value, change percentage, index code, trade value, trade volume, number of trades, trend, and date and time.
  9. dataframe

    • Description: Converts a dictionary to a Pandas DataFrame.
    • Parameters:
      • dictionary: Input dictionary.
    • Returns: Pandas DataFrame.
  10. save

    • Description: Saves a DataFrame to a CSV file.
    • Parameters:
      • df: Pandas DataFrame to save.
      • name: Name of the CSV file (without extension).
    • Returns: "Saved" upon successful saving.
  11. version

    • Description: Prints the version of the BSE Scraper library.
  12. description

    • Description: Prints the description of the BSE Scraper library.
  13. functions

    • Description: Prints the list of available functions in the BSE Scraper library.

Note: The library requires the requests and pandas libraries to be installed. Make sure to set the appropriate headers for web scraping.

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

bsescraper-1.0.5.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

bsescraper-1.0.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file bsescraper-1.0.5.tar.gz.

File metadata

  • Download URL: bsescraper-1.0.5.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for bsescraper-1.0.5.tar.gz
Algorithm Hash digest
SHA256 cfeec13e32b111b5749b9ff49a4e9264e434c586e920378a91b536dd6fda1a85
MD5 6207f354e55c3257d845f00f8698acc4
BLAKE2b-256 64b54aa645267e2f375cfec21bbf2c29f6327f4d50e9b84caee8993501ba44d0

See more details on using hashes here.

File details

Details for the file bsescraper-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: bsescraper-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for bsescraper-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9e8eb985bc282c79ae93e9e142e902246e8871ca8a7e53b694e1d558ae2d85cd
MD5 181a95ab6977253b6f649733bb5f9e70
BLAKE2b-256 fad4ac315b44de2cfb892e83746d16e4b422eab0bec8383878c20523eb93fa39

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