1 package org.oxerr.peatio.rest.service.polling;
2
3 import java.io.IOException;
4 import java.util.List;
5
6 import org.oxerr.peatio.rest.Peatio;
7 import org.oxerr.peatio.rest.PeatioAdapters;
8 import org.oxerr.peatio.rest.PeatioException;
9 import org.oxerr.peatio.rest.dto.Market;
10
11 import si.mazi.rescu.RestProxyFactory;
12
13 import com.xeiam.xchange.Exchange;
14 import com.xeiam.xchange.currency.CurrencyPair;
15 import com.xeiam.xchange.service.BaseExchangeService;
16 import com.xeiam.xchange.service.polling.BasePollingService;
17 import com.xeiam.xchange.utils.Assert;
18
19
20
21
22 public class PeatioBasePollingService extends BaseExchangeService implements
23 BasePollingService {
24
25 protected final Peatio peatio;
26
27 protected PeatioBasePollingService(Exchange exchange) {
28 super(exchange);
29 String baseUrl = exchange.getExchangeSpecification().getSslUri();
30 Assert.notNull(baseUrl, "Exchange specification URI cannot be null");
31 peatio = RestProxyFactory.createProxy(Peatio.class, baseUrl);
32 }
33
34
35
36
37 @Override
38 public List<CurrencyPair> getExchangeSymbols() throws PeatioException,
39 IOException {
40 return PeatioAdapters.adaptCurrencyPairs(getMarkets());
41 }
42
43 public Market[] getMarkets() throws PeatioException, IOException {
44 return peatio.getMarkets();
45 }
46
47 }