swapping of ERC-20 Tokens (buy/sell) based on the market health with bot strategy (condition) - by utilizing MetaMask & Puppeteer
- ChainLink Token, Decentraland, Uniswap, Aave, Curve (CRV), Sushi Token, Avalanche, Wrapped Matic, Wrapped BTC
- Full Details
- Polygon
- usdc (for trading)
- matic (for gas fees)
- Always make sure to have a balance in usdc (used for trading) & matic (for gas fees)
- One trade at a time (for now)
- Compound trading
npm i crypto-bot-trader
Filename as .env in {root}
PREFERRED_NETWORK="matic-mainnet"
# Default: 0
HEADLESS_BROWSER=1
# Sell Options
# Default: -10 (percent as unit)
SELL_CUTLOSS=-5
# Default: 5 (percent as unit)
SELL_PROFIT=1
As for initial setup will require you to input your PrivateKey & password (required upon encryption of your data)
Filename as {jsFile} in {root}
const {metaMask, trader, token} = require('crypto-bot-trader');
(async function() {
// // initiate
await metaMask.build();
const initiatedTrader = new trader({metamask_with_build: metaMask, token: token});
await initiatedTrader.analyzeMarket()
setInterval(async () => {
await initiatedTrader.analyzeMarket()
}, 300000);
// every 5 minutes
})();
node {jsFile}
You can also stop your trading bot on a certain date; This is quite ideal on cloud server
On Env File: Add the following key
CHECKPOINT_DATE="{YOUR_DATE_HERE-> Format: YYYY-MM-DD HH:mm} (24-hour)"
Typical headless in puppeteer with extension of metamask will not work. Alternatively, you can use X Virtual Frame Buffer (xvfb) See Details
const {metaMask, trader, token} = require('crypto-bot-trader');
const Xvfb = require('xvfb');
(async function() {
let xvfb = new Xvfb();
xvfb.startSync();
// // initiate
await metaMask.build();
const initiatedTrader = new trader({metamask_with_build: metaMask, token: token});
await initiatedTrader.analyzeMarket()
setInterval(async () => {
await initiatedTrader.analyzeMarket()
}, 300000);
// every 5 minutes
})();
Setup in cloud server, A simple CLI tool for ensuring that a given script runs continuously/in-background called (forever) See Details
const {metaMask, trader, token} = require('crypto-bot-trader');
const { exec } = require("child_process");
(async function() {
await metaMask.initializeSecurity({pwd: null, is_setup: true});
exec(`forever start headless.js --pwd=1`, (error, stdout, stderr) => {});
})();
Focus on a specific token, this is good especially if the volatility of token is really high.
- focus on matic? wmatic
- focus on bitcoin? wbtc
- foucus on etherium? weth
node {jsFile} --focus=wmatic
After a successful trade, profit will be sent to a specific wallet address. This feature is good if you have bunch of bot traders & you want the profit to be centralized.
node {jsFile} --focus=wmatic --method=sendto
In .env in {root}
WALLET_ADDRESS=
# Exact amount that will be the baseline of trader to prevent draining of wallet; (USDC Currency)
# Ex: 200
BASE_AMOUNT=