use of org.knowm.xchange.dto.trade.OpenOrders in project XChange by knowm.
the class TradeServiceIntegrationTransactionsCreateOrder method printOpenOrders.
private static void printOpenOrders(TradeService tradeService, OpenOrdersParams openOrdersParams) throws IOException {
OpenOrders openOrders = tradeService.getOpenOrders(openOrdersParams);
System.out.printf("Open Orders for %s: %s%n", openOrdersParams, openOrders);
}
use of org.knowm.xchange.dto.trade.OpenOrders in project XChange by knowm.
the class PoloniexTradeDemo method printOpenOrders.
private static void printOpenOrders(TradeService tradeService) throws Exception {
TimeUnit.SECONDS.sleep(2);
final OpenOrdersParamCurrencyPair params = (OpenOrdersParamCurrencyPair) tradeService.createOpenOrdersParams();
OpenOrders openOrders = tradeService.getOpenOrders(params);
System.out.printf("All open Orders: %s%n", openOrders);
params.setCurrencyPair(currencyPair);
openOrders = tradeService.getOpenOrders(params);
System.out.printf("Open Orders for %s: %s%n: ", params, openOrders);
params.setCurrencyPair(REP_ETH);
openOrders = tradeService.getOpenOrders(params);
System.out.printf("Open Orders for %s: %s%n: ", params, openOrders);
}
use of org.knowm.xchange.dto.trade.OpenOrders in project XChange by knowm.
the class DragonexTradeService method getOpenOrders.
@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException {
if (!(params instanceof OpenOrdersParamCurrencyPair)) {
throw new ExchangeException("You need to provide the currency pair.");
}
OpenOrdersParamCurrencyPair pairParams = (OpenOrdersParamCurrencyPair) params;
if (pairParams.getCurrencyPair() == null) {
throw new ExchangeException("You need to provide the currency pair.");
}
long symbolId = exchange.symbolId(pairParams.getCurrencyPair());
OrderHistoryRequest req = new OrderHistoryRequest(symbolId, null, null, 1000, 1);
OrderHistory orderHistory = super.orderHistory(exchange.getOrCreateToken().token, req);
List<LimitOrder> openOrders = orderHistory.getList().stream().map(o -> new LimitOrder(o.orderType == 1 ? OrderType.BID : OrderType.ASK, o.volume, exchange.pair(o.symbolId), Long.toString(o.orderId), o.getTimestamp(), o.price)).collect(Collectors.toList());
return new OpenOrders(openOrders);
}
use of org.knowm.xchange.dto.trade.OpenOrders in project XChange by knowm.
the class DVChainAdapters method adaptOpenOrders.
public static OpenOrders adaptOpenOrders(List<DVChainTrade> orders) {
List<LimitOrder> openOrders = new ArrayList<>(orders.size());
for (DVChainTrade order : orders) {
CurrencyPair currencyPair = new CurrencyPair(order.getAsset(), "USD");
Order.OrderType orderType = order.getSide().equals("buy") ? Order.OrderType.BID : Order.OrderType.ASK;
LimitOrder limitOrder = new LimitOrder(orderType, order.getQuantity(), order.getQuantity(), currencyPair, order.getId(), Date.from(order.getCreatedAt()), order.getLimitPrice());
openOrders.add(limitOrder);
}
return new OpenOrders(openOrders);
}
use of org.knowm.xchange.dto.trade.OpenOrders in project XChange by knowm.
the class HuobiAdapters method adaptOpenOrders.
public static OpenOrders adaptOpenOrders(HuobiOrder[] openOrders) {
List<LimitOrder> limitOrders = new ArrayList<>();
for (HuobiOrder openOrder : openOrders) {
if (openOrder.isLimit()) {
LimitOrder order = (LimitOrder) adaptOrder(openOrder);
limitOrders.add(order);
}
}
return new OpenOrders(limitOrders);
}
Aggregations