pub struct TradeAuthData {
pub ret_code: i32,
pub ret_msg: String,
pub op: String,
pub conn_id: String,
pub req_id: Option<String>,
}Expand description
Authentication data for trade WebSocket streams.
Fields§
§ret_code: i32Return code from authentication.
0 for success, non-zero for errors.
Common error codes:
10004: invalid signature10001: parameter error20001: repeat authentication Bots should check this field before proceeding with trade operations.
ret_msg: StringReturn message from authentication.
“OK” for success, error message for failure. Bots should log this for debugging authentication issues.
op: StringOperation type, always “auth” for authentication responses.
Bots use this to identify the message type.
conn_id: StringConnection ID for the authenticated WebSocket connection.
A unique identifier for the WebSocket connection. Bots can use this to track specific connections.
req_id: Option<String>Request ID (optional).
The ID of the authentication request, if provided. Bots can use this to correlate requests and responses.
Implementations§
Source§impl TradeAuthData
impl TradeAuthData
Sourcepub fn new(
ret_code: i32,
ret_msg: &str,
conn_id: &str,
req_id: Option<&str>,
) -> Self
pub fn new( ret_code: i32, ret_msg: &str, conn_id: &str, req_id: Option<&str>, ) -> Self
Creates a new TradeAuthData instance.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if authentication was successful (ret_code == 0).
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Returns true if authentication failed (ret_code != 0).
Sourcepub fn error_code(&self) -> Option<i32>
pub fn error_code(&self) -> Option<i32>
Returns the authentication error code if authentication failed.
Trait Implementations§
Source§impl Clone for TradeAuthData
impl Clone for TradeAuthData
Source§fn clone(&self) -> TradeAuthData
fn clone(&self) -> TradeAuthData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more