use of org.knowm.xchange.dto.trade.LimitOrder in project XChange by knowm.
the class TradeServiceIntegration method testPlaceTestOrderLimitOrderShouldNotThrowAnyException.
@Test
public void testPlaceTestOrderLimitOrderShouldNotThrowAnyException() throws IOException {
final LimitOrder limitOrder = sampleLimitOrder();
tradeService.placeTestOrder(LIMIT, limitOrder, limitOrder.getLimitPrice(), null);
}
use of org.knowm.xchange.dto.trade.LimitOrder in project XChange by knowm.
the class CCEXAdapters method adaptOpenOrder.
public static LimitOrder adaptOpenOrder(CCEXOpenorder cCEXOpenOrder) {
OrderType type = cCEXOpenOrder.getOrderType().equalsIgnoreCase("LIMIT_SELL") ? OrderType.ASK : OrderType.BID;
String[] currencies = cCEXOpenOrder.getExchange().split("-");
CurrencyPair pair = new CurrencyPair(currencies[1], currencies[0]);
return new LimitOrder(type, cCEXOpenOrder.getQuantityRemaining(), pair, cCEXOpenOrder.getOrderUuid(), null, cCEXOpenOrder.getLimit());
}
use of org.knowm.xchange.dto.trade.LimitOrder in project XChange by knowm.
the class CexIOAdapters method adaptOpenOrders.
public static OpenOrders adaptOpenOrders(List<CexIOOrder> cexIOOrderList) {
List<LimitOrder> limitOrders = new ArrayList<>();
for (CexIOOrder cexIOOrder : cexIOOrderList) {
OrderType orderType = cexIOOrder.getType() == CexIOOrder.Type.buy ? OrderType.BID : OrderType.ASK;
String id = Long.toString(cexIOOrder.getId());
limitOrders.add(new LimitOrder(orderType, cexIOOrder.getAmount(), cexIOOrder.getAmount().subtract(cexIOOrder.getPending()), new CurrencyPair(cexIOOrder.getSymbol1(), cexIOOrder.getSymbol2()), id, DateUtils.fromMillisUtc(cexIOOrder.getTime()), cexIOOrder.getPrice()));
}
return new OpenOrders(limitOrders);
}
use of org.knowm.xchange.dto.trade.LimitOrder in project XChange by knowm.
the class CexIOAdapters method adaptOrder.
public static Order adaptOrder(CexIOOpenOrder cexIOOrder) {
OrderType orderType = cexIOOrder.type.equals("sell") ? OrderType.ASK : OrderType.BID;
BigDecimal originalAmount = new BigDecimal(cexIOOrder.amount);
CurrencyPair currencyPair = new CurrencyPair(cexIOOrder.symbol1, cexIOOrder.symbol2);
Date timestamp = new Date(cexIOOrder.time);
BigDecimal limitPrice = new BigDecimal(cexIOOrder.price);
Order.OrderStatus status = adaptOrderStatus(cexIOOrder);
BigDecimal cumulativeAmount = null;
try {
BigDecimal remains = new BigDecimal(cexIOOrder.remains);
cumulativeAmount = originalAmount.subtract(remains);
} catch (Exception e) {
}
return new LimitOrder(orderType, originalAmount, currencyPair, cexIOOrder.orderId, timestamp, limitPrice, null, cumulativeAmount, null, status);
}
use of org.knowm.xchange.dto.trade.LimitOrder in project XChange by knowm.
the class CryptopiaAdapters method adaptOrderBook.
/**
* Adapts a CryptopiaOrderBook to an OrderBook Object
*
* @param cryptopiaOrderBook The exchange specific order book
* @param currencyPair (e.g. BTC/USD)
* @return The XChange OrderBook
*/
public static OrderBook adaptOrderBook(CryptopiaOrderBook cryptopiaOrderBook, CurrencyPair currencyPair) {
List<LimitOrder> asks = createOrders(currencyPair, Order.OrderType.ASK, cryptopiaOrderBook.getAsks());
List<LimitOrder> bids = createOrders(currencyPair, Order.OrderType.BID, cryptopiaOrderBook.getBids());
return new OrderBook(new Date(), asks, bids);
}
Aggregations