Class LimitOrder

java.lang.Object
org.knowm.xchange.dto.Order
org.knowm.xchange.dto.trade.LimitOrder
All Implemented Interfaces:
Serializable, Comparable<LimitOrder>
Direct Known Subclasses:
BitfinexLimitOrder, CexioOrder, GeminiLimitOrder, HitbtcLimitOrder, PoloniexLimitOrder, RippleLimitOrder

public class LimitOrder extends Order implements Comparable<LimitOrder>
DTO representing a limit order

A limit order lets you set a minimum or maximum price before your trade will be treated by the exchange as a MarketOrder. There is no guarantee that your conditions will be met on the exchange, so your order may not be executed. However, until you become very experienced, almost all orders should be limit orders to protect yourself.

See Also:
  • Field Details

    • limitPrice

      protected final BigDecimal limitPrice
      The limit price
  • Constructor Details

    • LimitOrder

      public LimitOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal limitPrice)
      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
      limitPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
    • LimitOrder

      public LimitOrder(Order.OrderType type, BigDecimal originalAmount, BigDecimal cumulativeAmount, Instrument instrument, String id, Date timestamp, BigDecimal limitPrice)
      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
      limitPrice - In a BID this is the highest acceptable price, in an ASK this is the lowest acceptable price
    • LimitOrder

      public LimitOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, 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
      limitPrice - 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
      fee - the fee associated with this order
      status - the status of the order at the exchange or broker
    • LimitOrder

      public LimitOrder(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp, BigDecimal limitPrice, BigDecimal averagePrice, BigDecimal cumulativeAmount, BigDecimal fee, Order.OrderStatus status, String userReference)
      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
      limitPrice - 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
      userReference - An id provided by the user
  • Method Details