private static CurrencyPairMetaData adaptPair( BitmexTicker ticker, CurrencyPairMetaData originalMeta) { if (originalMeta != null) { return new CurrencyPairMetaData( ticker.getTakerFee(), originalMeta.getMinimumAmount(), originalMeta.getMaximumAmount(), Math.max(0, ticker.getTickSize().stripTrailingZeros().scale()), originalMeta.getFeeTiers()); } else { return new CurrencyPairMetaData( ticker.getTakerFee(), null, null, Math.max(0, ticker.getTickSize().stripTrailingZeros().scale()), null); } }
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); }
private static CurrencyPairMetaData adaptPair( KrakenAssetPair krakenPair, CurrencyPairMetaData OriginalMeta) { if (OriginalMeta != null) { return new CurrencyPairMetaData( krakenPair.getFees().get(0).getPercentFee().divide(new BigDecimal(100)), OriginalMeta.getMinimumAmount(), OriginalMeta.getMaximumAmount(), krakenPair.getPairScale(), adaptFeeTiers(krakenPair.getFees_maker(), krakenPair.getFees())); } else { return new CurrencyPairMetaData( krakenPair.getFees().get(0).getPercentFee().divide(new BigDecimal(100)), null, null, krakenPair.getPairScale(), adaptFeeTiers(krakenPair.getFees_maker(), krakenPair.getFees())); } }
public static ExchangeMetaData adaptMetaData( BitfinexAccountInfosResponse[] bitfinexAccountInfos, ExchangeMetaData exchangeMetaData) { final Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); // lets go with the assumption that the trading fees are common across all trading pairs for // now. // also setting the taker_fee as the trading_fee for now. final CurrencyPairMetaData metaData = new CurrencyPairMetaData( bitfinexAccountInfos[0].getTakerFees().movePointLeft(2), null, null, null, null); currencyPairs .keySet() .parallelStream() .forEach( currencyPair -> currencyPairs.merge( currencyPair, metaData, (oldMetaData, newMetaData) -> new CurrencyPairMetaData( newMetaData.getTradingFee(), oldMetaData.getMinimumAmount(), oldMetaData.getMaximumAmount(), oldMetaData.getPriceScale(), oldMetaData.getFeeTiers()))); return exchangeMetaData; }
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); }
newMetaData.getMaximumAmount() != null ? newMetaData.getMaximumAmount() : oldMetaData.getMaximumAmount(), oldMetaData.getPriceScale(), newMetaData.getFeeTiers() != null
private static CurrencyPairMetaData adaptPair( BitmexTicker ticker, CurrencyPairMetaData originalMeta) { if (originalMeta != null) { return new CurrencyPairMetaData( ticker.getTakerFee(), originalMeta.getMinimumAmount(), originalMeta.getMaximumAmount(), Math.max(0, ticker.getTickSize().stripTrailingZeros().scale()), originalMeta.getFeeTiers()); } else { return new CurrencyPairMetaData( ticker.getTakerFee(), null, null, Math.max(0, ticker.getTickSize().stripTrailingZeros().scale()), null); } }
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); }
private static CurrencyPairMetaData adaptPair( KrakenAssetPair krakenPair, CurrencyPairMetaData OriginalMeta) { if (OriginalMeta != null) { return new CurrencyPairMetaData( krakenPair.getFees().get(0).getPercentFee().divide(new BigDecimal(100)), OriginalMeta.getMinimumAmount(), OriginalMeta.getMaximumAmount(), krakenPair.getPairScale(), adaptFeeTiers(krakenPair.getFees_maker(), krakenPair.getFees())); } else { return new CurrencyPairMetaData( krakenPair.getFees().get(0).getPercentFee().divide(new BigDecimal(100)), null, null, krakenPair.getPairScale(), adaptFeeTiers(krakenPair.getFees_maker(), krakenPair.getFees())); } }
public static ExchangeMetaData adaptMetaData( BitfinexAccountInfosResponse[] bitfinexAccountInfos, ExchangeMetaData exchangeMetaData) { final Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); // lets go with the assumption that the trading fees are common across all trading pairs for // now. // also setting the taker_fee as the trading_fee for now. final CurrencyPairMetaData metaData = new CurrencyPairMetaData( bitfinexAccountInfos[0].getTakerFees().movePointLeft(2), null, null, null, null); currencyPairs .keySet() .parallelStream() .forEach( currencyPair -> currencyPairs.merge( currencyPair, metaData, (oldMetaData, newMetaData) -> new CurrencyPairMetaData( newMetaData.getTradingFee(), oldMetaData.getMinimumAmount(), oldMetaData.getMaximumAmount(), oldMetaData.getPriceScale(), oldMetaData.getFeeTiers()))); return exchangeMetaData; }
newMetaData.getMaximumAmount() != null ? newMetaData.getMaximumAmount() : oldMetaData.getMaximumAmount(), oldMetaData.getPriceScale(), newMetaData.getFeeTiers() != null