public class DefaultBitoProClient extends Object implements BitoProClient
BitoProClient using HttpClient.BitoProClient.BitoProPairClient| Modifier and Type | Field and Description |
|---|---|
protected CloseableHttpClient |
client |
protected static org.apache.http.Header |
CLIENT_HEADER |
protected com.fasterxml.jackson.databind.ObjectMapper |
om |
| Constructor and Description |
|---|
DefaultBitoProClient(String apiKey,
String secret,
String email) |
DefaultBitoProClient(String apiKey,
String secret,
String email,
CloseableHttpClient client) |
| Modifier and Type | Method and Description |
|---|---|
Optional<OrderResponse> |
cancelOrder(String pair,
String orderId)
Cancel an order.
|
protected void |
checkStatus(org.apache.http.StatusLine sl,
org.apache.http.HttpEntity entity) |
OrderResponse |
createLimitOrder(String pair,
OrderAction action,
BigDecimal price,
BigDecimal amount)
Place a limit price order.
|
OrderResponse |
createMarketOrder(String pair,
OrderAction action,
BigDecimal totalAmount)
Place a market order.
|
List<Balance> |
getAccountBalances()
Get account's balances.
|
Optional<Order> |
getOrder(String pair,
String id)
Get order specified by pair and id.
|
List<Order> |
getOrderHistory()
Get the completed or cancelled orders.
|
PaginatedList<Order> |
getOrders(String pair,
boolean active,
int page)
Get orders for specified pair in paginated form.
|
protected String |
tryParseError(String body) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPairClientprotected final CloseableHttpClient client
protected final com.fasterxml.jackson.databind.ObjectMapper om
protected static final org.apache.http.Header CLIENT_HEADER
public DefaultBitoProClient(String apiKey, String secret, String email, CloseableHttpClient client)
public List<Balance> getAccountBalances() throws IOException
getAccountBalances in interface BitoProClientIOException - when connection error occured while called the Rest APIpublic OrderResponse createMarketOrder(String pair, OrderAction action, BigDecimal totalAmount) throws IOException
createMarketOrder in interface BitoProClientpair - the pair to place orderaction - OrderAction for the order, either BUY or SELLtotalAmount - total amount for the orderOrderResponse with result of the order placedIOException - when connection error occured while called the Rest APIpublic OrderResponse createLimitOrder(String pair, OrderAction action, BigDecimal price, BigDecimal amount) throws IOException
createLimitOrder in interface BitoProClientpair - the pair to place orderaction - OrderAction for the order, either BUY or SELLprice - price in terms of quote for the orderamount - amount in terms of quote for the orderOrderResponse with result of the order placedIOException - when connection error occured while called the Rest APIpublic Optional<OrderResponse> cancelOrder(String pair, String orderId) throws IOException
com.bitoex.bitopro.java.exception.BadArgumentException is thrown.cancelOrder in interface BitoProClientpair - the pair to cancel orderorderId - id of the order to be cancelledOrderResponse with status of the order cancelled, if presentIOException - when connection error occured while called the Rest APIpublic List<Order> getOrderHistory() throws IOException
getOrderHistory in interface BitoProClientIOException - when connection error occured while called the Rest APIOrderpublic PaginatedList<Order> getOrders(String pair, boolean active, int page) throws IOException
getOrders in interface BitoProClientpair - the pair to get ordersactive - whether to get active orders or not. Default: falsepage - page number for the order list. Start from 1.IOException - when connection error occured while called the Rest APIOrderpublic Optional<Order> getOrder(String pair, String id) throws IOException
getOrder in interface BitoProClientpair - the pair to get orderid - id of the orderIOException - when connection error occured while called the Rest APIprotected void checkStatus(org.apache.http.StatusLine sl,
org.apache.http.HttpEntity entity)
throws IOException
IOException