Skip to content

API Reference


API Reference / adjustTradingDateRange

Function: adjustTradingDateRange()

adjustTradingDateRange(input, options?): AdjustedDateRange

Defined in: src/ta/marketCalendar.ts:181

Normalizes and adjusts a date range for market APIs:

  • Clamps future dates to today's IST date.
  • Shifts weekend/holiday toDate to the nearest previous trading day (within maxShiftDays threshold, default 2).
  • Shifts weekend/holiday fromDate to the nearest trading day.
  • Clamps fromDate if toDate - fromDate exceeds maxDays (e.g., 90 days for intraday).

Parameters

input

DateRangeInput

options?

DateAdjustmentOptions = {}

Returns

AdjustedDateRange

Community project — not affiliated with Dhan. MIT License.