Burst
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ use tokio_tungstenite::{MaybeTlsStream, WebSocketStream, connect_async};
|
|||||||
use crate::{
|
use crate::{
|
||||||
account::AccountManager,
|
account::AccountManager,
|
||||||
executor::Executor,
|
executor::Executor,
|
||||||
strategy::{Strategy, strat::Strat},
|
strategy::{Strategy, burst::Burst},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Bot {
|
pub struct Bot {
|
||||||
@@ -69,7 +69,7 @@ impl Bot {
|
|||||||
ws: Mutex::new(connect_async("wss://pumpdev.io/ws").await?.0),
|
ws: Mutex::new(connect_async("wss://pumpdev.io/ws").await?.0),
|
||||||
executor: Mutex::new(Box::new(account.executor())),
|
executor: Mutex::new(Box::new(account.executor())),
|
||||||
accounts: Mutex::new(accounts),
|
accounts: Mutex::new(accounts),
|
||||||
strategy: Mutex::new(Box::new(Strat {
|
strategy: Mutex::new(Box::new(Burst {
|
||||||
tokens: HashMap::new(),
|
tokens: HashMap::new(),
|
||||||
})),
|
})),
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -3,15 +3,26 @@ use std::{collections::HashMap, sync::Arc};
|
|||||||
use crate::{
|
use crate::{
|
||||||
bot::Bot,
|
bot::Bot,
|
||||||
strategy::Strategy,
|
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>,
|
pub tokens: HashMap<String, Token>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[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<()> {
|
async fn on_new_coin(&mut self, bot: Arc<Bot>, token: NewToken) -> anyhow::Result<()> {
|
||||||
self.tokens.insert(
|
self.tokens.insert(
|
||||||
token.mint.clone(),
|
token.mint.clone(),
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
pub mod strat;
|
pub mod burst;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
|||||||
@@ -73,17 +73,6 @@ pub struct NewToken {
|
|||||||
pub sol_amount: f64,
|
pub sol_amount: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Mode {
|
|
||||||
Observing,
|
|
||||||
WaitingForEntry,
|
|
||||||
WaitingForExit,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Token {
|
|
||||||
pub mode: Mode,
|
|
||||||
pub execute_next: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
pub enum TradeType {
|
pub enum TradeType {
|
||||||
#[serde(rename = "buy")]
|
#[serde(rename = "buy")]
|
||||||
|
|||||||
Reference in New Issue
Block a user