hapetherw / pancakeswap_sniper

11 stars 3 forks source link

pancakeswap_sniper

A simple bot which will buy into every new BNB pair created on PancakeSwap. Built by a programmer for other programmers.

Motivation

Every day, every hour, almost every minute there are new LPs (liquidity pool) created on PancakeSwap. Almost all of them (probably 99%) are rug pulls (meaning 100% loss), but the remaining 1% is worth it in the long run.

Open any newly created LP on PancakeSwap and you will see multiple transactions buying 0.002 BNB worth of tokens right away. This bot does the same thing - buys in as early as possible and later on sells in smalls portions (when profitable).

The idea is that given enough time, bot will build up enough good tokens to generate constant revenue. But to get there you will need to first burn through those rug pulls.

Bot logic

Bot will stop buying into new positions if it's balance drops below 0.05 BNB (MIN_BALANCE).

Requirements

Build & Install

Copy and edit .env file, install npm packages, build, syncModels to initiate DB.

cp .env.sample .env
npm install
npm run build
node build/syncModels.js

NOTE: you might also need to install libpq-dev or postgresql-devel or libpq-devel (depending on your OS) and make with g++:

apt install libpq-dev make g++

Local development

If you need PostgreSQL you can spin it up quickly using Docker:

docker run --name roboape-db -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

Instead of npm run build you can use npm run dev to watch files for changes and compile on-the-fly.

Usage

Don't forget to set your private key (ACCOUNT_PK), BscScan.com API KEY (BSCSCAN_API_KEY) (if BSSCAN_CHECK=true) and database credentials in .env file!

To run bot:

node build/app.js

To dump all profitable tokens:

node build/dumpAll.js

To dump single profitable token provide LP pair address:

node build/dumpAll.js --single 0xLpPairAddressHere

If you want to keep bot running in background, a very easy way is to use PM2 (npm install -g pm2):

pm2 start pm2.json

Notes

Warning

Examples

Several examples of profitable trades: