Adapts Bankera BankeraTickerResponse to a Ticker

@param ticker Specific ticker
@param currencyPair BankeraCurrency pair (e.g. ETH/BTC)
@return Ticker
482396
public static Ticker adaptTicker(BankeraTickerResponse ticker, CurrencyPair currencyPair) {

    BigDecimal high = new BigDecimal(ticker.getTicker().getHigh());
    BigDecimal low = new BigDecimal(ticker.getTicker().getLow());
    BigDecimal bid = new BigDecimal(ticker.getTicker().getBid());
    BigDecimal ask = new BigDecimal(ticker.getTicker().getAsk());
    BigDecimal last = new BigDecimal(ticker.getTicker().getLast());
    BigDecimal volume = new BigDecimal(ticker.getTicker().getVolume());
    Date timestamp = new Date(ticker.getTicker().getTimestamp());

    return new Ticker.Builder()
        .currencyPair(currencyPair)
        .high(high)
        .low(low)
        .bid(bid)
        .ask(ask)
        .last(last)
        .volume(volume)
        .timestamp(timestamp)
        .build();
  }
547635
BitcointoyouPublicTrade[] getBitcointoyouPublicTrades(CurrencyPair currencyPair)
      throws IOException {

    try {
      return getBitcointoyouPublicTrades(currencyPair, null, null);
    } catch (BitcointoyouException e) {
      throw new ExchangeException(e.getError());
    }
  }
627191
public static Trades adaptTrades(List<BTCTurkTrades> btcTurkTrades, CurrencyPair currencyPair) {
    List<Trade> trades = new ArrayList<>();
    BigDecimal lastTradeId = new BigDecimal("0");
    for (BTCTurkTrades btcTurkTrade : btcTurkTrades) {
      if (btcTurkTrade.getTid().compareTo(lastTradeId) > 0) {
        lastTradeId = btcTurkTrade.getTid();
      }
      trades.add(adaptTrade(btcTurkTrade, currencyPair));
    }
    return new Trades(trades, lastTradeId.longValue(), Trades.TradeSortType.SortByID);
  }
583803
public static CurrencyPair fromLunoPair(String lunoPair) {
    return new CurrencyPair(
        fromLunoCurrency(lunoPair.substring(0, 3)), fromLunoCurrency(lunoPair.substring(3)));
  }
1070685
public static Ticker adaptTicker(PaymiumTicker PaymiumTicker, CurrencyPair currencyPair) {

    BigDecimal bid = PaymiumTicker.getBid();
    BigDecimal ask = PaymiumTicker.getAsk();
    BigDecimal high = PaymiumTicker.getHigh();
    BigDecimal low = PaymiumTicker.getLow();
    BigDecimal last = PaymiumTicker.getPrice();
    BigDecimal volume = PaymiumTicker.getVolume();
    Date timestamp = new Date(PaymiumTicker.getAt() * 1000L);

    return new Ticker.Builder()
        .currencyPair(currencyPair)
        .bid(bid)
        .ask(ask)
        .high(high)
        .low(low)
        .last(last)
        .volume(volume)
        .timestamp(timestamp)
        .build();
  }
755469
public static OrderBook adaptOrderBook(
      MercadoBitcoinOrderBook mercadoBitcoinOrderBook, CurrencyPair currencyPair) {

    List<LimitOrder> asks =
        createOrders(currencyPair, OrderType.ASK, mercadoBitcoinOrderBook.getAsks());
    List<LimitOrder> bids =
        createOrders(currencyPair, OrderType.BID, mercadoBitcoinOrderBook.getBids());
    return new OrderBook(null, asks, bids);
  }
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);
  }
1183398
public static Ticker adaptTicker(BitMarketTicker bitMarketTicker, CurrencyPair currencyPair) {

    BigDecimal bid = bitMarketTicker.getBid();
    BigDecimal ask = bitMarketTicker.getAsk();
    BigDecimal high = bitMarketTicker.getHigh();
    BigDecimal low = bitMarketTicker.getLow();
    BigDecimal volume = bitMarketTicker.getVolume();
    BigDecimal vwap = bitMarketTicker.getVwap();
    BigDecimal last = bitMarketTicker.getLast();

    return new Ticker.Builder()
        .currencyPair(currencyPair)
        .last(last)
        .bid(bid)
        .ask(ask)
        .high(high)
        .low(low)
        .volume(volume)
        .vwap(vwap)
        .build();
  }
