use of org.knowm.xchange.kraken.dto.trade.KrakenOpenPosition in project XChange by knowm.
the class KrakenTradeRawSpecificDemo method main.
public static void main(String[] args) throws IOException {
Exchange krakenExchange = KrakenExampleUtils.createTestExchange();
// Interested in the private trading functionality (authentication)
KrakenTradeServiceRaw tradeService = (KrakenTradeServiceRaw) krakenExchange.getTradeService();
// stop at -5% loss, take profit at +$10 price increase.
KrakenStandardOrder order = KrakenStandardOrder.getLimitOrderBuilder(CurrencyPair.BTC_USD, KrakenType.BUY, "100.00", new BigDecimal("2.12345678")).withCloseOrder(KrakenOrderType.STOP_LOSS_PROFIT, "#5%", "#10").withValidateOnly(// validate only for demo purposes
true).buildOrder();
KrakenOrderResponse orderResponse = tradeService.placeKrakenOrder(order);
System.out.println(orderResponse);
Map<String, KrakenOrder> openOrders = tradeService.getKrakenOpenOrders();
System.out.println(openOrders);
limitRate();
Map<String, KrakenOrder> closedOrders = tradeService.getKrakenClosedOrders();
System.out.println(closedOrders);
Set<String> closedOrderIds = closedOrders.keySet();
System.out.println(tradeService.queryKrakenOrders(closedOrderIds.toArray(new String[closedOrderIds.size()])));
Map<String, KrakenTrade> trades = tradeService.getKrakenTradeHistory().getTrades();
System.out.println(trades);
Set<String> tradeIds = trades.keySet();
System.out.println(tradeService.queryKrakenTrades(tradeIds.toArray(new String[tradeIds.size()])));
Map<String, KrakenOpenPosition> openPositions = tradeService.getKrakenOpenPositions();
System.out.println(openPositions);
}
Aggregations