From 85996c0554a364dc6304e679e56367755438f13e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Fri, 7 Aug 2026 06:28:01 +0200 Subject: [PATCH] Fix --- src/main.rs | 1 + src/tradelog.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index f87dda7..40a4cba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,7 @@ async fn try_shutdown_listener(bot: Arc, tx: watch::Sender) -> anyhow match line.to_lowercase().trim() { "exit" | "shutdown" => { let _ = tx.send(true); + break Ok(()); } "save" => { diff --git a/src/tradelog.rs b/src/tradelog.rs index 3b22b8f..0594fdb 100644 --- a/src/tradelog.rs +++ b/src/tradelog.rs @@ -14,7 +14,7 @@ pub struct TradeLog { pub opened_at: chrono::DateTime, pub closed_at: Option>, - pub duration: Option, + pub duration_secs: Option, pub entry_price_sol: f64, pub exit_price_sol: Option, @@ -44,7 +44,7 @@ impl TradeLog { exit_price_sol: None, pnl_percent: None, - duration: None, + duration_secs: None, exit_reason: None, @@ -63,7 +63,7 @@ impl TradeLog { self.pnl_percent = Some(pnl); self.closed_at = Some(now); - self.duration = Some(now.signed_duration_since(self.opened_at)); + self.duration_secs = Some(now.signed_duration_since(self.opened_at).num_seconds()); self.exit_reason = Some(reason); }