Class MarketOrder

java.lang.Object
org.knowm.xchange.dto.Order
org.knowm.xchange.dto.trade.MarketOrder
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DsxMarketOrder, HitbtcMarketOrder

public class MarketOrder
extends Order
DTO representing a market order

A market order is a buy or sell order to be executed immediately at current market prices. As long as there are willing sellers and buyers, market orders are filled. Market orders are therefore used when certainty of execution is a priority over price of execution. Use market orders with caution, and review LimitOrder in case it is more suitable.

See Also:
Serialized Form
  • Constructor Details

    • MarketOrder

      public MarketOrder​(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 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
      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
    • MarketOrder

      public MarketOrder​(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 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
      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
    • MarketOrder

      public MarketOrder​(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, String id, Date timestamp)
      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 - the absolute time for this order
    • MarketOrder

      public MarketOrder​(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, Date timestamp)
      Parameters:
      type - Either BID (buying) or ASK (selling)
      originalAmount - The amount to trade
      instrument - The identifier (e.g. BTC/USD)
      timestamp - the absolute time for this order
    • MarketOrder

      public MarketOrder​(Order.OrderType type, BigDecimal originalAmount, Instrument instrument)
      Parameters:
      type - Either BID (buying) or ASK (selling)
      originalAmount - The amount to trade
      instrument - The identifier (e.g. BTC/USD)