class GateioTradeService extends GateioTradeServiceRaw implements TradeService {

  public GateioTradeService(GateioExchange exchange) {
    super(exchange);
  }


  @Override
  public String placeMarketOrder(MarketOrder marketOrder) throws IOException {
    try {
      GateioOrder order = createOrder(GateioAdapters.toGateioOrder(marketOrder));
      return order.getId();
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  }


  @Override
  public String placeLimitOrder(LimitOrder limitOrder) throws IOException {
    try {
      GateioOrder order = createOrder(GateioAdapters.toGateioOrder(limitOrder));
      return order.getId();
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  }


  @Override
  public Collection<Order> getOrder(OrderQueryParams... orderQueryParams) throws IOException {
    // todo: implement getting of several orders
    Validate.validState(orderQueryParams.length == 1);
    Validate.isInstanceOf(OrderQueryParamInstrument.class, orderQueryParams[0]);

    OrderQueryParamInstrument params = (OrderQueryParamInstrument) orderQueryParams[0];

    try {
      GateioOrder gateioOrder = getOrder(params.getOrderId(), params.getInstrument());
      return Collections.singletonList(GateioAdapters.toOrder(gateioOrder));
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  }


  public Order cancelOrder(String orderId, Instrument instrument) throws IOException {<FILL_FUNCTION_BODY>}


  @Override
  public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
    Validate.isInstanceOf(DefaultCancelOrderByInstrumentAndIdParams.class, orderParams);
    DefaultCancelOrderByInstrumentAndIdParams params = (DefaultCancelOrderByInstrumentAndIdParams) orderParams;

    try {
      Order order = cancelOrder(params.getOrderId(), params.getInstrument());
      return order.getStatus() == OrderStatus.CANCELED;
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  }

  @Override
  public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
    try {
      List<UserTrade> userTradeList = getGateioUserTrades(params).stream()
          .map(GateioAdapters::toUserTrade)
          .collect(Collectors.toList());
      return new UserTrades(userTradeList, TradeSortType.SortByID);
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  }

  @Override
  public Class[] getRequiredCancelOrderParamClasses() {
    return new Class[] {DefaultCancelOrderByInstrumentAndIdParams.class};
  }


  @Override
  public TradeHistoryParams createTradeHistoryParams() {
    return GateioTradeHistoryParams.builder().build();
  }


}

    try {
      GateioOrder gateioOrder = cancelOrderRaw(orderId, instrument);
      return GateioAdapters.toOrder(gateioOrder);
    }
    catch (GateioException e) {
      throw GateioErrorAdapter.adapt(e);
    }
  
<methods>public void <init>(org.knowm.xchange.gateio.GateioExchange) ,public org.knowm.xchange.gateio.dto.account.GateioOrder cancelOrderRaw(java.lang.String, org.knowm.xchange.instrument.Instrument) throws java.io.IOException,public org.knowm.xchange.gateio.dto.account.GateioOrder createOrder(org.knowm.xchange.gateio.dto.account.GateioOrder) throws java.io.IOException,public List<org.knowm.xchange.gateio.dto.trade.GateioUserTradeRaw> getGateioUserTrades(org.knowm.xchange.service.trade.params.TradeHistoryParams) throws java.io.IOException,public org.knowm.xchange.gateio.dto.account.GateioOrder getOrder(java.lang.String, org.knowm.xchange.instrument.Instrument) throws java.io.IOException,public List<org.knowm.xchange.gateio.dto.account.GateioOrder> listOrders(org.knowm.xchange.instrument.Instrument, org.knowm.xchange.dto.Order.OrderStatus) throws java.io.IOException<variables>