nautechsystems/nautilus_trader · error · anyhow::Error

Binance Futures does not support GTD for order type

Error message

Binance Futures does not support GTD for order type {order_type:?}

What it means

determine_futures_order_lifetime maps a GTD order into Binance Futures parameters, but native goodTillDate is only valid for limit-style order types (Limit, StopLimit, LimitIfTouched). Submitting GTD with any other order type (Market, StopMarket, TrailingStopMarket, etc.) is rejected because Binance cannot honor an expiry on those order types.

Solutions

  1. Change the order type to Limit/StopLimit/LimitIfTouched if an expiry is truly required.
  2. Use TimeInForce Gtc (or Ioc/Fok) for market and stop-market orders instead of GTD.
  3. Enable manage_gtd_expiry on the submitting strategy or set use_gtd=false so GTD is emulated locally (mapped to GTC with local cancel).
  4. Gate the strategy so GTD is only emitted for supported limit-style orders.

Example fix

// before
order_factory.market(instrument_id, Side::Buy, qty, TimeInForce::Gtd, expire_time);
// after
order_factory.limit(instrument_id, Side::Buy, price, qty, TimeInForce::Gtd, Some(expire_time));
Defensive patterns

Strategy: validation

Validate before calling

const GTD_OK: &[OrderType] = &[OrderType::Limit, OrderType::StopLimit, OrderType::LimitIfTouched];
if tif == TimeInForce::Gtd && use_gtd && !GTD_OK.contains(&order_type) {
    // fall back to Gtc or change order type before submit
}

Prevention

When it happens

Trigger: validate_order or build_futures_order_list_batch called with TimeInForce=Gtd, use_gtd=true, and an order_type outside {Limit, StopLimit, LimitIfTouched} (e.g. a GTD market or stop-market order).

Common situations: Strategy configured with GTD defaults applied to all order types; porting equity-style GTD market orders to Binance Futures; automated schedulers tagging every order GTD regardless of type.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/6f72d3c8aee14ae8. Report an issue: GitHub.

Appendix: source

Thrown at crates/adapters/binance/src/futures/execution.rs:1494

) -> anyhow::Result<FuturesOrderLifetime> {
    if time_in_force != TimeInForce::Gtd {
        return Ok(FuturesOrderLifetime {
            time_in_force,
            good_till_date: None,
        });
    }

    if !use_gtd {
        log::warn!(
            "Binance Futures GTD submitted as GTC because use_gtd=false. Enable manage_gtd_expiry on the submitting strategy"
        );
        return Ok(FuturesOrderLifetime {
            time_in_force: TimeInForce::Gtc,
            good_till_date: None,
        });
    }

    anyhow::ensure!(
        matches!(
            order_type,
            OrderType::Limit | OrderType::StopLimit | OrderType::LimitIfTouched
        ),
        "Binance Futures does not support GTD for order type {order_type:?}"
    );
    anyhow::ensure!(!post_only, "Binance Futures GTD cannot be post-only");

    anyhow::ensure!(
        product_type == BinanceProductType::UsdM,
        "Binance {product_type:?} Futures does not support native GTD"
    );

    let expire_time = expire_time.context("Binance Futures GTD requires an expire_time")?;
    let expire_ns = expire_time.as_u64();
    anyhow::ensure!(
        expire_ns.is_multiple_of(NANOSECONDS_IN_SECOND),
        "Binance Futures goodTillDate requires whole-second precision"

View on GitHub (pinned to 18893faf8b)