Skip to content

Release 0.4.2

Latest

Choose a tag to compare

@froooze froooze released this 24 Dec 15:17
· 1 commit to main since this release
1efe23e

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