public final class Session extends Object
regular trading session is a period of time consisting of one day of business activities
in a financial market, from the opening bell to the closing bell, when regular trading occurs.
Sessions can be either trading or non-trading, with different sets of rules and reasons to exist. Sessions 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 session that starts there. Each session completely fits inside a certain day. 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.
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsTime(long time)
Returns
true if specified time belongs to this session. |
boolean |
equals(Object object) |
Session |
findNextSession(SessionFilter filter)
Returns following session accepted by specified filter.
|
Session |
findPrevSession(SessionFilter filter)
Returns previous session accepted by specified filter.
|
Day |
getDay()
Returns day to which this session belongs.
|
long |
getEndTime()
Returns end time of this session (exclusive).
|
Session |
getNextSession(SessionFilter filter)
Returns following session accepted by specified filter.
|
Session |
getPrevSession(SessionFilter filter)
Returns previous session accepted by specified filter.
|
long |
getStartTime()
Returns start time of this session (inclusive).
|
SessionType |
getType()
Returns type of this session.
|
int |
hashCode() |
boolean |
isEmpty()
Returns
true if this session has zero duration. |
boolean |
isTrading()
Returns
true if trading activity is allowed within this session. |
String |
toString() |
public Day getDay()
public SessionType getType()
public boolean isTrading()
true if trading activity is allowed within this session.
This method is equivalent to expression getType().isTrading().
Some sessions may have zero duration - e.g. indices that post value once a day. Such sessions can be of any appropriate type, trading or non-trading.
public boolean isEmpty()
true if this session has zero duration.
Empty sessions can be used for indices that post value once a day or for convenience.
Such sessions can be of any appropriate type, trading or non-trading.public long getStartTime()
public long getEndTime()
public boolean containsTime(long time)
true if specified time belongs to this session.public Session getPrevSession(SessionFilter filter)
NoSuchElementException.
To find previous trading session of any type use this code:
session = session.getPrevSession(SessionFilter.TRADING);To find previous regular trading session use this code:
session = session.getPrevSession(SessionFilter.REGULAR);
filter - the filter to test sessionsNoSuchElementException - if no such session was found within one yearpublic Session getNextSession(SessionFilter filter)
NoSuchElementException.
To find following trading session of any type use this code:
session = session.getNextSession(SessionFilter.TRADING);To find following regular trading session use this code:
session = session.getNextSession(SessionFilter.REGULAR);
filter - the filter to test sessionsNoSuchElementException - if no such session was found within one yearpublic Session findPrevSession(SessionFilter filter)
To find previous trading session of any type use this code:
session = session.findPrevSession(SessionFilter.TRADING);To find previous regular trading session use this code:
session = session.findPrevSession(SessionFilter.REGULAR);
filter - the filter to test sessionspublic Session findNextSession(SessionFilter filter)
To find following trading session of any type use this code:
session = session.findNextSession(SessionFilter.TRADING);To find following regular trading session use this code:
session = session.findNextSession(SessionFilter.REGULAR);
filter - the filter to test sessionsCopyright © 2002–2023 Devexperts LLC. All rights reserved.