Interface Order
public interface Order
Represents an order to buy or sell an instrument.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
exists()
Determines if this order exists.Gets the account ID for this order.Gets the action of this order (Buy or Sell)Gets the adjusted limit price.int
Gets the adjusted quantity.float
Gets the adjusted quantity.Gets the adjusted stop price.Gets the adjusted TIF (time in force).float
Gets the average fill price for this order.Gets the exchange order id (id of the order at the exchange).int
Gets the number of shares/contracts that have been filled.float
Gets the number of shares/contracts that have been filled (as a floating point value for partial fills).Gets the instrument associated to this order.float
Gets the last fill price for this order.long
Gets the time (in milliseconds since 1970) of the last fill on this order.Gets the limit price for the order (null if not a limit order).Gets the unique identifier for this order.int
Gets the quantity (size) of this order.float
Gets the quantity (size) of this order (as a float point value for partial quantities).Gets the reference ID for the order.Gets the stop price for the order (null if not a stop order).getTIF()
Gets the Time In Force for this order.getType()
Gets the type of order (Marker, Limit, Stop, Trail).boolean
isActive()
Determines if this order is active (waiting to be filled).boolean
Determines if this order has pending changes.boolean
isBuy()
Determines if this is a buy order.boolean
Determines if this order is cancelled.boolean
isFilled()
Determines if this order is filled.boolean
isSell()
Determines if this is a sell order.void
setAdjLimitPrice
(Float price) Sets the adjusted limit price.void
setAdjQuantity
(float qty) Sets the adjusted quantity.void
setAdjQuantity
(int qty) Sets the adjusted quantity.void
setAdjStopPrice
(Float price) Sets the adjusted stop price.void
Sets the adjusted TIF (time in force).
-
Method Details
-
getAccountId
String getAccountId()Gets the account ID for this order.- Returns:
- account ID for this order
-
getOrderId
String getOrderId()Gets the unique identifier for this order. Note: on some brokers, this order ID can change when the order is submitted or modified.- Returns:
- the unique identifier for this order.
-
getExchangeOrderId
String getExchangeOrderId()Gets the exchange order id (id of the order at the exchange). This will return null if this is not supported by the broker.- Returns:
- id of the order at the exchange
-
getInstrument
Instrument getInstrument()Gets the instrument associated to this order.- Returns:
- the instrument of this order.
-
getType
Enums.OrderType getType()Gets the type of order (Marker, Limit, Stop, Trail).- Returns:
- the type of this order (Stop, Limit etc)
-
getAction
Enums.OrderAction getAction()Gets the action of this order (Buy or Sell)- Returns:
- action (buy or sell)
-
isAdjusted
boolean isAdjusted()Determines if this order has pending changes.- Returns:
- true if this order has pending changes
-
isSell
boolean isSell()Determines if this is a sell order.- Returns:
- true if this is a sell order.
-
isBuy
boolean isBuy()Determines if this is a buy order.- Returns:
- true if this is a buy order.
-
getQuantity
int getQuantity()Gets the quantity (size) of this order.- Returns:
- the size of this order (ie number of shares, contracts etc)
-
getQuantityAsFloat
float getQuantityAsFloat()Gets the quantity (size) of this order (as a float point value for partial quantities).- Returns:
- the size of this order (ie number of shares, contracts etc)
-
getAvgFillPrice
float getAvgFillPrice()Gets the average fill price for this order.- Returns:
- the average fill price for this order.
-
getLastFillPrice
float getLastFillPrice()Gets the last fill price for this order.- Returns:
- the last price that this order was filled at.
-
getFilled
int getFilled()Gets the number of shares/contracts that have been filled.- Returns:
- the number of shares/contracts etc that have been filled.
-
getFilledAsFloat
float getFilledAsFloat()Gets the number of shares/contracts that have been filled (as a floating point value for partial fills).- Returns:
- the number of shares/contracts etc that have been filled.
-
getLastFillTime
long getLastFillTime()Gets the time (in milliseconds since 1970) of the last fill on this order.- Returns:
- last fill time (milliseconds since 1970)
-
getReferenceID
Object getReferenceID()Gets the reference ID for the order. This may be used to associate an order with a position (for hedging accounts)- Returns:
- the reference ID for the order
-
getLimitPrice
Float getLimitPrice()Gets the limit price for the order (null if not a limit order).- Returns:
- the limit price for the order
-
getStopPrice
Float getStopPrice()Gets the stop price for the order (null if not a stop order).- Returns:
- the stop price for the order
-
getTIF
Enums.TIF getTIF()Gets the Time In Force for this order.- Returns:
- time in force
-
getAdjLimitPrice
Float getAdjLimitPrice()Gets the adjusted limit price.- Returns:
- adjusted limit price
-
setAdjLimitPrice
Sets the adjusted limit price.- Parameters:
price
- new limit price
-
getAdjStopPrice
Float getAdjStopPrice()Gets the adjusted stop price.- Returns:
- adjusted stop price
-
setAdjStopPrice
Sets the adjusted stop price.- Parameters:
price
- new stop price
-
getAdjQuantity
int getAdjQuantity()Gets the adjusted quantity.- Returns:
- adjusted quantity
-
setAdjQuantity
void setAdjQuantity(int qty) Sets the adjusted quantity.- Parameters:
qty
- new quantity
-
getAdjQuantityAsFloat
float getAdjQuantityAsFloat()Gets the adjusted quantity.- Returns:
- adjusted quantity
-
setAdjQuantity
void setAdjQuantity(float qty) Sets the adjusted quantity.- Parameters:
qty
- new quantity
-
getAdjTIF
Enums.TIF getAdjTIF()Gets the adjusted TIF (time in force).- Returns:
- adjusted time in force
-
setAdjTIF
Sets the adjusted TIF (time in force).- Parameters:
tif
- new time in force
-
isCancelled
boolean isCancelled()Determines if this order is cancelled.- Returns:
- true if this order is cancelled.
-
isFilled
boolean isFilled()Determines if this order is filled.- Returns:
- true if this order is filled.
-
exists
boolean exists()Determines if this order exists.- Returns:
- true if this order still exists.
-
isActive
boolean isActive()Determines if this order is active (waiting to be filled).- Returns:
- true if this order is currently active (ie waiting to be filled)
-