I am trying to send a spot order using a unified account. There is absolutely no info about what this error message means and as far as I can tell from the ByBit v5 API docs I am doing everything correct. I have already established that the signature is formatted properly. This is the request being sent along:
RequestBuilder {method: POST,url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some( Domain("api.bybit.com", ), ), port: None, path: "/v5/order/create", query: None, fragment: None,},headers: {"content-type": "application/json","x-bapi-api-key": xxxxxxxxxxxxxx,"x-bapi-timestamp": "1676755850417","x-bapi-sign": xxxxxxxxxxxxxxxx,"x-bapi-recv-window": "5000",},}The request body that gets attached when the request is sent:
{"category":"spot","symbol":"ETHUSDT","side":"Sell","order_type":"Market","qty":"0.1"}This is the Rust code used to send the request:
// Set up the HTTP client let client = reqwest::Client::new(); let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("X-BAPI-API-KEY", HeaderValue::from_str(&api_key)?); headers.insert("X-BAPI-TIMESTAMP", HeaderValue::from_str(×tamp)?); headers.insert("X-BAPI-SIGN", HeaderValue::from_str(&sign)?); headers.insert("X-BAPI-RECV-WINDOW", HeaderValue::from_static(recv_window)); let body = serde_json::to_string(&order)?; // Submit the order let request = client .post("https://api.bybit.com/v5/order/create") .headers(headers.clone()) .body(body.clone()); let response = request.send().await?;And this is the response received:
Response {url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some( Domain("api.bybit.com", ), ), port: None, path: "/v5/order/create", query: None, fragment: None,},status: 200,headers: {"content-type": "application/json; charset=utf-8","content-length": "122","x-bapi-limit": "20","x-bapi-limit-status": "19","x-bapi-limit-reset-timestamp": "1676755851552","ret_code": "170130","traceid": "78d2bec29fead6e40447a63ba1eae5d9","timenow": "1676755851556","server": "Openresty","expires": "Sat, 18 Feb 2023 21:30:51 GMT","cache-control": "max-age=0, no-cache, no-store","pragma": "no-cache","date": "Sat, 18 Feb 2023 21:30:51 GMT","connection": "keep-alive",},}