Package com.xeiam.xchange.cryptonit.v2.dto.marketdata

Examples of com.xeiam.xchange.cryptonit.v2.dto.marketdata.CryptonitTicker


  @Override
  public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {

    // Request data
    CryptonitOrders cryptonitTrades = getCryptonitTrades(currencyPair, 1000);

    // Adapt to XChange DTOs
    return CryptonitAdapters.adaptTrades(cryptonitTrades, currencyPair);
  }
View Full Code Here


  private static void raw(CryptonitMarketDataServiceRaw marketDataService) throws IOException {

    CryptonitTicker ticker = marketDataService.getCryptonitTicker(CurrencyPair.BTC_USD);
    System.out.println(ticker);

    CryptonitOrders marketDepth = marketDataService.getCryptonitAsks(CurrencyPair.BTC_USD, 10);
    System.out.println(marketDepth);

    CryptonitOrders trades = marketDataService.getCryptonitTrades(CurrencyPair.BTC_USD, 10);
    System.out.println(trades);
  }
View Full Code Here

  }

  public CryptonitOrders getCryptonitAsks(CurrencyPair currencyPair, int limit) throws IOException {

    // Request data
    CryptonitOrders cryptonitDepth = cryptonit.getOrders(currencyPair.baseSymbol, currencyPair.counterSymbol, "placed", String.valueOf(limit));

    return cryptonitDepth;
  }
View Full Code Here

  }

  public CryptonitOrders getCryptonitBids(CurrencyPair currencyPair, int limit) throws IOException {

    // Request data
    CryptonitOrders cryptonitDepth = cryptonit.getOrders(currencyPair.counterSymbol, currencyPair.baseSymbol, "placed", String.valueOf(limit));

    return cryptonitDepth;
  }
View Full Code Here

  }

  public CryptonitOrders getCryptonitTrades(CurrencyPair currencyPair, int limit) throws IOException {

    // Request data
    CryptonitOrders cryptonitTrades = cryptonit.getOrders(currencyPair.baseSymbol, currencyPair.counterSymbol, "filled", String.valueOf(limit));

    return cryptonitTrades;
  }
View Full Code Here

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

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

    List<LimitOrder> asks = CryptonitAdapters.adaptOrders(cryptonitTrades, CurrencyPair.BTC_USD, "ask", "");

    // Verify all fields filled
    assertEquals(new BigDecimal("604.449"), asks.get(0).getLimitPrice().stripTrailingZeros());
View Full Code Here

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

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

    Trades trades = CryptonitAdapters.adaptTrades(cryptonitTrades, CurrencyPair.BTC_USD);
    assertThat(trades.getTrades().size()).isEqualTo(100);

    // Verify all fields filled
View Full Code Here

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

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

    // Verify that the example data was unmarshalled correctly
    assertThat(cryptonitDepth.getOrder(60751).getAskAmount()).isEqualTo(new BigDecimal("8.74000000"));
  }
View Full Code Here

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

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

    // Verify that the example data was unmarshalled correctly
    assertThat(cryptonitTrades.getOrder(268129).getAskAmount()).isEqualTo(new BigDecimal("703.56367800"));
  }
View Full Code Here

   * @param cryptonitTicker
   * @return
   */
  public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) {

    CryptonitRate rate = cryptonitTicker.getRate();

    BigDecimal last = rate.getLast();
    BigDecimal high = rate.getHigh();
    BigDecimal low = rate.getLow();
    BigDecimal bid = rate.getBid();
    BigDecimal ask = rate.getAsk();
    BigDecimal volume = cryptonitTicker.getVolume().getVolume(currencyPair.baseSymbol);

    return new Ticker.Builder().currencyPair(currencyPair).last(last).high(high).low(low).bid(bid).ask(ask).volume(volume).build();
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.cryptonit.v2.dto.marketdata.CryptonitTicker

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.