@Override public String placeLimitOrder(LimitOrder order) throws IOException, TheRockException { final TheRockOrder placedOrder = placeOrder( order.getCurrencyPair(), order.getTradableAmount(), order.getLimitPrice(), TheRockAdapters.adaptSide(order.getType()), TheRockOrder.Type.limit); return placedOrder.getId().toString(); }
public KrakenOrderResponse placeKrakenLimitOrder(LimitOrder limitOrder) throws IOException { KrakenType type = KrakenType.fromOrderType(limitOrder.getType()); KrakenOrderBuilder krakenOrderBuilder = KrakenStandardOrder.getLimitOrderBuilder( limitOrder.getCurrencyPair(), type, limitOrder.getLimitPrice().toString(), limitOrder.getTradableAmount()) .withOrderFlags(limitOrder.getOrderFlags()); return placeKrakenOrder(krakenOrderBuilder.buildOrder()); }
@Override public String placeLimitOrder(LimitOrder limitOrder) throws IOException, BitstampException { Assert.isTrue( limitOrder.getCurrencyPair().equals(CurrencyPair.BTC_USD), "Currency Pair must be USD/BTC!!!"); BitstampOrder bitstampOrder; if (limitOrder.getType() == BID) { bitstampOrder = buyBitStampOrder(limitOrder.getTradableAmount(), limitOrder.getLimitPrice()); } else { bitstampOrder = sellBitstampOrder(limitOrder.getTradableAmount(), limitOrder.getLimitPrice()); } if (bitstampOrder.getErrorMessage() != null) { throw new ExchangeException(bitstampOrder.getErrorMessage()); } return Integer.toString(bitstampOrder.getId()); }
public BitfinexOrderStatusResponse placeBitfinexLimitOrder( LimitOrder limitOrder, BitfinexOrderType bitfinexOrderType, boolean hidden) throws IOException { String pair = BitfinexUtils.toPairString(limitOrder.getCurrencyPair()); String type = limitOrder.getType().equals(Order.OrderType.BID) ? "buy" : "sell"; String orderType = bitfinexOrderType.toString(); BitfinexNewOrderRequest request; if (hidden) { request = new BitfinexNewHiddenOrderRequest( String.valueOf(exchange.getNonceFactory().createValue()), pair, limitOrder.getTradableAmount(), limitOrder.getLimitPrice(), "bitfinex", type, orderType); } else { request = new BitfinexNewOrderRequest( String.valueOf(exchange.getNonceFactory().createValue()), pair, limitOrder.getTradableAmount(), limitOrder.getLimitPrice(), "bitfinex", type, orderType); } try { BitfinexOrderStatusResponse newOrder = bitfinex.newOrder(apiKey, payloadCreator, signatureCreator, request); return newOrder; } catch (BitfinexException e) { throw new ExchangeException(e.getMessage()); } }