Search in sources :

Example 1 with StreamingTradeService

use of info.bitrich.xchangestream.core.StreamingTradeService in project XChange by knowm.

the class CoinjarUserTradesExample method runTest.

@Test
public void runTest() {
    ExchangeSpecification defaultExchangeSpecification = new ExchangeSpecification(CoinjarStreamingExchange.class);
    AuthUtils.setApiAndSecretKey(defaultExchangeSpecification);
    if (defaultExchangeSpecification.getApiKey() != null) {
        StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(defaultExchangeSpecification);
        exchange.connect().blockingAwait();
        StreamingTradeService streamingTradeService = exchange.getStreamingTradeService();
        Disposable disposable = streamingTradeService.getUserTrades(null).test().awaitCount(1, BaseTestConsumer.TestWaitStrategy.SLEEP_100MS, 1000 * 60 * 10).assertNoErrors();
        disposable.dispose();
    }
}
Also used : Disposable(io.reactivex.disposables.Disposable) StreamingExchange(info.bitrich.xchangestream.core.StreamingExchange) StreamingTradeService(info.bitrich.xchangestream.core.StreamingTradeService) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) Test(org.junit.Test)

Example 2 with StreamingTradeService

use of info.bitrich.xchangestream.core.StreamingTradeService in project XChange by knowm.

the class CoinjarOrderChangesExample method runTest.

@Test
public void runTest() {
    ExchangeSpecification defaultExchangeSpecification = new ExchangeSpecification(CoinjarStreamingExchange.class);
    AuthUtils.setApiAndSecretKey(defaultExchangeSpecification);
    if (defaultExchangeSpecification.getApiKey() != null) {
        StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(defaultExchangeSpecification);
        exchange.connect().blockingAwait();
        StreamingTradeService streamingTradeService = exchange.getStreamingTradeService();
        Disposable disposable = streamingTradeService.getOrderChanges(null).test().awaitCount(10, BaseTestConsumer.TestWaitStrategy.SLEEP_100MS, 1000 * 60 * 10).assertNoErrors();
        disposable.dispose();
    }
}
Also used : Disposable(io.reactivex.disposables.Disposable) StreamingExchange(info.bitrich.xchangestream.core.StreamingExchange) StreamingTradeService(info.bitrich.xchangestream.core.StreamingTradeService) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) Test(org.junit.Test)

Aggregations

StreamingExchange (info.bitrich.xchangestream.core.StreamingExchange)2 StreamingTradeService (info.bitrich.xchangestream.core.StreamingTradeService)2 Disposable (io.reactivex.disposables.Disposable)2 Test (org.junit.Test)2 ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)2