Sell percent

This commit is contained in:
2026-08-06 07:58:04 +02:00
parent a91ee5160a
commit e241b2e364
2 changed files with 47 additions and 5 deletions
+10
View File
@@ -26,6 +26,16 @@ pub trait Executor {
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
Ok(()) Ok(())
} }
async fn sell_percent(
&self,
mint: String,
amount: u8,
priority: Decimal,
slippage: u16,
) -> anyhow::Result<()> {
Ok(())
}
} }
impl Account { impl Account {
+37 -5
View File
@@ -40,7 +40,7 @@ impl PumpDev {
&self, &self,
action: &str, action: &str,
mint: String, mint: String,
amount: Decimal, amount: String,
priority: Decimal, priority: Decimal,
slippage: u16, slippage: u16,
denominated_in_sol: bool, denominated_in_sol: bool,
@@ -92,8 +92,15 @@ impl Executor for PumpDev {
priority: Decimal, priority: Decimal,
slippage: u16, slippage: u16,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
self.trade("buy", mint, amount, priority, slippage, true) self.trade(
.await "buy",
mint,
amount.round_dp(3).to_string(),
priority,
slippage,
true,
)
.await
} }
async fn sell( async fn sell(
@@ -103,7 +110,32 @@ impl Executor for PumpDev {
priority: Decimal, priority: Decimal,
slippage: u16, slippage: u16,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
self.trade("sell", mint, amount, priority, slippage, false) self.trade(
.await "sell",
mint,
amount.round_dp(3).to_string(),
priority,
slippage,
false,
)
.await
}
async fn sell_percent(
&self,
mint: String,
amount: u8,
priority: Decimal,
slippage: u16,
) -> anyhow::Result<()> {
self.trade(
"sell",
mint,
format!("{amount}%"),
priority,
slippage,
false,
)
.await
} }
} }