package info.bitrich.xchangestream.coinmate.v2;

import info.bitrich.xchangestream.core.StreamingExchange;
import info.bitrich.xchangestream.core.StreamingExchangeFactory;
import io.reactivex.disposables.Disposable;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.coinmate.Coinmate;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.currency.CurrencyPair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CoinmateManualExample {
  private static final Logger LOG = LoggerFactory.getLogger(CoinmateStreamingExchange.class);

  public static void main(String[] args) {

    ExchangeSpecification exSpec = new CoinmateStreamingExchange().getDefaultExchangeSpecification();
    exSpec.setUserName("2985");
    exSpec.setApiKey("WRBBKkKPp43ST5yeUhfsba1E2ZikE8afQDSxDLCKSXg");
    exSpec.setSecretKey("wyhudaS7irE3MXTRR8F9FSxt6QKo0-Wn8GQSvgLiCXk");
    StreamingExchange exchange =
        StreamingExchangeFactory.INSTANCE.createExchange(exSpec);
    exchange.connect().blockingAwait();

//    exchange
//        .getStreamingMarketDataService()
//        .getOrderBook(CurrencyPair.BTC_EUR)
//        .subscribe(
//            orderBook -> {
//              LOG.info("Ask: {}", orderBook.getAsks().get(0));
//              LOG.info("Bid: {}", orderBook.getBids().get(0));
//            });

            Disposable subscribe =
     exchange.getStreamingAccountService().getBalanceChanges(Currency.BTC).subscribe(trade -> {
                LOG.info("Trade {}", trade);
            });

    //        Disposable subscribe =
    // exchange.getStreamingMarketDataService().getTrades(CurrencyPair.BTC_USD).subscribe(trade -> {
    //            LOG.info("Trade {}", trade);
    //        });

    //        subscribe.dispose();

    //        exchange.disconnect().subscribe(() -> LOG.info("Disconnected from the Exchange"));

    try {
      Thread.sleep(100000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
}

@@ -176,179 +176,47 @@
 ort 
-io.reactivex.disposables.Disposable;%0Aimport org.knowm.xchange.ExchangeSpecification;%0Aimport org.knowm.xchange.coinmate.Coinmate;%0Aimport org.knowm.xchange.currency.Currency
+org.knowm.xchange.ExchangeSpecification
 ;%0Aim
@@ -601,181 +601,8 @@
 ();%0A
-    exSpec.setUserName(%222985%22);%0A    exSpec.setApiKey(%22WRBBKkKPp43ST5yeUhfsba1E2ZikE8afQDSxDLCKSXg%22);%0A    exSpec.setSecretKey(%22wyhudaS7irE3MXTRR8F9FSxt6QKo0-Wn8GQSvgLiCXk%22);%0A
     
@@ -737,18 +737,16 @@
 ait();%0A%0A
-//
     exch
@@ -750,18 +750,16 @@
 xchange%0A
-//
         
@@ -791,18 +791,16 @@
 rvice()%0A
-//
         
@@ -835,18 +835,16 @@
 TC_EUR)%0A
-//
         
@@ -854,31 +854,16 @@
 bscribe(
-%0A//            
 orderBoo
@@ -869,22 +869,16 @@
 ok -%3E %7B%0A
-//    
         
@@ -920,36 +920,32 @@
 Asks().get(0));%0A
-//  
             LOG.
@@ -930,34 +930,32 @@
 (0));%0A          
-  
 LOG.info(%22Bid: %7B
@@ -987,22 +987,16 @@
 et(0));%0A
-//    
         
@@ -1008,249 +1008,25 @@
     
-        Disposable subscribe =%0A     exchange.getStreamingAccountService().getBalanceChanges(Currency.BTC).subscribe(trade -%3E %7B%0A                LOG.info(%22Trade %7B%7D%22, trade);%0A            %7D);%0A%0A    //        Disposable subscribe =%0A    // exchange
+exchange%0A        
 .get
@@ -1053,16 +1053,25 @@
 ervice()
+%0A        
 .getTrad
@@ -1116,24 +1116,16 @@
 de -%3E %7B%0A
-    //  
         
@@ -1163,153 +1163,13 @@
     
-//        %7D);%0A%0A    //        subscribe.dispose();%0A%0A    //        exchange.disconnect().subscribe(() -%3E LOG.info(%22Disconnected from the Exchange%22)
+    %7D
 );%0A%0A

remove commented code from manual example