use of org.knowm.xchange.kucoin.KucoinTradeService.KucoinOrderFlags in project XChange by knowm.
the class KucoinAdapters method adaptOrder.
/**
* Returns {@code Object} instead of the Lombok builder in order to avoid a Lombok limitation with
* Javadoc.
*/
private static Object adaptOrder(Order order) {
OrderCreateApiRequest.OrderCreateApiRequestBuilder request = OrderCreateApiRequest.builder();
boolean hasClientId = false;
for (IOrderFlags flag : order.getOrderFlags()) {
if (flag instanceof KucoinOrderFlags) {
request.clientOid(((KucoinOrderFlags) flag).getClientId());
hasClientId = true;
} else if (flag instanceof TimeInForce) {
request.timeInForce(((TimeInForce) flag).name());
}
}
if (!hasClientId) {
request.clientOid(UUID.randomUUID().toString());
}
return request.symbol(adaptCurrencyPair((CurrencyPair) order.getInstrument())).size(order.getOriginalAmount()).side(adaptSide(order.getType()));
}
Aggregations