From 35f4127d29ee020489524091201ea41529bb5d6d Mon Sep 17 00:00:00 2001 From: Sebastian Rollen Date: Thu, 15 Apr 2021 16:06:57 -0400 Subject: [PATCH] fix latch bug at end of trading day --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 022dfe7..6cc9d56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,7 +1309,7 @@ checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "volatility-harvesting" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 59cd19a..22916aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "volatility-harvesting" -version = "1.0.0" +version = "1.0.1" authors = ["RollenRegistratorBot "] edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index 49a05a8..5a801de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -155,7 +155,11 @@ impl Sink for Receiver { self.unlatch() } } - (false, State::Open { .. }) => self.latch(), + (false, State::Open { next_close }) => { + if next_close > 600 { + self.latch() + } + } (true, State::Closed { .. }) => { warn!("Market closed before unlatching"); self.unlatch()