See {@link Bitmex#replaceOrder}

@return {@link BitmexPrivateOrder} contains the results of the call.
165708
@Nonnull
  public BitmexPrivateOrder replaceOrder(@Nonnull final BitmexReplaceOrderParameters parameters)
      throws ExchangeException {
    return updateRateLimit(
        () ->
            bitmex.replaceOrder(
                apiKey,
                exchange.getNonceFactory(),
                signatureCreator,
                parameters.getClOrdId() != null ? null : parameters.getOrderId(),
                parameters.getOrigClOrdId(),
                parameters.getClOrdId(),
                parameters.getSimpleOrderQuantity(),
                parameters.getOrderQuantity(),
                parameters.getSimpleLeavesQuantity(),
                parameters.getLeavesQuantity(),
                parameters.getPrice(),
                parameters.getStopPrice(),
                parameters.getPegOffsetValue(),
                parameters.getText()));
  }
740003
public Order ORDER(DomainObjectMatch<?> toOrder) {
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(toOrder);
		DomainObjectMatch<?> match = delegate != null ? delegate : toOrder;
		OrderExpression oe = this.queryExecutor.getOrderFor(match);
		Order ret = APIAccess.createOrder(oe);
		QueryRecorder.recordInvocation(this, "ORDER", ret, QueryRecorder.placeHolder(match));
		return ret;
	}
308639
public List<BitmexPrivateOrder> getBitmexOrders(
      @Nullable String symbol,
      @Nullable String filter,
      @Nullable String columns,
      @Nullable Date startTime,
      @Nullable Date endTime)
      throws ExchangeException {
    ArrayList<BitmexPrivateOrder> orders = new ArrayList<>();

    for (int i = 0; orders.size() % 500 == 0; i++) {
      final int j = i;
      List<BitmexPrivateOrder> orderResponse =
          updateRateLimit(
              () ->
                  bitmex.getOrders(
                      apiKey,
                      exchange.getNonceFactory(),
                      signatureCreator,
                      symbol,
                      filter,
                      columns,
                      500,
                      (long) (j * 500),
                      true,
                      startTime,
                      endTime));
      orders.addAll(orderResponse);
      // Prevent loop when no orders found
      if (orderResponse.size() == 0) break;
    }

    return orders;
  }
50033
@Override
	public com.liferay.commerce.model.CommerceOrder createCommerceOrder(
		long commerceOrderId) {
		return _commerceOrderLocalService.createCommerceOrder(commerceOrderId);
	}
96379
public static CryptonitGenericOrder adaptOrder(
      String orderId, CryptonitOrderStatusResponse cryptonitOrderStatusResponse) {

    CryptonitOrderTransaction[] cryptonitTransactions =
        cryptonitOrderStatusResponse.getTransactions();
    CurrencyPair currencyPair = null;
    Date date = null;
    BigDecimal averagePrice = null;
    BigDecimal cumulativeAmount = null;
    BigDecimal totalFee = null;
    // Use only the first transaction, because we assume that for a single order id all transactions
    // will
    // be of the same currency pair
    if (cryptonitTransactions.length > 0) {
      currencyPair = adaptCurrencyPair(cryptonitTransactions[0]);
      date = cryptonitTransactions[0].getDatetime();

      averagePrice =
          Arrays.stream(cryptonitTransactions)
              .map(t -> t.getPrice())
              .reduce((x, y) -> x.add(y))
              .get()
              .divide(BigDecimal.valueOf(cryptonitTransactions.length), 2);

      cumulativeAmount =
          Arrays.stream(cryptonitTransactions)
              .map(t -> getBaseCurrencyAmountFromCryptonitTransaction(t))
              .reduce((x, y) -> x.add(y))
              .get();

      totalFee =
          Arrays.stream(cryptonitTransactions)
              .map(t -> t.getFee())
              .reduce((x, y) -> x.add(y))
              .get();
    }

    OrderStatus orderStatus =
        adaptOrderStatus(cryptonitOrderStatusResponse.getStatus(), cryptonitTransactions.length);

    CryptonitGenericOrder cryptonitGenericOrder =
        new CryptonitGenericOrder(
            null, // not discernable from response data
            null, // not discernable from the data
            currencyPair,
            orderId,
            date,
            averagePrice,
            cumulativeAmount,
            totalFee,
            orderStatus);

    return cryptonitGenericOrder;
  }
1061891
public static com.liferay.commerce.model.CommerceOrderNote updateCommerceOrderNote(
		com.liferay.commerce.model.CommerceOrderNote commerceOrderNote) {
		return getService().updateCommerceOrderNote(commerceOrderNote);
	}
402485
public static String makeMercadoBitcoinOrderId(CurrencyPair currencyPair, String orderId) {

    String pair;

    if (currencyPair.equals(CurrencyPair.BTC_BRL)) {
      pair = "btc_brl";
    } else if (currencyPair.equals(new CurrencyPair(Currency.LTC, Currency.BRL))) {
      pair = "ltc_brl";
    } else {
      throw new NotAvailableFromExchangeException();
    }

    return pair + ":" + orderId;
  }
1370507
@Override
	public List<CommerceOrder> findByBillingAddressId(long billingAddressId) {
		return findByBillingAddressId(billingAddressId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
461846
public static OrderBook adaptOrderBook(
      CryptonitOrderBook cryptonitOrderBook, CurrencyPair currencyPair) {
    List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, cryptonitOrderBook.getAsks());
    List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, cryptonitOrderBook.getBids());
    return new OrderBook(cryptonitOrderBook.getTimestamp(), asks, bids);
  }
917116
public OrderingList<S> replace(int index, OrderedProperty<S> property) {
        int size = size();
        if (index < 0 || index >= size) {
            throw new IndexOutOfBoundsException();
        }
        OrderingList<S> newList = emptyList();
        for (int i=0; i<size; i++) {
            newList = newList.concat(i == index ? property : get(i));
        }
        return newList;
    }
620226
public static com.liferay.commerce.model.CommerceOrder updateCommerceOrder(
		com.liferay.commerce.model.CommerceOrder commerceOrder) {
		return getService().updateCommerceOrder(commerceOrder);
	}
148591
public static LimitOrder createOrder(
      CurrencyPair currencyPair,
      BitcoindeOrder bitcoindeOrder,
      Order.OrderType orderType,
      String orderId,
      Date timeStamp) {

    return new LimitOrder(
        orderType,
        bitcoindeOrder.getAmount(),
        currencyPair,
        orderId,
        timeStamp,
        bitcoindeOrder.getPrice());
  }
310093
@Override
	public List<CommerceOrderPayment> findByCommerceOrderId(
		long commerceOrderId) {
		return findByCommerceOrderId(commerceOrderId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
195967
public static <T> OrderBy<T> convertToEbeanOrderBy(Sort sort) {
        if (sort == null) {
            return null;
        }
        List<String> list = new ArrayList<>();

        Iterator<Sort.Order> orderIterator = sort.iterator();
        while (orderIterator.hasNext()) {
            Sort.Order so = orderIterator.next();
            list.add(so.getProperty() + " " + so.getDirection());
        }
        return new OrderBy<T>(StringUtils.collectionToCommaDelimitedString(list));
    }
1098076
public AnimaQuery<T> order(String order) {
        if (this.orderBySQL.length() > 0) {
            this.orderBySQL.append(',');
        }
        this.orderBySQL.append(' ').append(order);
        return this;
    }
1117981
@Override
    public OrderableTransaction poll() {
        OrderableTransaction retval = null;
        updateQueueState();
        if (m_state == QueueState.UNBLOCKED) {
            retval = super.peek();
            super.poll();
            // not BLOCKED_EMPTY
            assert(retval != null);
        }
        return retval;
    }
981008
public static List<LimitOrder> createOrders(
      CurrencyPair currencyPair, Order.OrderType orderType, BitcoindeOrder[] orders) {

    List<LimitOrder> limitOrders = new ArrayList<>();
    for (BitcoindeOrder order : orders) {
      limitOrders.add(createOrder(currencyPair, order, orderType, null, null));
    }
    return limitOrders;
  }