Package com.xeiam.xchange.dto.marketdata

Examples of com.xeiam.xchange.dto.marketdata.Ticker


    // Interested in the public market data feed (no authentication)
    PollingMarketDataService marketDataService = anx.getPollingMarketDataService();

    // Get the latest ticker data showing BTC to USD
    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
    String btcusd = ticker.getLast().toString();
    System.out.println("Current exchange rate for BTC / USD: " + btcusd);

    // Get the current orderbook
    OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
    System.out.println("Current Order Book size for BTC / USD: " + orderBook.getAsks().size() + orderBook.getBids().size());
View Full Code Here


    // Interested in the public polling market data feed (no authentication)
    PollingMarketDataService marketDataService = anx.getPollingMarketDataService();

    // Get the latest ticker data showing BTC to USD
    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());

    // Get the latest ticker data showing BTC to EUR
    ticker = marketDataService.getTicker(CurrencyPair.BTC_EUR);
    System.out.println(ticker.toString());

    // Get the latest ticker data showing BTC to GBP
    ticker = marketDataService.getTicker(CurrencyPair.BTC_GBP);
    System.out.println(ticker.toString());

  }
View Full Code Here

  private static void generic(PollingMarketDataService marketDataService) throws IOException {

    Collection<CurrencyPair> currencyPairs = marketDataService.getExchangeSymbols();
    System.out.println(currencyPairs);

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
    System.out.println(ticker);

    OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_USD);
    System.out.println(orderBook);
View Full Code Here

    // Interested in the public polling market data feed (no authentication)
    PollingMarketDataService justcoinGenericMarketDataService = justcoinExchange.getPollingMarketDataService();

    // Get the latest ticker data for the BTC/LTC market
    Ticker ticker = justcoinGenericMarketDataService.getTicker(CurrencyPair.BTC_LTC);
    System.out.println(ticker);

    // Get the latest order book data for BTC/LTC
    OrderBook orderBook = justcoinGenericMarketDataService.getOrderBook(CurrencyPair.BTC_LTC);
    System.out.println("Order book: " + orderBook);
View Full Code Here

    System.out.println(orderBook.toString());
  }

  public static void requestAndPrintLatestTicker(PollingMarketDataService marketDataService) throws IOException {

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());
  }
View Full Code Here

  public void testTickerRetrieval() throws IOException {

    bitKonanExchange.applySpecification(bitKonanExchange.getDefaultExchangeSpecification());
    BitKonanMarketDataService bitKonanMarketDataService = (BitKonanMarketDataService) bitKonanExchange.getPollingMarketDataService();

    Ticker ticker = bitKonanMarketDataService.getTicker(CurrencyPair.BTC_USD);

    System.out.println(ticker.toString());

  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    BitKonanTicker ticker = mapper.readValue(is, BitKonanTicker.class);
    Ticker adaptedTicker = BitKonanAdapters.adaptTicker(ticker, CurrencyPair.BTC_USD);

    assertThat(adaptedTicker.getAsk()).isEqualTo("609.58");
    assertThat(adaptedTicker.getBid()).isEqualTo("608.63");
    assertThat(adaptedTicker.getLow()).isEqualTo("563.4");
    assertThat(adaptedTicker.getHigh()).isEqualTo("621.81");
    assertThat(adaptedTicker.getLast()).isEqualTo("609.24");
    assertThat(adaptedTicker.getVolume()).isEqualTo("1232.17");
    assertThat(adaptedTicker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BitcoinAverageTicker BitcoinAverageTicker = mapper.readValue(is, BitcoinAverageTicker.class);

    Ticker ticker = BitcoinAverageAdapters.adaptTicker(BitcoinAverageTicker, CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());

    assertThat(ticker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
    assertThat(ticker.getLast().toString()).isEqualTo("629.45");
    assertThat(ticker.getBid().toString()).isEqualTo("628.2");
    assertThat(ticker.getAsk().toString()).isEqualTo("631.21");
    assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("118046.63"));

  }
View Full Code Here

  @Test
  public void testAdaptTicker() throws IOException {

    BTCTradeTicker btcTradeTicker = mapper.readValue(getClass().getResource("dto/marketdata/ticker.json"), BTCTradeTicker.class);
    Ticker ticker = BTCTradeAdapters.adaptTicker(btcTradeTicker, CurrencyPair.BTC_CNY);
    assertEquals(new BigDecimal("3760"), ticker.getHigh());
    assertEquals(new BigDecimal("3658"), ticker.getLow());
    assertEquals(new BigDecimal("3752"), ticker.getBid());
    assertEquals(new BigDecimal("3758"), ticker.getAsk());
    assertEquals(new BigDecimal("3757"), ticker.getLast());
    assertEquals(new BigDecimal("11009.76"), ticker.getVolume());
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    HitbtcTicker ticker = mapper.readValue(is, HitbtcTicker.class);
    Ticker adaptedTicker = HitbtcAdapters.adaptTicker(ticker, CurrencyPair.BTC_USD);

    assertThat(adaptedTicker.getAsk()).isEqualTo("609.58");
    assertThat(adaptedTicker.getBid()).isEqualTo("608.63");
    assertThat(adaptedTicker.getLow()).isEqualTo("563.4");
    assertThat(adaptedTicker.getHigh()).isEqualTo("621.81");
    assertThat(adaptedTicker.getLast()).isEqualTo("609.24");
    assertThat(adaptedTicker.getVolume()).isEqualTo("1232.17");
    assertThat(adaptedTicker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_USD);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.marketdata.Ticker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.