Search in sources :

Example 1 with KrakenMarketDataServiceRaw

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()));
}
Also used : KrakenDepth(org.knowm.xchange.kraken.dto.marketdata.KrakenDepth) KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw)

Example 2 with KrakenMarketDataServiceRaw

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());
    }
}
Also used : KrakenAssetPair(org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair) KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw) KrakenAssetPairs(org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPairs)

Example 3 with KrakenMarketDataServiceRaw

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());
}
Also used : KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw) KrakenPublicTrades(org.knowm.xchange.kraken.dto.marketdata.KrakenPublicTrades)

Example 4 with KrakenMarketDataServiceRaw

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());
}
Also used : KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw) KrakenAssetPairs(org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPairs) KrakenAssets(org.knowm.xchange.kraken.dto.marketdata.KrakenAssets)

Example 5 with KrakenMarketDataServiceRaw

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);
}
Also used : KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange) KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw) KrakenSpreads(org.knowm.xchange.kraken.dto.marketdata.KrakenSpreads) KrakenAssets(org.knowm.xchange.kraken.dto.marketdata.KrakenAssets) KrakenServerTime(org.knowm.xchange.kraken.dto.marketdata.KrakenServerTime)

Aggregations

KrakenMarketDataServiceRaw (org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw)6 KrakenAssetPairs (org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPairs)2 KrakenAssets (org.knowm.xchange.kraken.dto.marketdata.KrakenAssets)2 Exchange (org.knowm.xchange.Exchange)1 KrakenExchange (org.knowm.xchange.kraken.KrakenExchange)1 KrakenAssetPair (org.knowm.xchange.kraken.dto.marketdata.KrakenAssetPair)1 KrakenDepth (org.knowm.xchange.kraken.dto.marketdata.KrakenDepth)1 KrakenPublicTrades (org.knowm.xchange.kraken.dto.marketdata.KrakenPublicTrades)1 KrakenServerTime (org.knowm.xchange.kraken.dto.marketdata.KrakenServerTime)1 KrakenSpreads (org.knowm.xchange.kraken.dto.marketdata.KrakenSpreads)1 KrakenTicker (org.knowm.xchange.kraken.dto.marketdata.KrakenTicker)1