@Override public String toString() { return "BinanceCurrencyPairMetaData{" + "minNotional=" + minNotional + "} " + super.toString(); } }
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( List<CurrencyPair> currencyPairs, ExchangeMetaData metaData) { Map<CurrencyPair, CurrencyPairMetaData> pairsMap = metaData.getCurrencyPairs(); Map<Currency, CurrencyMetaData> currenciesMap = metaData.getCurrencies(); for (CurrencyPair c : currencyPairs) { if (!pairsMap.containsKey(c)) { pairsMap.put(c, null); } if (!currenciesMap.containsKey(c.base)) { currenciesMap.put(c.base, null); } if (!currenciesMap.containsKey(c.counter)) { currenciesMap.put(c.counter, null); } } return metaData; }
@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) { } } }
private static CurrencyPairMetaData adaptCurrencyPairMetaData(BxAssetPair assetPair) { return new CurrencyPairMetaData(null, assetPair.getPrimaryMin(), null, 0, null); }
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; }
public void verifyOrder(LimitOrder limitOrder) { ExchangeMetaData exchangeMetaData = exchange.getExchangeMetaData(); verifyOrder(limitOrder, exchangeMetaData); BigDecimal price = limitOrder.getLimitPrice().stripTrailingZeros(); if (price.scale() > exchangeMetaData.getCurrencyPairs().get(limitOrder.getCurrencyPair()).getPriceScale()) { throw new IllegalArgumentException("Unsupported price scale " + price.scale()); } }
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 CoinfloorTradeService(Exchange exchange) { super(exchange); allConfiguredCurrencyPairs = exchange.getExchangeMetaData().getCurrencyPairs().keySet(); }
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; }
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 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); }
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)); } }
/** * Constructor * * @param exchange */ public GeminiAccountServiceRaw(Exchange exchange) { super(exchange); this.allCurrencyPairs = new ArrayList<CurrencyPair>(exchange.getExchangeMetaData().getCurrencyPairs().keySet()); }
private static CurrencyMetaData adaptCurrencyMetadata(KucoinCoin coin) { return new CurrencyMetaData(coin.getTradePrecision(), coin.getWithdrawMinFee()); }
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 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 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 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); }
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); }