Adapts a Transaction[] to a Trades Object

@param transactions The Bitso transactions
@param currencyPair (e.g. BTC/MXN)
@return The XChange Trades
197418
public static Trades adaptTrades(BitsoTransaction[] transactions, CurrencyPair currencyPair) {

    List<Trade> trades = new ArrayList<>();
    long lastTradeId = 0;
    for (BitsoTransaction tx : transactions) {
      Order.OrderType type;
      switch (tx.getSide()) {
        case "buy":
          type = Order.OrderType.ASK;
          break;
        case "sell":
          type = Order.OrderType.BID;
          break;
        default:
          type = null;
      }
      final long tradeId = tx.getTid();
      if (tradeId > lastTradeId) {
        lastTradeId = tradeId;
      }
      trades.add(
          new Trade(
              type,
              tx.getAmount(),
              currencyPair,
              tx.getPrice(),
              DateUtils.fromMillisUtc(tx.getDate() * 1000L),
              String.valueOf(tradeId)));
    }

    return new Trades(trades, lastTradeId, TradeSortType.SortByID);
  }
626852
@Override
  public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {

    String marketName = DSXAdapters.currencyPairToMarketName(currencyPair);

    int numberOfItems = -1;
    try {
      if (args != null) {
        numberOfItems =
            (Integer)
                args[0]; // can this really be args[0] if we are also using args[0] as a string//
        // below??
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      // ignore, can happen if no argument given.
    }
    DSXTrade[] dsxTrades;

    String accountType = null;
    try {
      if (args != null) {
        accountType = (String) args[1];
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      // ignore, can happen if no argument given.
    }

    if (numberOfItems == -1) {
      dsxTrades = getDSXTrades(marketName, FULL_SIZE, accountType).getTrades(marketName);
    } else {
      dsxTrades = getDSXTrades(marketName, numberOfItems, accountType).getTrades(marketName);
    }
    return DSXAdapters.adaptTrades(dsxTrades, currencyPair);
  }
614806
public static Trade adaptTrade(BTCTurkTrades btcTurkTrade, CurrencyPair currencyPair) {

    return new Trade(
        null,
        btcTurkTrade.getAmount(),
        currencyPair,
        btcTurkTrade.getPrice(),
        btcTurkTrade.getDate(),
        btcTurkTrade.getTid().toString());
  }
392364
public static EthereumTransaction convertToEthereumTransaction(HiveEthereumTransaction transaction) {
			EthereumTransaction result = new EthereumTransaction();
			// note we set only the raw values, the other ones can be automatically dervied by the EthereumTransaction class if needed. This avoids conversion issues for large numbers
			result.setNonce(transaction.getNonce());
			result.setValueRaw(transaction.getValueRaw());
			result.setReceiveAddress(transaction.getReceiveAddress());
			result.setGasPriceRaw(transaction.getGasPriceRaw());
			result.setGasLimitRaw(transaction.getGasLimitRaw());
			result.setData(transaction.getData());
			result.setSig_v(transaction.getSig_v());
			result.setSig_r(transaction.getSig_r());
			result.setSig_s(transaction.getSig_s());
			return result;
	}
1107103
@Override
    public ExchangeRate getExchangeRate(MonetaryAmount amount) {
        return this.rateProvider.getExchangeRate(ConversionQueryBuilder
                .of(conversionQuery).setBaseCurrency(amount.getCurrency())
                .build());
        // return this.rateProvider.getExchangeRate(amount.getCurrency(),
        // getCurrency());
    }
760162
public static Trades adaptTrades(
      BitcoindeTradesWrapper bitcoindeTradesWrapper, CurrencyPair currencyPair) {

    List<Trade> trades = new ArrayList<>();
    long lastTradeId = 0;
    for (BitcoindeTrade bitcoindeTrade : bitcoindeTradesWrapper.getTrades()) {
      final long tid = bitcoindeTrade.getTid();
      if (tid > lastTradeId) {
        lastTradeId = tid;
      }
      trades.add(
          new Trade(
              null,
              bitcoindeTrade.getAmount(),
              currencyPair,
              bitcoindeTrade.getPrice(),
              DateUtils.fromMillisUtc(bitcoindeTrade.getDate() * 1000L),
              String.valueOf(tid)));
    }
    return new Trades(trades, lastTradeId, TradeSortType.SortByID);
  }
78778
public static OrderBook adaptOrderBook(EXXOrderbook exxOrderbook, CurrencyPair currencyPair) {
    List<LimitOrder> asks = new ArrayList<LimitOrder>();
    List<LimitOrder> bids = new ArrayList<LimitOrder>();

    for (BigDecimal[] exxAsk : exxOrderbook.getAsks()) {
      asks.add(new LimitOrder(OrderType.ASK, exxAsk[1], currencyPair, null, null, exxAsk[0]));
    }

    for (BigDecimal[] exxBid : exxOrderbook.getBids()) {
      bids.add(new LimitOrder(OrderType.BID, exxBid[1], currencyPair, null, null, exxBid[0]));
    }

    return new OrderBook(new Date(), asks, bids);
  }
520924
public static BitfinexCurrencyPair of(final String currency, final String profitCurrency) {
		final String key = buildCacheKey(currency, profitCurrency);

		final BitfinexCurrencyPair bcp = instances.get(key);

		if (bcp == null) {
			throw new IllegalArgumentException("CurrencyPair is not registered: " + currency + " " + profitCurrency);
		}

		return bcp;
	}
1108078
private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) {
        for (MeterValue meterValue : meterValues) {
            addMeterValueToTransaction(transaction, meterValue);
        }
    }
480392
public BitZTrades getOrder(CurrencyPair currencyPair) throws IOException {
    BitZTradesResult result = bitz.getOrder(BitZUtils.toPairString(currencyPair));
    return result.getData();
  }
725438
public function getExchangeRate(ExchangeRateQuery $exchangeQuery): ExchangeRateContract
    {
        $currencyPair = $exchangeQuery->getCurrencyPair();

        $response = $this->request(
            sprintf(
                self::LATEST_URL,
                strtolower($currencyPair->getBaseCurrency()),
                strtolower($currencyPair->getQuoteCurrency())
            )
        );

        $data = StringUtil::jsonToArray($response);

        if (!$data['success']) {
            $message = !empty($data['error']) ? $data['error'] : 'Unknown error';

            throw new Exception($message);
        }

        $date = (new \DateTime())->setTimestamp($data['timestamp']);

        return $this->createRate($currencyPair, (float) ($data['ticker']['price']), $date);
    }
1131082
public static OrderBook adaptOrderBook(
      CCEXGetorderbook ccexOrderBook, CurrencyPair currencyPair) {

    List<LimitOrder> asks =
        createOrders(currencyPair, Order.OrderType.ASK, ccexOrderBook.getAsks());
    List<LimitOrder> bids =
        createOrders(currencyPair, Order.OrderType.BID, ccexOrderBook.getBids());
    Date date = new Date();
    return new OrderBook(date, asks, bids);
  }
1230224
public OkCoinPositionResult getFuturesPositionsFixed(
      CurrencyPair currencyPair, FuturesContract contract) throws IOException {
    return okCoin.getFuturesPositionsFixed(
        apikey, OkCoinAdapters.adaptSymbol(currencyPair), contract.getName(), signatureCreator());
  }
204897
public static List<UserTrade> adaptUserTrades(
      List<CurrencyPair> currencyPairList, List<LykkeOrder> tradeHistoryList) throws IOException {
    List<UserTrade> userTrades = new ArrayList<>();

    for (LykkeOrder lykkeTradeHistory : tradeHistoryList) {
      userTrades.add(adaptUserTrade(currencyPairList, lykkeTradeHistory));
    }
    return userTrades;
  }
1236176
public static UserTrades adaptTradeHistory(LakeBTCTradeResponse[] transactions) {

    List<UserTrade> trades = new ArrayList<>();
    long lastTradeId = 0;
    for (LakeBTCTradeResponse trade : transactions) {
      final OrderType orderType = trade.getType().startsWith("buy") ? OrderType.BID : OrderType.ASK;
      BigDecimal originalAmount = trade.getAmount();
      BigDecimal price = trade.getTotal().abs();
      Date timestamp = DateUtils.fromMillisUtc(trade.getAt() * 1000L);

      final String tradeId = trade.getId();
      final CurrencyPair currencyPair = CurrencyPair.BTC_CNY;
      UserTrade userTrade =
          new UserTrade(
              orderType,
              originalAmount,
              currencyPair,
              price,
              timestamp,
              tradeId,
              null,
              null,
              Currency.getInstance(currencyPair.counter.getCurrencyCode()));
      trades.add(userTrade);
    }

    return new UserTrades(trades, lastTradeId, Trades.TradeSortType.SortByTimestamp);
  }
464435
@Override
  public UserTrades getTradeHistory(TradeHistoryParams params)
      throws ExchangeException, IOException {

    CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
    List<GateioTrade> userTrades = getGateioTradeHistory(pair).getTrades();

    return GateioAdapters.adaptUserTrades(userTrades);
  }
121922
public static OrderBook adaptOrderBook(
      BTCTurkOrderBook btcTurkOrderBook, CurrencyPair currencyPair) {
    List<LimitOrder> asks =
        createOrders(currencyPair, Order.OrderType.ASK, btcTurkOrderBook.getAsks());
    List<LimitOrder> bids =
        createOrders(currencyPair, Order.OrderType.BID, btcTurkOrderBook.getBids());
    return new OrderBook(btcTurkOrderBook.getTimestamp(), asks, bids);
  }