|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dxfeed.schedule.Day
public final class Day
Day represents a continuous period of time approximately 24 hours long. The day is aligned to the start and the end of business activities of a certain business entity or business process. For example, the day may be aligned to a trading schedule of a particular instrument on an exchange. Thus, different days may start and end at various local times depending on the related trading schedules.
The length of the day depends on the trading schedule and other circumstances. For example, it is possible that day for Monday is longer than 24 hours because it includes part of Sunday; consequently, the day for Sunday will be shorter than 24 hours to avoid overlapping with Monday.
Days do not overlap with each other - rather they form consecutive chain of adjacent periods of time that cover entire time scale. The point on a border line is considered to belong to following day that starts there.
Each day consists of sessions that cover entire duration of the day. If day contains at least one trading session (i.e. session within which trading activity is allowed), then the day is considered trading day. Otherwise the day is considered non-trading day (e.g. weekend or holiday).
Day may contain sessions with zero duration - e.g. indices that post value once a day. Such sessions can be of any appropriate type, trading or non-trading. Day may have zero duration as well - e.g. when all time within it is transferred to other days.
Method Summary | |
---|---|
boolean |
containsTime(long time)
Returns true if specified time belongs to this day. |
boolean |
equals(java.lang.Object object)
|
int |
getDayId()
Number of this day since January 1, 1970 (that day has identifier of 0 and previous days have negative identifiers). |
int |
getDayOfMonth()
Returns ordinal day number in the month starting with 1 for the first day of month. |
int |
getDayOfWeek()
Returns ordinal day number in the week starting with 1=Monday and ending with 7=Sunday. |
java.lang.String |
getDescription()
Deprecated. no replacement |
long |
getEndTime()
Returns end time of this day (exclusive). |
Session |
getFirstSession(SessionFilter filter)
Returns first session belonging to this day accepted by specified filter. |
Session |
getLastSession(SessionFilter filter)
Returns last session belonging to this day accepted by specified filter. |
int |
getMonthOfYear()
Returns calendar month number in the year starting with 1=January and ending with 12=December. |
Day |
getNextDay(DayFilter filter)
Returns following day accepted by specified filter. |
Day |
getPrevDay(DayFilter filter)
Returns previous day accepted by specified filter. |
Schedule |
getSchedule()
Returns schedule to which this day belongs. |
Session |
getSessionByTime(long time)
Returns session belonging to this day that contains specified time. |
java.util.List<Session> |
getSessions()
Returns list of sessions that constitute this day. |
long |
getStartTime()
Returns start time of this day (inclusive). |
int |
getYear()
Returns calendar year - i.e. it returns 1977 for the year 1977 . |
int |
getYearMonthDay()
Returns year, month and day numbers decimally packed in the following way: YearMonthDay = year * 10000 + month * 100 + day For example, September 28, 1977 has value 19770928. |
int |
hashCode()
|
boolean |
isHoliday()
Returns true if this day is an exchange holiday. |
boolean |
isShortDay()
Returns true if this day is a short day. |
boolean |
isTrading()
Returns true if trading activity is allowed within this day. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public Schedule getSchedule()
public int getDayId()
public int getYearMonthDay()
YearMonthDay = year * 10000 + month * 100 + dayFor example, September 28, 1977 has value 19770928.
public int getYear()
1977
for the year 1977
.
public int getMonthOfYear()
public int getDayOfMonth()
public int getDayOfWeek()
@Deprecated public java.lang.String getDescription()
public boolean isHoliday()
true
if this day is an exchange holiday.
Usually there are no trading takes place on an exchange holiday.
public boolean isShortDay()
true
if this day is a short day.
Usually trading stops earlier on a short day.
public boolean isTrading()
true
if trading activity is allowed within this day.
Positive result assumes that day has at least one trading session.
public long getStartTime()
public long getEndTime()
public boolean containsTime(long time)
true
if specified time belongs to this day.
public java.util.List<Session> getSessions()
public Session getSessionByTime(long time)
NoSuchElementException
.
time
- the time to search for
java.util.NoSuchElementException
- if no such session was found within this daypublic Session getFirstSession(SessionFilter filter)
NoSuchElementException
.
To find first trading session of any type use this code:
Session session = day.getFirstSession(SessionFilter.TRADING);To find first regular trading session use this code:
Session session = day.getFirstSession(SessionFilter.REGULAR);
filter
- the filter to test sessions
java.util.NoSuchElementException
- if no such session was found within this daypublic Session getLastSession(SessionFilter filter)
NoSuchElementException
.
To find last trading session of any type use this code:
Session session = day.getLastSession(SessionFilter.TRADING);To find last regular trading session use this code:
Session session = day.getLastSession(SessionFilter.REGULAR);
filter
- the filter to test sessions
java.util.NoSuchElementException
- if no such session was found within this daypublic Day getPrevDay(DayFilter filter)
NoSuchElementException
.
filter
- the filter to test days
java.util.NoSuchElementException
- if no such day was found within one yearpublic Day getNextDay(DayFilter filter)
NoSuchElementException
.
filter
- the filter to test days
java.util.NoSuchElementException
- if no such day was found within one yearpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |