public final class Schedule extends Object
days
that are aligned to the specific
trading hours of covered trading schedule.Modifier and Type | Method and Description |
---|---|
static void |
downloadDefaults(String downloadConfig)
Downloads defaults using specified download config and optionally start periodic download.
|
Session |
findNearestSessionByTime(long time,
SessionFilter filter)
Returns session that is nearest to the specified time and that is accepted by specified filter.
|
Day |
getDayById(int dayId)
Returns day for specified day identifier.
|
Day |
getDayByTime(long time)
Returns day that contains specified time.
|
Day |
getDayByYearMonthDay(int yearMonthDay)
Returns day for specified year, month and day numbers.
|
static Schedule |
getInstance(InstrumentProfile profile)
Returns default schedule instance for specified instrument profile.
|
static Schedule |
getInstance(InstrumentProfile profile,
String venue)
Returns schedule instance for specified instrument profile and trading venue.
|
static Schedule |
getInstance(String scheduleDefinition)
Returns default schedule instance for specified schedule definition.
|
String |
getName()
Returns name of this schedule.
|
Session |
getNearestSessionByTime(long time,
SessionFilter filter)
Returns session that is nearest to the specified time and that is accepted by specified filter.
|
Session |
getSessionByTime(long time)
Returns session that contains specified time.
|
TimeZone |
getTimeZone()
Returns time zone in which this schedule is defined.
|
static List<String> |
getTradingVenues(InstrumentProfile profile)
Returns trading venues for specified instrument profile.
|
static void |
setDefaults(byte[] data)
Sets shared defaults that are used by individual schedule instances.
|
String |
toString() |
public static Schedule getInstance(InstrumentProfile profile)
profile
- instrument profile those schedule is requestedpublic static Schedule getInstance(String scheduleDefinition)
scheduleDefinition
- schedule definition of requested schedulepublic static Schedule getInstance(InstrumentProfile profile, String venue)
profile
- instrument profile those schedule is requestedvenue
- trading venue those schedule is requestedpublic static List<String> getTradingVenues(InstrumentProfile profile)
profile
- instrument profile those trading venues are requestedpublic static void downloadDefaults(String downloadConfig)
downloadConfig
- download configpublic static void setDefaults(byte[] data) throws IOException
data
- content of default dataIOException
- If an I/O error occurspublic Session getSessionByTime(long time)
IllegalArgumentException
if specified time
falls outside of valid date range from 0001-01-02 to 9999-12-30.time
- the time to search forIllegalArgumentException
- if specified time falls outside of valid date rangepublic Day getDayByTime(long time)
IllegalArgumentException
if specified time
falls outside of valid date range from 0001-01-02 to 9999-12-30.time
- the time to search forIllegalArgumentException
- if specified time falls outside of valid date rangepublic Day getDayById(int dayId)
IllegalArgumentException
if specified day identifier
falls outside of valid date range from 0001-01-02 to 9999-12-30.dayId
- day identifier to search forIllegalArgumentException
- if specified day identifier falls outside of valid date rangeDay.getDayId()
public Day getDayByYearMonthDay(int yearMonthDay)
YearMonthDay = year * 10000 + month * 100 + dayFor 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 IllegalArgumentException
if specified year, month and day numbers
fall outside of valid date range from 0001-01-02 to 9999-12-30.
yearMonthDay
- year, month and day numbers to search forIllegalArgumentException
- if specified year, month and day numbers fall outside of valid date rangeDay.getYearMonthDay()
public Session getNearestSessionByTime(long time, SessionFilter filter)
IllegalArgumentException
if specified time
falls outside of valid date range from 0001-01-02 to 9999-12-30.
If no sessions acceptable by specified filter are found within one year this method will throw NoSuchElementException
.
To find nearest trading session of any type use this code:
session = schedule.getNearestSessionByTime(time, SessionFilter.TRADING);To find nearest regular trading session use this code:
session = schedule.getNearestSessionByTime(time, SessionFilter.REGULAR);
time
- the time to search forfilter
- the filter to test sessionsIllegalArgumentException
- if specified time falls outside of valid date rangeNoSuchElementException
- if no such day was found within one yearpublic Session findNearestSessionByTime(long time, SessionFilter filter)
IllegalArgumentException
if specified time
falls outside of valid date range from 0001-01-02 to 9999-12-30.
If no sessions acceptable by specified filter are found within one year this method will return null.
To find nearest trading session of any type use this code:
session = schedule.findNearestSessionByTime(time, SessionFilter.TRADING);To find nearest regular trading session use this code:
session = schedule.findNearestSessionByTime(time, SessionFilter.REGULAR);
time
- the time to search forfilter
- the filter to test sessionsIllegalArgumentException
- if specified time falls outside of valid date rangepublic String getName()
public TimeZone getTimeZone()
Copyright © 2002–2023 Devexperts LLC. All rights reserved.