Search in sources :

Example 1 with BTCTurkOrderBook

use of org.knowm.xchange.btcturk.dto.marketdata.BTCTurkOrderBook in project XChange by knowm.

the class MarketDataFetchIntegration method Tests.

@Test
public void Tests() throws Exception, InterruptedException {
    // Ticker Test
    Thread.sleep(1000);
    Ticker ticker = btcTurkMarketDataService.getTicker(new CurrencyPair("BTC", "TRY"));
    System.out.println(ticker.toString());
    assertThat(ticker).isNotNull();
    Thread.sleep(1000);
    List<Ticker> tickers = btcTurkMarketDataService.getTickers(new Params() {
    });
    for (Ticker _ticker : tickers) {
        System.out.println(_ticker.toString());
        assertThat(_ticker).isNotNull();
    }
    Thread.sleep(1000);
    // TradesTest
    Trades trades = btcTurkMarketDataService.getTrades(CurrencyPair.BTC_TRY);
    assertThat(trades.getTrades().size()).isEqualTo(50);
    Thread.sleep(1000);
    trades = btcTurkMarketDataService.getTrades(CurrencyPair.BTC_TRY, 5);
    assertThat(trades.getTrades().size()).isEqualTo(5);
    Thread.sleep(1000);
    // OHCLTest
    List<BTCTurkOHLC> btcTurkBTCTurkOHLC = btcTurkMarketDataService.getBTCTurkOHLC(CurrencyPair.BTC_TRY);
    // Daily size is always changing
    assertThat(btcTurkBTCTurkOHLC.size()).isNotEqualTo(0);
    Thread.sleep(1000);
    List<BTCTurkOHLC> btcTurkBTCTurkOHLC2 = btcTurkMarketDataService.getBTCTurkOHLC(CurrencyPair.BTC_TRY, 2);
    assertThat(btcTurkBTCTurkOHLC2.size()).isEqualTo(2);
    // OrderBookTest
    Thread.sleep(1000);
    BTCTurkOrderBook btcTurkBTCTurkOrderBook = btcTurkMarketDataService.getBTCTurkOrderBook(CurrencyPair.BTC_TRY);
    assertThat(btcTurkBTCTurkOrderBook.getAsks().size()).isEqualTo(100);
    assertThat(btcTurkBTCTurkOrderBook.getBids().size()).isEqualTo(100);
}
Also used : Trades(org.knowm.xchange.dto.marketdata.Trades) Ticker(org.knowm.xchange.dto.marketdata.Ticker) Params(org.knowm.xchange.service.marketdata.params.Params) BTCTurkOrderBook(org.knowm.xchange.btcturk.dto.marketdata.BTCTurkOrderBook) BTCTurkOHLC(org.knowm.xchange.btcturk.dto.marketdata.BTCTurkOHLC) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) Test(org.junit.Test) BTCTurkDemoUtilsTest(org.knowm.xchange.btcturk.service.BTCTurkDemoUtilsTest)

Aggregations

Test (org.junit.Test)1 BTCTurkOHLC (org.knowm.xchange.btcturk.dto.marketdata.BTCTurkOHLC)1 BTCTurkOrderBook (org.knowm.xchange.btcturk.dto.marketdata.BTCTurkOrderBook)1 BTCTurkDemoUtilsTest (org.knowm.xchange.btcturk.service.BTCTurkDemoUtilsTest)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 Ticker (org.knowm.xchange.dto.marketdata.Ticker)1 Trades (org.knowm.xchange.dto.marketdata.Trades)1 Params (org.knowm.xchange.service.marketdata.params.Params)1