Skip to content

contango.market.calendar.nyse_calendar

contango.market.calendar.nyse_calendar

NYSECalendar

NYSECalendar()

Bases: Calendar

Trading calendar for the New York Stock Exchange (9:00AM-4:00PM on weekdays, holidays taken into account).

Initializes `NYSECalendar.

Source code in src\contango\market\calendar\nyse_calendar.py
19
20
21
22
23
24
def __init__(self) -> None:
    """
    Initializes `NYSECalendar.
    """
    # xcals is cached by the library, so this does not have to be manually cached.
    self._calendar = xcals.get_calendar("XNYS", start="1990-01-01")

get_expected_timestamps

get_expected_timestamps(start_timestamp: int, end_timestamp: int, interval: Interval) -> tuple[datetime, ...]

Returns the expected available NYSE timestamps for the specified period.

Parameters:

Name Type Description Default
start_timestamp int

The start time in unix ms.

required
end_timestamp int

The end time in unix ms.

required
interval Interval

The bar interval type.

required

Returns:

Type Description
tuple[datetime, ...]

tuple[datetime]: The close times of the available NYSE trading bars for the designated period.

Source code in src\contango\market\calendar\nyse_calendar.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def get_expected_timestamps(
    self,
    start_timestamp: int,
    end_timestamp: int,
    interval: Interval,
) -> tuple[datetime, ...]:
    """
    Returns the expected available NYSE timestamps for the specified period.

    Args:
        start_timestamp: The start time in unix ms.
        end_timestamp: The end time in unix ms.
        interval: The bar interval type.

    Returns:
        tuple[datetime]: The close times of the available NYSE trading bars for the designated period.
    """
    return self._get_expected_timestamps_cached(start_timestamp, end_timestamp, interval)