use of org.knowm.xchange.latoken.dto.trade.LatokenTestOrder in project XChange by knowm.
the class LatokenTradeServiceIntegration method newOrder.
@Test
public void newOrder() throws Exception {
CurrencyPair pair = CurrencyPair.ETH_BTC;
OrderType type = OrderType.BID;
BigDecimal amount = BigDecimal.valueOf(0.01);
BigDecimal limitPrice = BigDecimal.valueOf(0.018881);
LimitOrder newOrder = new LimitOrder.Builder(type, pair).originalAmount(amount).limitPrice(limitPrice).timestamp(new Date(System.currentTimeMillis())).build();
// Test order
LatokenTestOrder testOrder = tradeService.placeLatokenTestOrder(pair, "", LatokenOrderSide.buy, limitPrice, amount);
System.out.println(testOrder);
// Place order
String newOrderId = tradeService.placeLimitOrder(newOrder);
System.out.println(newOrderId);
// Check open orders
DefaultOpenOrdersParamCurrencyPair params = (DefaultOpenOrdersParamCurrencyPair) tradeService.createOpenOrdersParams();
params.setCurrencyPair(CurrencyPair.ETH_BTC);
List<LimitOrder> openOrders = tradeService.getOpenOrders(params).getOpenOrders();
System.out.println(openOrders);
// Cancel
tradeService.cancelLatokenOrder(newOrderId);
// Check open orders
openOrders = tradeService.getOpenOrders().getOpenOrders();
System.out.println(openOrders);
}
Aggregations