Переглянути джерело

修改导出时间展示为毫秒级别

gepangpang 1 рік тому
батько
коміт
e3aff1cfeb

+ 1 - 1
derive/src/binance_swap_export.rs

@@ -70,7 +70,7 @@ impl ExportConnector for BinanceSwapExport {
                 if index >= data_array.len() {
                     data_array.push(Vec::new());
                 }
-                let time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.time.clone()).unwrap()).format("%Y-%m-%d %T").to_string();
+                let time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.time.clone()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
 
                 data_array[index] = vec![
                     value.id.to_string(),

+ 1 - 1
derive/src/bitget_spot_export.rs

@@ -58,7 +58,7 @@ impl ExportConnector for BitgetSpotExport {
                 if index >= data_array.len() {
                     data_array.push(Vec::new());
                 }
-                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.ts.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %T").to_string();
+                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.ts.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
                 let trade_value = Decimal::from_str(&value.price).unwrap() * Decimal::from_str(&value.size).unwrap();
                 data_array[index] = vec![
                     value.trade_id.clone(),

+ 1 - 1
derive/src/gate_swap_export.rs

@@ -71,7 +71,7 @@ impl ExportConnector for GateSwapExport {
                 let size = Decimal::from_i64(value.size).unwrap();
                 let side = if size < Decimal::ZERO { "sell" } else { "buy" };
                 let created_time = Decimal::from_f64(value.create_time).unwrap() * dec!(1000);
-                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(created_time.to_i64().unwrap()).unwrap()).format("%Y-%m-%d %T").to_string();
+                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(created_time.to_i64().unwrap()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
                 let trade_value = Decimal::from_str(&value.price).unwrap() * size.abs();
                 data_array[index] = vec![
                     value.id.to_string(),

+ 1 - 1
derive/src/kucoin_spot_export.rs

@@ -80,7 +80,7 @@ impl ExportConnector for KucoinSpotExport {
                 if index >= data_array.len() {
                     data_array.push(Vec::new());
                 }
-                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.created_at.clone()).unwrap()).format("%Y-%m-%d %T").to_string();
+                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.created_at.clone()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
 
                 data_array[index] = vec![
                     value.trade_id.clone(),

+ 2 - 2
derive/src/kucoin_swap_export.rs

@@ -83,8 +83,8 @@ impl ExportConnector for KucoinSwapExport {
                 if index >= data_array.len() {
                     data_array.push(Vec::new());
                 }
-                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.created_at.clone()).unwrap()).format("%Y-%m-%d %T").to_string();
-                let trade_time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&Utc.timestamp_nanos(value.trade_time.clone()).naive_utc()).format("%Y-%m-%d %T").to_string();
+                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.created_at.clone()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
+                let trade_time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&Utc.timestamp_nanos(value.trade_time.clone()).naive_utc()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
 
                 data_array[index] = vec![
                     value.trade_id.clone(),

+ 2 - 2
derive/src/okx_swap_export.rs

@@ -96,8 +96,8 @@ impl ExportConnector for OkxSwapExport {
                     data_array.push(Vec::new());
                 }
 
-                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.ts.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %T").to_string();
-                let trade_time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.fill_time.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %T").to_string();
+                let created_at = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.ts.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
+                let trade_time = FixedOffset::east_opt(8 * 3600).unwrap().from_utc_datetime(&NaiveDateTime::from_timestamp_millis(value.fill_time.parse::<i64>().unwrap()).unwrap()).format("%Y-%m-%d %H:%M:%S%.3f").to_string();
                 let trade_value = Decimal::from_str(&value.fill_px).unwrap() * Decimal::from_str(&value.fill_sz).unwrap();
                 data_array[index] = vec![
                     value.trade_id.clone(),