Package org.knowm.xchange.dto
Class Order
java.lang.Object
org.knowm.xchange.dto.Order
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BitstampGenericOrder
,LimitOrder
,MarketOrder
,StopOrder
Data object representing an order
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
static enum
static enum
-
Constructor Summary
ConstructorsConstructorDescriptionOrder
(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp) Order
(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status) Order
(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status, String userReference) -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
The average price of the fills in the order.The amount that has been filledDeprecated.CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivativegetFee()
The total of the fees incurred for all transactions related to this ordergetId()
The amount to tradegetType()
boolean
hasFlag
(Order.IOrderFlags flag) int
hashCode()
void
setAveragePrice
(BigDecimal averagePrice) void
setCumulativeAmount
(BigDecimal cumulativeAmount) void
setFee
(BigDecimal fee) void
setLeverage
(String leverage) void
setOrderFlags
(Set<Order.IOrderFlags> flags) void
setOrderStatus
(Order.OrderStatus status) toString()
-
Constructor Details
-
Order
public Order(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp) - Parameters:
type
- Either BID (buying) or ASK (selling)originalAmount
- The amount to tradeinstrument
- instrument The identifier (e.g. BTC/USD)id
- An id (usually provided by the exchange)timestamp
- the absolute time for this order according to the exchange's server, null if not provided
-
Order
public Order(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status) - Parameters:
type
- Either BID (buying) or ASK (selling)originalAmount
- The amount to tradeinstrument
- The identifier (e.g. BTC/USD)id
- An id (usually provided by the exchange)timestamp
- the absolute time for this order according to the exchange's server, null if not providedaveragePrice
- the averagePrice of fill belonging to the ordercumulativeAmount
- the amount that has been filledfee
- the fee associated with this orderstatus
- the status of the order at the exchange
-
Order
public Order(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status, String userReference) - Parameters:
type
- Either BID (buying) or ASK (selling)originalAmount
- The amount to tradeinstrument
- The identifier (e.g. BTC/USD)id
- An id (usually provided by the exchange)timestamp
- the absolute time for this order according to the exchange's server, null if not providedaveragePrice
- the averagePrice of fill belonging to the ordercumulativeAmount
- the amount that has been filledfee
- the fee associated with this orderstatus
- the status of the order at the exchangeuserReference
- a reference provided by the user to identify the order
-
-
Method Details
-
getFee
The total of the fees incurred for all transactions related to this order- Returns:
- null if this information is not available on the order level on the given exchange in which case you will have to navigate trades which filled this order to calculate it
-
setFee
-
getType
- Returns:
- The type (BID or ASK)
-
getStatus
- Returns:
- The type (PENDING_NEW, NEW, PARTIALLY_FILLED, FILLED, PENDING_CANCEL, CANCELED, PENDING_REPLACE, REPLACED, STOPPED, REJECTED or EXPIRED)
-
getOriginalAmount
The amount to trade -
getCumulativeAmount
The amount that has been filled -
setCumulativeAmount
-
getCumulativeCounterAmount
-
getRemainingAmount
- Returns:
- The remaining order amount
-
getAveragePrice
The average price of the fills in the order.- Returns:
- null if this information is not available on the order level on the given exchange in which case you will have to navigate trades which filled this order to calculate it
-
setAveragePrice
-
getCurrencyPair
Deprecated.CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivativeuse
getInstrument()
instead -
getInstrument
- Returns:
- The instrument to be bought or sold
-
getId
- Returns:
- A unique identifier (normally provided by the exchange)
-
getUserReference
- Returns:
- A unique identifier provided by the user on placement
-
getTimestamp
-
getOrderFlags
-
setOrderFlags
-
hasFlag
-
addOrderFlag
-
setOrderStatus
-
getLeverage
-
setLeverage
-
toString
-
hashCode
public int hashCode() -
equals
-