use of org.knowm.xchange.kraken.dto.marketdata.KrakenAsset in project XChange by knowm.
the class KrakenAdapters method adaptToExchangeMetaData.
public static ExchangeMetaData adaptToExchangeMetaData(ExchangeMetaData originalMetaData, Map<String, KrakenAssetPair> krakenPairs, Map<String, KrakenAsset> krakenAssets) {
Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>();
// add assets before pairs to Utils!
KrakenUtils.setKrakenAssets(krakenAssets);
KrakenUtils.setKrakenAssetPairs(krakenPairs);
for (String krakenPairCode : krakenPairs.keySet()) {
// skip dark markets!
if (!krakenPairCode.endsWith(".d")) {
KrakenAssetPair krakenPair = krakenPairs.get(krakenPairCode);
pairs.put(adaptCurrencyPair(krakenPairCode), adaptPair(krakenPair, pairs.get(adaptCurrencyPair(krakenPairCode))));
}
}
Map<Currency, CurrencyMetaData> currencies = new HashMap<>();
for (String krakenAssetCode : krakenAssets.keySet()) {
KrakenAsset krakenAsset = krakenAssets.get(krakenAssetCode);
Currency currencyCode = KrakenAdapters.adaptCurrency(krakenAssetCode);
currencies.put(currencyCode, new CurrencyMetaData(krakenAsset.getScale(), null));
}
return new ExchangeMetaData(pairs, currencies, originalMetaData == null ? null : originalMetaData.getPublicRateLimits(), originalMetaData == null ? null : originalMetaData.getPrivateRateLimits(), originalMetaData == null ? null : originalMetaData.isShareRateLimits());
}
Aggregations