This commit is contained in:
2026-08-07 06:28:01 +02:00
parent ab18ac194e
commit 85996c0554
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -25,6 +25,7 @@ async fn try_shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow
match line.to_lowercase().trim() { match line.to_lowercase().trim() {
"exit" | "shutdown" => { "exit" | "shutdown" => {
let _ = tx.send(true); let _ = tx.send(true);
break Ok(());
} }
"save" => { "save" => {
+3 -3
View File
@@ -14,7 +14,7 @@ pub struct TradeLog {
pub opened_at: chrono::DateTime<chrono::Utc>, pub opened_at: chrono::DateTime<chrono::Utc>,
pub closed_at: Option<chrono::DateTime<chrono::Utc>>, pub closed_at: Option<chrono::DateTime<chrono::Utc>>,
pub duration: Option<chrono::TimeDelta>, pub duration_secs: Option<i64>,
pub entry_price_sol: f64, pub entry_price_sol: f64,
pub exit_price_sol: Option<f64>, pub exit_price_sol: Option<f64>,
@@ -44,7 +44,7 @@ impl TradeLog {
exit_price_sol: None, exit_price_sol: None,
pnl_percent: None, pnl_percent: None,
duration: None, duration_secs: None,
exit_reason: None, exit_reason: None,
@@ -63,7 +63,7 @@ impl TradeLog {
self.pnl_percent = Some(pnl); self.pnl_percent = Some(pnl);
self.closed_at = Some(now); 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); self.exit_reason = Some(reason);
} }