docs: @Override
    public UserTrades getTradeHistory(TradeHistoryParams params)
        throws ExchangeException, IOException {
  
      Long offset = null;
      Long count = null;
      Long startId = null;
      Long endId = null;
      WexAuthenticated.SortOrder sort = WexAuthenticated.SortOrder.DESC;
      Long startTime = null;
      Long endTime = null;
      String btcrPair = null;
  
      if (params instanceof TradeHistoryParamPaging) {
        TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params;
        Integer pageLength = pagingParams.getPageLength();
        Integer pageNumber = pagingParams.getPageNumber();
        if (pageNumber == null) {
          pageNumber = 0;
        }
  
        if (pageLength != null) {
          count = pageLength.longValue();
          offset = (long) (pageLength * pageNumber);
        } else {
          offset = pageNumber.longValue();
        }
      }
  
      if (params instanceof TradeHistoryParamsIdSpan) {
        TradeHistoryParamsIdSpan idParams = (TradeHistoryParamsIdSpan) params;
        startId = nullSafeToLong(idParams.getStartId());
        endId = nullSafeToLong(idParams.getEndId());
      }
  
      if (params instanceof TradeHistoryParamsTimeSpan) {
        TradeHistoryParamsTimeSpan timeParams = (TradeHistoryParamsTimeSpan) params;
        startTime = nullSafeUnixTime(timeParams.getStartTime());
        endTime = nullSafeUnixTime(timeParams.getEndTime());
      }
  
      if (params instanceof TradeHistoryParamCurrencyPair) {
        CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
        if (pair != null) {
          btcrPair = WexAdapters.getPair(pair);
        }
      }
  
      if (params instanceof WexTransHistoryParams) {
        sort = ((WexTransHistoryParams) params).getSortOrder();
      }
  
      Map<Long, WexTradeHistoryResult> resultMap =
          getBTCETradeHistory(offset, count, startId, endId, sort, startTime, endTime, btcrPair);
      return WexAdapters.adaptTradeHistory(resultMap);
    }