use of org.knowm.xchange.kucoin.dto.request.OrderCreateApiRequest in project XChange by knowm.
the class KucoinTradeRawDemo method raw.
private static void raw(KucoinTradeServiceRaw tradeService) throws Exception {
System.out.println("RAW...\n");
OrderCreateApiRequest limitOrder = OrderCreateApiRequest.builder().size(AMOUNT).price(PRICE).side("sell").symbol(SYMBOL).type("limit").clientOid(UUID.randomUUID().toString()).build();
OrderCreateResponse response = tradeService.kucoinCreateOrder(limitOrder);
String orderId = response.getOrderId();
System.out.println("Order successfully placed. ID=" + orderId);
// wait for order to propagate
Thread.sleep(3000);
System.out.println("All orders: " + tradeService.getKucoinOpenOrders(null, 1, 500));
System.out.println(SYMBOL + " orders: " + tradeService.getKucoinOpenOrders(SYMBOL, 1, 500));
System.out.println("All fills: " + tradeService.getKucoinFills(null, null, 1, 500, null, null));
System.out.println(SYMBOL + " fills: " + tradeService.getKucoinFills(SYMBOL, null, 1, 500, null, null));
// Not yet implemented
System.out.println("Attempting to cancel order " + orderId);
OrderCancelResponse cancelResponse = tradeService.kucoinCancelOrder(orderId);
if (cancelResponse.getCancelledOrderIds().contains(orderId)) {
System.out.println("Order successfully canceled.");
} else {
System.out.println("Order not successfully canceled.");
}
// wait for cancellation to propagate
Thread.sleep(3000);
System.out.println(SYMBOL + " orders: " + tradeService.getKucoinOpenOrders(SYMBOL, 1, 500));
}
Aggregations