use of org.knowm.xchange.kraken.dto.trade.results.KrakenCancelOrderResult.KrakenCancelOrderResponse in project XChange by knowm.
the class KrakenCancelOrderDemo method raw.
private static void raw(Exchange krakenExchange) throws IOException {
KrakenTradeServiceRaw tradeService = (KrakenTradeServiceRaw) krakenExchange.getTradeService();
System.out.println("Open Orders: " + tradeService.getKrakenOpenOrders());
// place a limit buy order
LimitOrder limitOrder = new LimitOrder((OrderType.ASK), new BigDecimal(".01"), CurrencyPair.BTC_LTC, "", null, new BigDecimal("51.25"));
KrakenOrderResponse limitOrderReturnValue = tradeService.placeKrakenLimitOrder(limitOrder);
System.out.println("Limit Order return value: " + limitOrderReturnValue);
Map<String, KrakenOrder> openOrders = tradeService.getKrakenOpenOrders();
System.out.println("Open Orders: " + openOrders);
// Cancel the added order
List<String> transactionIds = limitOrderReturnValue.getTransactionIds();
if (transactionIds != null && !transactionIds.isEmpty()) {
KrakenCancelOrderResponse cancelResult = tradeService.cancelKrakenOrder(transactionIds.get(0));
System.out.println("Canceling returned " + cancelResult);
System.out.println("Open Orders: " + tradeService.getKrakenOpenOrders());
}
}
use of org.knowm.xchange.kraken.dto.trade.results.KrakenCancelOrderResult.KrakenCancelOrderResponse in project XChange by knowm.
the class KrakenTradeJsonTest method testCancelOrderUnmarshal.
@Test
public void testCancelOrderUnmarshal() throws IOException {
// Read in the JSON from the example resources
InputStream is = KrakenTradeJsonTest.class.getResourceAsStream("/org/knowm/xchange/kraken/dto/trading/example-cancelorder-data.json");
// Use Jackson to parse it
ObjectMapper mapper = new ObjectMapper();
KrakenCancelOrderResult krakenResult = mapper.readValue(is, KrakenCancelOrderResult.class);
KrakenCancelOrderResponse cancelOrderResponse = krakenResult.getResult();
assertThat(cancelOrderResponse.getCount()).isEqualTo(1);
assertFalse(cancelOrderResponse.isPending());
}
Aggregations