Skip to content

froooze/DEXBot2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,177 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DEXBot2

DEXBot2 is an automated market maker for the BitShares decentralized exchange.

Grid Bot Order Distribution

πŸš€ Features

  • Smart Grid Trading β€” automated geometric order grids that rebalance as the market moves, capturing volatility round the clock
  • Adaptive Market Signals β€” real-time trend detection and dynamic weight adjustments keep your grid aligned with market conditions
  • Self-Healing & Reliable β€” automatic recovery from network issues, batch fill processing, and dust cleanup keep the bot running smoothly 24/7
  • Bank-Grade Security β€” AES-encrypted keys, a hardened credential daemon, and RAM-only password handling protect your funds
  • Advanced DeFi Workflows β€” native margin trading, credit offer management, and multi-bot operation via PM2

πŸ”₯ Quick Start

# 1. Clone and install
git clone https://github.com/froooze/DEXBot2.git && cd DEXBot2 && npm install

# 2. Set up your master password, keys and add bots
node dexbot keys
node dexbot bots

# 3. Start with PM2 or directly
node pm2           # For production
node pm2 claw-only  # PM2-managed credential daemon only
node unlock-start  # Single prompt, no PM2
node unlock-start --claw-only  # Credential daemon only for claw workflows
node dexbot start  # For testing

For detailed setup, see Installation or Updating sections below.

Disclaimer β€” Use At Your Own Risk

  • This software is provided "as-is" without warranty.
  • Secure your keys. Never share private keys or passwords.
  • The authors and maintainers are not responsible for losses.

πŸ“₯ Installation

Prerequisites

You'll need Git and Node.js installed.

Windows Users

  1. Install Node.js LTS from nodejs.org (accept defaults, restart after)
  2. Install Git from git-scm.com (accept defaults, restart after)
  3. Verify installation in Command Prompt:
    node --version && npm --version && git --version
    All three should display version numbers.

macOS Users

Use Homebrew to install Node.js and Git:

# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Node.js and Git
brew install node git

Linux Users

Use your package manager:

# Ubuntu/Debian
sudo apt-get update
sudo apt-get install nodejs npm git

# Fedora/RHEL
sudo dnf install nodejs npm git

Clone and Setup DEXBot2

# Clone the repository and switch to folder
git clone https://github.com/froooze/DEXBot2.git
cd DEXBot2

# Install dependencies
npm install

# Set up your master password and keyring
node dexbot keys

# Create and configure your bots
node dexbot bots

Updating DEXBot2

Update to the latest version:

# Run the update script from project root
node dexbot update

The update script automatically:

  • Fetches and pulls the latest code
  • Installs any new dependencies
  • Reloads active PM2 bot processes if running
  • Ensures your profiles/ directory is protected and unchanged
  • Logs all operations to update.log

πŸ”§ Configuration

Bot Options

Configuration options from node dexbot bots, stored in profiles/bots.json:

Parameter Type Description
assetA string Base asset
assetB string Quote asset
name string Friendly name for logging and CLI selection
active boolean false to keep config without running
dryRun boolean Simulate orders without broadcasting
preferredAccount string BitShares account name for trading
startPrice num | str Initial price. "pool" (liquidity pool), "book" (order book), or numeric A/B ratio
minPrice num | str Lower bound. Number or multiplier (e.g., "2x" = startPrice / 2)
maxPrice num | str Upper bound. Number or multiplier (e.g., "2x" = startPrice * 2)
gridPrice num | str | null Reference price for bound calculations. null (uses startPrice), numeric, or AMA keyword ("ama", "ama1"-"ama4")
incrementPercent number Geometric step between layers (e.g., 0.5 = 0.5%)
targetSpreadPercent number Width of the empty spread zone between buy and sell orders
weightDistribution object Sizing: { "sell": 1.0, "buy": 1.0 }. Range -1 (super valley) to 2 (super mountain), 0.5 = neutral
botFunds object Capital: { "sell": "100%", "buy": 1000 }. Numbers or percentage strings
activeOrders object Max concurrent orders per side: { "sell": 5, "buy": 5 }

General Options (Global)

Global settings via node dexbot bots, stored in profiles/general.settings.json:

  • Grid Health: Grid Cache Regeneration % (default 3%), RMS Divergence Threshold % (default 14.3%), AMA Delta Threshold % (default 2.5%)
  • Order Recovery: Partial Dust Threshold % (default 5%), Dust Cancel Delay (default 5 min, -1 = off, 0 = instant)
  • Timing (Core): Blockchain Fetch Interval (default 240 min), Sync Delay (default 500ms), Lock Timeout (default 10s)
  • Timing (Fill): Dedupe Window (default 5s), Cleanup Interval (default 10s), Record Retention (default 60 min)
  • Log Level: debug, info, warn, error. Fine-grained category control via LOGGING_CONFIG (see Logging)
  • Updater: Active (default ON), Branch (auto/main/dev/test), Interval (default 1 day), Time (default 00:00)

🎯 PM2 Process Management

For production use with automatic restart and monitoring. Run node pm2 to start β€” it handles connection, authentication, and PM2 startup automatically.

# Start all active bots with PM2
node pm2

# Start a specific bot
node pm2 <bot-name>

# Start only the credential daemon
node pm2 claw-only

# Or via CLI
node dexbot pm2

# View status and resource usage
pm2 status

# View real-time logs
pm2 logs [<bot-name>]

# Safe restart/reload path for DEXBot-managed PM2 apps
node pm2 restart {all|<bot-name>|dexbot-cred}
node pm2 reload {all|<bot-name>|dexbot-cred}

# Stop processes
pm2 stop {all|<bot-name>}

# Delete processes
pm2 delete {all|<bot-name>}

# Stop/delete only dexbot processes (via wrapper)
node pm2 stop {all|<bot-name>}
node pm2 delete {all|<bot-name>}

# Reset grid (regenerate orders)
node dexbot reset {all|[<bot-name>]}

# Disable a bot in config
node dexbot disable {all|[<bot-name>]}

# Show PM2 wrapper usage
node pm2 help

Bot logs are written to profiles/logs/<bot-name>.log (errors to <bot-name>-error.log).

Security note: node pm2 now unlocks dexbot-cred through a one-shot local bootstrap channel instead of exporting the master password to every PM2 app. Use node pm2 restart ... or node pm2 reload ... for DEXBot-managed PM2 actions. Avoid raw pm2 restart all / pm2 reload all, because dexbot-cred must only be re-unlocked through the wrapper. If dexbot-cred stops, rerun node pm2 or node pm2 restart dexbot-cred.

πŸ“š Documentation

For architecture, fund accounting, rotation mechanics, and development guides, see the docs/ folder:

🀝 Contributing

  1. Fork the repository and create a feature branch
  2. Make your changes and test with npm test
  3. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details

πŸ”— Links

  • Telegram
  • Website
  • Ask DeepWiki
  • Awesome BitShares
  • Reddit

About

Rewrite and optimize the staggered order strategy for market making in JavaScript for BitShares.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages