Lean  $LEAN_TAG$
QuantConnect.Securities.LocalMarketHours Class Reference

Represents the market hours under normal conditions for an exchange and a specific day of the week in terms of local time More...

Public Member Functions

 LocalMarketHours (DayOfWeek day, params MarketHoursSegment[] segments)
 Initializes a new instance of the LocalMarketHours class More...
 
 LocalMarketHours (DayOfWeek day, IEnumerable< MarketHoursSegment > segments)
 Initializes a new instance of the LocalMarketHours class More...
 
 LocalMarketHours (DayOfWeek day, TimeSpan extendedMarketOpen, TimeSpan marketOpen, TimeSpan marketClose, TimeSpan extendedMarketClose)
 Initializes a new instance of the LocalMarketHours class from the specified open/close times More...
 
 LocalMarketHours (DayOfWeek day, TimeSpan marketOpen, TimeSpan marketClose)
 Initializes a new instance of the LocalMarketHours class from the specified open/close times using the market open as the extended market open and the market close as the extended market close, effectively removing any 'extended' session from these exchange hours More...
 
TimeSpan? GetMarketOpen (TimeSpan time, bool extendedMarketHours, TimeSpan? previousDayLastSegment=null)
 Gets the market opening time of day More...
 
TimeSpan? GetMarketClose (TimeSpan time, bool extendedMarketHours, TimeSpan? nextDaySegmentStart=null)
 Gets the market closing time of day More...
 
bool IsOpen (TimeSpan time, bool extendedMarketHours)
 Determines if the exchange is open at the specified time More...
 
bool IsOpen (TimeSpan start, TimeSpan end, bool extendedMarketHours)
 Determines if the exchange is open during the specified interval More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 

Static Public Member Functions

static LocalMarketHours ClosedAllDay (DayOfWeek dayOfWeek)
 Gets a LocalMarketHours instance that is always closed More...
 
static LocalMarketHours OpenAllDay (DayOfWeek dayOfWeek)
 Gets a LocalMarketHours instance that is always open More...
 
static bool IsContinuousMarketOpen (TimeSpan? previousSegmentEnd, TimeSpan? nextSegmentStart, bool prevSegmentIsFromPrevDay=true)
 Check the given segment is not part of the current previous segment More...
 

Properties

bool IsClosedAllDay [get]
 Gets whether or not this exchange is closed all day More...
 
bool IsOpenAllDay [get]
 Gets whether or not this exchange is closed all day More...
 
DayOfWeek DayOfWeek [get]
 Gets the day of week these hours apply to More...
 
TimeSpan MarketDuration [get]
 Gets the tradable time during the market day. For a normal US equity trading day this is 6.5 hours. This does NOT account for extended market hours and only considers MarketHoursState.Market More...
 
ReadOnlyCollection< MarketHoursSegmentSegments [get]
 Gets the individual market hours segments that define the hours of operation for this day More...
 

Detailed Description

Represents the market hours under normal conditions for an exchange and a specific day of the week in terms of local time

Definition at line 27 of file LocalMarketHours.cs.

Constructor & Destructor Documentation

◆ LocalMarketHours() [1/4]

QuantConnect.Securities.LocalMarketHours.LocalMarketHours ( DayOfWeek  day,
params MarketHoursSegment[]  segments 
)

Initializes a new instance of the LocalMarketHours class

Parameters
dayThe day of the week these hours are applicable
segmentsThe open/close segments defining the market hours for one day

Definition at line 62 of file LocalMarketHours.cs.

Here is the caller graph for this function:

◆ LocalMarketHours() [2/4]

QuantConnect.Securities.LocalMarketHours.LocalMarketHours ( DayOfWeek  day,
IEnumerable< MarketHoursSegment segments 
)

Initializes a new instance of the LocalMarketHours class

Parameters
dayThe day of the week these hours are applicable
segmentsThe open/close segments defining the market hours for one day

Definition at line 72 of file LocalMarketHours.cs.

◆ LocalMarketHours() [3/4]

QuantConnect.Securities.LocalMarketHours.LocalMarketHours ( DayOfWeek  day,
TimeSpan  extendedMarketOpen,
TimeSpan  marketOpen,
TimeSpan  marketClose,
TimeSpan  extendedMarketClose 
)

Initializes a new instance of the LocalMarketHours class from the specified open/close times

Parameters
dayThe day of week these hours apply to
extendedMarketOpenThe extended market open time
marketOpenThe regular market open time, must be greater than or equal to the extended market open time
marketCloseThe regular market close time, must be greater than the regular market open time
extendedMarketCloseThe extended market close time, must be greater than or equal to the regular market close time

Definition at line 101 of file LocalMarketHours.cs.

◆ LocalMarketHours() [4/4]

QuantConnect.Securities.LocalMarketHours.LocalMarketHours ( DayOfWeek  day,
TimeSpan  marketOpen,
TimeSpan  marketClose 
)

Initializes a new instance of the LocalMarketHours class from the specified open/close times using the market open as the extended market open and the market close as the extended market close, effectively removing any 'extended' session from these exchange hours

Parameters
dayThe day of week these hours apply to
marketOpenThe regular market open time
marketCloseThe regular market close time, must be greater than the regular market open time

Definition at line 114 of file LocalMarketHours.cs.

Member Function Documentation

