use of org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair in project XChange by knowm.
the class KrakenExchangeSymbolsDemo method raw.
private static void raw(Exchange krakenExchange) throws IOException {
// Interested in the public market data feed (no authentication)
KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
KrakenAssetPairs krakenAssetPairs = krakenMarketDataService.getKrakenAssetPairs();
for (Entry<String, KrakenAssetPair> assetPairEntry : krakenAssetPairs.getAssetPairMap().entrySet()) {
System.out.println(assetPairEntry.getKey() + ": " + assetPairEntry.getValue());
}
}
use of org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair 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());
}
use of org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair in project XChange by knowm.
the class KrakenUtils method setKrakenAssetPairs.
public static void setKrakenAssetPairs(Map<String, KrakenAssetPair> pairs) {
if (assetPairMap.isEmpty()) {
for (Map.Entry<String, KrakenAssetPair> entry : pairs.entrySet()) {
// skip dark markets!
if (!entry.getKey().endsWith(".d")) {
CurrencyPair pair = new CurrencyPair(translateKrakenCurrencyCode(entry.getValue().getBase()), translateKrakenCurrencyCode(entry.getValue().getQuote()));
assetPairMap.put(entry.getKey(), pair);
assetPairMapReverse.put(pair, entry.getKey());
}
}
}
}
use of org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair in project XChange by knowm.
the class KrakenBaseService method getAssetPairScale.
protected int getAssetPairScale(Instrument instrument) throws IOException {
// get decimal precision scale
CurrencyPair cp = (CurrencyPair) instrument;
Map<String, KrakenAssetPair> assetPairMap = kraken.getAssetPairs(cp.toString()).getResult();
KrakenAssetPair assetPair = assetPairMap.get(cp.toString());
int scale = assetPair.getPairScale();
return scale;
}
Aggregations