package org.knowm.xchange.btctrade; import org.knowm.xchange.BaseExchange; import org.knowm.xchange.Exchange; import org.knowm.xchange.ExchangeSpecification; import org.knowm.xchange.btctrade.service.BTCTradeAccountService; import org.knowm.xchange.btctrade.service.BTCTradeMarketDataService; import org.knowm.xchange.btctrade.service.BTCTradeTradeService; import org.knowm.xchange.utils.nonce.CurrentNanosecondTimeIncrementalNonceFactory; import si.mazi.rescu.SynchronizedValueFactory; public class BTCTradeExchange extends BaseExchange implements Exchange { private SynchronizedValueFactory<Long> nonceFactory = new CurrentNanosecondTimeIncrementalNonceFactory(); @Override protected void initServices() { this.marketDataService = new BTCTradeMarketDataService(this); if (exchangeSpecification.getApiKey() != null) { this.accountService = new BTCTradeAccountService(this); this.tradeService = new BTCTradeTradeService(this); } } @Override public ExchangeSpecification getDefaultExchangeSpecification() { ExchangeSpecification exchangeSpecification = new ExchangeSpecification(getClass()); exchangeSpecification.setSslUri("https://www.btctrade.com/api"); exchangeSpecification.setHost("www.btctrade.com"); exchangeSpecification.setExchangeName("BTCTrade"); return exchangeSpecification; } @Override public SynchronizedValueFactory<Long> getNonceFactory() { return nonceFactory; } }