better stuff

This commit is contained in:
2026-08-07 06:21:15 +02:00
parent fc32026c86
commit ab18ac194e
2 changed files with 11 additions and 8 deletions
+10 -5
View File
@@ -15,12 +15,11 @@ use tokio::{
use crate::bot::Bot; use crate::bot::Bot;
async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Result<()> { async fn try_shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Result<()> {
let mut stdin = BufReader::new(io::stdin());
let mut line = String::new();
loop { loop {
let mut stdin = BufReader::new(io::stdin());
let mut line = String::new();
stdin.read_line(&mut line).await?; stdin.read_line(&mut line).await?;
match line.to_lowercase().trim() { match line.to_lowercase().trim() {
@@ -56,6 +55,12 @@ async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Re
} }
} }
async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) {
if let Err(e) = try_shutdown_listener(bot, tx).await {
log::error!("{e}");
}
}
#[tokio::main] #[tokio::main]
async fn main() -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> {
let mut builder = env_logger::Builder::from_default_env(); let mut builder = env_logger::Builder::from_default_env();
+1 -3
View File
@@ -14,16 +14,14 @@ 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 entry_price_sol: f64, pub entry_price_sol: f64,
pub exit_price_sol: Option<f64>, pub exit_price_sol: Option<f64>,
pub pnl_percent: Option<f64>, pub pnl_percent: Option<f64>,
pub duration: Option<chrono::TimeDelta>,
pub exit_reason: Option<ExitReason>, pub exit_reason: Option<ExitReason>,
// Conditions when entered
pub unique_buyers: usize, pub unique_buyers: usize,
pub net_sol_flow: f64, pub net_sol_flow: f64,
pub curve_sol: f64, pub curve_sol: f64,