Skip to content

Releases: froooze/DEXBot2

Release 0.4.2

24 Dec 15:17
1efe23e

Choose a tag to compare

0.4.2 - Grid Recalculation Fixes & Documentation Updates (2025-12-24)

Fixed

Grid Recalculation in Post-Rotation Divergence Flow

  • Added missing grid recalculation call in post-rotation divergence flow
  • Problem: Orders were losing size information during divergence correction
  • Symptoms: "Skipping virtual X - no size defined" warnings, "Cannot read properties of undefined" batch errors
  • Solution: Added Grid.updateGridFromBlockchainSnapshot() call to post-rotation flow, matching startup and timer divergence paths
  • Impact: Prevents order size loss during divergence correction cycles

PARTIAL Order State Preservation at Startup

  • Fixed state inconsistency during synchronization
  • Problem: PARTIAL orders (those with remaining amounts being filled) were unconditionally converted to ACTIVE state at startup
  • Symptoms: False divergence spikes (700%+), state mismatches between persistedGrid and calculatedGrid, unnecessary grid recalculations
  • Solution: Preserve PARTIAL state across bot restarts if already set; only convert VIRTUAL orders to ACTIVE when matched on-chain
  • Impact: Eliminates false divergence detection and maintains consistent order state across restarts

Redundant Grid Recalculation Removal

  • Eliminated duplicate processing in divergence correction
  • Problem: Grid was being recalculated twice when divergence was detected
  • Symptoms: Double order size updates, unnecessary blockchain fetches, performance inefficiency
  • Solution: Removed redundant recalculation from applyGridDivergenceCorrections()
  • Impact: Single grid recalculation per divergence event, improved performance

BTS Fee Formula Documentation

  • Updated outdated comments and logged output to accurately reflect the complete fee calculation formula
  • Fixed modules/order/grid.js: Changed comment from "2x multiplier" to "4x multiplier"
  • Updated formula in 5 files to show: available = max(0, chainFree - virtuel - cacheFunds - applicableBtsFeesOwed - btsFeesReservation)
  • Fixed modules/order/logger.js: Console output now displays full formula
  • Updated modules/order/manager.js: Changed variable references from "4xReservation" to "btsFeesReservation"
  • Fixed modules/account_bots.js: Default targetSpreadPercent comment now correctly states 4x (not 3x)

Files Changed

  • modules/order/grid.js
  • modules/order/index.js
  • modules/order/logger.js
  • modules/order/manager.js
  • modules/order/runner.js
  • modules/order/utils.js
  • modules/account_bots.js
  • package.json
  • CHANGELOG.md

Commits Included

  • 21c3fb0 - docs: expand v0.4.2 changelog with comprehensive bug fix details
  • 36add08 - release: version 0.4.2
  • 3b65efb - fix: update outdated comments and formulas for BTS fee calculations
  • 873a4f8 - fix: add missing grid recalculation in post-rotation divergence flow
  • 07a2d11 - merge: bring main's BTS fee accounting fixes into dev
  • 7e590f4 - fix: remove redundant grid recalculation in applyGridDivergenceCorrections
  • de9763d - fix: preserve PARTIAL state during startup synchronization

v0.4.1 - Order Consolidation, Grid Edge Handling & Partial Order Fixes

23 Dec 02:27
3ec7f3e

Choose a tag to compare

Release v0.4.1

Key Features

  • Code Consolidation: Eliminated ~1,000 lines of duplicate code

    • Extracted shared DEXBot class to modules/dexbot_class.js
    • Refactored bot.js and dexbot.js to thin wrappers
  • Conditional Rotation: Smart order placement at grid boundaries

    • Creates new orders instead of rotating when below target count
    • Handles grid edge cases gracefully
  • Partial Order Fixes: Enforced state machine invariants

    • PARTIAL orders guaranteed to have size > 0
    • Proper state transitions: ACTIVE → PARTIAL → SPREAD
  • Repository Analytics: Interactive visualization of git history

    • Charts showing added/deleted lines over time
    • Daily and cumulative statistics

Files Changed

  • 10 files changed, 2,101 insertions(+), 1,875 deletions(-)
  • New: modules/dexbot_class.js, scripts/analyze-repo-stats.js, test files

