org.knowm.xchange.livecoin.LivecoinExchange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-livecoin Show documentation
Show all versions of xchange-livecoin Show documentation
A convenient way to buy and sell Bitcoin
package org.knowm.xchange.livecoin;
import java.io.IOException;
import java.util.List;
import org.knowm.xchange.BaseExchange;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.livecoin.dto.LivecoinException;
import org.knowm.xchange.livecoin.dto.marketdata.LivecoinRestriction;
import org.knowm.xchange.livecoin.service.LivecoinAccountService;
import org.knowm.xchange.livecoin.service.LivecoinMarketDataService;
import org.knowm.xchange.livecoin.service.LivecoinMarketDataServiceRaw;
import org.knowm.xchange.livecoin.service.LivecoinTradeService;
import org.knowm.xchange.utils.nonce.CurrentTimeNonceFactory;
import si.mazi.rescu.SynchronizedValueFactory;
public class LivecoinExchange extends BaseExchange implements Exchange {
private SynchronizedValueFactory nonceFactory = new CurrentTimeNonceFactory();
@Override
public SynchronizedValueFactory getNonceFactory() {
return nonceFactory;
}
@Override
public ExchangeSpecification getDefaultExchangeSpecification() {
ExchangeSpecification exchangeSpecification =
new ExchangeSpecification(this.getClass().getCanonicalName());
exchangeSpecification.setSslUri("https://api.livecoin.net");
exchangeSpecification.setHost("api.livecoin.net");
exchangeSpecification.setExchangeName("Livecoin");
exchangeSpecification.setExchangeDescription(
"Livecoin - A convenient way to buy and sell Bitcoin");
return exchangeSpecification;
}
@Override
protected void initServices() {
this.marketDataService = new LivecoinMarketDataService(this);
this.accountService = new LivecoinAccountService(this);
this.tradeService = new LivecoinTradeService(this);
}
@Override
public void remoteInit() throws IOException {
try {
List products =
((LivecoinMarketDataServiceRaw) marketDataService).getRestrictions();
exchangeMetaData = LivecoinAdapters.adaptToExchangeMetaData(exchangeMetaData, products);
} catch (LivecoinException e) {
throw LivecoinErrorAdapter.adapt(e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy