View Javadoc
1   package org.oxerr.okcoin.rest.service;
2   
3   import java.io.IOException;
4   
5   import org.knowm.xchange.Exchange;
6   import org.knowm.xchange.ExchangeSpecification;
7   import org.oxerr.okcoin.rest.OKCoin;
8   import org.oxerr.okcoin.rest.dto.CandlestickChart;
9   import org.oxerr.okcoin.rest.dto.Depth;
10  import org.oxerr.okcoin.rest.dto.LendDepth;
11  import org.oxerr.okcoin.rest.dto.TickerResponse;
12  import org.oxerr.okcoin.rest.dto.Trade;
13  
14  import si.mazi.rescu.RestProxyFactory;
15  
16  /**
17   * Raw market data service.
18   */
19  public class OKCoinMarketDataServiceRaw extends OKCoinBaseService {
20  
21  	private final OKCoin okCoin;
22  
23  	protected OKCoinMarketDataServiceRaw(Exchange exchange) {
24  		super(exchange);
25  		ExchangeSpecification spec = exchange.getExchangeSpecification();
26  		final String baseUrl = spec.getSslUri();
27  		okCoin = RestProxyFactory.createProxy(OKCoin.class, baseUrl);
28  	}
29  
30  	public TickerResponse getTicker(String symbol) throws IOException {
31  		return okCoin.getTicker(symbol);
32  	}
33  
34  	public Depth getDepth(String symbol, Integer size, Integer merge)
35  			throws IOException {
36  		return okCoin.getDepth(symbol, size, merge);
37  	}
38  
39  	public Trade[] getTrades(String symbol, Long since) throws IOException {
40  		return okCoin.getTrades(symbol, since);
41  	}
42  
43  	/**
44  	 * Get BTC/LTC Candlestick Data.
45  	 *
46  	 * @param symbol the symbol.
47  	 * @param type type of candlestick.
48  	 * @param size 1 based.
49  	 * @param since since timestamp.
50  	 * @return Candlestick data.
51  	 * @throws IOException indicates I/O exception.
52  	 */
53  	public CandlestickChart getCandlestickChart(String symbol, String type,
54  			Integer size, Long since) throws IOException {
55  		return okCoin.getCandlestickChart(symbol, type, size, since);
56  	}
57  
58  	public LendDepth getLendDepth(String symbol) throws IOException {
59  		return okCoin.getLendDepth(symbol);
60  	}
61  
62  }