use of org.knowm.xchange.gateio.dto.trade.GateioTrade in project XChange by knowm.
the class GateioTradeDemo method raw.
private static void raw(GateioTradeServiceRaw tradeService) throws IOException, InterruptedException {
String placedOrderId = tradeService.placeGateioLimitOrder(CurrencyPair.LTC_BTC, GateioOrderType.SELL, new BigDecimal("0.0265"), new BigDecimal("0.384"));
System.out.println(placedOrderId);
// wait for Gateio's back-end to propagate the order
Thread.sleep(2000);
GateioOpenOrders openOrders = tradeService.getGateioOpenOrders();
System.out.println(openOrders);
List<GateioOpenOrder> openOrdersList = openOrders.getOrders();
if (!openOrdersList.isEmpty()) {
String existingOrderId = openOrdersList.get(0).getId();
GateioOrderStatus orderStatus = tradeService.getGateioOrderStatus(existingOrderId, CurrencyPair.LTC_BTC);
System.out.println(orderStatus);
boolean isCancelled = tradeService.cancelOrder(existingOrderId, CurrencyPairDeserializer.getCurrencyPairFromString(openOrdersList.get(0).getCurrencyPair()));
System.out.println(isCancelled);
}
// wait for Gateio's back-end to propagate the cancelled order
Thread.sleep(2000);
openOrders = tradeService.getGateioOpenOrders();
System.out.println(openOrders);
List<GateioTrade> tradeHistory = tradeService.getGateioTradeHistory(CurrencyPair.LTC_BTC).getTrades();
System.out.println(tradeHistory);
}
use of org.knowm.xchange.gateio.dto.trade.GateioTrade in project XChange by knowm.
the class GateioTradeService method getTradeHistory.
/**
* Required parameter: {@link TradeHistoryParamCurrencyPair}
*/
@Override
public UserTrades getTradeHistory(TradeHistoryParams params) throws ExchangeException, IOException {
CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
List<GateioTrade> userTrades = getGateioTradeHistory(pair).getTrades();
return GateioAdapters.adaptUserTrades(userTrades);
}
Aggregations