Package org.knowm.xchange.dto.trade
Class StopOrder
java.lang.Object
org.knowm.xchange.dto.Order
org.knowm.xchange.dto.trade.StopOrder
- All Implemented Interfaces:
Serializable
,Comparable<StopOrder>
public class StopOrder extends Order implements Comparable<StopOrder>
DTO representing a stop order
A stop order lets you set a minimum or maximum price before your trade will be treated by the
exchange as a MarketOrder
unless a limit price is also set. There is no guarantee that
your conditions will be met on the exchange, so your order may not be executed.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StopOrder.Builder
static class
StopOrder.Intention
Nested classes/interfaces inherited from class org.knowm.xchange.dto.Order
Order.IOrderFlags, Order.OrderStatus, Order.OrderType
-
Field Summary
Fields Modifier and Type Field Description protected StopOrder.Intention
intention
Some exchanges requires to define the goal of stop orderprotected BigDecimal
limitPrice
The limit price this should be null if the stop order should be treated as a market order once the stop price is hitprotected BigDecimal
stopPrice
The stop priceprotected BigDecimal
trailValue
TrailValue is being used when the stop order is a trailing one -
Constructor Summary
Constructors Constructor Description StopOrder(Order.OrderType type, BigDecimal originalAmount, BigDecimal cumulativeAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice)
StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice)
StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status)
StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status, String userReference, StopOrder.Intention intention, BigDecimal trailValue)
StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, Order.OrderStatus status)
StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, Order.OrderStatus status)
-
Method Summary
Modifier and Type Method Description int
compareTo(StopOrder stopOrder)
boolean
equals(Object obj)
StopOrder.Intention
getIntention()
BigDecimal
getLimitPrice()
BigDecimal
getStopPrice()
BigDecimal
getTrailValue()
int
hashCode()
String
toString()
Methods inherited from class org.knowm.xchange.dto.Order
addOrderFlag, getAveragePrice, getCumulativeAmount, getCumulativeCounterAmount, getCurrencyPair, getFee, getId, getInstrument, getLeverage, getOrderFlags, getOriginalAmount, getRemainingAmount, getStatus, getTimestamp, getType, getUserReference, hasFlag, setAveragePrice, setCumulativeAmount, setFee, setLeverage, setOrderFlags, setOrderStatus
-
Field Details
-
stopPrice
The stop price -
limitPrice
The limit price this should be null if the stop order should be treated as a market order once the stop price is hit -
intention
Some exchanges requires to define the goal of stop order -
trailValue
TrailValue is being used when the stop order is a trailing one
-
-
Constructor Details
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice)- 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
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, BigDecimal cumulativeAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice)- Parameters:
type
- Either BID (buying) or ASK (selling)originalAmount
- The amount to tradecumulativeAmount
- The cumulative amountinstrument
- The identifier (e.g. BTC/USD)id
- An id (usually provided by the exchange)timestamp
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, 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
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable priceaveragePrice
- the weighted average price of any fills belonging to the ordercumulativeAmount
- the amount that has been filledstatus
- the status of the order at the exchange or broker
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, 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
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable pricelimitPrice
- The limit price the order should be placed at once the stopPrice has been hit null for marketaveragePrice
- the weighted average price of any fills belonging to the ordercumulativeAmount
- the amount that has been filledstatus
- the status of the order at the exchange or broker
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, 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
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable pricelimitPrice
- The limit price the order should be placed at once the stopPrice has been hit null for marketaveragePrice
- the weighted average price of any fills belonging to the ordercumulativeAmount
- the amount that has been filledfee
- the fee associated with this orderstatus
- the status of the order at the exchange or broker
-
StopOrder
public StopOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal stopPrice, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status, String userReference, StopOrder.Intention intention, BigDecimal trailValue)- 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
- a Date object representing the order's timestamp according to the exchange's server, null if not providedstopPrice
- In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable pricelimitPrice
- The limit price the order should be placed at once the stopPrice has been hit null for marketaveragePrice
- the weighted average price of any fills belonging to the ordercumulativeAmount
- the amount that has been filledstatus
- the status of the order at the exchange or broker
-
-
Method Details
-
getStopPrice
- Returns:
- The stop price
-
getLimitPrice
- Returns:
- The limit price
-
getIntention
- Returns:
- The order intention
-
getTrailValue
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<StopOrder>
-
equals
-
hashCode
public int hashCode()
-