See CHANGELOG.md for complete details.

v0.4.0: Fund Management Consolidation & Automatic Fund Cycling

22 Dec 22:05
8144e31

Choose a tag to compare

Major Features

Automatic Fund Cycling

Available funds now automatically included in cacheFunds before rotation, making grids responsive to new deposits.

  • Newly deposited funds immediately available for grid sizing
  • Grid resizes when deposits arrive, not just after fills
  • More responsive to market changes and new capital inflows

Unified Fund Management

Complete consolidation of pendingProceeds into cacheFunds for simplified fund tracking.

  • Single cacheFunds field for all unallocated funds
  • Cleaner codebase (272 line reduction)
  • Backward compatible: legacy pendingProceeds automatically migrated

Fund Formula Updated:

OLD: available = max(0, chainFree - virtuel - cacheFunds - btsFeesOwed) + pendingProceeds
NEW: available = max(0, chainFree - virtuel - cacheFunds - btsFeesOwed)

Bot Metadata Initialization

Fixed new order files being created with null metadata (name, assetA, assetB).

  • ensureBotEntries() called before any Grid initialization
  • Applied to both bot.js and dexbot.js DEXBot classes

Bug Fixes

  • Partial Order Precision: Fixed floating-point noise in partial fill detection using integer-based subtraction
  • Logger Undefined Variables: Fixed references to removed pendingProceeds variables
  • Grid Regeneration: Now includes available funds in threshold calculation

Breaking Changes

⚠️ pendingProceeds field removed from profiles/orders/.json

Migration Required:

# Backup first
cp -r profiles/orders profiles/orders.backup

# Run migration
node scripts/migrate_pending_proceeds.js

# Restart bots

Backward compatible: legacy pendingProceeds automatically merged into cacheFunds on load.

Configuration Changes

  • GRID_REGENERATION_PERCENTAGE: 1% → 3% (more stable, reduces unnecessary regeneration)
  • DIVERGENCE_THRESHOLD_PERCENTAGE: 1% (unchanged, remains strict for synchronization)

Testing

✅ Fund cycling trigger detection
✅ Crossed rotation with fund cycling
✅ Fee refinement with new fund system
✅ Partial order precision improvements
✅ Bot metadata initialization
✅ Migration script (5 test scenarios)

Resources


Always test with dryRun: true before enabling live trading.

Release 0.3.0

19 Dec 15:56
6084346

Choose a tag to compare

Promille to Percentage Threshold Conversion & Documentation Improvements

Major Features & Changes:

  • Threshold Format: Convert divergence threshold from promille to percentage (0-100% scale)
  • RMS Documentation: Add complete Root Mean Square definition and explanation
  • Input Validation: Comprehensive framework for bot configuration validation
  • Grid Divergence Detection: Automatic regeneration when divergence exceeds threshold
  • Cache Funds Monitoring: Track and manage accumulated proceeds from fills
  • Threshold Documentation: Reference tables and mathematical formulas

Configuration Changes:

  • Grid Divergence Threshold: Now percentage-based (1% by default, configurable)
  • Cache Funds Threshold: 2% by default (when cache reaches 2% of grid capital)
  • Variable Naming: DIVERGENCE_THRESHOLD_PERCENTAGE (was DIVERGENCE_THRESHOLD_Promille)

Documentation Highlights:

  • Percentage threshold reference table (0.01% to 10%)
  • Explanation of 1/(1+n) distribution scaling for uneven errors
  • RMS vs Simple Average comparison with examples
  • Clear formula definitions and threshold trigger logic
  • Configuration examples with current defaults

Technical Details:

  • Grid.js: Updated threshold comparisons for percentage values
  • Constants.js: Reorganized for better readability
  • README: Comprehensive threshold documentation with tables
  • Tests: Expanded test suite for grid comparison
  • All metric calculations now use percentage scale (0.01 = 1% divergence)

Bug Fixes & Improvements:

  • Fixed threshold formula clarity (Threshold vs Metric distinction)
  • Improved RMS definition in brackets for clarity
  • Updated cache funds example values to match defaults
  • Removed misleading percentage conversion comments
  • Consistent terminology throughout documentation

