npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

crypto-bot-trader

v2.4.3

Published

swapping of ERC-20 Tokens (buy/sell) based on the market health with bot strategy (condition) - by utilizing metamask & pupeteer

Downloads

4

Readme

CryptoCurrency Bot Trader

swapping of ERC-20 Tokens (buy/sell) based on the market health with bot strategy (condition) - by utilizing MetaMask & Puppeteer

image

List of ERC-20 Tokens Included

  • ChainLink Token, Decentraland, Uniswap, Aave, Curve (CRV), Sushi Token, Avalanche, Wrapped Matic, Wrapped BTC
  • Full Details

Compatible Networks

  • Polygon

Important token/coin

  • usdc (for trading)
  • matic (for gas fees)

Notes

  • 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

Installation

npm i crypto-bot-trader

Usage

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

Security

As for initial setup will require you to input your PrivateKey & password (required upon encryption of your data) image

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}

Extras

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)"

Headless

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

})();

Deploy in cloud server

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 Feature

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

Method: 'sendto'

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=