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;