v0.2.0: Startup Grid Reconciliation & Fee Caching

12 Dec 07:34
0cef3a9

Choose a tag to compare

Major Release

What's New

Startup Grid Reconciliation System

  • Intelligent grid recovery at startup with price-based matching
  • Smart regeneration decisions based on on-chain order states
  • Count-based reconciliation for order synchronization

Fee Caching System

  • One-time fee data loading to improve fill processing performance
  • Cache fee deductions to avoid repeated blockchain queries
  • Integrated into fill processing workflows for better efficiency

Enhanced Order Manager

  • Refactored startup grid initialization and synchronization
  • Unified startup order reconciliation logic in bot.js and dexbot.js
  • Improved chain order synchronization with price+size matching
  • Grid recalculation for full grid resync with better parameters

Improved Account Handling

  • Set account info on manager during restart for balance calculations
  • Support percentage-based botFunds configuration at restart
  • Fetch on-chain balances before grid initialization if needed

Bug Fixes

  • Fixed limit_order_update parameter calculation in chain_orders.js
  • Corrected receive amount handling for price-change detection
  • Improved delta calculation when price changes toward/away from market
  • Added comprehensive validation for final amounts after delta adjustment

Testing

  • Comprehensive test coverage for new reconciliation logic
  • Test startup decision logic with various grid/chain scenarios
  • Test TwentyX-specific edge cases and recovery paths

DEXBot2 v0.1.2 - Multi-Bot Fund Allocation & Update Script

10 Dec 17:04
77805d6

Choose a tag to compare

Features

