export type GetApiApiCalendarExchangeHolidaysArgs = {api_key: string, mic: string, year?: number | undefined, format?: ('json' | 'xml') | undefined, callback?: string | undefined}; export type GetApiApiCalendarExchangeHolidaysOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * All weekday closures (holidays), early closes and late opens for an exchange in one year, with holiday names where the rule set has them (ad-hoc closures have name null). For a year partly or wholly after the exchange's holiday data ends (e.g. XSHG, XBOM, XSES - see data_available_through on /api/calendar/exchanges) the covered part is returned, no closures are listed after the end date, trading_days counts every weekday after it, `holiday_data_available` is false and `warning` explains. Pro subscription required. Reference only. * * GET /api/calendar/exchange/holidays */ export const getApiApiCalendarExchangeHolidays = async (args: GetApiApiCalendarExchangeHolidaysArgs, options: GetApiApiCalendarExchangeHolidaysOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "nyse_2026") if (args.api_key != null) query.append("api_key", String(args.api_key)) if (args.mic != null) query.append("mic", String(args.mic)) if (args.year != null) query.append("year", String(args.year)) if (args.format != null) query.append("format", String(args.format)) if (args.callback != null) query.append("callback", String(args.callback)) const url = `${baseUrl.replace(/\/+$/, '')}/api/calendar/exchange/holidays${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };