@livefolio/sdk / getCalendar
Function: getCalendar()
getCalendar(
name):ExchangeCalendar
Defined in: calendars/get-calendar.ts:36
Returns a new instance of the ExchangeCalendar registered under name. Acts as a simple factory / registry for the two built-in calendar implementations.
Supported exchange names: 'NYSE' (NYSEExchangeCalendar) and 'LSE' (LSEExchangeCalendar). TypeScript's exhaustive switch prevents unknown names from compiling.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | ExchangeName | One of the supported ExchangeName values. |
Returns
A fresh ExchangeCalendar instance for the named exchange.
Example
ts
import { getCalendar } from '@livefolio/sdk';
const nyse = getCalendar('NYSE');
console.log(nyse.isOpen(new Date('2024-07-04'))); // false — US Independence Day
const lse = getCalendar('LSE');
console.log(lse.isOpen(new Date('2024-12-25'))); // false — Christmas Day