Interface Order
public interface Order
Represents an order to buy or sell an instrument.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()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.intGets the adjusted quantity.floatGets the adjusted quantity.Gets the adjusted stop price.Gets the adjusted TIF (time in force).floatGets the average fill price for this order.Gets the exchange order id (id of the order at the exchange).intGets the number of shares/contracts that have been filled.floatGets the number of shares/contracts that have been filled (as a floating point value for partial fills).Gets the instrument associated to this order.floatGets the last fill price for this order.longGets 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.intGets the quantity (size) of this order.floatGets 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).booleanisActive()Determines if this order is active (waiting to be filled).booleanDetermines if this order has pending changes.booleanisBuy()Determines if this is a buy order.booleanDetermines if this order is cancelled.booleanisFilled()Determines if this order is filled.booleanisSell()Determines if this is a sell order.voidsetAdjLimitPrice(Float price) Sets the adjusted limit price.voidsetAdjQuantity(float qty) Sets the adjusted quantity.voidsetAdjQuantity(int qty) Sets the adjusted quantity.voidsetAdjStopPrice(Float price) Sets the adjusted stop price.voidSets the adjusted TIF (time in force).
-
Method Details
-
getAccountId
-
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
-
getAdjLimitPrice
-
setAdjLimitPrice
Sets the adjusted limit price.- Parameters:
price- new limit price
-
getAdjStopPrice
-
setAdjStopPrice
-
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
-
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)
-