package com.xeiam.xchange.dto.trade;

import java.math.BigDecimal;
import java.util.Date;

import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.Order;

/**
 * DTO representing a market order
 * <p>
 * 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.
 * </p>
 * <strong>Use market orders with caution, and review {@link LimitOrder} in case it is more suitable.</strong>
 */
public final class MarketOrder extends Order {

  /**
   * @param type Either BID (buying) or ASK (selling)
   * @param tradableAmount The amount to trade
   * @param currencyPair The identifier (e.g. BTC/USD)
   * @param id An id (usually provided by the exchange)
   * @param timestamp the absolute time for this order
   */
  public MarketOrder(OrderType type, BigDecimal tradableAmount, CurrencyPair currencyPair, String id, Date timestamp) {

    super(type, tradableAmount, currencyPair, id, timestamp);
  }

  /**
   * @param type Either BID (buying) or ASK (selling)
   * @param tradableAmount The amount to trade
   * @param currencyPair The identifier (e.g. BTC/USD)
   * @param timestamp the absolute time for this order
   */
  public MarketOrder(OrderType type, BigDecimal tradableAmount, CurrencyPair currencyPair, Date timestamp) {

    super(type, tradableAmount, currencyPair, "", timestamp);
  }

  /**
   * @param type Either BID (buying) or ASK (selling)
   * @param tradableAmount The amount to trade
   * @param CurrencyPair currencyPair The identifier (e.g. BTC/USD)
   */
  public MarketOrder(OrderType type, BigDecimal tradableAmount, CurrencyPair currencyPair) {

    super(type, tradableAmount, currencyPair, "", null);
  }

}

@@ -1644,17 +1644,17 @@
  @param 
-C
+c
 urrencyP
@@ -1796,24 +1796,24 @@
 ncyPair) %7B%0A%0A
-
     super(ty
@@ -1862,10 +1862,1215 @@
 );%0A  %7D%0A%0A
+  public static class Builder %7B%0A%0A    OrderType orderType;%0A    BigDecimal tradableAmount;%0A    CurrencyPair currencyPair;%0A    String id;%0A    Date timestamp;%0A%0A    public Builder(OrderType orderType, CurrencyPair currencyPair) %7B%0A%0A      this.orderType = orderType;%0A      this.currencyPair = currencyPair;%0A    %7D%0A%0A    public static Builder from(Order o)%7B%0A      return new Builder(o.getType(),o.getCurrencyPair()).tradableAmount(o.getTradableAmount()).timestamp(o.getTimestamp())%0A              .id(o.getId());%0A    %7D%0A%0A    public Builder orderType(OrderType orderType) %7B%0A%0A      this.orderType = orderType;%0A      return this;%0A    %7D%0A%0A    public Builder tradableAmount(BigDecimal tradableAmount) %7B%0A%0A      this.tradableAmount = tradableAmount;%0A      return this;%0A    %7D%0A%0A    public Builder currencyPair(CurrencyPair currencyPair) %7B%0A%0A      this.currencyPair = currencyPair;%0A      return this;%0A    %7D%0A%0A    public Builder id(String id) %7B%0A%0A      this.id = id;%0A      return this;%0A    %7D%0A%0A    public Builder timestamp(Date timestamp) %7B%0A%0A      this.timestamp = timestamp;%0A      return this;%0A    %7D%0A%0A    public MarketOrder build() %7B%0A%0A      return new MarketOrder(orderType, tradableAmount, currencyPair, id, timestamp);%0A    %7D%0A  %7D%0A%0A
 %7D%0A

Add MarketOrder.Builder