Search in sources :

Example 1 with KrakenAsset

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());
}
Also used : CurrencyPairMetaData(org.knowm.xchange.dto.meta.CurrencyPairMetaData) KrakenAssetPair(org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair) KrakenAsset(org.knowm.xchange.kraken.dto.marketdata.KrakenAsset) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) HashMap(java.util.HashMap) ExchangeMetaData(org.knowm.xchange.dto.meta.ExchangeMetaData) Currency(org.knowm.xchange.currency.Currency) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Aggregations

HashMap (java.util.HashMap)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)1 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)1 ExchangeMetaData (org.knowm.xchange.dto.meta.ExchangeMetaData)1 KrakenAsset (org.knowm.xchange.kraken.dto.marketdata.KrakenAsset)1 KrakenAssetPair (org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair)1