better stuff
This commit is contained in:
+8
-3
@@ -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<()> {
|
||||||
loop {
|
|
||||||
let mut stdin = BufReader::new(io::stdin());
|
let mut stdin = BufReader::new(io::stdin());
|
||||||
|
|
||||||
let mut line = String::new();
|
let mut line = String::new();
|
||||||
|
|
||||||
|
loop {
|
||||||
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
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user