Enum Class OrderStrategy
- All Implemented Interfaces:
Serializable,Comparable<OrderStrategy>,Constable
One strategy can cover more than one order; each order of the group reports the same value here.
A child order also gives the id of its parent order in OrderInfo.parentOrderId
(if the provider reports that id).
A provider reports this value in OrderInfo.orderStrategy. Support is optional; a provider that
does not implement the field reports UNKNOWN. The consumer must always handle UNKNOWN
and must not read it as SIMPLE.
Later versions of the API can add new constants. Code that reads this enum must accept an unknown value
and handle it in the same way as OTHER.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA bracket order consisting of a parent order and linked child orders, typically a profit-taking order and a stop-loss order.A One-Cancels-Other (OCO) group of two or more linked orders.A recognized order strategy that does not match any explicitly defined strategy in this enum.A simple, standalone order, such as LMT, MKT, STP, or STP LMT.Indicates that order strategy is not specified and not implemented by provider. -
Method Summary
Modifier and TypeMethodDescriptionstatic OrderStrategyReturns the enum constant of this class with the specified name.static OrderStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SIMPLE
A simple, standalone order, such as LMT, MKT, STP, or STP LMT. This strategy does not include Bracket, or other special order types (OCO for example).This order stands alone: it does not change the state of another order, and no other order changes its state.
OrderInfo.parentOrderIdis null.- See Also:
-
BRACKET
A bracket order consisting of a parent order and linked child orders, typically a profit-taking order and a stop-loss order.Each order of the bracket reports this strategy: the parent order and each child order. A child order gives the id of the parent order in
OrderInfo.parentOrderId(if the provider reports that id).The two children behave like an OCO pair: a fill of one cancels the other. They still report this strategy and not
OCO, because the bracket created them.- See Also:
-
OCO
A One-Cancels-Other (OCO) group of two or more linked orders. A fill of one order of the group cancels each other order of the group.Each order of the group reports this strategy. The orders are equal in rank; no parent order stands above them, so
OrderInfo.parentOrderIdis null.- See Also:
-
OTHER
A recognized order strategy that does not match any explicitly defined strategy in this enum.Use this value when the provider has a specific order strategy, but this enum has no constant for it.
OTHERis notUNKNOWN:OTHERstates that the provider knows the strategy. The consumer still cannot find the link between such orders, because this enum does not name that strategy.Later versions of the API can add a constant for a strategy that currently reports
OTHER.- See Also:
-
UNKNOWN
Indicates that order strategy is not specified and not implemented by provider. Should be treated as any possible of the above strategies.This is the default value of
OrderInfo.orderStrategy; many providers can report it, because support for this field is optional.The value gives no information about the order: an order with
UNKNOWNcan still be a bracket child or a member of an OCO group. Do not readUNKNOWNasSIMPLE.Code that needs the strategy must use another source. If no such source exists, the code must work in the same way for each strategy.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-