From 8fa20a02e665fe7acdeac5a72b0d5e57028ac52f Mon Sep 17 00:00:00 2001 From: zjp Date: Sat, 18 Feb 2023 22:32:03 +0800 Subject: [PATCH] =?UTF-8?q?update:=20clickhouse=20=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8C=E8=8E=B7=E5=8F=96=20factor.csv=20?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rustdx-cmd/src/io.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rustdx-cmd/src/io.rs b/rustdx-cmd/src/io.rs index 4e9a754..0be7f16 100644 --- a/rustdx-cmd/src/io.rs +++ b/rustdx-cmd/src/io.rs @@ -245,11 +245,14 @@ pub fn previous_csv_table(path: &Option, table: &str) -> Pre /// 读取前收盘价(前 factor )数据 pub fn previous_csv(p: impl AsRef) -> Previous { - Ok(csv::Reader::from_reader(File::open(p)?) + let path = p.as_ref(); + let prev = csv::Reader::from_reader(File::open(path)?) .deserialize::() .filter_map(|f| f.ok()) .map(|f| (f.code.parse().unwrap(), f)) - .collect()) + .collect(); + fs::remove_file(path)?; + Ok(prev) } /// 获取当前最新 factor