Multi-Bot Fund Allocation

  • Enforce botFunds percentage allocation when multiple bots share an account
  • Each bot respects its allocated percentage of chainFree (what's free on-chain)
  • Bot1 with 90% gets 90% of chainFree, Bot2 with 10% gets 10% of remaining
  • Prevents fund allocation conflicts in shared accounts
  • Applied at grid initialization for accurate startup sizing

Update Script Improvements

  • Removed interactive merge prompts by using git pull --rebase
  • Made update.sh permanently executable via git config
  • Cleaner, fully automated update process

What's Fixed

  • Multi-bot fund allocation conflicts when bots share an account
  • Update script no longer requires interactive merge confirmation
  • Script permissions persist after clone/pull

What's New in v0.1.2

  • ✅ Multi-bot fund allocation for shared accounts
  • ✅ Automatic merge prompt removal in update script
  • ✅ Permanent executable permissions on update.sh
  • ✅ Better handling of percentage-based botFunds with multiple bots

Installation

Fresh Installation

git clone https://github.com/froooze/DEXBot2.git
cd DEXBot2
git checkout v0.1.2
npm install
npm run bootstrap:profiles

Upgrade from v0.1.1

cd ~/DEXBot2
./scripts/update.sh

Documentation

  • README.md - Complete feature overview and configuration guide
  • RELEASE_0.1.2.md - Release notes with detailed upgrade instructions
  • CHANGELOG.md - Full version history

Code Changes

  • File: modules/order/manager.js - Added applyBotFundsAllocation() method
  • File: modules/order/grid.js - Call fund allocation at grid init
  • File: scripts/update.sh - Use git pull --rebase for clean updates
  • Commits: 5a1c967, 04e3834, 14a322a, 04e3834

Testing

Test with multiple bots on the same account:

# In bots.json:
{
  "name": "Bot1",
  "botFunds": { "buy": "90%", "sell": "100%" }
},
{
  "name": "Bot2",
  "botFunds": { "buy": "10%", "sell": "100%" }
}

Security

  • Master password: encrypted, RAM-only
  • Private keys: never written to disk
  • Configuration: use PM2 for production deployments

Support

DEXBot2 v0.1.1 - Minimum Delta Enforcement

10 Dec 16:14
1861166

Choose a tag to compare

Features

Minimum Delta Enforcement

  • Enforce meaningful blockchain updates for price-only order moves
  • When price changes but amount delta is zero, automatically set delta to ±1
  • Prevents wasted on-chain transactions for imperceptible price changes
  • Maintains grid integrity by pushing orders toward spread

What's Fixed

  • Eliminated zero-delta price-only updates that had no economic effect
  • Improved order update efficiency for partial order price adjustments

What's New in v0.1.1

  • ✅ Minimum delta enforcement for price-only updates
  • ✅ Automatic order adjustment toward market center
  • ✅ Reduced wasted blockchain transactions
  • ✅ Better partial order handling

Installation

Fresh Installation

git clone https://github.com/froooze/DEXBot2.git DEXBot2
cd DEXBot2
git checkout v0.1.1
npm install
npm run bootstrap:profiles

Upgrade from v0.1.0

cd ~/DEXBot2
git fetch origin
git checkout v0.1.1
npm install

Documentation

  • README.md - Complete feature overview and configuration guide
  • RELEASE_0.1.1.md - Release notes with detailed upgrade instructions
  • CHANGELOG.md - Full version history

Code Changes

  • File: modules/chain_orders.js
  • Function: buildUpdateOrderOp()
  • Lines Added: 24 (minimum delta enforcement logic)
  • Commit: 10c878f

Testing

Test with dryRun: true before enabling live trading:

node dexbot.js start <bot-name>

Security

  • Master password: encrypted, RAM-only
  • Private keys: never written to disk
  • Configuration: use PM2 for production deployments

Support

DEXBot2 v0.1.0 - Initial Release

10 Dec 14:09
v0.1.0
5b7994a

Choose a tag to compare

DEXBot2 v0.1.0 - Initial Release

This is the first production-ready release of DEXBot2, a sophisticated market making bot for the BitShares Decentralized Exchange.

What's New

Critical Fix: Fill Processing in PM2 Mode

  • Implemented complete 4-step fill processing pipeline for PM2-managed bots
  • Fills are now properly detected, validated, deduplicated, and processed
  • Grid synchronization with blockchain working correctly
  • Order rotation and rebalancing executing atomically
  • 327 new lines of robust fill handling logic

Features

  • Staggered Order Grid Algorithm - Geometric order distribution with configurable weight distribution
  • Dynamic Rebalancing - Automatic order updates after fills with atomic transactions
  • Multi-Bot Support - Run multiple bots via PM2 (single-bot mode via node dexbot for testing)
  • PM2 Process Management - Production-ready orchestration with auto-restart policies
  • Partial Order Handling - Atomic moves for partially-filled orders
  • Fill Deduplication - 5-second deduplication window prevents duplicate processing
  • Master Password Security - Encrypted key storage with RAM-only password handling
  • Price Tolerance - Intelligent blockchain rounding compensation
  • API Resilience - Multi-API support with graceful fallbacks
  • Dry-Run Mode - Safe simulation before live trading

Getting Started

git clone https://github.com/froooze/DEXBot2.git
cd DEXBot2
npm install
node dexbot keys  # Set master password
node dexbot bots  # Configure bots

See README.md for complete documentation.

Usage

Single-Bot Mode (Testing/Development)

node dexbot start my-bot    # Start single bot
node dexbot drystart my-bot # Force dry-run mode
node dexbot keys            # Manage keys
node dexbot bots            # Configure bots

Multi-Bot Mode (Production) - PM2 Required

node pm2.js          # Start all configured bots with PM2
pm2 status           # View bot status
pm2 logs my-bot      # View logs
pm2 stop/restart my-bot

Testing

25+ comprehensive tests included:

npm test

Tests cover: order grid, price derivation, fills, manager state, keys, API connectivity

Documentation

  • README.md - Complete feature overview and CLI reference
  • CHANGELOG.md - Detailed release notes
  • RELEASE_0.1.0.md - Release checklist and publishing guide
  • modules/ - Inline code documentation
  • examples/ - Configuration templates

Important Notes

⚠️ Always test in dry-run mode first before enabling live trading.

Multi-Bot Support: Multiple bots are only supported through PM2 mode (node pm2.js). Direct execution (node dexbot) runs in single-bot mode for testing.

Keep your private keys secure. Do not commit keys to git. Use the profiles/ directory for live configuration.

Support

  • GitHub Issues: Report bugs or feature requests
  • Documentation: See README.md and module documentation
  • Community: BitShares forums and DEX communities

License

ISC License - see LICENSE file for details


Thank you for using DEXBot2! A sophisticated market making bot for the BitShares Decentralized Exchange.