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