1300652
public static OrderBook adaptOrderBook(
      BitcoindeOrderbookWrapper bitcoindeOrderbookWrapper, CurrencyPair currencyPair) {

    // System.out.println("bitcoindeOrderbookWrapper = " +
    // bitcoindeOrderbookWrapper);
    // System.out.println("credits = " + bitcoindeOrderbookWrapper.getCredits());

    List<LimitOrder> asks =
        createOrders(
            currencyPair,
            Order.OrderType.ASK,
            bitcoindeOrderbookWrapper.getBitcoindeOrders().getAsks());
    List<LimitOrder> bids =
        createOrders(
            currencyPair,
            Order.OrderType.BID,
            bitcoindeOrderbookWrapper.getBitcoindeOrders().getBids());

    Collections.sort(bids, BID_COMPARATOR);
    Collections.sort(asks, ASK_COMPARATOR);
    return new OrderBook(null, asks, bids);
  }
1092684
public static BitfinexCurrencyPair register(final String currency, 
			final String profitCurrency, final double minimalOrderSize) {

		final String key = buildCacheKey(currency, profitCurrency);

		final BitfinexCurrencyPair newCurrency = new BitfinexCurrencyPair(currency, profitCurrency, 
				minimalOrderSize);

		final BitfinexCurrencyPair oldCurrency = instances.putIfAbsent(key, newCurrency);

		// The currency was already registered
		if(oldCurrency != null) {
			throw new IllegalArgumentException("The currency " + key + " is already known");
		}

		return newCurrency;
	}
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());
    }
455011
public TypeSpec createCurrencyUtil(String className, Map<String, CurrencyData> currencies) {
    TypeSpec.Builder type = TypeSpec.classBuilder(className)
        .addModifiers(Modifier.PUBLIC);
    
    CurrencyData defaultData = currencies.get("DEFAULT");
    currencies.remove("DEFAULT");
    
    MethodSpec.Builder code = MethodSpec.methodBuilder("getCurrencyDigits")
        .addModifiers(PUBLIC, STATIC)
        .addParameter(Types.CLDR_CURRENCY_ENUM, "code")
        .returns(int.class);
    
    code.beginControlFlow("switch (code)");
    for (Map.Entry<String, CurrencyData> entry : currencies.entrySet()) {
      CurrencyData data = entry.getValue();
      code.addStatement("case $L: return $L", entry.getKey(), data.digits);
    }
    code.addStatement("default: return $L", defaultData.digits);
    code.endControlFlow();
    
    type.addMethod(code.build());
    return type.build();
  }
814737
public static CurrencyUnitBuilder of(String currencyCode, String providerName) {
        return new CurrencyUnitBuilder(currencyCode, CurrencyContextBuilder.of(providerName).build());
    }
367139
private function doCreateRate($url, CurrencyPair $currencyPair): ExchangeRate
    {
        $content = $this->request($url);
        $data = StringUtil::jsonToArray($content);

        if (empty($data['success'])) {
            throw new Exception($data['error']['info']);
        }

        $date = (new \DateTime())->setTimestamp($data['timestamp']);
        $hash = $currencyPair->getBaseCurrency().$currencyPair->getQuoteCurrency();

        if ($data['source'] === $currencyPair->getBaseCurrency() && isset($data['quotes'][$hash])) {
            return $this->createRate($currencyPair, (float) ($data['quotes'][$hash]), $date);
        }

        throw new UnsupportedCurrencyPairException($currencyPair, $this);
    }
1270973
public static BitfinexExecutedTradeSymbol executedTrades(final String currency, 
    		final String profitCurrency) {
    	
        final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
        final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
        
        return executedTrades(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull));
    }
1235737
public static Ticker adaptTicker(KoinimTicker koinimTicker, CurrencyPair currencyPair) {

    if (!currencyPair.equals(new CurrencyPair(BTC, TRY))) {
      throw new NotAvailableFromExchangeException();
    }

    if (koinimTicker != null) {
      return new Ticker.Builder()
          .currencyPair(new CurrencyPair(BTC, Currency.TRY))
          .last(koinimTicker.getSell())
          .bid(koinimTicker.getBid())
          .ask(koinimTicker.getAsk())
          .high(koinimTicker.getHigh())
          .low(koinimTicker.getLow())
          .volume(koinimTicker.getVolume())
          .vwap(koinimTicker.getAvg())
          .build();
    }
    return null;
  }
1000865
public CreateCardChargeParams currency(final Currency currency) {
        return this.with("currency", currency == null ? Currency.MXN.name() : currency.name());
    }