package org.knowm.xchange.coinbene;

import java.io.IOException;
import org.knowm.xchange.BaseExchange;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.coinbene.service.CoinbeneAccountService;
import org.knowm.xchange.coinbene.service.CoinbeneMarketDataService;
import org.knowm.xchange.coinbene.service.CoinbeneTradeService;
import org.knowm.xchange.utils.nonce.CurrentTimeNonceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import si.mazi.rescu.SynchronizedValueFactory;

public class CoinbeneExchange extends BaseExchange implements Exchange {

  private static final Logger LOG = LoggerFactory.getLogger(CoinbeneExchange.class);

  private SynchronizedValueFactory<Long> nonceFactory = new CurrentTimeNonceFactory();

  @Override
  protected void initServices() {

    this.marketDataService = new CoinbeneMarketDataService(this);
    this.accountService = new CoinbeneAccountService(this);
    this.tradeService = new CoinbeneTradeService(this);
  }

  @Override
  public ExchangeSpecification getDefaultExchangeSpecification() {

    ExchangeSpecification exchangeSpecification =
        new ExchangeSpecification(this.getClass().getCanonicalName());
    exchangeSpecification.setSslUri("https://api.coinbene.com/");
    exchangeSpecification.setHost("coinbene.com");
    exchangeSpecification.setPort(80);
    exchangeSpecification.setExchangeName("Coinbene");
    exchangeSpecification.setExchangeDescription("Coinbene is a bitcoin and altcoin exchange.");

    return exchangeSpecification;
  }

  @Override
  public SynchronizedValueFactory<Long> getNonceFactory() {
    return nonceFactory;
  }

  @Override
  public void remoteInit() {

    try {
      exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata();
    } catch (IOException e) {
      LOG.error("Retrieving MetaData for Coinbene failed", e);
    }
  }
}

@@ -371,32 +371,87 @@
 neTradeService;%0A
+import org.knowm.xchange.exceptions.ExchangeException;%0A
 import org.knowm
@@ -492,24 +492,24 @@
 nceFactory;%0A
-
 import org.s
@@ -1216,16 +1216,8 @@
 on =
-%0A       
  new
@@ -1764,16 +1764,54 @@
 teInit()
+ throws IOException, ExchangeException
  %7B%0A%0A    
@@ -1944,17 +1944,29 @@
     
-LOG.error
+throw new IOException
 (%22Re

add symbols to market data throw new IOException in remoteInit