swapping of ERC-20 Tokens (buy/sell) based on the market health with bot strategy (condition) - by utilizing metamask & pupeteer
``bash`
npm i crypto-bot-trader`Usage
Filename as .env in {root}bash`
PREFERRED_NETWORK="matic-mainnet"Default: 0
HEADLESS_BROWSER=1Sell Options
Default: -10 (percent as unit)
SELL_CUTLOSS=-5Default: 5 (percent as unit)
SELL_PROFIT=1
Filename as {jsFile} in {root}
`js
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
})();
`
`bash`
node {jsFile}
On Env File: Add the following key
`bash`
CHECKPOINT_DATE="{YOUR_DATE_HERE-> Format: YYYY-MM-DD HH:mm} (24-hour)"
`js
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
})();
`
`js
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) => {});
})();
`
`bash`
node {jsFile} --focus=wmatic
[erc20]: https://etherscan.io/tokens
[erc20List]: https://github.com/marcelooblan2016/crypto-bot-trader/blob/main/src/Records/Migrations/tokenContracts.js
[npmforever]: https://www.npmjs.com/package/forever
[npmxvfb]: https://www.npmjs.com/package/xvfb
bash
node {jsFile} --focus=wmatic --method=sendto
`
In .env in {root}
`bash
WALLET_ADDRESS=
Exact amount that will be the baseline of trader to prevent draining of wallet; (USDC Currency)
Ex: 200
BASE_AMOUNT=
``