use of org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw in project XChange by knowm.
the class KrakenDepthDemo method raw.
private static void raw(Exchange krakenExchange) throws IOException {
// Interested in the public market data feed (no authentication)
KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
// Get the latest full order book data
KrakenDepth depth = krakenMarketDataService.getKrakenDepth(CurrencyPair.BTC_EUR, Long.MAX_VALUE);
System.out.println(depth.toString());
System.out.println("size: " + (depth.getAsks().size() + depth.getBids().size()));
// Get the latest partial size order book data
depth = krakenMarketDataService.getKrakenDepth(CurrencyPair.BTC_EUR, 3L);
System.out.println(depth.toString());
System.out.println("size: " + (depth.getAsks().size() + depth.getBids().size()));
}
use of org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw 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.service.KrakenMarketDataServiceRaw in project XChange by knowm.
the class KrakenTradesDemo method raw.
private static void raw(Exchange krakenExchange) throws IOException {
// Interested in the public market data feed (no authentication)
KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
// Get the latest trade data for BTC_USD
KrakenPublicTrades krakenPublicTrades = krakenMarketDataService.getKrakenTrades(CurrencyPair.BTC_USD);
long last = krakenPublicTrades.getLast();
System.out.println(krakenPublicTrades.getTrades());
System.out.println("Trades size: " + krakenPublicTrades.getTrades().size());
System.out.println("Trades(0): " + krakenPublicTrades.getTrades().get(0).toString());
System.out.println("Last: " + last);
// Poll for any new trades since last id
krakenPublicTrades = krakenMarketDataService.getKrakenTrades(CurrencyPair.LTC_USD, last);
System.out.println(krakenPublicTrades.getTrades());
System.out.println("Trades size: " + krakenPublicTrades.getTrades().size());
}
use of org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw in project XChange by knowm.
the class KrakenExchange method remoteInit.
@Override
public void remoteInit() throws IOException {
KrakenAssetPairs assetPairs = ((KrakenMarketDataServiceRaw) marketDataService).getKrakenAssetPairs();
KrakenAssets assets = ((KrakenMarketDataServiceRaw) marketDataService).getKrakenAssets();
KrakenUtils.clearAssets();
// Note: CurrencyPair Metadata will not contain accurate maker/taker fees
// Note: Currency Metadata will only contain price scale
exchangeMetaData = KrakenAdapters.adaptToExchangeMetaData(exchangeMetaData, assetPairs.getAssetPairMap(), assets.getAssetPairMap());
}
use of org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw in project XChange by knowm.
the class KrakenMarketDataRawSpecificDemo method main.
public static void main(String[] args) throws IOException {
// Use the factory to get Kraken exchange API using default settings
Exchange krakenExchange = ExchangeFactory.INSTANCE.createExchange(KrakenExchange.class);
// Interested in the public market data feed (no authentication)
KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
KrakenServerTime serverTime = krakenMarketDataService.getServerTime();
System.out.println(serverTime);
KrakenAssets assets = krakenMarketDataService.getKrakenAssets();
System.out.println(assets);
KrakenSpreads spreads = krakenMarketDataService.getKrakenSpreads(Currency.BTC, Currency.USD);
System.out.println(spreads);
}
Aggregations