class GateioAdapters {


  public String toString(Instrument instrument) {
    if (instrument == null) {
      return null;
    }
    else {
      return String.format("%s_%s",
                      instrument.getBase().getCurrencyCode(),
                      instrument.getCounter().getCurrencyCode())
              .toUpperCase(Locale.ROOT);
    }
  }


  public OrderBook toOrderBook(GateioOrderBook gateioOrderBook, Instrument instrument) {
    List<LimitOrder> asks = gateioOrderBook.getAsks().stream()
        .map(priceSizeEntry -> new LimitOrder(OrderType.ASK, priceSizeEntry.getSize(), instrument, null, null, priceSizeEntry.getPrice()))
        .collect(Collectors.toList());

    List<LimitOrder> bids = gateioOrderBook.getBids().stream()
        .map(priceSizeEntry -> new LimitOrder(OrderType.BID, priceSizeEntry.getSize(), instrument, null, null, priceSizeEntry.getPrice()))
        .collect(Collectors.toList());

    return new OrderBook(Date.from(gateioOrderBook.getGeneratedAt()), asks, bids);
  }


  public InstrumentMetaData toInstrumentMetaData(GateioCurrencyPairDetails gateioCurrencyPairDetails) {
    return new InstrumentMetaData.Builder()
        .tradingFee(gateioCurrencyPairDetails.getFee())
        .minimumAmount(gateioCurrencyPairDetails.getMinAssetAmount())
        .counterMinimumAmount(gateioCurrencyPairDetails.getMinQuoteAmount())
        .volumeScale(gateioCurrencyPairDetails.getAssetScale())
        .priceScale(gateioCurrencyPairDetails.getQuoteScale())
        .build();
  }


  public String toString(OrderStatus orderStatus) {<FILL_FUNCTION_BODY>}


  public OrderStatus toOrderStatus(String gateioOrderStatus) {
    switch (gateioOrderStatus) {
      case "open":
        return OrderStatus.OPEN;
      case "filled":
      case "closed":
        return OrderStatus.FILLED;
      case "cancelled":
      case "stp":
        return OrderStatus.CANCELED;
      default:
        throw new IllegalArgumentException("Can't map " + gateioOrderStatus);
    }
  }


  public GateioOrder toGateioOrder(MarketOrder marketOrder) {
    return GateioOrder.builder()
        .currencyPair((CurrencyPair) marketOrder.getInstrument())
        .side(marketOrder.getType())
        .clientOrderId(marketOrder.getUserReference())
        .account("spot")
        .type("market")
        .timeInForce("ioc")
        .amount(marketOrder.getOriginalAmount())
        .build();
  }


  public GateioOrder toGateioOrder(LimitOrder limitOrder) {
    return GateioOrder.builder()
        .currencyPair((CurrencyPair) limitOrder.getInstrument())
        .side(limitOrder.getType())
        .clientOrderId(limitOrder.getUserReference())
        .account("spot")
        .type("limit")
        .timeInForce("gtc")
        .price(limitOrder.getLimitPrice())
        .amount(limitOrder.getOriginalAmount())
        .build();
  }


  public Order toOrder(GateioOrder gateioOrder) {
    Order.Builder builder;
    Instrument instrument = gateioOrder.getCurrencyPair();
    OrderType orderType = gateioOrder.getSide();

    switch (gateioOrder.getType()) {
      case "market":
        builder = new MarketOrder.Builder(orderType, instrument);
        break;
      case "limit":
        builder = new LimitOrder.Builder(orderType, instrument)
            .limitPrice(gateioOrder.getPrice());
        break;
      default:
        throw new IllegalArgumentException("Can't map " + gateioOrder.getType());
    }

    if (orderType == OrderType.BID) {
      builder.cumulativeAmount(gateioOrder.getFilledTotalQuote());
    }
    else if (orderType == OrderType.ASK) {
      BigDecimal filledAssetAmount = gateioOrder.getFilledTotalQuote().divide(gateioOrder.getAvgDealPrice(), MathContext.DECIMAL32);
      builder.cumulativeAmount(filledAssetAmount);
    }
    else {
      throw new IllegalArgumentException("Can't map " + orderType);
    }

    return builder
        .id(gateioOrder.getId())
        .originalAmount(gateioOrder.getAmount())
        .userReference(gateioOrder.getClientOrderId())
        .timestamp(Date.from(gateioOrder.getCreatedAt()))
        .orderStatus(toOrderStatus(gateioOrder.getStatus()))
        .averagePrice(gateioOrder.getAvgDealPrice())
        .fee(gateioOrder.getFee())
        .build();
  }


  public UserTrade toUserTrade(GateioUserTradeRaw gateioUserTradeRaw) {
    return new GateioUserTrade(gateioUserTradeRaw.getSide(), gateioUserTradeRaw.getAmount(), gateioUserTradeRaw.getCurrencyPair(),
        gateioUserTradeRaw.getPrice(), Date.from(gateioUserTradeRaw.getTimeMs()), String.valueOf(
        gateioUserTradeRaw.getId()),
        String.valueOf(gateioUserTradeRaw.getOrderId()), gateioUserTradeRaw.getFee(), gateioUserTradeRaw.getFeeCurrency(),
        gateioUserTradeRaw.getRemark(), gateioUserTradeRaw.getRole());
  }


  public GateioWithdrawalRequest toGateioWithdrawalRequest(GateioWithdrawFundsParams p) {
    return GateioWithdrawalRequest.builder()
        .clientRecordId(p.getClientRecordId())
        .address(p.getAddress())
        .tag(p.getAddressTag())
        .chain(p.getChain())
        .amount(p.getAmount())
        .currency(p.getCurrency())
        .build();

  }


  public Ticker toTicker(GateioTicker gateioTicker) {
    return new Ticker.Builder()
            .instrument(gateioTicker.getCurrencyPair())
            .last(gateioTicker.getLastPrice())
            .bid(gateioTicker.getHighestBid())
            .ask(gateioTicker.getLowestAsk())
            .high(gateioTicker.getMaxPrice24h())
            .low(gateioTicker.getMinPrice24h())
            .volume(gateioTicker.getAssetVolume())
            .quoteVolume(gateioTicker.getQuoteVolume())
            .percentageChange(gateioTicker.getChangePercentage24h())
            .build();
  }


  public FundingRecord toFundingRecords(GateioAccountBookRecord gateioAccountBookRecord) {
    return new FundingRecord.Builder()
        .setInternalId(gateioAccountBookRecord.getId())
        .setDate(Date.from(gateioAccountBookRecord.getTimestamp()))
        .setCurrency(gateioAccountBookRecord.getCurrency())
        .setBalance(gateioAccountBookRecord.getBalance())
        .setType(gateioAccountBookRecord.getType())
        .setAmount(gateioAccountBookRecord.getChange().abs())
        .setDescription(gateioAccountBookRecord.getTypeDescription())
        .build();
  }
}

    switch (orderStatus) {
      case OPEN:
        return "open";
      case CLOSED:
        return "finished";
      default:
        throw new IllegalArgumentException("Can't map " + orderStatus);
    }
  
<no_super_class>