This commit is contained in:
2026-08-06 21:56:22 +02:00
parent 1dc1402cd2
commit c39700e4c2
4 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ use tokio_tungstenite::{MaybeTlsStream, WebSocketStream, connect_async};
use crate::{
account::AccountManager,
executor::Executor,
strategy::{Strategy, strat::Strat},
strategy::{Strategy, burst::Burst},
};
pub struct Bot {
@@ -69,7 +69,7 @@ impl Bot {
ws: Mutex::new(connect_async("wss://pumpdev.io/ws").await?.0),
executor: Mutex::new(Box::new(account.executor())),
accounts: Mutex::new(accounts),
strategy: Mutex::new(Box::new(Strat {
strategy: Mutex::new(Box::new(Burst {
tokens: HashMap::new(),
})),
}))
@@ -3,15 +3,26 @@ use std::{collections::HashMap, sync::Arc};
use crate::{
bot::Bot,
strategy::Strategy,
types::{Mode, NewToken, Token, Trade},
types::{NewToken, Trade},
};
pub struct Strat {
pub enum Mode {
Observing,
WaitingForEntry,
WaitingForExit,
}
pub struct Token {
pub mode: Mode,
pub execute_next: bool,
}
pub struct Burst {
pub tokens: HashMap<String, Token>,
}
#[async_trait::async_trait]
impl Strategy for Strat {
impl Strategy for Burst {
async fn on_new_coin(&mut self, bot: Arc<Bot>, token: NewToken) -> anyhow::Result<()> {
self.tokens.insert(
token.mint.clone(),
+1 -1
View File
@@ -1,4 +1,4 @@
pub mod strat;
pub mod burst;
use std::sync::Arc;
-11
View File
@@ -73,17 +73,6 @@ pub struct NewToken {
pub sol_amount: f64,
}
pub enum Mode {
Observing,
WaitingForEntry,
WaitingForExit,
}
pub struct Token {
pub mode: Mode,
pub execute_next: bool,
}
#[derive(Debug, Clone, Deserialize)]
pub enum TradeType {
#[serde(rename = "buy")]