You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v_exchanges/src/binance/futures/core.rs
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
use serde::{Deserialize,Serialize};
2
+
use serde_json::Value;
2
3
use serde_with::{DisplayFromStr, serde_as};
3
4
4
5
//TODO: make these actually consistent
@@ -10,7 +11,7 @@ use serde_with::{DisplayFromStr, serde_as};
10
11
#[serde_as]
11
12
#[derive(Debug,Serialize,Deserialize,Clone)]
12
13
#[serde(rename_all = "camelCase")]
13
-
pubstructKlineCore{
14
+
pubstructKlineCoreNamed{
14
15
#[serde(rename = "t")]
15
16
pubopen_time:i64,
16
17
@@ -52,9 +53,8 @@ pub struct KlineCore {
52
53
#[serde(rename = "Q")]
53
54
pubtaker_buy_quote_asset_volume:f64,
54
55
55
-
#[serde_as(as = "DisplayFromStr")]
56
56
#[serde(skip, rename = "B")]
57
-
pub__ignore:Option<f64>,
57
+
__ignore:Option<Value>,
58
58
}
59
59
60
60
#[serde_as]
@@ -101,11 +101,36 @@ pub struct Kline {
101
101
pub__ignore:u64,
102
102
}
103
103
104
+
#[serde_as]
105
+
#[derive(Debug,Serialize,Deserialize,Clone)]
106
+
pubstructKlineCore{
107
+
pubopen_time:i64,
108
+
#[serde_as(as = "DisplayFromStr")]
109
+
pubopen:f64,
110
+
#[serde_as(as = "DisplayFromStr")]
111
+
pubclose:f64,
112
+
#[serde_as(as = "DisplayFromStr")]
113
+
pubhigh:f64,
114
+
#[serde_as(as = "DisplayFromStr")]
115
+
publow:f64,
116
+
#[serde_as(as = "DisplayFromStr")]
117
+
pubvolume:f64,
118
+
pubclose_time:i64,
119
+
#[serde_as(as = "DisplayFromStr")]
120
+
pubquote_asset_volume:f64,
121
+
pubnumber_of_trades:i64,
122
+
#[serde_as(as = "DisplayFromStr")]
123
+
pubtaker_buy_base_asset_volume:f64,
124
+
#[serde_as(as = "DisplayFromStr")]
125
+
pubtaker_buy_quote_asset_volume:f64,
126
+
__ignore:Option<Value>,
127
+
}
128
+
104
129
#[cfg(test)]
105
130
mod tests {
106
131
#[test]
107
132
fnkline_core(){
108
-
let raw_str = r#"[1731448080000,\"88591.90\",\"88630.90\",\"88560.00\",\"88574.10\",\"173.581\",1731448139999,\"15378315.48720\",2800,\"113.654\",\"10069629.84420\",\"0\"]"#;
133
+
let raw_str = "[1731448080000,\"88591.90\",\"88630.90\",\"88560.00\",\"88574.10\",\"173.581\",1731448139999,\"15378315.48720\",2800,\"113.654\",\"10069629.84420\",\"0\"]";
109
134
let _:super::KlineCore = serde_json::from_str(raw_str).unwrap();
0 commit comments