Open KyoMorya opened 2 days ago
pub async fn add_order(
&self,
path: &str,
symbol: String,
price: String,
quantity: String,
side: String,
order_type: String,
tif: String,
session_id: u16,
id: u32,
) -> anyhow::Result
match order_type.as_str() {
"STOP_MARKET" => {
// For stop market orders, the price is treated as stopPrice
params.push(("stopPrice".into(), price));
}
"MARKET" => {
// Market orders don't need a price, so no action needed
}
_ => {
// For other types (e.g., LIMIT), use price
params.push(("price".into(), price));
}
}
if tif != "UNDEF" {
params.push(("timeInForce".into(), tif));
}
self.post(path, ¶ms, true).await
} added this to rest.rs it solved the issue
long_order.send(price, self.dsize, Side.BUY, OrderType.STOP_MARKET, Tif.GTC) => Order { time: 1727708860003, symbol: "wifusdt", side: BUY, state: REJECTED, order_type: STOP_MARKET, tif: GTC, quantity: 5.0, price: 2.5, order_id: -1, internal_id: 4, trade_time: 0, trade_price: 0.0, trade_quantity: 0.0, acc: 0.0, making: Some( false, ), } in the server log [16:07:43.720197166 trade.rs 124 ERROR] Error { code: -1106, msg: "Parameter 'price' sent when not required." } stop_price should be used not price