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:
  • Field Details

    • stopPrice

      protected final BigDecimal stopPrice
      The stop price
    • limitPrice

      protected 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 hit
    • intention

      protected StopOrder.Intention intention
      Some exchanges requires to define the goal of stop order
    • trailValue

      protected BigDecimal 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 trade
      instrument - 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 provided
      stopPrice - 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 trade
      cumulativeAmount - The cumulative amount
      instrument - 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 provided
      stopPrice - 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 trade
      instrument - 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 provided
      stopPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
      averagePrice - the weighted average price of any fills belonging to the order
      cumulativeAmount - the amount that has been filled
      status - 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 trade
      instrument - 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 provided
      stopPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
      limitPrice - The limit price the order should be placed at once the stopPrice has been hit null for market
      averagePrice - the weighted average price of any fills belonging to the order
      cumulativeAmount - the amount that has been filled
      status - 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 trade
      instrument - 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 provided
      stopPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
      limitPrice - The limit price the order should be placed at once the stopPrice has been hit null for market
      averagePrice - the weighted average price of any fills belonging to the order
      cumulativeAmount - the amount that has been filled
      fee - the fee associated with this order
      status - 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 trade
      instrument - 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 provided
      stopPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
      limitPrice - The limit price the order should be placed at once the stopPrice has been hit null for market
      averagePrice - the weighted average price of any fills belonging to the order
      cumulativeAmount - the amount that has been filled
      status - the status of the order at the exchange or broker
  • Method Details