{"record":{"id":"e8eca746b89724f8","repo":"nautechsystems/nautilus_trader","slug":"tp-order-type-is-limit-but-tp-limit-price-wa","errorCode":null,"errorMessage":"'tp_order_type' is 'Limit' but 'tp_limit_price' was not provided","messagePattern":"'tp_order_type' is 'Limit' but 'tp_limit_price' was not provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/common/parse.rs","lineNumber":1872,"sourceCode":"        || result.tp_order_type.is_some()\n        || result.tp_limit_price.is_some()\n        || result.tp_trigger_price.is_some();\n\n    let has_sl_fields = result.sl_trigger_by.is_some()\n        || result.sl_order_type.is_some()\n        || result.sl_limit_price.is_some()\n        || result.sl_trigger_price.is_some();\n\n    if result.take_profit.is_none() && has_tp_fields {\n        anyhow::bail!(\"TP override fields require 'take_profit' to be set\");\n    }\n\n    if result.stop_loss.is_none() && has_sl_fields {\n        anyhow::bail!(\"SL override fields require 'stop_loss' to be set\");\n    }\n\n    if result.tp_order_type == Some(BybitOrderType::Limit) && result.tp_limit_price.is_none() {\n        anyhow::bail!(\"'tp_order_type' is 'Limit' but 'tp_limit_price' was not provided\");\n    }\n\n    if result.sl_order_type == Some(BybitOrderType::Limit) && result.sl_limit_price.is_none() {\n        anyhow::bail!(\"'sl_order_type' is 'Limit' but 'sl_limit_price' was not provided\");\n    }\n\n    if result.tp_limit_price.is_some() && result.tp_order_type != Some(BybitOrderType::Limit) {\n        anyhow::bail!(\"'tp_limit_price' requires 'tp_order_type' to be 'Limit'\");\n    }\n\n    if result.sl_limit_price.is_some() && result.sl_order_type != Some(BybitOrderType::Limit) {\n        anyhow::bail!(\"'sl_limit_price' requires 'sl_order_type' to be 'Limit'\");\n    }\n\n    result.close_on_trigger = params.get_bool(\"close_on_trigger\");\n\n    if let Some(value) = params.get(\"order_iv\") {\n        match get_price_str(params, \"order_iv\") {","sourceCodeStart":1854,"sourceCodeEnd":1890,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/common/parse.rs#L1854-L1890","documentation":"When 'tp_order_type' is Limit, Bybit requires a limit price for the take-profit order. The parser enforces this locally and bails if 'tp_limit_price' is missing so the request does not fail at the exchange.","triggerScenarios":"Setting params 'tp_order_type' = \"Limit\" without providing 'tp_limit_price'.","commonSituations":"Copying TP/SL params that specify a limit order type but relying on defaults that only set the trigger price; switching order type from Market to Limit without adding a price.","solutions":["Add a 'tp_limit_price' value when 'tp_order_type' is Limit","Change 'tp_order_type' to \"Market\" if a limit price is not intended"],"exampleFix":"// before\nparams.set(\"tp_order_type\", \"Limit\");\n// after\nparams.set(\"tp_order_type\", \"Limit\");\nparams.set(\"tp_limit_price\", \"45000\");","handlingStrategy":"validation","validationCode":"fn validate_tp_limit(params: &Params) -> Result<(), String> {\n    if params.get_str(\"tp_order_type\") == Some(\"Limit\") && params.get(\"tp_limit_price\").is_none() {\n        return Err(\"tp_order_type Limit requires tp_limit_price\".into());\n    }\n    Ok(())\n}","typeGuard":"fn is_limit_tp_missing_price(params: &Params) -> bool {\n    params.get_str(\"tp_order_type\") == Some(\"Limit\")\n        && params.get(\"tp_limit_price\").is_none()\n}","tryCatchPattern":"match parse_bybit_tp_sl_params(&params) {\n    Ok(p) => submit(p),\n    Err(e) if e.to_string().contains(\"'tp_limit_price' was not provided\") => {\n        log::warn(\"Limit TP without price; add tp_limit_price or switch to Market\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Set tp_order_type and tp_limit_price from the same config block","Default to Market unless a limit price is explicitly configured","Add a schema check that requires tp_limit_price when tp_order_type == Limit"],"tags":["bybit","params-validation","take-profit","limit-order"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}