use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class IdexExchange method getExchangeMetaData.
@Override
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);
}
use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class BityAdapters method adaptMetaData.
public static ExchangeMetaData adaptMetaData(List<BityPair> rawSymbols, ExchangeMetaData metaData) {
List<CurrencyPair> currencyPairs = BityAdapters.adaptCurrencyPairs(rawSymbols);
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;
}
use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class HitbtcExchange method remoteInit.
@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);
}
use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class CoinbaseProAdapters method adaptToExchangeMetaData.
public static ExchangeMetaData adaptToExchangeMetaData(ExchangeMetaData exchangeMetaData, CoinbaseProProduct[] products, CoinbaseProCurrency[] cbCurrencies) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData == null ? new HashMap<>() : exchangeMetaData.getCurrencyPairs();
Map<Currency, CurrencyMetaData> currencies = exchangeMetaData == null ? new HashMap<>() : exchangeMetaData.getCurrencies();
for (CoinbaseProProduct product : products) {
if (!"online".equals(product.getStatus())) {
continue;
}
CurrencyPair pair = adaptCurrencyPair(product);
CurrencyPairMetaData staticMetaData = currencyPairs.get(pair);
int baseScale = numberOfDecimals(product.getBaseIncrement());
int priceScale = numberOfDecimals(product.getQuoteIncrement());
boolean marketOrderAllowed = !product.isLimitOnly();
currencyPairs.put(pair, new CurrencyPairMetaData(// Trading fee at Coinbase is 0.5 %
new BigDecimal("0.50"), product.getBaseMinSize(), product.getBaseMaxSize(), product.getMinMarketFunds(), product.getMaxMarketFunds(), baseScale, priceScale, null, staticMetaData != null ? staticMetaData.getFeeTiers() : null, null, pair.counter, marketOrderAllowed));
}
Arrays.stream(cbCurrencies).forEach(currency -> currencies.put(adaptCurrency(currency), new CurrencyMetaData(numberOfDecimals(currency.getMaxPrecision()), BigDecimal.ZERO, currency.getDetails().getMinWithdrawalAmount(), "online".equals(currency.getStatus()) ? WalletHealth.ONLINE : WalletHealth.OFFLINE)));
return new ExchangeMetaData(currencyPairs, currencies, exchangeMetaData == null ? null : exchangeMetaData.getPublicRateLimits(), exchangeMetaData == null ? null : exchangeMetaData.getPrivateRateLimits(), true);
}
use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class FtxAdapters method adaptExchangeMetaData.
public static ExchangeMetaData adaptExchangeMetaData(FtxMarketsDto marketsDto) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>();
Map<Currency, CurrencyMetaData> currency = new HashMap<>();
marketsDto.getMarketList().forEach(ftxMarketDto -> {
CurrencyPairMetaData currencyPairMetaData = new CurrencyPairMetaData.Builder().amountStepSize(ftxMarketDto.getPriceIncrement()).minimumAmount(ftxMarketDto.getSizeIncrement()).priceScale(ftxMarketDto.getPriceIncrement().scale()).baseScale(ftxMarketDto.getSizeIncrement().scale()).build();
if ("spot".equals(ftxMarketDto.getType())) {
CurrencyPair currencyPair = new CurrencyPair(ftxMarketDto.getBaseCurrency(), ftxMarketDto.getQuoteCurrency());
currencyPairs.put(currencyPair, currencyPairMetaData);
if (!currency.containsKey(currencyPair.base)) {
currency.put(currencyPair.base, new CurrencyMetaData(ftxMarketDto.getSizeIncrement().scale(), BigDecimal.ZERO));
}
if (!currency.containsKey(currencyPair.counter)) {
currency.put(currencyPair.counter, new CurrencyMetaData(ftxMarketDto.getPriceIncrement().scale(), BigDecimal.ZERO));
}
} else if ("future".equals(ftxMarketDto.getType()) && ftxMarketDto.getName().contains("-")) {
CurrencyPair futuresContract = new CurrencyPair(ftxMarketDto.getName());
currencyPairs.put(futuresContract, currencyPairMetaData);
}
});
RateLimit[] rateLimits = { new RateLimit(30, 1, TimeUnit.SECONDS) };
return new ExchangeMetaData(currencyPairs, currency, rateLimits, rateLimits, true);
}
Aggregations