nautechsystems/nautilus_trader · error

Unsupported TIF {time_in_force} for STOP_LIMIT on Coinbase

Error message

Unsupported TIF {time_in_force} for STOP_LIMIT on Coinbase

What it means

When building a STOP_LIMIT order, the adapter matches the TimeInForce to one of the Coinbase stop-limit order configurations (GTC/GTD with end_time, etc.). Any TIF not explicitly handled causes an immediate bail, because Coinbase's STOP_LIMIT schema differs per TIF and the adapter cannot synthesize a request.

Source

Thrown at crates/adapters/coinbase/src/http/client.rs:1714

                        limit_price,
                        stop_price,
                        stop_direction: direction,
                    },
                })),
                TimeInForce::Gtd => {
                    let expire = expire_time
                        .ok_or_else(|| anyhow::anyhow!("GTD STOP_LIMIT requires expire_time"))?;
                    Ok(OrderConfiguration::StopLimitGtd(StopLimitGtd {
                        stop_limit_stop_limit_gtd: StopLimitGtdParams {
                            base_size: qty,
                            limit_price,
                            stop_price,
                            stop_direction: direction,
                            end_time: format_rfc3339_from_nanos(expire)?,
                        },
                    }))
                }
                _ => anyhow::bail!("Unsupported TIF {time_in_force} for STOP_LIMIT on Coinbase"),
            }
        }
        other => anyhow::bail!("Unsupported order type for Coinbase: {other}"),
    }
}

#[cfg(test)]
mod tests {
    use rstest::rstest;

    use super::*;

    #[rstest]
    fn test_raw_client_construction_live() {
        let client = CoinbaseRawHttpClient::new(CoinbaseEnvironment::Live, 10, None, None).unwrap();
        assert_eq!(client.environment(), CoinbaseEnvironment::Live);
        assert!(!client.is_authenticated());
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use TimeInForce::Gtc or TimeInForce::Gtd for STOP_LIMIT orders on Coinbase
  2. If GTD, ensure the expire time is set (it is formatted via format_rfc3339_from_nanos)
  3. Extend the match arms only if Coinbase's API adds support for the TIF

Example fix

// before
.order_type(OrderType::StopLimit).time_in_force(TimeInForce::Ioc)
// after
.order_type(OrderType::StopLimit).time_in_force(TimeInForce::Gtc)
Defensive patterns

Strategy: validation

Validate before calling

fn coinbase_stop_limit_tif(tif: TimeInForce) -> Result<(), String> {
    match tif {
        TimeInForce::Gtc | TimeInForce::Gtd => Ok(()),
        other => Err(format!("Coinbase STOP_LIMIT supports Gtc/Gtd only, got {other}")),
    }
}

Prevention

When it happens

Trigger: Submitting a STOP_LIMIT order to Coinbase with a TimeInForce outside the handled set (e.g. Ioc, Fok, Day) instead of Gtc or Gtd.

Common situations: Reusing a STOP_LIMIT order spec written for another exchange that allows IOC/FOK stop-limits; strategy config that sets stop-limit exits with a TIF Coinbase rejects.

Related errors


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