public static ExchangeMetaData adaptMetaData(List<BitflyerMarket> markets) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (BitflyerMarket market : markets) { CurrencyPair pair = adaptCurrencyPair(market.getProductCode()); currencyPairs.put(pair, null); } return new ExchangeMetaData(currencyPairs, currencies, null, null, false); }
public static ExchangeMetaData adaptMetadata(List<ZaifMarket> markets) { Map<CurrencyPair, CurrencyPairMetaData> pairMeta = new HashMap<>(); for (ZaifMarket zaifMarket : markets) { pairMeta.put(zaifMarket.getName(), new CurrencyPairMetaData(null, null, null, null, null)); } return new ExchangeMetaData(pairMeta, null, null, null, null); } }
public static ExchangeMetaData adaptMetaData( BitcoinAverageTickers tickers, ExchangeMetaData bAMetaData) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); for (String currency : tickers.getTickers().keySet()) { if (!currency.startsWith("BTC")) { throw new IllegalStateException("Unsupported currency: " + currency); } currencyPairs.put(new CurrencyPair(BTC, Currency.getInstance(currency.substring(3))), null); } return new ExchangeMetaData( currencyPairs, Collections.<Currency, CurrencyMetaData>emptyMap(), null, null, null); } }
public static ExchangeMetaData adaptExchangeMetadata( List<KucoinTicker> tickers, List<KucoinCoin> coins) { Map<String, KucoinCoin> coinMap = coins.stream().collect(Collectors.toMap(c -> c.getCoin(), c -> c)); Map<CurrencyPair, CurrencyPairMetaData> pairMeta = adaptCurrencyPairMap(tickers, coinMap); Map<Currency, CurrencyMetaData> coinMeta = adaptCurrencyMap(coins); return new ExchangeMetaData(pairMeta, coinMeta, null, null, null); }
public static ExchangeMetaData adaptToExchangeMetaData(final Map<String, LiquiPairInfo> infos) { final Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); final Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (final Map.Entry<String, LiquiPairInfo> entry : infos.entrySet()) { final CurrencyPair pair = adaptCurrencyPair(entry.getKey()); final BigDecimal fee = entry.getValue().getFee(); final BigDecimal minAmount = entry.getValue().getMinAmount(); final BigDecimal maxAmount = entry.getValue().getMaxAmount(); final int priceScale = entry.getValue().getDecimalPlaces(); currencyPairs.put( pair, new CurrencyPairMetaData(fee, minAmount, maxAmount, priceScale, null)); if (!currencies.containsKey(pair.base)) currencies.put(pair.base, null); if (!currencies.containsKey(pair.counter)) currencies.put(pair.counter, null); } return new ExchangeMetaData(currencyPairs, currencies, null, null, null); }
public static ExchangeMetaData adaptToExchangeMetaData(Map<String, BxAssetPair> assetPairs) { BxUtils.setBxAssetPairs(assetPairs); Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>(); for (String id : assetPairs.keySet()) { if (assetPairs.get(id).isActive()) { pairs.put(adaptCurrencyPair(id), adaptCurrencyPairMetaData(assetPairs.get(id))); } } return new ExchangeMetaData(pairs, BxUtils.getCurrencies(), null, null, false); }
public static ExchangeMetaData adaptToExchangeMetaData( Map<CurrencyPair, GateioMarketInfo> currencyPair2BTERMarketInfoMap) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); for (Entry<CurrencyPair, GateioMarketInfo> entry : currencyPair2BTERMarketInfoMap.entrySet()) { CurrencyPair currencyPair = entry.getKey(); GateioMarketInfo btermarketInfo = entry.getValue(); CurrencyPairMetaData currencyPairMetaData = new CurrencyPairMetaData( btermarketInfo.getFee(), btermarketInfo.getMinAmount(), null, btermarketInfo.getDecimalPlaces(), null); currencyPairs.put(currencyPair, currencyPairMetaData); } ExchangeMetaData exchangeMetaData = new ExchangeMetaData(currencyPairs, null, null, null, null); return exchangeMetaData; }
public static ExchangeMetaData adaptMetadata(List<BiboxMarket> markets) { Map<CurrencyPair, CurrencyPairMetaData> pairMeta = new HashMap<>(); for (BiboxMarket biboxMarket : markets) { pairMeta.put( new CurrencyPair(biboxMarket.getCoinSymbol(), biboxMarket.getCurrencySymbol()), new CurrencyPairMetaData(null, null, null, null, null)); } return new ExchangeMetaData(pairMeta, null, null, null, null); }
public static ExchangeMetaData toMetaData( DSXExchangeInfo dsxExchangeInfo, DSXMetaData dsxMetaData) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); if (dsxExchangeInfo != null) { for (Entry<String, DSXPairInfo> e : dsxExchangeInfo.getPairs().entrySet()) { String marketName = e.getKey(); CurrencyPair pair = adaptCurrencyPair(marketName); CurrencyPairMetaData marketMetaData = toMarketMetaData(e.getValue()); currencyPairs.put(pair, marketMetaData); addCurrencyMetaData(pair.base, currencies, dsxMetaData); addCurrencyMetaData(pair.counter, currencies, dsxMetaData); } } RateLimit[] publicRateLimits = new RateLimit[] {new RateLimit(dsxMetaData.publicInfoCacheSeconds, 1, TimeUnit.SECONDS)}; return new ExchangeMetaData(currencyPairs, currencies, publicRateLimits, null, false); }
public static ExchangeMetaData adaptMetadata(List<CoinbeneSymbol> markets) { Map<CurrencyPair, CurrencyPairMetaData> pairMeta = new HashMap<>(); for (CoinbeneSymbol ticker : markets) { pairMeta.put( new CurrencyPair(ticker.getBaseAsset(), ticker.getQuoteAsset()), new CurrencyPairMetaData(null, ticker.getMinQuantity(), null, null, null)); } return new ExchangeMetaData(pairMeta, null, null, null, null); } }
public static ExchangeMetaData adaptToExchangeMetaData( ExchangeMetaData exchangeMetaData, List<CCEXMarket> products) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(); Map<CurrencyPair, CurrencyPairMetaData> existingCurrencyPairMetadata = exchangeMetaData.getCurrencyPairs(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (CCEXMarket product : products) { BigDecimal minSize = product.getMinTradeSize(); CurrencyPair pair = adaptCurrencyPair(product); CurrencyPairMetaData existingMetaForPair = existingCurrencyPairMetadata.get(pair); FeeTier[] existingFeeTiers = null; if (existingMetaForPair != null) { existingFeeTiers = existingMetaForPair.getFeeTiers(); } CurrencyPairMetaData cpmd = new CurrencyPairMetaData(null, minSize, null, 0, existingFeeTiers); currencyPairs.put(pair, cpmd); currencies.put(pair.base, null); currencies.put(pair.counter, null); } return new ExchangeMetaData(currencyPairs, currencies, null, null, true); }
public static ExchangeMetaData adaptToExchangeMetaData( List<BleutradeCurrency> bleutradeCurrencies, List<BleutradeMarket> bleutradeMarkets) { Map<CurrencyPair, CurrencyPairMetaData> marketMetaDataMap = new HashMap<>(); Map<Currency, CurrencyMetaData> currencyMetaDataMap = new HashMap<>(); for (BleutradeCurrency bleutradeCurrency : bleutradeCurrencies) { // the getTxFee parameter is the withdrawal charge in the currency in question currencyMetaDataMap.put( Currency.getInstance(bleutradeCurrency.getCurrency()), new CurrencyMetaData(8, null)); } // https://bleutrade.com/help/fees_and_deadlines 11/25/2015 all == 0.25% BigDecimal txFee = new BigDecimal("0.0025"); for (BleutradeMarket bleutradeMarket : bleutradeMarkets) { CurrencyPair currencyPair = CurrencyPairDeserializer.getCurrencyPairFromString(bleutradeMarket.getMarketName()); CurrencyPairMetaData marketMetaData = new CurrencyPairMetaData(txFee, bleutradeMarket.getMinTradeSize(), null, 8, null); marketMetaDataMap.put(currencyPair, marketMetaData); } return new ExchangeMetaData(marketMetaDataMap, currencyMetaDataMap, null, null, null); }
public static ExchangeMetaData toMetaData( WexExchangeInfo wexExchangeInfo, WexMetaData wexMetaData) { // Initialize with the static meta-data Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>(wexMetaData.getCurrencyPairs()); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(wexMetaData.getCurrencies()); // Override entries if relevant real-time exchange data is provided if (wexExchangeInfo != null) { for (Entry<String, WexPairInfo> e : wexExchangeInfo.getPairs().entrySet()) { CurrencyPair pair = adaptCurrencyPair(e.getKey()); CurrencyPairMetaData marketMetaData = toMarketMetaData(e.getValue(), wexMetaData); currencyPairs.put(pair, marketMetaData); addCurrencyMetaData(pair.base, currencies, wexMetaData); addCurrencyMetaData(pair.counter, currencies, wexMetaData); } } RateLimit[] publicRateLimits = new RateLimit[] {new RateLimit(wexMetaData.publicInfoCacheSeconds, 1, TimeUnit.SECONDS)}; return new ExchangeMetaData(currencyPairs, currencies, publicRateLimits, null, false); }
public final ExchangeMetaData getExchangeMetaData() { ReturnCurrenciesResponse allCurrenciesStatic = null; try { allCurrenciesStatic = allCurrenciesStatic(); } catch (IOException e) { e.printStackTrace(); } LinkedHashMap<CurrencyPair, CurrencyPairMetaData> currencyPairs = new LinkedHashMap<>(); ReturnTickerRequestedWithNull allTickers = IdexMarketDataService.Companion.allTickers; allTickers .keySet() .forEach( s -> currencyPairs.put(IdexExchange.Companion.getCurrencyPair(s), unavailableCPMeta)); LinkedHashMap<Currency, CurrencyMetaData> linkedHashMap = new LinkedHashMap<>(); allCurrenciesStatic.forEach( (key, value) -> linkedHashMap.put( Currency.getInstance(key), new IdexCurrencyMeta( 0, ZERO, value.getAddress(), value.getName(), value.getDecimals()))); RateLimit[] publicRateLimits = {}; return new ExchangeMetaData( currencyPairs, linkedHashMap, publicRateLimits, publicRateLimits, Boolean.FALSE); }
public static ExchangeMetaData adaptToExchangeMetaData( ExchangeMetaData exchangeMetaData, List<LivecoinRestriction> products) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies(); for (LivecoinRestriction product : products) { BigDecimal minSize = product.getMinLimitQuantity() == null ? BigDecimal.ZERO : product.getMinLimitQuantity(); minSize = minSize.setScale(product.getPriceScale(), BigDecimal.ROUND_UNNECESSARY); CurrencyPair pair = adaptCurrencyPair(product); CurrencyPairMetaData staticMetaData = exchangeMetaData.getCurrencyPairs().get(pair); int priceScale = staticMetaData == null ? 8 : staticMetaData.getPriceScale(); if (currencyPairs.containsKey(pair)) { CurrencyPairMetaData existing = currencyPairs.get(pair); currencyPairs.put( pair, new CurrencyPairMetaData( existing.getTradingFee(), minSize, existing.getMaximumAmount(), priceScale, existing.getFeeTiers())); } else { currencyPairs.put(pair, new CurrencyPairMetaData(null, minSize, null, priceScale, null)); } if (!currencies.containsKey(pair.base)) currencies.put(pair.base, null); if (!currencies.containsKey(pair.counter)) currencies.put(pair.counter, null); } return new ExchangeMetaData(currencyPairs, currencies, null, null, true); }
public static ExchangeMetaData adaptToExchangeMetaData( List<HitbtcSymbol> symbols, Map<Currency, CurrencyMetaData> currencies, Map<CurrencyPair, CurrencyPairMetaData> currencyPairs) { if (symbols != null) { for (HitbtcSymbol symbol : symbols) { CurrencyPair pair = adaptSymbol(symbol); BigDecimal tickSize = symbol.getTickSize(); int priceScale = tickSize.scale(); // not 100% sure this is correct BigDecimal tradingFee = symbol.getTakeLiquidityRate(); BigDecimal minimumAmount = symbol.getQuantityIncrement(); BigDecimal maximumAmount = null; FeeTier[] feeTiers = null; if (currencyPairs.containsKey(pair)) { CurrencyPairMetaData existing = currencyPairs.get(pair); minimumAmount = existing.getMinimumAmount(); maximumAmount = existing.getMaximumAmount(); feeTiers = existing.getFeeTiers(); } CurrencyPairMetaData meta = new CurrencyPairMetaData( tradingFee, minimumAmount, maximumAmount, priceScale, feeTiers); currencyPairs.put(pair, meta); } } return new ExchangeMetaData(currencyPairs, currencies, null, null, null); }
static ExchangeMetaData adaptToExchangeMetaData( HuobiAssetPair[] assetPairs, HuobiAsset[] assets, ExchangeMetaData staticMetaData) { HuobiUtils.setHuobiAssets(assets); HuobiUtils.setHuobiAssetPairs(assetPairs); Map<CurrencyPair, CurrencyPairMetaData> pairsMetaData = staticMetaData.getCurrencyPairs(); Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>(); for (HuobiAssetPair assetPair : assetPairs) { CurrencyPair pair = adaptCurrencyPair(assetPair.getKey()); pairs.put(pair, adaptPair(assetPair, pairsMetaData.getOrDefault(pair, null))); } Map<Currency, CurrencyMetaData> currenciesMetaData = staticMetaData.getCurrencies(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (HuobiAsset asset : assets) { Currency currency = adaptCurrency(asset.getAsset()); CurrencyMetaData metadata = currenciesMetaData.getOrDefault(currency, null); BigDecimal withdrawalFee = metadata == null ? null : metadata.getWithdrawalFee(); int scale = metadata == null ? 8 : metadata.getScale(); currencies.put(currency, new CurrencyMetaData(scale, withdrawalFee)); } return new ExchangeMetaData(pairs, currencies, null, null, false); }
public static ExchangeMetaData adaptToExchangeMetaData( ExchangeMetaData exchangeMetaData, CoinbaseProProduct[] products) { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies(); for (CoinbaseProProduct product : products) { BigDecimal minSize = product.getBaseMinSize(); BigDecimal maxSize = product.getBaseMaxSize(); CurrencyPair pair = adaptCurrencyPair(product); CurrencyPairMetaData staticMetaData = exchangeMetaData.getCurrencyPairs().get(pair); int priceScale = numberOfDecimals(product.getQuoteIncrement()); CurrencyPairMetaData cpmd = new CurrencyPairMetaData( null, minSize, maxSize, priceScale, staticMetaData != null ? staticMetaData.getFeeTiers() : null); currencyPairs.put(pair, cpmd); if (!currencies.containsKey(pair.base)) currencies.put(pair.base, null); if (!currencies.containsKey(pair.counter)) currencies.put(pair.counter, null); } return new ExchangeMetaData( currencyPairs, currencies, exchangeMetaData.getPublicRateLimits(), exchangeMetaData.getPrivateRateLimits(), true); }
public static ExchangeMetaData adaptToExchangeMetaData( List<CryptopiaCurrency> cryptopiaCurrencies, List<CryptopiaTradePair> tradePairs) { Map<CurrencyPair, CurrencyPairMetaData> marketMetaDataMap = new HashMap<>(); Map<Currency, CurrencyMetaData> currencyMetaDataMap = new HashMap<>(); for (CryptopiaCurrency cryptopiaCurrency : cryptopiaCurrencies) { currencyMetaDataMap.put( Currency.getInstance(cryptopiaCurrency.getSymbol()), new CurrencyMetaData(8, null)); } for (CryptopiaTradePair cryptopiaTradePair : tradePairs) { CurrencyPair currencyPair = CurrencyPairDeserializer.getCurrencyPairFromString(cryptopiaTradePair.getLabel()); CurrencyPairMetaData currencyPairMetaData = new CurrencyPairMetaData( cryptopiaTradePair.getTradeFee(), cryptopiaTradePair.getMinimumTrade(), cryptopiaTradePair.getMaximumTrade(), 8, null); marketMetaDataMap.put(currencyPair, currencyPairMetaData); } return new ExchangeMetaData(marketMetaDataMap, currencyMetaDataMap, null, null, null); } }
public static ExchangeMetaData adaptMetaData( ExchangeMetaData exchangeMetaData, BitcoinChartsTicker[] tickers) { Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>(); for (BitcoinChartsTicker ticker : tickers) { BigDecimal anyPrice = firstNonNull( ticker.getAsk(), ticker.getBid(), ticker.getClose(), ticker.getHigh(), ticker.getHigh()); int scale = anyPrice != null ? anyPrice.scale() : 0; pairs.put( new CurrencyPair(Currency.BTC, Currency.getInstance(ticker.getSymbol())), new CurrencyPairMetaData(null, null, null, scale, null)); } return new ExchangeMetaData( pairs, exchangeMetaData.getCurrencies(), exchangeMetaData.getPublicRateLimits(), exchangeMetaData.getPrivateRateLimits(), exchangeMetaData.isShareRateLimits()); }