public static Map<Currency, CurrencyMetaData> getCurrencies() { Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (String key : assetMap.keySet()) { currencies.put(assetMap.get(key), new CurrencyMetaData(0, null)); } return currencies; }
private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, DSXMetaData dsxMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = dsxMetaData.getCurrencies().get(symbol) == null ? null : dsxMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(dsxMetaData.amountScale, withdrawalFee)); } }
private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, WexMetaData wexMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = wexMetaData.getCurrencies().get(symbol) == null ? null : wexMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(wexMetaData.amountScale, withdrawalFee)); } }
public static ExchangeMetaData adaptMetaData( BitfinexAccountFeesResponse accountFeesResponse, ExchangeMetaData metaData) { Map<Currency, CurrencyMetaData> currencies = metaData.getCurrencies(); final Map<Currency, BigDecimal> withdrawFees = accountFeesResponse.getWithdraw(); withdrawFees.forEach( (currency, withdrawalFee) -> { CurrencyMetaData newMetaData = new CurrencyMetaData( // Currency should have at least the scale of the withdrawalFee currencies.get(currency) == null ? withdrawalFee.scale() : Math.max(withdrawalFee.scale(), currencies.get(currency).getScale()), withdrawalFee); currencies.put(currency, newMetaData); }); return metaData; }
currenciesMap.put( c.base, new CurrencyMetaData( 2, currenciesMap.put(c.counter, new CurrencyMetaData(2, null));
private static CurrencyMetaData adaptCurrencyMetadata(KucoinCoin coin) { return new CurrencyMetaData(coin.getTradePrecision(), coin.getWithdrawMinFee()); }
public void updateMetadata(ExchangeMetaData exchangeMetaData) throws IOException { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); Map<Currency, CurrencyMetaData> currencies = exchangeMetaData.getCurrencies(); Map<String, Map<String, String>> map = exmo.pairSettings(); for (String marketName : map.keySet()) { CurrencyPair currencyPair = adaptMarket(marketName); Map<String, String> data = map.get(marketName); Integer priceScale = null; BigDecimal tradingFee = null; if (currencyPairs.containsKey(currencyPair)) { priceScale = currencyPairs.get(currencyPair).getPriceScale(); tradingFee = currencyPairs.get(currencyPair).getTradingFee(); } CurrencyPairMetaData staticMeta = currencyPairs.get(currencyPair); // min_quantity or min_amount ??? CurrencyPairMetaData currencyPairMetaData = new CurrencyPairMetaData( tradingFee, new BigDecimal(data.get("min_quantity")), new BigDecimal(data.get("max_quantity")), priceScale, staticMeta != null ? staticMeta.getFeeTiers() : null); currencyPairs.put(currencyPair, currencyPairMetaData); if (!currencies.containsKey(currencyPair.base)) currencies.put(currencyPair.base, new CurrencyMetaData(8, null)); if (!currencies.containsKey(currencyPair.counter)) currencies.put(currencyPair.counter, new CurrencyMetaData(8, null)); } }
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); }
? null : originalMetaData.getCurrencies().get(currencyCode).getWithdrawalFee(); currencies.put(currencyCode, new CurrencyMetaData(krakenAsset.getScale(), withdrawalFee));
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( 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); } }
BigDecimal withdrawalFee = currencyMetaData == null ? null : currencyMetaData.getWithdrawalFee(); currencies.put(pair.base, new CurrencyMetaData(8, withdrawalFee)); currencyMetaData == null ? null : new CurrencyMetaData(8, currencyMetaData.getWithdrawalFee()); currencies.put(pair.counter, withdrawalFee);
new CurrencyMetaData( basePrecision, currencies.containsKey(pair.base) currencies.put( pair.counter, new CurrencyMetaData( counterPrecision, currencies.containsKey(pair.counter)
: originalMetaData.getCurrencies().get(quoteCurrencyCode).getWithdrawalFee(); currencies.put(baseCurrencyCode, new CurrencyMetaData(scale, baseWithdrawalFee)); currencies.put(quoteCurrencyCode, new CurrencyMetaData(scale, quoteWithdrawalFee)); BitmexPrompt prompt = contracts.inverse().get(ticker.getSymbol().replaceFirst(ticker.getRootSymbol(), ""))
Collectors.toMap( hitbtcCurrency -> new Currency(hitbtcCurrency.getId()), hitbtcCurrency -> new CurrencyMetaData(null, hitbtcCurrency.getPayoutFee())));
private static void addCurrencyMetaData(Currency symbol, Map<Currency, CurrencyMetaData> currencies, BTCEMetaData btceMetaData) { if (!currencies.containsKey(symbol)) { currencies.put(symbol, new CurrencyMetaData(btceMetaData.amountScale)); } }
private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, WexMetaData wexMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = wexMetaData.getCurrencies().get(symbol) == null ? null : wexMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(wexMetaData.amountScale, withdrawalFee)); } }
public static ExchangeMetaData adaptMetaData( BitfinexAccountFeesResponse accountFeesResponse, ExchangeMetaData metaData) { Map<Currency, CurrencyMetaData> currencies = metaData.getCurrencies(); final Map<Currency, BigDecimal> withdrawFees = accountFeesResponse.getWithdraw(); withdrawFees.forEach( (currency, withdrawalFee) -> { CurrencyMetaData newMetaData = new CurrencyMetaData( // Currency should have at least the scale of the withdrawalFee currencies.get(currency) == null ? withdrawalFee.scale() : Math.max(withdrawalFee.scale(), currencies.get(currency).getScale()), withdrawalFee); currencies.put(currency, newMetaData); }); return metaData; }
currenciesMap.put( c.base, new CurrencyMetaData( 2, currenciesMap.put(c.counter, new CurrencyMetaData(2, null));
@Override public void remoteInit() throws IOException { HitbtcMarketDataServiceRaw dataService = ((HitbtcMarketDataServiceRaw) marketDataService); List<HitbtcSymbol> hitbtcSymbols = dataService.getHitbtcSymbols(); Map<Currency, CurrencyMetaData> currencies = dataService.getHitbtcCurrencies().stream() .collect( Collectors.toMap( hitbtcCurrency -> new Currency(hitbtcCurrency.getId()), hitbtcCurrency -> new CurrencyMetaData(null, hitbtcCurrency.getPayoutFee()))); Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = hitbtcSymbols.stream() .collect( Collectors.toMap( hitbtcSymbol -> new CurrencyPair( new Currency(hitbtcSymbol.getBaseCurrency()), new Currency(hitbtcSymbol.getQuoteCurrency())), hitbtcSymbol -> new CurrencyPairMetaData( (BigDecimal) null, hitbtcSymbol.getQuantityIncrement(), (BigDecimal) null, hitbtcSymbol.getTickSize().scale(), (FeeTier[]) null))); exchangeMetaData = HitbtcAdapters.adaptToExchangeMetaData(hitbtcSymbols, currencies, currencyPairs); } }