binance_client/http_api_v3/data/account/get/
request.rs1use chrono::prelude::*;
6
7pub struct Query {
11 pub recv_window: Option<i64>,
13 pub timestamp: i64,
15}
16
17impl Default for Query {
18 fn default() -> Self {
19 Self::new()
20 }
21}
22
23impl Query {
24 const QUERY_INITIAL_CAPACITY: usize = 256;
26
27 pub fn new() -> Self {
31 Self {
32 recv_window: None,
33 timestamp: Utc::now().timestamp_millis(),
34 }
35 }
36}
37
38impl ToString for Query {
39 fn to_string(&self) -> String {
40 let mut params = String::with_capacity(Self::QUERY_INITIAL_CAPACITY);
41 if let Some(recv_window) = self.recv_window {
42 params += &format!("&recvWindow={}", recv_window);
43 }
44 params += &format!("×tamp={}", self.timestamp);
45 params
46 }
47}