Search in sources :

Example 1 with OrderType

use of org.knowm.xchange.binance.dto.trade.OrderType in project XChange by knowm.

the class BinanceTradeService method placeStopOrder.

@Override
public String placeStopOrder(StopOrder order) throws IOException {
    // Time-in-force should not be provided for market orders but is required for
    // limit orders, order we only default it for limit orders. If the caller
    // specifies one for a market order, we don't remove it, since Binance might
    // allow
    // it at some point.
    TimeInForce tif = timeInForceFromOrder(order).orElse(order.getLimitPrice() != null ? TimeInForce.GTC : null);
    OrderType orderType = BinanceAdapters.adaptOrderType(order);
    return placeOrder(orderType, order, order.getLimitPrice(), order.getStopPrice(), tif);
}
Also used : OrderType(org.knowm.xchange.binance.dto.trade.OrderType) TimeInForce(org.knowm.xchange.binance.dto.trade.TimeInForce)

Example 2 with OrderType

use of org.knowm.xchange.binance.dto.trade.OrderType in project XChange by knowm.

the class BinanceTradeService method placeLimitOrder.

@Override
public String placeLimitOrder(LimitOrder limitOrder) throws IOException {
    TimeInForce tif = timeInForceFromOrder(limitOrder).orElse(TimeInForce.GTC);
    OrderType type;
    if (limitOrder.hasFlag(org.knowm.xchange.binance.dto.trade.BinanceOrderFlags.LIMIT_MAKER)) {
        type = OrderType.LIMIT_MAKER;
        tif = null;
    } else {
        type = OrderType.LIMIT;
    }
    return placeOrder(type, limitOrder, limitOrder.getLimitPrice(), null, tif);
}
Also used : OrderType(org.knowm.xchange.binance.dto.trade.OrderType) TimeInForce(org.knowm.xchange.binance.dto.trade.TimeInForce)

Aggregations

OrderType (org.knowm.xchange.binance.dto.trade.OrderType)2 TimeInForce (org.knowm.xchange.binance.dto.trade.TimeInForce)2