<commit_before>package org.knowm.xchange.dsx.service;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.dsx.DSXAuthenticatedV2;
import org.knowm.xchange.dsx.dto.trade.DSXActiveOrdersReturn;
import org.knowm.xchange.dsx.dto.trade.DSXCancelAllOrdersResult;
import org.knowm.xchange.dsx.dto.trade.DSXCancelAllOrdersReturn;
import org.knowm.xchange.dsx.dto.trade.DSXCancelOrderResult;
import org.knowm.xchange.dsx.dto.trade.DSXCancelOrderReturn;
import org.knowm.xchange.dsx.dto.trade.DSXFeesResult;
import org.knowm.xchange.dsx.dto.trade.DSXFeesReturn;
import org.knowm.xchange.dsx.dto.trade.DSXOrder;
import org.knowm.xchange.dsx.dto.trade.DSXOrderHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXOrderHistoryReturn;
import org.knowm.xchange.dsx.dto.trade.DSXOrderStatusResult;
import org.knowm.xchange.dsx.dto.trade.DSXOrderStatusReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTradeHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXTradeHistoryReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTradeResult;
import org.knowm.xchange.dsx.dto.trade.DSXTradeReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTransHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXTransHistoryReturn;

/**
 * @author <NAME>
 */

public class DSXTradeServiceRaw extends DSXBaseService {

  private static final String MSG_NO_TRADES = "no trades";
  private static final String MSG_BAD_STATUS = "bad status";
  private static final String MSG_NO_ORDERS = "No open orders!";

  /**
   * Constructor
   *
   * @param exchange
   */
  protected DSXTradeServiceRaw(Exchange exchange) {

    super(exchange);
  }

  /**
   * @param pair The pair to display the orders e.g. btcusd (null: all pairs)
   * @return Active orders map
   * @throws IOException
   */
  public Map<Long, DSXOrder> getDSXActiveOrders(String pair) throws IOException {
    DSXActiveOrdersReturn orders = dsx.getActiveOrders(apiKey, signatureCreator, exchange.getNonceFactory(), pair);
    if (MSG_NO_ORDERS.equals(orders.getError())) {
      return new HashMap<>();
    }
    checkResult(orders);
    return orders.getReturnValue();
  }

  /**
   * @param order DSXOrder object
   * @return DSXTradeResult object
   * @throws IOException
   */
  public DSXTradeResult tradeDSX(DSXOrder order) throws IOException {

    String pair = order.getPair().toLowerCase();
    DSXTradeReturn ret = dsx.Trade(apiKey, signatureCreator, exchange.getNonceFactory(), order.getType(), order.getRate(),
        order.getAmount(), pair, order.getOrderType());
    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXCancelOrderResult cancelDSXOrder(long orderId) throws IOException {

    DSXCancelOrderReturn ret = dsx.CancelOrder(apiKey, signatureCreator, exchange.getNonceFactory(), orderId);
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      System.out.println(":(((((");
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXCancelAllOrdersResult cancelAllDSXOrders() throws IOException {

    DSXCancelAllOrdersReturn ret = dsx.cancelAllOrders(apiKey, signatureCreator, exchange.getNonceFactory());
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXOrderStatusResult getOrderStatus(Long orderId) throws IOException {
    DSXOrderStatusReturn ret = dsx.getOrderStatus(apiKey, signatureCreator, exchange.getNonceFactory(), orderId);
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXFeesResult getFees() throws IOException {
    DSXFeesReturn res = dsx.getFees(apiKey, signatureCreator, exchange.getNonceFactory());<commit_msg>[dsx] deleted useless print<commit_after>package org.knowm.xchange.dsx.service;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.dsx.DSXAuthenticatedV2;
import org.knowm.xchange.dsx.dto.trade.DSXActiveOrdersReturn;
import org.knowm.xchange.dsx.dto.trade.DSXCancelAllOrdersResult;
import org.knowm.xchange.dsx.dto.trade.DSXCancelAllOrdersReturn;
import org.knowm.xchange.dsx.dto.trade.DSXCancelOrderResult;
import org.knowm.xchange.dsx.dto.trade.DSXCancelOrderReturn;
import org.knowm.xchange.dsx.dto.trade.DSXFeesResult;
import org.knowm.xchange.dsx.dto.trade.DSXFeesReturn;
import org.knowm.xchange.dsx.dto.trade.DSXOrder;
import org.knowm.xchange.dsx.dto.trade.DSXOrderHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXOrderHistoryReturn;
import org.knowm.xchange.dsx.dto.trade.DSXOrderStatusResult;
import org.knowm.xchange.dsx.dto.trade.DSXOrderStatusReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTradeHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXTradeHistoryReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTradeResult;
import org.knowm.xchange.dsx.dto.trade.DSXTradeReturn;
import org.knowm.xchange.dsx.dto.trade.DSXTransHistoryResult;
import org.knowm.xchange.dsx.dto.trade.DSXTransHistoryReturn;

/**
 * @author <NAME>
 */

public class DSXTradeServiceRaw extends DSXBaseService {

  private static final String MSG_NO_TRADES = "no trades";
  private static final String MSG_BAD_STATUS = "bad status";
  private static final String MSG_NO_ORDERS = "No open orders!";

  /**
   * Constructor
   *
   * @param exchange
   */
  protected DSXTradeServiceRaw(Exchange exchange) {

    super(exchange);
  }

  /**
   * @param pair The pair to display the orders e.g. btcusd (null: all pairs)
   * @return Active orders map
   * @throws IOException
   */
  public Map<Long, DSXOrder> getDSXActiveOrders(String pair) throws IOException {
    DSXActiveOrdersReturn orders = dsx.getActiveOrders(apiKey, signatureCreator, exchange.getNonceFactory(), pair);
    if (MSG_NO_ORDERS.equals(orders.getError())) {
      return new HashMap<>();
    }
    checkResult(orders);
    return orders.getReturnValue();
  }

  /**
   * @param order DSXOrder object
   * @return DSXTradeResult object
   * @throws IOException
   */
  public DSXTradeResult tradeDSX(DSXOrder order) throws IOException {

    String pair = order.getPair().toLowerCase();
    DSXTradeReturn ret = dsx.Trade(apiKey, signatureCreator, exchange.getNonceFactory(), order.getType(), order.getRate(),
        order.getAmount(), pair, order.getOrderType());
    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXCancelOrderResult cancelDSXOrder(long orderId) throws IOException {

    DSXCancelOrderReturn ret = dsx.CancelOrder(apiKey, signatureCreator, exchange.getNonceFactory(), orderId);
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXCancelAllOrdersResult cancelAllDSXOrders() throws IOException {

    DSXCancelAllOrdersReturn ret = dsx.cancelAllOrders(apiKey, signatureCreator, exchange.getNonceFactory());
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXOrderStatusResult getOrderStatus(Long orderId) throws IOException {
    DSXOrderStatusReturn ret = dsx.getOrderStatus(apiKey, signatureCreator, exchange.getNonceFactory(), orderId);
    if (MSG_BAD_STATUS.equals(ret.getError())) {
      return null;
    }

    checkResult(ret);
    return ret.getReturnValue();
  }

  public DSXFeesResult getFees() throws IOException {
    DSXFeesReturn res = dsx.getFees(apiKey, signatureCreator, exchange.getNonceFactory());
{'fraction_non_alphanumeric': 0.11057692307692307, 'fraction_numerical': 0.0002598752598752599, 'mean_word_length': 4.688839615668884, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2896148', 'n_tokens_mistral': 2650, 'n_tokens_neox': 2580, 'n_words': 447}