Skip to content

Commit 1ae558d

Browse files
committed
test: _
1 parent edd6bd0 commit 1ae558d

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

Cargo.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v_exchanges/src/binance/futures/core.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use serde::{Deserialize, Serialize};
2+
use serde_json::Value;
23
use serde_with::{DisplayFromStr, serde_as};
34

45
//TODO: make these actually consistent
@@ -10,7 +11,7 @@ use serde_with::{DisplayFromStr, serde_as};
1011
#[serde_as]
1112
#[derive(Debug, Serialize, Deserialize, Clone)]
1213
#[serde(rename_all = "camelCase")]
13-
pub struct KlineCore {
14+
pub struct KlineCoreNamed {
1415
#[serde(rename = "t")]
1516
pub open_time: i64,
1617

@@ -52,9 +53,8 @@ pub struct KlineCore {
5253
#[serde(rename = "Q")]
5354
pub taker_buy_quote_asset_volume: f64,
5455

55-
#[serde_as(as = "DisplayFromStr")]
5656
#[serde(skip, rename = "B")]
57-
pub __ignore: Option<f64>,
57+
__ignore: Option<Value>,
5858
}
5959

6060
#[serde_as]
@@ -101,11 +101,36 @@ pub struct Kline {
101101
pub __ignore: u64,
102102
}
103103

104+
#[serde_as]
105+
#[derive(Debug, Serialize, Deserialize, Clone)]
106+
pub struct KlineCore {
107+
pub open_time: i64,
108+
#[serde_as(as = "DisplayFromStr")]
109+
pub open: f64,
110+
#[serde_as(as = "DisplayFromStr")]
111+
pub close: f64,
112+
#[serde_as(as = "DisplayFromStr")]
113+
pub high: f64,
114+
#[serde_as(as = "DisplayFromStr")]
115+
pub low: f64,
116+
#[serde_as(as = "DisplayFromStr")]
117+
pub volume: f64,
118+
pub close_time: i64,
119+
#[serde_as(as = "DisplayFromStr")]
120+
pub quote_asset_volume: f64,
121+
pub number_of_trades: i64,
122+
#[serde_as(as = "DisplayFromStr")]
123+
pub taker_buy_base_asset_volume: f64,
124+
#[serde_as(as = "DisplayFromStr")]
125+
pub taker_buy_quote_asset_volume: f64,
126+
__ignore: Option<Value>,
127+
}
128+
104129
#[cfg(test)]
105130
mod tests {
106131
#[test]
107132
fn kline_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\"]";
109134
let _: super::KlineCore = serde_json::from_str(raw_str).unwrap();
110135
}
111136
}

v_exchanges/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use v_exchanges_adapters::{
66
mod binance;
77

88
use binance::futures::KlineCore;
9-
use v_utils::utils::init_subscriber;
9+
use v_utils::utils::{LogDestination, init_subscriber};
1010

1111
//- [ ] generics request for klines rest
1212
//- [ ] generics request for klines ws
@@ -15,8 +15,7 @@ use v_utils::utils::init_subscriber;
1515
#[tokio::main]
1616
async fn main() {
1717
color_eyre::install().unwrap();
18-
//init_subscriber(Some(std::path::PathBuf::from("/home/v/.local/share/v_exchanges/.log").into())); //dbg
19-
init_subscriber(None);
18+
init_subscriber(LogDestination::xdg_data_home("v_exchanges"));
2019

2120
tracing::info!("Starting...");
2221
let mut client = Client::new();

0 commit comments

Comments
 (0)