nautechsystems/nautilus_trader · error · anyhow::Error
Unsupported `TimeInForce` for Binance: {value:?}
Error message
Unsupported `TimeInForce` for Binance: {value:?} What it means
Converting a NautilusTrader TimeInForce to BinanceTimeInForce supports only Gtc, Ioc, Fok and Gtd - the four time-in-force modes the Binance API accepts. Any other TIF variant (e.g. AtTheClose or Day) makes the TryFrom conversion fail during order encoding.
Source
Thrown at crates/adapters/binance/src/common/enums.rs:402
/// Good till date.
Gtd,
/// Request-for-quote interactive (USD-M Futures).
Rpi,
/// Unknown or undocumented value.
#[serde(other)]
Unknown,
}
impl TryFrom<TimeInForce> for BinanceTimeInForce {
type Error = anyhow::Error;
fn try_from(value: TimeInForce) -> Result<Self, Self::Error> {
match value {
TimeInForce::Gtc => Ok(Self::Gtc),
TimeInForce::Ioc => Ok(Self::Ioc),
TimeInForce::Fok => Ok(Self::Fok),
TimeInForce::Gtd => Ok(Self::Gtd),
_ => anyhow::bail!("Unsupported `TimeInForce` for Binance: {value:?}"),
}
}
}
/// Income type for account income history.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum BinanceIncomeType {
/// Internal transfers.
Transfer,
/// Welcome bonus.
WelcomeBonus,
/// Realized profit and loss.
RealizedPnl,
/// Funding fee payments/receipts.
FundingFee,
/// Trading commission.
Commission,View on GitHub (pinned to a4b06ed870)
Solutions
- Map the order's time_in_force to Gtc, Ioc, Fok or Gtd for Binance venues before submission
- For GTD confirm the expiry time is also provided as Binance requires
- Add a per-venue TIF translation in your strategy factory so unsupported values never reach the encoder
Example fix
# before (shared config) time_in_force = "AT_THE_CLOSE" # after (binance venue config) time_in_force = "GTC" # or IOC / FOK / GTD
Defensive patterns
Strategy: type-guard
Validate before calling
fn is_binance_supported_tif(tif: TimeInForce) -> bool {
matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc | TimeInForce::Fok | TimeInForce::Gtd)
} Type guard
fn is_binance_supported_tif(tif: TimeInForce) -> bool {
matches!(tif, TimeInForce::Gtc | TimeInForce::Ioc | TimeInForce::Fok | TimeInForce::Gtd)
} Try / catch
match BinanceTimeInForce::try_from(order.time_in_force()) {
Ok(tif) => encode_order(order, tif),
Err(_) => log::error!("TIF {:?} not supported on Binance - remap to GTC or route elsewhere", order.time_in_force()),
} Prevention
- Add venue-specific TIF mapping in strategy config instead of one global TIF
- Test submissions against Binance testnet when porting strategies between venue types
- Remember GTD on Binance also requires an expiry time - validate both together
When it happens
Trigger: Submitting to a Binance execution client an order with TimeInForce other than GTC/IOC/FOK/GTD - most commonly AtTheClose (used by venues like Betfair) or Day carried over from multi-venue strategy code.
Common situations: Strategies parameterized per-venue without per-venue TIF mapping; porting configs from equities/betting exchanges; default TIF changed in shared strategy code.
Related errors
- Unsupported `OrderSide` for Binance: {value:?}
- callbackRate {rate}% out of Binance range [{min_rate}, {max_
- Unsupported time in force for Binance Spot: {tif:?}
- Unsupported month interval: {step}M
- Unsupported bar aggregation for Binance: {agg:?}
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/65bce500e78524e1.
Report an issue: GitHub.