public BitfinexOrderStatusResponse placeBitfinexMarketOrder( MarketOrder marketOrder, BitfinexOrderType bitfinexOrderType) throws IOException { String pair = BitfinexUtils.toPairString(marketOrder.getCurrencyPair()); String type = marketOrder.getType().equals(Order.OrderType.BID) ? "buy" : "sell"; String orderType = bitfinexOrderType.toString(); try { BitfinexOrderStatusResponse newOrder = bitfinex.newOrder( apiKey, payloadCreator, signatureCreator, new BitfinexNewOrderRequest( String.valueOf(exchange.getNonceFactory().createValue()), pair, marketOrder.getTradableAmount(), BigDecimal.ONE, "bitfinex", type, orderType)); return newOrder; } catch (BitfinexException e) { throw new ExchangeException(e.getMessage()); } }
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()); } }