private static CurrencyPairMetaData adaptCurrencyPairMetaData(BxAssetPair assetPair) { return new CurrencyPairMetaData(null, assetPair.getPrimaryMin(), null, 0, null); }
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); } }
private static CurrencyPairMetaData adaptCurrencyPairMetadata( KucoinTicker tick, KucoinCoin coin) { // trading scale is determined by the base currency's trade precision return new CurrencyPairMetaData(tick.getFeeRate(), null, null, coin.getTradePrecision(), 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); }
private static CurrencyPairMetaData adaptPair( HuobiAssetPair pair, CurrencyPairMetaData metadata) { BigDecimal minQty = metadata == null ? null : metadata.getMinimumAmount().setScale(Integer.parseInt(pair.getAmountPrecision())); FeeTier[] feeTiers = metadata == null ? null : metadata.getFeeTiers(); return new CurrencyPairMetaData( fee, minQty, // Min amount null, // Max amount new Integer(pair.getPricePrecision()), // Price scale feeTiers); }
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); }
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<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 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 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( 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); }
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 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 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; }
@Override public void remoteInit() { Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs(); CoindirectMarketDataService coindirectMarketDataService = (CoindirectMarketDataService) marketDataService; try { List<CoindirectMarket> coindirectMarketList = coindirectMarketDataService.getCoindirectMarkets(1000); for (CoindirectMarket market : coindirectMarketList) { CurrencyPair currencyPair = CoindirectAdapters.toCurrencyPair(market.symbol); CurrencyPairMetaData staticMeta = currencyPairs.get(currencyPair); CurrencyPairMetaData adaptedMeta = new CurrencyPairMetaData( staticMeta.getTradingFee(), market.minimumQuantity, market.maximumQuantity, staticMeta.getPriceScale(), staticMeta.getFeeTiers()); currencyPairs.put(currencyPair, adaptedMeta); } } catch (IOException exception) { } } }
public static CurrencyPairMetaData toMarketMetaData(WexPairInfo info, WexMetaData wexMetaData) { int priceScale = info.getDecimals(); BigDecimal minimumAmount = withScale(info.getMinAmount(), wexMetaData.amountScale); BigDecimal feeFraction = info.getFee().movePointLeft(2); return new CurrencyPairMetaData(feeFraction, minimumAmount, null, priceScale, null); }
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()); }
public static CurrencyPairMetaData toMarketMetaData(DSXPairInfo info) { int priceScale = info.getDecimalsPrice(); BigDecimal minimumAmount = withScale(info.getMinAmount(), info.getDecimalVolume()); BigDecimal maximumAmount = withScale(info.getMaxPrice(), info.getDecimalVolume()); BigDecimal feeFraction = info.getFee().movePointLeft(2); return new CurrencyPairMetaData(feeFraction, minimumAmount, maximumAmount, priceScale, null); }