Examples of BTCChinaTicker


Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

  @Override
  public synchronized Collection<CurrencyPair> getExchangeSymbols() throws IOException {

    if (currencyPairs.isEmpty()) {
      BTCChinaTicker btcChinaTicker = btcChina.getTicker(BTCChinaExchange.ALL_MARKET);
      Map<CurrencyPair, Ticker> tickers = BTCChinaAdapters.adaptTickers(btcChinaTicker);
      currencyPairs.addAll(tickers.keySet());
    }

    return currencyPairs;
View Full Code Here

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

  @Override
  public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {

    // Request data
    BTCChinaTicker btcChinaTicker = getBTCChinaTicker(BTCChinaAdapters.adaptMarket(currencyPair));

    // Adapt to XChange DTOs
    return BTCChinaAdapters.adaptTicker(btcChinaTicker, currencyPair);
  }
View Full Code Here

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

  private final ObjectMapper mapper = new ObjectMapper();

  @Test
  public void testAdaptTickers() throws IOException {

    BTCChinaTicker btcChinaTicker = mapper.readValue(getClass().getResource("dto/marketdata/ticker-all-market.json"), BTCChinaTicker.class);
    Map<CurrencyPair, Ticker> tickers = BTCChinaAdapters.adaptTickers(btcChinaTicker);
    assertEquals(3, tickers.size());

    assertEquals(new HashSet<CurrencyPair>(Arrays.asList(CurrencyPair.BTC_CNY, CurrencyPair.LTC_CNY, CurrencyPair.LTC_BTC)), tickers.keySet());
View Full Code Here

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

    // Read in the JSON from the example resources
    InputStream is = BTCChinaTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

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

    Ticker ticker = BTCChinaAdapters.adaptTicker(BTCChinaTicker, CurrencyPair.BTC_CNY);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("546.00");
View Full Code Here

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

    // Read in the JSON from the example resources
    InputStream is = BTCChinaTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

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

    // Verify that the example data was unmarshalled correctly
    assertThat(BTCChinaTicker.getTicker().getLast()).isEqualTo(new BigDecimal("546.00"));
    assertThat(BTCChinaTicker.getTicker().getHigh()).isEqualTo(new BigDecimal("547.77"));
    assertThat(BTCChinaTicker.getTicker().getLow()).isEqualTo(new BigDecimal("545.00"));
    assertThat(BTCChinaTicker.getTicker().getVol()).isEqualTo(new BigDecimal("2593.89900000"));
  }
View Full Code Here

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaTicker

  public static void raw() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    BTCChinaMarketDataServiceRaw marketDataServiceRaw = ((BTCChinaMarketDataServiceRaw) marketDataService);

    // Get the latest ticker data showing BTC to CNY
    BTCChinaTicker ticker = marketDataServiceRaw.getBTCChinaTicker("ltccny");

    System.out.println("Date: " + ticker.getTicker().getDate());

    System.out.println("Last: " + ticker.getTicker().getLast().toString());
    System.out.println("Volume: " + ticker.getTicker().getVol().toString());
    System.out.println("High: " + ticker.getTicker().getHigh().toString());
    System.out.println("Low: " + ticker.getTicker().getLow().toString());

    System.out.println("vwap: " + ticker.getTicker().getVwap());
    System.out.println("prev_close: " + ticker.getTicker().getPrevClose());
    System.out.println("open: " + ticker.getTicker().getOpen());

    Map<String, BTCChinaTickerObject> tickers = marketDataServiceRaw.getBTCChinaTickers();
    System.out.println(tickers);

    System.out.println(((BasePollingService) marketDataServiceRaw).getExchangeSymbols());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.