From 548cad568bb85fed3761235e7c8dd7dfbf4fc258 Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Thu, 9 Apr 2020 01:13:36 -0400 Subject: [PATCH] start windows mod --- src/csv.rs | 7 +++++-- src/windows.rs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/windows.rs diff --git a/src/csv.rs b/src/csv.rs index 601741c..98aec41 100644 --- a/src/csv.rs +++ b/src/csv.rs @@ -252,7 +252,10 @@ fn run(start: Instant, logger: &slog::Logger) -> Result { if trade.ticker != t!(btc-usd) { continue } - if trade.time >= next_hour { // finalize last hour, and prepare for this hour + if trade.time >= next_hour { + // `trade` is past the last hour bucket, so finalize/write last + // hour results, and reset state for this hour + if n_bmex == 0 || n_gdax == 0 { wtr.write_record(&[ &format!("{}", cur_hour), @@ -334,7 +337,7 @@ fn run(start: Instant, logger: &slog::Logger) -> Result { } } - // intentionally skipping the partial hour here + // intentionally skipping handling the partial hour here info!(logger, "finished parsing CSV/calculating query. closing output file"); drop(wtr); diff --git a/src/windows.rs b/src/windows.rs new file mode 100644 index 0000000..5061c59 --- /dev/null +++ b/src/windows.rs @@ -0,0 +1 @@ +use std::collections::VecDeque;