View Javadoc
1   package org.oxerr.chbtc;
2   
3   import java.io.IOException;
4   
5   import javax.ws.rs.GET;
6   import javax.ws.rs.Path;
7   import javax.ws.rs.Produces;
8   import javax.ws.rs.QueryParam;
9   import javax.ws.rs.core.MediaType;
10  
11  import org.oxerr.chbtc.dto.AccountInfo;
12  import org.oxerr.chbtc.dto.CHBTCError;
13  import org.oxerr.chbtc.dto.Order;
14  import org.oxerr.chbtc.dto.OrderResponse;
15  
16  @Path("/")
17  @Produces(MediaType.APPLICATION_JSON)
18  public interface CHBTC {
19  
20  	String METHOD_ORDER = "order";
21  	String METHOD_CANCEL_ORDER = "cancelOrder";
22  	String METHOD_GET_ORDER = "getOrder";
23  	String METHOD_GET_ORDERS = "getOrders";
24  	String METHOD_GET_ORDERS_NEW = "getOrdersNew";
25  	String METHOD_GET_ORDERS_IGNORE_TRADE_TYPE = "getOrdersIgnoreTradeType";
26  	String METHOD_GET_UNFINISHED_ORDERS_IGNORE_TRADE_TYPE = "getUnfinishedOrdersIgnoreTradeType";
27  	String METHOD_GET_ACCOUNT_INFO = "getAccountInfo";
28  
29  	/**
30  	 * Places a buy or sell order.
31  	 *
32  	 * @param method order.
33  	 * @param accessKey the access key.
34  	 * @param price the order price.
35  	 * @param amount the quantity of the order.
36  	 * @param tradeType the trade type, 1 means buy, 0 means sell.
37  	 * @param currency the tradable currency, could be BTC, LTC.
38  	 * @param sign the MD5 signature.
39  	 * @param reqTime the time stamp of request, in milliseconds.
40  	 * @return the response of placing order, contains order ID.
41  	 * @throws IOException indicates I/O exception.
42  	 * @deprecated Use {@link CHBTCClient#order(java.math.BigDecimal, java.math.BigDecimal, org.oxerr.chbtc.dto.Type, String)} instead.
43  	 */
44  	@Deprecated
45  	@GET
46  	@Path("order")
47  	OrderResponse order(
48  			@QueryParam("method") String method,
49  			@QueryParam("accesskey") String accessKey,
50  			@QueryParam("price") String price,
51  			@QueryParam("amount") String amount,
52  			@QueryParam("tradeType") int tradeType,
53  			@QueryParam("currency") String currency,
54  			@QueryParam("sign") String sign,
55  			@QueryParam("reqTime") long reqTime)
56  					throws IOException;
57  
58  	/**
59  	 * Cancels an order.
60  	 *
61  	 * @param method cancelOrder.
62  	 * @param accessKey the access key.
63  	 * @param id the ID of the order to be cancelled.
64  	 * @param currency the currency of the tradable, could be BTC or LTC.
65  	 * @param sign the MD5 signature.
66  	 * @param reqTime the time stamp of the request, in milliseconds.
67  	 * @return the cancellation result.
68  	 * @throws IOException indicates I/O exception.
69  	 * @deprecated Use {@link CHBTCClient#cancelOrder(long, String)} instead.
70  	 */
71  	@Deprecated
72  	@GET
73  	@Path("cancelOrder")
74  	CHBTCError cancelOrder(
75  			@QueryParam("method") String method,
76  			@QueryParam("accesskey") String accessKey,
77  			@QueryParam("id") long id,
78  			@QueryParam("currency") String currency,
79  			@QueryParam("sign") String sign,
80  			@QueryParam("reqTime") long reqTime)
81  					throws IOException;
82  
83  	/**
84  	 * Gets order detail.
85  	 *
86  	 * @param method getOrder.
87  	 * @param accessKey the access key.
88  	 * @param id the order ID.
89  	 * @param currency the currency of the tradable, could be BTC or LTC.
90  	 * @param sign the MD5 signature.
91  	 * @param reqTime the time stamp of the reuqest, in milliseconds.
92  	 * @return the order detail.
93  	 * @throws IOException indicates I/O exception.
94  	 * @deprecated Use {@link CHBTCClient#getOrder(long, String)} instead.
95  	 */
96  	@Deprecated
97  	@GET
98  	@Path("getOrder")
99  	Order getOrder(
100 			@QueryParam("method") String method,
101 			@QueryParam("accesskey") String accessKey,
102 			@QueryParam("id") long id,
103 			@QueryParam("currency") String currency,
104 			@QueryParam("sign") String sign,
105 			@QueryParam("reqTime") long reqTime)
106 					throws IOException;
107 
108 	/**
109 	 * Gets orders, the page size is always 10.
110 	 *
111 	 * @param method getOrders.
112 	 * @param accessKey the access key.
113 	 * @param tradeType the trade type, 1 means buy, 0 means sell.
114 	 * @param currency the currency of the tradable, could be BTC or LTC.
115 	 * @param pageIndex the page index, 1 based.
116 	 * @param sign the MD5 signature.
117 	 * @param reqTime the time stamp of the request, in milliseconds.
118 	 * @return order details.
119 	 * @throws IOException indicates I/O exception.
120 	 * @deprecated The response JSON maybe array
121 	 * or object<code>{"code":3001,"message":"挂单没有找到"}</code>,
122 	 * then it will be parsed failed.
123 	 */
124 	@Deprecated
125 	@GET
126 	@Path("getOrders")
127 	Order[] getOrders(
128 			@QueryParam("method") String method,
129 			@QueryParam("accesskey") String accessKey,
130 			@QueryParam("tradeType") int tradeType,
131 			@QueryParam("currency") String currency,
132 			@QueryParam("pageIndex") int pageIndex,
133 			@QueryParam("sign") String sign,
134 			@QueryParam("reqTime") long reqTime)
135 					throws IOException;
136 
137 	/**
138 	 * Gets orders, the page size can be specified.
139 	 *
140 	 * @param method getOrdersNew.
141 	 * @param accessKey the access key.
142 	 * @param tradeType the trade type, 1 means buy, 0 means sell.
143 	 * @param currency the currency of the tradable, could be BTC or LTC.
144 	 * @param pageIndex the page index, 1 based.
145 	 * @param pageSize the page size, should be less than or equals to 100.
146 	 * @param sign the MD5 signature.
147 	 * @param reqTime the time stamp of the request, in milliseconds.
148 	 * @return the orders.
149 	 * @throws IOException indicates I/O exception.
150 	 * @deprecated The response JSON maybe array
151 	 * or object<code>{"code":3001,"message":"挂单没有找到"}</code>,
152 	 * then it will be parsed failed.
153 	 */
154 	@Deprecated
155 	@GET
156 	@Path("getOrdersNew")
157 	Order[] getOrdersNew(
158 			@QueryParam("method") String method,
159 			@QueryParam("accesskey") String accessKey,
160 			@QueryParam("tradeType") int tradeType,
161 			@QueryParam("currency") String currency,
162 			@QueryParam("pageIndex") int pageIndex,
163 			@QueryParam("pageSize") int pageSize,
164 			@QueryParam("sign") String sign,
165 			@QueryParam("reqTime") long reqTime)
166 					throws IOException;
167 
168 	/**
169 	 * Gets the orders, contains buy and sell order.
170 	 *
171 	 * @param method getOrdersIgnoreTradeType.
172 	 * @param accessKey the access key.
173 	 * @param currency the currency of the tradable, could be BTC or LTC.
174 	 * @param pageIndex the page index, 1 based.
175 	 * @param pageSize the page size.
176 	 * @param sign the MD5 signature.
177 	 * @param reqTime the time stamp of the request, in milliseconds.
178 	 * @return the orders.
179 	 * @throws IOException indicates I/O exception.
180 	 * @deprecated The response JSON may be array
181 	 * or object<code>{"code":3001,"message":"挂单没有找到"}</code>,
182 	 * then it will be parsed failed.
183 	 */
184 	@Deprecated
185 	@GET
186 	@Path("getOrdersIgnoreTradeType")
187 	Order[] getOrdersIgnoreTradeType(
188 			@QueryParam("method") String method,
189 			@QueryParam("accesskey") String accessKey,
190 			@QueryParam("currency") String currency,
191 			@QueryParam("pageIndex") int pageIndex,
192 			@QueryParam("pageSize") int pageSize,
193 			@QueryParam("sign") String sign,
194 			@QueryParam("reqTime") long reqTime)
195 					throws IOException;
196 
197 	/**
198 	 * Gets open orders, contains buy and sell orders.
199 	 *
200 	 * @param method getUnfinishedOrdersIgnoreTradeType.
201 	 * @param accessKey the access key.
202 	 * @param currency the currency of the tradable, could be BTC or LTC.
203 	 * @param pageIndex the page index, 1 based.
204 	 * @param pageSize the page size, should be less than or equals to 100.
205 	 * @param sign the MD5 signature.
206 	 * @param reqTime the time stamp of the request, in milliseconds.
207 	 * @return the open orders.
208 	 * @throws IOException indicates I/O exception.
209 	 * @deprecated The response JSON maybe array
210 	 * or object<code>{"code":3001,"message":"挂单没有找到"}</code>,
211 	 * then it will be parsed failed.
212 	 */
213 	@Deprecated
214 	@GET
215 	@Path("getUnfinishedOrdersIgnoreTradeType")
216 	Order[] getUnfinishedOrdersIgnoreTradeType(
217 			@QueryParam("method") String method,
218 			@QueryParam("accesskey") String accessKey,
219 			@QueryParam("currency") String currency,
220 			@QueryParam("pageIndex") int pageIndex,
221 			@QueryParam("pageSize") int pageSize,
222 			@QueryParam("sign") String sign,
223 			@QueryParam("reqTime") long reqTime)
224 					throws IOException;
225 
226 	/**
227 	 * Gets account information.
228 	 *
229  	 * @param method getAccountInfo.
230 	 * @param accessKey the access key.
231 	 * @param sign the MD5 signature.
232 	 * @param reqTime the time stamp of the request, in milliseconds.
233 	 * @return the account information.
234 	 * @throws IOException indicates I/O exception.
235 	 * @deprecated Use {@link CHBTCClient#getAccountInfo()} instead.
236 	 */
237 	@Deprecated
238 	@GET
239 	@Path("getAccountInfo")
240 	AccountInfo getAccountInfo(
241 			@QueryParam("method") String method,
242 			@QueryParam("accesskey") String accessKey,
243 			@QueryParam("sign") String sign,
244 			@QueryParam("reqTime") long reqTime)
245 					throws IOException;
246 
247 }