mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2026-06-22 04:11:27 +10:00
fix: don't check if duration/interval is zero
This commit is contained in:
@@ -343,6 +343,11 @@ export class Bot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async priceMatch(amountIn: TokenAmount, poolKeys: LiquidityPoolKeysV4) {
|
private async priceMatch(amountIn: TokenAmount, poolKeys: LiquidityPoolKeysV4) {
|
||||||
|
if (this.config.priceCheckDuration === 0 || this.config.priceCheckInterval === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const timesToCheck = this.config.priceCheckDuration / this.config.priceCheckInterval;
|
||||||
const profitFraction = this.config.quoteAmount.mul(this.config.takeProfit).numerator.div(new BN(100));
|
const profitFraction = this.config.quoteAmount.mul(this.config.takeProfit).numerator.div(new BN(100));
|
||||||
const profitAmount = new TokenAmount(this.config.quoteToken, profitFraction, true);
|
const profitAmount = new TokenAmount(this.config.quoteToken, profitFraction, true);
|
||||||
const takeProfit = this.config.quoteAmount.add(profitAmount);
|
const takeProfit = this.config.quoteAmount.add(profitAmount);
|
||||||
@@ -351,8 +356,6 @@ export class Bot {
|
|||||||
const lossAmount = new TokenAmount(this.config.quoteToken, lossFraction, true);
|
const lossAmount = new TokenAmount(this.config.quoteToken, lossFraction, true);
|
||||||
const stopLoss = this.config.quoteAmount.subtract(lossAmount);
|
const stopLoss = this.config.quoteAmount.subtract(lossAmount);
|
||||||
const slippage = new Percent(this.config.sellSlippage, 100);
|
const slippage = new Percent(this.config.sellSlippage, 100);
|
||||||
|
|
||||||
const timesToCheck = this.config.priceCheckDuration / this.config.priceCheckInterval;
|
|
||||||
let timesChecked = 0;
|
let timesChecked = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user