API Reference
This page contains the auto-generated API reference for aynse
.
aynse.nse
NSEArchives
cutoff_date = date(2024, 7, 8)
class-attribute
instance-attribute
Conventions d - 1, 12 (without leading zero) dd - 01, 21 (day of the month with leading zero) mm - 01, 12 (month with leading zero) m - 1, 12 (month without leading zero) MMM - JAN, DEC yy - 19, 20 yyyy - 2020, 2030
bhavcopy_fo_raw(dt)
Downloads raw F&O bhavcopy text for a specific date
bhavcopy_fo_save(dt, dest, skip_if_present=True)
Saves Derivatives Bhavcopy to a directory
bhavcopy_raw(dt)
Downloads raw bhavcopy text for a specific date
Uses new NSE API endpoints with date-based format switching. - Before July 8, 2024: Uses old CSV format API - After July 8, 2024: Uses new ZIP format API with different structure
bhavcopy_save(dt, dest, skip_if_present=True)
Downloads and saves raw bhavcopy csv file for a specific date
Uses new NSE API endpoints with automatic fallback to old archives.
bulk_deals_raw(from_date, to_date)
Downloads bulk deals for a given date range. :param from_date: From date :param to_date: To date :return: JSON response from the API
bulk_deals_save(from_date, to_date, dest)
Saves bulk deals for a given date range to a JSON file. :param from_date: From date :param to_date: To date :param dest: Destination directory :return: Path to the saved file
full_bhavcopy_raw(dt)
Downloads full raw bhavcopy text for a specific date. This uses the new API endpoint and works for all dates without a cutoff. The endpoint directly returns the CSV content.
NSEIndexConstituents
Bases: NSEArchives
NSE Index constituents https://niftyindices.com/indices/equity/broad-based-indices/NIFTY--50 Index constituent link https://niftyindices.com/IndexConstituent/ind_nifty50list.csv Args: NSEArchives (class): Base class
index_constituent_raw(index_type=str)
Downloads raw index constituent text for a specific index
index_constituent_save(index_type, dest, skip_if_present=True)
Downloads and saves index constituent csv for a specific index
index_constituent_save_all(dest, skip_if_present=True)
Downloads and saves index constituent csv for all known indexes
NSEIndices
List of NSE indices
get_indices_with_underscores()
classmethod
Returns a list of indices with underscores
get_indices_without_underscores()
classmethod
Returns a list of indices without underscores
NSEIndicesArchives
Bases: NSEArchives
bhavcopy_index_raw(dt)
Downloads raw index bhavcopy text for a specific date
bhavcopy_index_save(dt, dest, skip_if_present=True)
Downloads and saves index bhavcopy csv for a specific date
NSELive
corporate_announcements(segment='equities', from_date=None, to_date=None, symbol=None)
This function returns the corporate annoucements (https://www.nseindia.com/companies-listing/corporate-filings-announcements)
live_cache(app_name)
Caches the output for time_out specified. This is done in order to prevent hitting live quote requests to NSE too frequently. This wrapper will fetch the quote/live result first time and return the same result for any calls within 'time_out' seconds.
Logic
key = concat of args try: cached_value = self._cache[key] if now - self._cache['tstamp'] < time_out return cached_value['value'] except AttributeError: # _cache attribute has not been created yet self._cache = {} finally: val = fetch-new-value new_value = {'tstamp': now, 'value': val} self._cache[key] = new_value return val
aynse.holidays
aynse.rbi
RBI
current_rates()
DEPRECATED: This function is broken because of website changes.