◆ GetMarketOpen()

TimeSpan? QuantConnect.Securities.LocalMarketHours.GetMarketOpen ( TimeSpan  time,
bool  extendedMarketHours,
TimeSpan?  previousDayLastSegment = null 
)

Gets the market opening time of day

Parameters
timeThe reference time, the open returned will be the first open after the specified time if there are multiple market open segments
extendedMarketHoursTrue to include extended market hours, false for regular market hours
previousDayLastSegmentThe previous days last segment. This is used when the potential next market open is the first segment of the day so we need to check that segment is not part of previous day last segment. If null, it means there were no segments on the last day
Returns
The market's opening time of day

Definition at line 127 of file LocalMarketHours.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMarketClose()

TimeSpan? QuantConnect.Securities.LocalMarketHours.GetMarketClose ( TimeSpan  time,
bool  extendedMarketHours,
TimeSpan?  nextDaySegmentStart = null 
)

Gets the market closing time of day

Parameters
timeThe reference time, the close returned will be the first close after the specified time if there are multiple market open segments
extendedMarketHoursTrue to include extended market hours, false for regular market hours
nextDaySegmentStartNext day first segment start. This is used when the potential next market close is the last segment of the day so we need to check that segment is not continued on next day first segment. If null, it means there are no segments on the next day
Returns
The market's closing time of day

Definition at line 173 of file LocalMarketHours.cs.

Here is the call graph for this function:

◆ IsOpen() [1/2]

bool QuantConnect.Securities.LocalMarketHours.IsOpen ( TimeSpan  time,
bool  extendedMarketHours 
)

Determines if the exchange is open at the specified time

Parameters
timeThe time of day to check
extendedMarketHoursTrue to check exended market hours, false to check regular market hours
Returns
True if the exchange is considered open, false otherwise

Definition at line 222 of file LocalMarketHours.cs.

Here is the caller graph for this function:

◆ IsOpen() [2/2]

bool QuantConnect.Securities.LocalMarketHours.IsOpen ( TimeSpan  start,
TimeSpan  end,
bool  extendedMarketHours 
)

Determines if the exchange is open during the specified interval

Parameters
startThe start time of the interval
endThe end time of the interval
extendedMarketHoursTrue to check exended market hours, false to check regular market hours
Returns
True if the exchange is considered open, false otherwise

Definition at line 249 of file LocalMarketHours.cs.

Here is the call graph for this function:

◆ ClosedAllDay()

static LocalMarketHours QuantConnect.Securities.LocalMarketHours.ClosedAllDay ( DayOfWeek  dayOfWeek)
static

Gets a LocalMarketHours instance that is always closed

Parameters
dayOfWeekThe day of week
Returns
A LocalMarketHours instance that is always closed

Definition at line 282 of file LocalMarketHours.cs.

Here is the call graph for this function:

◆ OpenAllDay()

static LocalMarketHours QuantConnect.Securities.LocalMarketHours.OpenAllDay ( DayOfWeek  dayOfWeek)
static

Gets a LocalMarketHours instance that is always open

Parameters
dayOfWeekThe day of week
Returns
A LocalMarketHours instance that is always open

Definition at line 292 of file LocalMarketHours.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsContinuousMarketOpen()

static bool QuantConnect.Securities.LocalMarketHours.IsContinuousMarketOpen ( TimeSpan?  previousSegmentEnd,
TimeSpan?  nextSegmentStart,
bool  prevSegmentIsFromPrevDay = true 
)
static

Check the given segment is not part of the current previous segment

Parameters
previousSegmentEndPrevious segment end time before the current segment
nextSegmentStartThe next segment start time
prevSegmentIsFromPrevDayIndicated whether the previous segment is from the previous day or not (then it is from the same day as the next segment). Defaults to true
Returns
True if indeed the given segment is part of the last segment. False otherwise

Definition at line 305 of file LocalMarketHours.cs.

Here is the caller graph for this function:

◆ ToString()

override string QuantConnect.Securities.LocalMarketHours.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 328 of file LocalMarketHours.cs.

Property Documentation

◆ IsClosedAllDay

bool QuantConnect.Securities.LocalMarketHours.IsClosedAllDay
get

Gets whether or not this exchange is closed all day

Definition at line 32 of file LocalMarketHours.cs.

◆ IsOpenAllDay

bool QuantConnect.Securities.LocalMarketHours.IsOpenAllDay
get

Gets whether or not this exchange is closed all day

Definition at line 37 of file LocalMarketHours.cs.

◆ DayOfWeek

DayOfWeek QuantConnect.Securities.LocalMarketHours.DayOfWeek
get

Gets the day of week these hours apply to

Definition at line 42 of file LocalMarketHours.cs.

◆ MarketDuration

TimeSpan QuantConnect.Securities.LocalMarketHours.MarketDuration
get

Gets the tradable time during the market day. For a normal US equity trading day this is 6.5 hours. This does NOT account for extended market hours and only considers MarketHoursState.Market

Definition at line 50 of file LocalMarketHours.cs.

◆ Segments

ReadOnlyCollection<MarketHoursSegment> QuantConnect.Securities.LocalMarketHours.Segments
get

Gets the individual market hours segments that define the hours of operation for this day

Definition at line 55 of file LocalMarketHours.cs.


The documentation for this class was generated from the following file: