@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { return independentReservePlaceLimitOrder( limitOrder.getCurrencyPair(), limitOrder.getType(), limitOrder.getLimitPrice(), limitOrder.getOriginalAmount()); }
private static LimitOrder createOrder( CurrencyPair currencyPair, Order.OrderType orderType, BigDecimal originalAmount, BigDecimal limitPric) { return new LimitOrder(orderType, originalAmount, currencyPair, "", null, limitPric); }
private static LimitOrder withAmount(LimitOrder limitOrder, BigDecimal tradeableAmount) { OrderType type = limitOrder.getType(); CurrencyPair currencyPair = limitOrder.getCurrencyPair(); String id = limitOrder.getId(); Date date = limitOrder.getTimestamp(); BigDecimal limit = limitOrder.getLimitPrice(); return new LimitOrder(type, tradeableAmount, currencyPair, id, date, limit); }
@Override public int compareTo(LimitOrder limitOrder) { final int ret; if (this.getType() == limitOrder.getType()) { // Same side ret = this.getLimitPrice().compareTo(limitOrder.getLimitPrice()) * (getType() == OrderType.BID ? -1 : 1); } else { // Keep bid side be less than ask side ret = this.getType() == OrderType.BID ? -1 : 1; } return ret; }
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { final BTCTradePlaceOrderResult result; if (limitOrder.getType() == OrderType.BID) { result = buy(limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); } else { result = sell(limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); } return BTCTradeAdapters.adaptPlaceOrderResult(result); }
@Override public String placeLimitOrder(LimitOrder limitOrder) throws ExchangeException { String symbol = BitmexAdapters.adaptCurrencyPairToSymbol(limitOrder.getCurrencyPair()); Builder b = new BitmexPlaceOrderParameters.Builder(symbol) .setOrderQuantity(limitOrder.getOriginalAmount()) .setPrice(limitOrder.getLimitPrice()) .setSide(fromOrderType(limitOrder.getType())) .setClOrdId(limitOrder.getId()); if (limitOrder.hasFlag(BitmexOrderFlags.POST)) { b.addExecutionInstruction(BitmexExecutionInstruction.PARTICIPATE_DO_NOT_INITIATE); } return placeOrder(b.build()).getId(); }
public LiquiTrade placeLiquiLimitOrder(final LimitOrder order) { final LiquiTradeType orderType = LiquiTradeType.fromOrderType(order.getType()); final LiquiTradeResult trade = liquiAuthenticated.trade( exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(), "trade", new Liqui.Pairs(order.getCurrencyPair()), orderType.toString(), order.getLimitPrice().toPlainString(), order.getRemainingAmount().toPlainString()); return checkResult(trade); }
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { BigDecimal amount = limitOrder.getOriginalAmount(); BigDecimal price = limitOrder.getAveragePrice(); String type = limitOrder.getType() == OrderType.ASK ? "buy" : "sell"; String coin = limitOrder.getCurrencyPair().base.getCurrencyCode().toLowerCase(); return CoinEggAdapters.adaptTradeAdd(getCoinEggTradeAdd(amount, price, type, coin)); }
@Override public String changeOrder(LimitOrder limitOrder) throws ExchangeException { BitmexPrivateOrder order = replaceOrder( new BitmexReplaceOrderParameters.Builder() .setClOrdId(limitOrder.getId()) .setOrderQuantity(limitOrder.getOriginalAmount()) .setPrice(limitOrder.getLimitPrice()) .build()); return order.getId(); }
public void verifyOrder(LimitOrder limitOrder) { ExchangeMetaData exchangeMetaData = exchange.getExchangeMetaData(); verifyOrder(limitOrder, exchangeMetaData); BigDecimal price = limitOrder.getLimitPrice().stripTrailingZeros(); if (price.scale() > exchangeMetaData.getCurrencyPairs().get(limitOrder.getCurrencyPair()).getPriceScale()) { throw new IllegalArgumentException("Unsupported price scale " + price.scale()); } }
@Override public int compare(LimitOrder o1, LimitOrder o2) { return o1.getLimitPrice().compareTo(o2.getLimitPrice()); } };
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { if (limitOrder.getType() == OrderType.BID) { return buyLimit(limitOrder); } else { return sellLimit(limitOrder); } }
/** @see #makeMercadoBitcoinOrderId(org.knowm.xchange.currency.CurrencyPair, String) */ public static String makeMercadoBitcoinOrderId(LimitOrder limitOrder) { return makeMercadoBitcoinOrderId(limitOrder.getCurrencyPair(), limitOrder.getId()); }
@Override default boolean accept(LimitOrder order) { return order != null && getCurrencyPairs() != null && getCurrencyPairs().contains(order.getCurrencyPair()); }
/** * Given a new LimitOrder, it will replace a matching limit order in the orderbook if one is * found, or add the new LimitOrder if one is not. timeStamp will be updated if the new timestamp * is non-null and in the future. * * @param limitOrder the new LimitOrder */ public void update(LimitOrder limitOrder) { update(getOrders(limitOrder.getType()), limitOrder); updateDate(limitOrder.getTimestamp()); }
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException, BitsoException { BitsoOrder bitsoOrder; if (limitOrder.getType() == BID) { bitsoOrder = buyBitoOrder(limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); } else { bitsoOrder = sellBitsoOrder(limitOrder.getOriginalAmount(), limitOrder.getLimitPrice()); } if (bitsoOrder.getErrorMessage() != null) { throw new ExchangeException(bitsoOrder.getErrorMessage()); } return bitsoOrder.getId(); }
@Override public String placeLimitOrder(LimitOrder order) throws IOException { try { CoingiPlaceLimitOrderRequest request = new CoingiPlaceLimitOrderRequest() .setCurrencyPair(CoingiAdapters.adaptCurrency(order.getCurrencyPair())) .setOrderType(order.getType().equals(BID) ? 0 : 1) .setPrice(order.getLimitPrice()) .setVolume(order.getRemainingAmount()); return placeCoingiLimitOrder(request).getResult(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
@Override public int compare(LimitOrder o1, LimitOrder o2) { return o2.getLimitPrice().compareTo(o1.getLimitPrice()); } };
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException { CampBXResponse campBXResponse = placeCampBXLimitOrder(limitOrder); logger.debug("campBXResponse = {}", campBXResponse); if (!campBXResponse.isError()) { return composeOrderId(campBXResponse.getSuccess(), limitOrder.getType()); } else { throw new ExchangeException("Error calling placeLimitOrder(): " + campBXResponse.getError()); } }
@Override default boolean accept(LimitOrder order) { return order != null && getCurrencyPair() != null && getCurrencyPair().equals(order.getCurrencyPair()); }