Class Schedule
Schedule class provides API to retrieve and explore trading schedules of different exchanges and different classes of financial instruments. Each instance of schedule covers separate trading schedule of some class of instruments, i.e. NYSE stock trading schedule or CME corn futures trading schedule. Each schedule splits entire time scale into separate Day that are aligned to the specific trading hours of covered trading schedule.
public class Schedule
- Inheritance
-
Schedule
- Inherited Members
Methods
DownloadDefaults(string)
Downloads defaults using specified download config and optionally start periodic download. The specified config can be one of the following:
- "" or null - stop periodic download
- URL - download once from specified URL and stop periodic download
- URL,period - start periodic download from specified URL
- "auto" - start periodic download from default location
public static void DownloadDefaults(string downloadConfig)
Parameters
downloadConfig
stringThe download config.
GetDayById(int)
Gets day for specified day identifier. This method will throw JavaException if specified day identifier falls outside of valid date range from 0001-01-02 to 9999-12-30.
public Day GetDayById(int dayId)
Parameters
dayId
intThe day identifier to search for.
Returns
- Day
The day for specified day identifier.
GetDayByTime(long)
Gets day that contains specified time. This method will throw JavaException if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30.
public Day GetDayByTime(long time)
Parameters
time
longThe time to search for.
Returns
- Day
The day that contains specified time.
GetDayByYearMonthDay(int)
Gets day for specified year, month and day numbers. Year, month, and day numbers shall be decimally packed in the following way:
YearMonthDay = year * 10000 + month * 100 + day
For example, September 28, 1977 has value 19770928.
If specified day does not exist then this method returns day with the lowest valid YearMonthDay that is greater than specified one. This method will throw JavaException if specified year, month and day numbers fall outside of valid date range from 0001-01-02 to 9999-12-30.public Day GetDayByYearMonthDay(int yearMonthDay)
Parameters
yearMonthDay
intThe year, month and day numbers to search for.
Returns
- Day
The day for specified year, month and day numbers.
GetInstance(InstrumentProfile)
Gets default schedule instance for specified instrument profile.
public static Schedule GetInstance(InstrumentProfile profile)
Parameters
profile
InstrumentProfileThe instrument profile those schedule is requested.
Returns
- Schedule
The default schedule instance for specified instrument profile.
GetInstance(InstrumentProfile, string)
Gets schedule instance for specified instrument profile and trading venue.
public static Schedule GetInstance(InstrumentProfile profile, string venue)
Parameters
profile
InstrumentProfileThe instrument profile those schedule is requested.
venue
stringThe trading venue those schedule is requested.
Returns
- Schedule
The schedule instance for specified instrument profile and trading venue.
GetInstance(string)
Gets default schedule instance for specified schedule definition.
public static Schedule GetInstance(string scheduleDefinition)
Parameters
scheduleDefinition
stringThe schedule definition of requested schedule.
Returns
- Schedule
The default schedule instance for specified schedule definition.
GetName()
Gets name of this schedule.
public string GetName()
Returns
- string
The name.
GetNearestSessionByTime(long, SessionFilter)
Gets the session nearest to the specified time that is accepted by the specified filter, or null if no such session is found.
public Session? GetNearestSessionByTime(long time, SessionFilter filter)
Parameters
time
longThe time to search for, expressed as a long integer.
filter
SessionFilterThe filter used to evaluate the sessions.
Returns
- Session
The nearest session to the specified time that meets the filter criteria; otherwise, null.
GetSessionByTime(long)
Gets session that contains specified time. This method will throw JavaException if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30.
public Session GetSessionByTime(long time)
Parameters
time
longThe time to search for.
Returns
- Session
The session that contains specified time.
GetTimeZone()
Gets time zone in which this schedule is defined.
public string GetTimeZone()
Returns
- string
The time zone.
GetTradingVenues(InstrumentProfile)
Gets trading venues for specified instrument profile.
public static List<string> GetTradingVenues(InstrumentProfile profile)
Parameters
profile
InstrumentProfileThe instrument profile those trading venues are requested.
Returns
SetDefaults(byte[])
Sets shared defaults that are used by individual schedule instances.
public static void SetDefaults(byte[] data)
Parameters
data
byte[]The content of default data.
TryGetNearestSessionByTime(long, SessionFilter, out Session)
Tries to find the session nearest to the specified time that is accepted by the specified filter.
public bool TryGetNearestSessionByTime(long time, SessionFilter filter, out Session session)
Parameters
time
longThe time to search for, expressed as a long integer.
filter
SessionFilterThe filter used to test the sessions.
session
SessionWhen this method returns, contains the session that is nearest to the specified time and accepted by the specified filter, if such a session is found; otherwise, null.
Returns
- bool
true
if a session meeting the filter criteria is found; otherwise,false
.
Remarks
This method will return null
if no sessions acceptable by the specified filter are found within one year.
To find the nearest trading session of any type, use the following code:
bool found = TryGetNearestSessionByTime(time, SessionFilter.TRADING, out Session session);
To find the nearest regular trading session, use this code:
bool found = TryGetNearestSessionByTime(time, SessionFilter.REGULAR, out Session session);
Exceptions
- JavaException
Thrown if the specified time falls outside of the valid date range from 0001-01-02 to 9999-12-30.