### Install bsedata with pip Source: https://bsedata.readthedocs.io/en/latest/usage.html Use this command to install the bsedata library using pip. ```bash pip install bsedata ``` -------------------------------- ### Get Multiple Stock Quotes in Bulk Source: https://bsedata.readthedocs.io/en/latest/usage.html Fetch quotes for multiple stocks efficiently by iterating through a list of scrip codes. This example demonstrates how to retrieve the company name, current value, and update time for each stock. ```python b = BSE() codelist = ["500116", "512573"] for code in codelist: quote = b.getQuote(code) pprint(quote["companyName"]) pprint(quote["currentValue"]) pprint(quote["updatedOn"]) ``` -------------------------------- ### Get Indices by Category Source: https://bsedata.readthedocs.io/en/latest/_sources/usage.rst.txt Retrieve index data by specifying a category. The 'corporate' category is used as an example, and the output contains index details including change. ```Python indices = b.getIndices(category='corporate') pprint(indices) # Output: # {'indices': [{'change': '-0.31', ``` -------------------------------- ### Get All Listed Companies and Scrip Codes Source: https://bsedata.readthedocs.io/en/latest/usage.html Retrieves a dictionary containing all listed companies and their corresponding scrip codes. The output can be very large. ```python pprint(b.getScripCodes()) ``` -------------------------------- ### Get Indices by Category Source: https://bsedata.readthedocs.io/en/latest/usage.html Fetch index data by specifying a category. The 'corporate' category is used in this example to retrieve corporate bond indices. ```python indices = b.getIndices(category='corporate') pprint(indices) ``` -------------------------------- ### Get Top Gainers Source: https://bsedata.readthedocs.io/en/latest/usage.html Retrieve a list of stocks that have shown the highest gains. The output includes the Last Traded Price (LTP), change in price, and percentage change. ```python tg = b.topGainers() pprint(tg) ``` -------------------------------- ### Get Top Losers Source: https://bsedata.readthedocs.io/en/latest/usage.html Retrieve a list of stocks that have experienced the largest losses. The output includes the Last Traded Price (LTP), change in price, and percentage change. ```python tg = b.topLosers() pprint(tg) ``` -------------------------------- ### Get a Single Stock Quote Source: https://bsedata.readthedocs.io/en/latest/usage.html Retrieve all publicly available data for a specific stock using its scrip code. You can then extract the required fields from the returned dictionary. ```python q = b.getQuote('534976') pprint(q) ``` -------------------------------- ### BSE.getQuote() Source: https://bsedata.readthedocs.io/en/latest/index.html Gets the stock quote for a given scrip code. This method is part of the BSE class. ```APIDOC ## BSE.getQuote() ### Description Retrieves the real-time stock quote for a specific scrip code. ### Method This is a method within the `BSE` class. ### Parameters This method likely requires a scrip code as input, though not explicitly detailed in the provided text. ### Response Returns the stock quote information for the specified scrip code. Specific response format is not detailed. ``` -------------------------------- ### Instantiate BSE Class Source: https://bsedata.readthedocs.io/en/latest/_sources/usage.rst.txt Create an instance of the BSE class to interact with the library. Optionally, update script codes on instantiation. ```Python from bsedata.bse import BSE b = BSE() print(b) # Output: # Driver Class for Bombay Stock Exchange (BSE) ``` ```Python # to execute "updateScripCodes" on instantiation b = BSE(update_codes = True) ``` -------------------------------- ### Instantiate BSE Class Source: https://bsedata.readthedocs.io/en/latest/usage.html Instantiate the BSE class to interact with the Bombay Stock Exchange data. Optionally, update scrip codes on instantiation. ```python from bsedata.bse import BSE b = BSE() print(b) ``` ```python # to execute "updateScripCodes" on instantiation b = BSE(update_codes = True) ``` -------------------------------- ### BSE.topGainers() Source: https://bsedata.readthedocs.io/en/latest/index.html Fetches the list of top gainers. This method is part of the BSE class. ```APIDOC ## BSE.topGainers() ### Description Retrieves the list of top performing stocks (gainers) on the BSE. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response Returns a list or structure of top gainers. Specific response format is not detailed. ``` -------------------------------- ### Update Scrip Codes Cache Source: https://bsedata.readthedocs.io/en/latest/usage.html Downloads a fresh list of scrip codes from Quandl and refreshes the library's cache. This function returns nothing. ```python b.updateScripCodes() ``` -------------------------------- ### BSE.topLosers() Source: https://bsedata.readthedocs.io/en/latest/index.html Fetches the list of top losers. This method is part of the BSE class. ```APIDOC ## BSE.topLosers() ### Description Retrieves the list of top performing stocks (losers) on the BSE. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response Returns a list or structure of top losers. Specific response format is not detailed. ``` -------------------------------- ### BSE.getIndices() Source: https://bsedata.readthedocs.io/en/latest?badge=latest Fetches current index data for the Bombay Stock Exchange. ```APIDOC ## BSE.getIndices() ### Description Fetches current index data for the Bombay Stock Exchange. ### Method `BSE.getIndices()` ### Parameters This method does not take any parameters. ### Response Returns index data. Specific response structure is not detailed in the source. ``` -------------------------------- ### BSE.getScripCodes() Source: https://bsedata.readthedocs.io/en/latest/index.html Retrieves a list of all scrip codes. This method is part of the BSE class. ```APIDOC ## BSE.getScripCodes() ### Description Retrieves a list of all available scrip codes for listed companies on the BSE. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response Returns a list or structure containing scrip codes. Specific response format is not detailed. ``` -------------------------------- ### BSE.verifyScripCode() Source: https://bsedata.readthedocs.io/en/latest/index.html Verifies if a given scrip code is valid. This method is part of the BSE class. ```APIDOC ## BSE.verifyScripCode() ### Description Verifies the validity of a provided scrip code against the BSE's records. ### Method This is a method within the `BSE` class. ### Parameters This method likely requires a scrip code as input, though not explicitly detailed in the provided text. ### Response Returns a boolean or status indicating whether the scrip code is valid. Specific response format is not detailed. ``` -------------------------------- ### BSE.topLosers Source: https://bsedata.readthedocs.io/en/latest/apiref.html Returns a sorted list of scrip codes for the top-losing stocks on the BSE. This helps identify stocks that have experienced the most significant price decrease. ```APIDOC ## BSE.topLosers() ### Description Retrieves a list of scrip codes for the top losers on the BSE. ### Returns A sorted list of codes of top losers ``` -------------------------------- ### BSE.topGainers Source: https://bsedata.readthedocs.io/en/latest/apiref.html Returns a sorted list of scrip codes for the top-performing stocks (gainers) on the BSE. This helps identify stocks that have shown the most significant price increase. ```APIDOC ## BSE.topGainers() ### Description Retrieves a list of scrip codes for the top gainers on the BSE. ### Returns A sorted list of codes of top gainers ``` -------------------------------- ### BSE.getBhavCopyData() Source: https://bsedata.readthedocs.io/en/latest/index.html Retrieves Bhav Copy data. This method is part of the BSE class. ```APIDOC ## BSE.getBhavCopyData() ### Description Retrieves Bhav Copy data from the Bombay Stock Exchange. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response Returns Bhav Copy data. Specific response format is not detailed. ``` -------------------------------- ### BSE.getScripCodes Source: https://bsedata.readthedocs.io/en/latest/apiref.html Retrieves a dictionary mapping scrip codes to their corresponding company names. This is useful for looking up company names associated with specific stock codes. ```APIDOC ## BSE.getScripCodes() ### Description Fetches a mapping of all available scrip codes to their respective company names. ### Returns A dictionary with scrip codes as keys and company names as values ``` -------------------------------- ### BSE.verifyScripCode Source: https://bsedata.readthedocs.io/en/latest/apiref.html Verifies if a given code corresponds to a valid stock trading on the BSE. Returns the company name if the code is valid, otherwise returns None. ```APIDOC ## BSE.verifyScripCode(code) ### Description Verifies if the provided code is a valid stock code on the BSE. ### Parameters #### Path Parameters - **code** (string) - Required - The stock code to verify ### Returns Company name if it is a valid stock code, else None ``` -------------------------------- ### BSE.updateScripCodes() Source: https://bsedata.readthedocs.io/en/latest/index.html Updates the list of scrip codes. This method is part of the BSE class. ```APIDOC ## BSE.updateScripCodes() ### Description Updates the internal list of scrip codes, likely by fetching the latest data from the BSE. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response This method likely performs an update operation and may not return significant data, or the return value is not detailed. ``` -------------------------------- ### BSE.getIndices() Source: https://bsedata.readthedocs.io/en/latest/index.html Fetches stock market indices. This method is part of the BSE class. ```APIDOC ## BSE.getIndices() ### Description Fetches current stock market indices from the Bombay Stock Exchange. ### Method This is a method within the `BSE` class. ### Parameters This method does not appear to take any parameters based on the provided documentation. ### Response Returns a list or structure containing stock market indices. Specific response format is not detailed. ``` -------------------------------- ### BSE.getBhavCopyData Source: https://bsedata.readthedocs.io/en/latest/apiref.html Retrieves historical OHLCV (Open, High, Low, Close, Volume) data from the Bhav Copy released by BSE daily. It provides detailed information about each scrip's trading activity for a specified date. ```APIDOC ## BSE.getBhavCopyData(statsDate: date) ### Description Get historical OHLCV data from Bhav Copy released by BSE everyday after market closing. The columns available in the data and their description is as given below. Dictionary Field | Description ---|--- scripCode | Unique code assigned to a scrip of a company by BSE open | The price at which the security first trades on a given trading day high | The highest intra-day price of a stock low | The lowest intra-day price of a stock close | The final price at which a security is traded on a given trading day last | The last trade price of the stock prevClose | The closing price of the stock for the previous trading day totalTrades | The total number of trades of a scrip totalSharesTraded | The total number of shares transacted of a scrip netTurnover | Total turnover of a scrip scripType | Scrip category: Equity, Preference, Debenture or Bond securityID | Name of the company The Bhav Copy files have been mapped to the above mentioned custom fields. The complete documentation for Bhav Copy can be found here: https://www.bseindia.com/markets/MarketInfo/BhavCopy.aspx. ### Parameters #### Path Parameters - **statsDate** (date) - Required - A datetime.date object for the for which you want to fetch the data ### Returns A list of dictionaries which contains OHLCV data for that day for all scrip codes active on that day ### Raises - **BhavCopyNotFound** – Raised when Bhav Copy file is not found on BSE ``` -------------------------------- ### BSE.getIndices Source: https://bsedata.readthedocs.io/en/latest/apiref.html Fetches details about stock market indices belonging to a specified category. Returns a dictionary containing information about the indices. ```APIDOC ## BSE.getIndices(category) ### Description Retrieves details about stock market indices based on the provided category. ### Parameters #### Path Parameters - **category** (string) - Required - A category of indices ### Returns A dictionary with details about the indices belonging to the given category ``` -------------------------------- ### Verify Scrip Code Source: https://bsedata.readthedocs.io/en/latest/usage.html Verifies if a given scrip code is valid. Returns the company name if valid, otherwise returns None. Ensure `updateScripCodes()` has been called prior to verification. ```python b.updateScripCodes() # Valid scrip code pprint(b.verifyScripCode('534976')) # Output: # V-mart Retail Ltd. # invalid scrip code pprint(b.verifyScripCode('534980')) # Output: # None ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.