public class ExpirationDate extends OrderValidityDate
The date an order should expire. This can be a recognised string from a backend trading system just as GFD (Good for Day) or can be a date and time with a location or UTC offset.
Modifier and Type | Field and Description |
---|---|
static ExpirationDate |
FOK
An instance of ExpirationDate that represents Fill or Kill.
|
static ExpirationDate |
GFD
An instance of ExpirationDate that represents Good for Day.
|
static ExpirationDate |
GTC
An instance of ExpirationDate that represents Good til Canceled.
|
static ExpirationDate |
IOC
An instance of ExpirationDate that represents Immediate or Cancel.
|
DATE_PATTERN, dateStr, datetime, isLocal, LOCAL, location, offset, timeStr, ZEROED_OFFSET
Constructor and Description |
---|
ExpirationDate(String date,
String time,
String location,
String offset)
Constructs a GTD (Good til Date) ExpirationDate which represents a specific date,
time and location.
|
Modifier and Type | Method and Description |
---|---|
String |
getDateFieldValue() |
boolean |
isFillOrKill()
A 'Fill or Kill' expiration means that the order must immediately be
fully filled by the backend trading system, or it should be canceled.
|
boolean |
isGoodForDay()
A 'Good For Day' expiration means that the order should stay in effect
until the end of the trading day, at which point the order should be
canceled by the back end system.
|
boolean |
isGoodTillCanceled()
A 'Good Till Canceled' expiration means that the order should stay in
effect until the client decides to cancel it.
|
boolean |
isGoodTillDate()
A 'Good Till Date' expiration means that the order should stay in effect
until the date and time specified by the client.
|
boolean |
isImmediateOrCancel()
An 'Immediate or Cancel' expiration means that the order must be at least
immediately partially filled by the backend trading system, or it should be
cancelled.
|
static ExpirationDate |
parseFromValues(String date,
String time,
String location,
String offset) |
String |
toString() |
equals, getDateAsString, getDateTime, getLocation, getOffset, getTimeAsString, hashCode, isLocal, parse
public static final ExpirationDate GTC
public static final ExpirationDate GFD
public static final ExpirationDate FOK
public static final ExpirationDate IOC
public ExpirationDate(String date, String time, String location, String offset) throws OrderConfigurationException
Constructs a GTD (Good til Date) ExpirationDate which represents a specific date, time and location. If you don't want a GTD expiration date, you can use one of the static instances provided as fields on this class:
date
- The date as string in the format "YYYYMMDD".time
- The time as string in the format "HH:MM:SS".location
- The location pertaining to the date and time the order should expire. This can either
be an entry in the tz database such as "Europe/London", or the string "LOCAL" (OrderValidityDate.LOCAL
).offset
- The UTC offset if the location was specified as "LOCAL", i.e local to the user. If a specific location is provided
then this value must be null, because the offset can be inferred from the date, time and location.OrderConfigurationException
- If any of the criteria specified by OrderValidityDate.parse(String, String, String, String)
are not met.
In particular, make sure you only provide a location or an offset, but not both. One of those two parameters must be null, or an
exception will be thrown.public static ExpirationDate parseFromValues(String date, String time, String location, String offset) throws OrderConfigurationException
OrderConfigurationException
public boolean isGoodTillCanceled()
public boolean isGoodForDay()
public boolean isGoodTillDate()
public boolean isFillOrKill()
public boolean isImmediateOrCancel()
public String getDateFieldValue()
public String toString()
toString
in class OrderValidityDate
Copyright © 2015 Caplin Systems.