dexbot 1.6.7 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +3 -3
- package/analysis/README.md +2 -3
- package/analysis/tradingview/README.md +78 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
- package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
- package/dist/analysis/tradingview/grid_reset_config.js +235 -0
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
- package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
- package/dist/dexbot.js +22 -6
- package/dist/market_adapter/core/market_adapter_service.js +14 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
- package/dist/market_adapter/inputs/window_cache.js +302 -48
- package/dist/market_adapter/market_adapter.d.ts +8 -1
- package/dist/market_adapter/market_adapter.js +22 -4
- package/dist/modules/account_bots.js +10 -0
- package/dist/modules/account_orders.d.ts +24 -2
- package/dist/modules/account_orders.js +41 -4
- package/dist/modules/bot_settings.js +10 -1
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.js +1 -0
- package/dist/modules/constants.d.ts +11 -3
- package/dist/modules/constants.js +116 -37
- package/dist/modules/dexbot_class.d.ts +6 -76
- package/dist/modules/dexbot_class.js +0 -32
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
- package/dist/modules/dexbot_cow_runtime.js +4 -87
- package/dist/modules/dexbot_maintenance_runtime.d.ts +15 -1
- package/dist/modules/dexbot_maintenance_runtime.js +59 -11
- package/dist/modules/dexbot_startup_runtime.js +73 -20
- package/dist/modules/dexbot_state_recovery.d.ts +6 -0
- package/dist/modules/dexbot_state_recovery.js +21 -0
- package/dist/modules/order/async_lock.d.ts +8 -0
- package/dist/modules/order/async_lock.js +15 -0
- package/dist/modules/order/genesis_policy.d.ts +162 -0
- package/dist/modules/order/genesis_policy.js +267 -0
- package/dist/modules/order/grid.js +76 -134
- package/dist/modules/order/grid_reconcile.d.ts +9 -0
- package/dist/modules/order/grid_reconcile.js +13 -4
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/manager.d.ts +4 -0
- package/dist/modules/order/manager.js +14 -1
- package/dist/modules/order/sync_engine.d.ts +19 -0
- package/dist/modules/order/sync_engine.js +284 -344
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +64 -1
- package/dist/modules/order/utils/order.d.ts +43 -58
- package/dist/modules/order/utils/order.js +220 -197
- package/dist/modules/order/utils/system.js +8 -1
- package/dist/modules/paths.d.ts +1 -0
- package/dist/modules/paths.js +1 -0
- package/dist/modules/version_notice.d.ts +165 -0
- package/dist/modules/version_notice.js +364 -0
- package/dist/pm2.js +9 -0
- package/dist/unlock.js +28 -0
- package/docs/BITSHARES_ONBOARDING.md +8 -1
- package/docs/COW_INVARIANTS.md +3 -2
- package/docs/DEXBOT_COMPARISON.md +4 -4
- package/docs/EVOLUTION.md +20 -19
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +149 -31
- package/docs/GRID_RECALCULATION.md +12 -0
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +1 -1
- package/modules/README.md +18 -1
- package/package.json +13 -5
- package/scripts/README.md +28 -2
- package/scripts/clear-all.sh +13 -4
- package/scripts/clear-logs.sh +13 -4
- package/scripts/clear-market-adapter.sh +6 -0
- package/scripts/clear-orders.sh +5 -0
- package/scripts/lib/dexbot-paths.sh +108 -0
- package/tests/README.md +11 -3
- package/analysis/account_resolver.ts +0 -161
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
- package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
- package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
- package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
- package/analysis/analyze_dynamic_weight.ts +0 -243
- package/analysis/analyze_kalman.ts +0 -157
- package/analysis/analyze_regime.ts +0 -158
- package/analysis/analyze_regime_windows.ts +0 -470
- package/analysis/analyze_risk_profile.ts +0 -199
- package/analysis/analyze_trade_heatmap.ts +0 -362
- package/analysis/analyze_volatility.ts +0 -182
- package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
- package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
- package/analysis/bot_fitting/shared_utils.ts +0 -52
- package/analysis/bot_key_utils.ts +0 -426
- package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
- package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
- package/analysis/chain_pool.ts +0 -47
- package/analysis/chart_css.ts +0 -62
- package/analysis/chart_ui.ts +0 -105
- package/analysis/chart_utils.ts +0 -210
- package/analysis/fills_source.ts +0 -228
- package/analysis/grid_correction_check.ts +0 -786
- package/analysis/math_utils.ts +0 -53
- package/analysis/price_sources.ts +0 -136
- package/analysis/resolve_bot_accounts.ts +0 -199
- package/analysis/resolve_source.ts +0 -99
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/trade_profitability.ts +0 -1335
- package/analysis/tradingview/analyze_tradingview.ts +0 -280
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
- package/analysis/trend_detection/hurst_analyzer.ts +0 -7
- package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
- package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
- package/analysis/trend_detection/package.json +0 -23
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
- package/analysis/trend_detection/regime_chart_generator.ts +0 -338
- package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
- package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
- package/analysis/tsconfig.json +0 -29
- package/claw/tests/package.json +0 -3
- package/claw/tests/test_claw_bridge.ts +0 -570
- package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
- package/claw/tests/test_claw_chain_layer.ts +0 -739
- package/claw/tests/test_claw_data_flow.ts +0 -525
- package/claw/tests/test_claw_domain_logic.ts +0 -471
- package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
- package/claw/tests/test_claw_mcp_transport.ts +0 -243
- package/claw/tests/test_claw_regressions.ts +0 -711
- package/claw/tests/test_claw_skill_generation.ts +0 -103
- package/claw/tests/test_claw_state_store.ts +0 -44
- package/claw/tests/test_dexbot_profiles.ts +0 -654
- package/claw/tests/test_memu_bridge.ts +0 -189
- package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
- package/claw/tests/test_position_health.ts +0 -343
- package/claw/tests/test_position_manager.ts +0 -429
- package/claw/tests/test_position_manager_watch_health.ts +0 -100
- package/claw/tests/test_short_mpa_strategy.ts +0 -232
- package/dist/analysis/account_resolver.d.ts.map +0 -1
- package/dist/analysis/account_resolver.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/chain_pool.d.ts.map +0 -1
- package/dist/analysis/chain_pool.js.map +0 -1
- package/dist/analysis/chart_css.d.ts.map +0 -1
- package/dist/analysis/chart_css.js.map +0 -1
- package/dist/analysis/chart_ui.d.ts.map +0 -1
- package/dist/analysis/chart_ui.js.map +0 -1
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/fills_source.d.ts.map +0 -1
- package/dist/analysis/fills_source.js.map +0 -1
- package/dist/analysis/grid_correction_check.d.ts.map +0 -1
- package/dist/analysis/grid_correction_check.js.map +0 -1
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/resolve_bot_accounts.js.map +0 -1
- package/dist/analysis/resolve_source.d.ts.map +0 -1
- package/dist/analysis/resolve_source.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
- package/dist/bot.d.ts.map +0 -1
- package/dist/bot.js.map +0 -1
- package/dist/credential-daemon.d.ts.map +0 -1
- package/dist/credential-daemon.js.map +0 -1
- package/dist/dexbot.d.ts.map +0 -1
- package/dist/dexbot.js.map +0 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
- package/dist/market_adapter/ama_signal_runner.js.map +0 -1
- package/dist/market_adapter/candle_utils.d.ts.map +0 -1
- package/dist/market_adapter/candle_utils.js.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
- package/dist/market_adapter/core/config_normalizers.js.map +0 -1
- package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_candles.js.map +0 -1
- package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_client.js.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
- package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
- package/dist/market_adapter/inputs/window_cache.js.map +0 -1
- package/dist/market_adapter/interval_utils.d.ts.map +0 -1
- package/dist/market_adapter/interval_utils.js.map +0 -1
- package/dist/market_adapter/log_format.d.ts.map +0 -1
- package/dist/market_adapter/log_format.js.map +0 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_core.js.map +0 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_runner.js.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
- package/dist/market_adapter/market_adapter.d.ts.map +0 -1
- package/dist/market_adapter/market_adapter.js.map +0 -1
- package/dist/market_adapter/test_helpers.d.ts.map +0 -1
- package/dist/market_adapter/test_helpers.js.map +0 -1
- package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
- package/dist/market_adapter/utils/adapter_client.js.map +0 -1
- package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
- package/dist/market_adapter/utils/atomic_write.js.map +0 -1
- package/dist/market_adapter/utils/chain.d.ts.map +0 -1
- package/dist/market_adapter/utils/chain.js.map +0 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
- package/dist/market_adapter/utils/data_discovery.js.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
- package/dist/market_adapter/utils/file_lock.js.map +0 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
- package/dist/market_adapter/utils/native_history.js.map +0 -1
- package/dist/modules/account_bots.d.ts.map +0 -1
- package/dist/modules/account_bots.js.map +0 -1
- package/dist/modules/account_orders.d.ts.map +0 -1
- package/dist/modules/account_orders.js.map +0 -1
- package/dist/modules/authority_resolver.d.ts.map +0 -1
- package/dist/modules/authority_resolver.js.map +0 -1
- package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/chain_client.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
- package/dist/modules/bitshares-native/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/index.js.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
- package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
- package/dist/modules/bitshares-native/resolvers.js.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/index.js.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
- package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/types.js.map +0 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/signing_client.js.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
- package/dist/modules/bitshares-native/transport.js.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
- package/dist/modules/bitshares_client.d.ts.map +0 -1
- package/dist/modules/bitshares_client.js.map +0 -1
- package/dist/modules/bot_defaults.d.ts.map +0 -1
- package/dist/modules/bot_defaults.js.map +0 -1
- package/dist/modules/bot_settings.d.ts.map +0 -1
- package/dist/modules/bot_settings.js.map +0 -1
- package/dist/modules/bots_file_lock.d.ts.map +0 -1
- package/dist/modules/bots_file_lock.js.map +0 -1
- package/dist/modules/broadcast_failure.d.ts.map +0 -1
- package/dist/modules/broadcast_failure.js.map +0 -1
- package/dist/modules/chain_keys.d.ts.map +0 -1
- package/dist/modules/chain_keys.js.map +0 -1
- package/dist/modules/chain_orders.d.ts.map +0 -1
- package/dist/modules/chain_orders.js.map +0 -1
- package/dist/modules/cli_colors.d.ts.map +0 -1
- package/dist/modules/cli_colors.js.map +0 -1
- package/dist/modules/cli_start_onboarding.d.ts.map +0 -1
- package/dist/modules/cli_start_onboarding.js.map +0 -1
- package/dist/modules/cli_start_output.d.ts.map +0 -1
- package/dist/modules/cli_start_output.js.map +0 -1
- package/dist/modules/config.d.ts.map +0 -1
- package/dist/modules/config.js.map +0 -1
- package/dist/modules/constants.d.ts.map +0 -1
- package/dist/modules/constants.js.map +0 -1
- package/dist/modules/cr_planner.d.ts.map +0 -1
- package/dist/modules/cr_planner.js.map +0 -1
- package/dist/modules/credential_policy.d.ts.map +0 -1
- package/dist/modules/credential_policy.js.map +0 -1
- package/dist/modules/credential_runtime.d.ts.map +0 -1
- package/dist/modules/credential_runtime.js.map +0 -1
- package/dist/modules/credential_session_cache.d.ts.map +0 -1
- package/dist/modules/credential_session_cache.js.map +0 -1
- package/dist/modules/credit_pricing.d.ts.map +0 -1
- package/dist/modules/credit_pricing.js.map +0 -1
- package/dist/modules/credit_runtime.d.ts.map +0 -1
- package/dist/modules/credit_runtime.js.map +0 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
- package/dist/modules/crypto/browser_provider.js.map +0 -1
- package/dist/modules/crypto/index.d.ts.map +0 -1
- package/dist/modules/crypto/index.js.map +0 -1
- package/dist/modules/crypto/node_provider.d.ts.map +0 -1
- package/dist/modules/crypto/node_provider.js.map +0 -1
- package/dist/modules/crypto/provider.d.ts.map +0 -1
- package/dist/modules/crypto/provider.js.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
- package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
- package/dist/modules/crypto/pure_scrypt.js.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
- package/dist/modules/crypto/sync.d.ts.map +0 -1
- package/dist/modules/crypto/sync.js.map +0 -1
- package/dist/modules/daemon_node_health.d.ts.map +0 -1
- package/dist/modules/daemon_node_health.js.map +0 -1
- package/dist/modules/dexbot_class.d.ts.map +0 -1
- package/dist/modules/dexbot_class.js.map +0 -1
- package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_cow_runtime.js.map +0 -1
- package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
- package/dist/modules/dexbot_credential_client.js.map +0 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_fill_runtime.js.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_startup_runtime.js.map +0 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
- package/dist/modules/dexbot_state_recovery.js.map +0 -1
- package/dist/modules/env.d.ts.map +0 -1
- package/dist/modules/env.js.map +0 -1
- package/dist/modules/fund_registry.d.ts.map +0 -1
- package/dist/modules/fund_registry.js.map +0 -1
- package/dist/modules/general_settings.d.ts.map +0 -1
- package/dist/modules/general_settings.js.map +0 -1
- package/dist/modules/graceful_shutdown.d.ts.map +0 -1
- package/dist/modules/graceful_shutdown.js.map +0 -1
- package/dist/modules/grid_price_source.d.ts.map +0 -1
- package/dist/modules/grid_price_source.js.map +0 -1
- package/dist/modules/key_store.d.ts.map +0 -1
- package/dist/modules/key_store.js.map +0 -1
- package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
- package/dist/modules/launcher/adapter_requirement.js.map +0 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
- package/dist/modules/launcher/bot_supervisor.js.map +0 -1
- package/dist/modules/launcher/child_env.d.ts.map +0 -1
- package/dist/modules/launcher/child_env.js.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/credential_daemon.js.map +0 -1
- package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
- package/dist/modules/launcher/credential_secret.js.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
- package/dist/modules/launcher/headless_password.d.ts.map +0 -1
- package/dist/modules/launcher/headless_password.js.map +0 -1
- package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
- package/dist/modules/launcher/launch_modes.js.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
- package/dist/modules/launcher/runtime_entry.js.map +0 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
- package/dist/modules/launcher/status_reporting.js.map +0 -1
- package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
- package/dist/modules/launcher/supervisor_control.js.map +0 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
- package/dist/modules/market_adapter_whitelist.js.map +0 -1
- package/dist/modules/node_connect_policy.d.ts.map +0 -1
- package/dist/modules/node_connect_policy.js.map +0 -1
- package/dist/modules/node_failure_ledger.d.ts.map +0 -1
- package/dist/modules/node_failure_ledger.js.map +0 -1
- package/dist/modules/node_health_cache.d.ts.map +0 -1
- package/dist/modules/node_health_cache.js.map +0 -1
- package/dist/modules/node_manager.d.ts.map +0 -1
- package/dist/modules/node_manager.js.map +0 -1
- package/dist/modules/order/accounting.d.ts.map +0 -1
- package/dist/modules/order/accounting.js.map +0 -1
- package/dist/modules/order/async_lock.d.ts.map +0 -1
- package/dist/modules/order/async_lock.js.map +0 -1
- package/dist/modules/order/export.d.ts.map +0 -1
- package/dist/modules/order/export.js.map +0 -1
- package/dist/modules/order/format.d.ts.map +0 -1
- package/dist/modules/order/format.js.map +0 -1
- package/dist/modules/order/grid.d.ts.map +0 -1
- package/dist/modules/order/grid.js.map +0 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile.js.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
- package/dist/modules/order/index.d.ts.map +0 -1
- package/dist/modules/order/index.js.map +0 -1
- package/dist/modules/order/logger.d.ts.map +0 -1
- package/dist/modules/order/logger.js.map +0 -1
- package/dist/modules/order/logger_state.d.ts.map +0 -1
- package/dist/modules/order/logger_state.js.map +0 -1
- package/dist/modules/order/manager.d.ts.map +0 -1
- package/dist/modules/order/manager.js.map +0 -1
- package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
- package/dist/modules/order/processed_fill_store.js.map +0 -1
- package/dist/modules/order/strategy.d.ts.map +0 -1
- package/dist/modules/order/strategy.js.map +0 -1
- package/dist/modules/order/sync_engine.d.ts.map +0 -1
- package/dist/modules/order/sync_engine.js.map +0 -1
- package/dist/modules/order/utils/math.d.ts.map +0 -1
- package/dist/modules/order/utils/math.js.map +0 -1
- package/dist/modules/order/utils/order.d.ts.map +0 -1
- package/dist/modules/order/utils/order.js.map +0 -1
- package/dist/modules/order/utils/slot.d.ts.map +0 -1
- package/dist/modules/order/utils/slot.js.map +0 -1
- package/dist/modules/order/utils/system.d.ts.map +0 -1
- package/dist/modules/order/utils/system.js.map +0 -1
- package/dist/modules/order/utils/timeout.d.ts.map +0 -1
- package/dist/modules/order/utils/timeout.js.map +0 -1
- package/dist/modules/order/utils/validate.d.ts.map +0 -1
- package/dist/modules/order/utils/validate.js.map +0 -1
- package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
- package/dist/modules/order/utils/withPoolRef.js.map +0 -1
- package/dist/modules/order/working_grid.d.ts.map +0 -1
- package/dist/modules/order/working_grid.js.map +0 -1
- package/dist/modules/path_api.d.ts.map +0 -1
- package/dist/modules/path_api.js.map +0 -1
- package/dist/modules/paths.d.ts.map +0 -1
- package/dist/modules/paths.js.map +0 -1
- package/dist/modules/process_discovery.d.ts.map +0 -1
- package/dist/modules/process_discovery.js.map +0 -1
- package/dist/modules/runtime.d.ts.map +0 -1
- package/dist/modules/runtime.js.map +0 -1
- package/dist/modules/runtime_settings.d.ts.map +0 -1
- package/dist/modules/runtime_settings.js.map +0 -1
- package/dist/modules/settings_merge.d.ts.map +0 -1
- package/dist/modules/settings_merge.js.map +0 -1
- package/dist/modules/socket_json_client.d.ts.map +0 -1
- package/dist/modules/socket_json_client.js.map +0 -1
- package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
- package/dist/modules/storage/browser_adapter.js.map +0 -1
- package/dist/modules/storage/index.d.ts.map +0 -1
- package/dist/modules/storage/index.js.map +0 -1
- package/dist/modules/storage/node_adapter.d.ts.map +0 -1
- package/dist/modules/storage/node_adapter.js.map +0 -1
- package/dist/modules/storage/types.d.ts.map +0 -1
- package/dist/modules/storage/types.js.map +0 -1
- package/dist/modules/types.d.ts.map +0 -1
- package/dist/modules/types.js.map +0 -1
- package/dist/modules/utils/base58check.d.ts.map +0 -1
- package/dist/modules/utils/base58check.js.map +0 -1
- package/dist/modules/utils/build_dir.d.ts.map +0 -1
- package/dist/modules/utils/build_dir.js.map +0 -1
- package/dist/modules/utils/chain_logs.d.ts.map +0 -1
- package/dist/modules/utils/chain_logs.js.map +0 -1
- package/dist/modules/utils/errors.d.ts.map +0 -1
- package/dist/modules/utils/errors.js.map +0 -1
- package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
- package/dist/modules/utils/sanitize_key.js.map +0 -1
- package/dist/modules/utils/text_width.d.ts.map +0 -1
- package/dist/modules/utils/text_width.js.map +0 -1
- package/dist/modules/validate_profiles.d.ts.map +0 -1
- package/dist/modules/validate_profiles.js.map +0 -1
- package/dist/pm2.d.ts.map +0 -1
- package/dist/pm2.js.map +0 -1
- package/dist/scripts/analyze-credit.d.ts.map +0 -1
- package/dist/scripts/analyze-credit.js.map +0 -1
- package/dist/scripts/analyze-git.d.ts.map +0 -1
- package/dist/scripts/analyze-git.js.map +0 -1
- package/dist/scripts/analyze-orders.d.ts.map +0 -1
- package/dist/scripts/analyze-orders.js.map +0 -1
- package/dist/scripts/chart_command.d.ts.map +0 -1
- package/dist/scripts/chart_command.js.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
- package/dist/scripts/diagnose-pool-history.js.map +0 -1
- package/dist/scripts/divergence-calc.d.ts.map +0 -1
- package/dist/scripts/divergence-calc.js.map +0 -1
- package/dist/scripts/dw.d.ts.map +0 -1
- package/dist/scripts/dw.js.map +0 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
- package/dist/scripts/generate_lp_chart.js.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
- package/dist/scripts/native_release_gates.d.ts.map +0 -1
- package/dist/scripts/native_release_gates.js.map +0 -1
- package/dist/scripts/print_grid.d.ts.map +0 -1
- package/dist/scripts/print_grid.js.map +0 -1
- package/dist/scripts/run-tests.d.ts.map +0 -1
- package/dist/scripts/run-tests.js.map +0 -1
- package/dist/scripts/runner.d.ts.map +0 -1
- package/dist/scripts/runner.js.map +0 -1
- package/dist/scripts/sync-version.d.ts.map +0 -1
- package/dist/scripts/sync-version.js.map +0 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
- package/dist/scripts/test-credit-renewal.js.map +0 -1
- package/dist/scripts/tv.d.ts.map +0 -1
- package/dist/scripts/tv.js.map +0 -1
- package/dist/scripts/update.d.ts.map +0 -1
- package/dist/scripts/update.js.map +0 -1
- package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
- package/dist/scripts/update_dist_freshness.js.map +0 -1
- package/dist/scripts/validate_bots.d.ts.map +0 -1
- package/dist/scripts/validate_bots.js.map +0 -1
- package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
- package/dist/scripts/verify-browser-bundle.js.map +0 -1
- package/dist/unlock.d.ts.map +0 -1
- package/dist/unlock.js.map +0 -1
package/dist/unlock.js
CHANGED
|
@@ -51,6 +51,7 @@ import { UPDATER, LAUNCHER } from './modules/constants.js';
|
|
|
51
51
|
import { formatStartupNotice } from './modules/cli_start_output.js';
|
|
52
52
|
import { runtime } from './modules/runtime.js';
|
|
53
53
|
import { PATHS, printRelocationNotices } from './modules/paths.js';
|
|
54
|
+
import { startVersionStatusCheck, flushVersionStatus, printVersionStatusWhenReady } from './modules/version_notice.js';
|
|
54
55
|
import { buildRuntimeScriptArgs } from './modules/launcher/runtime_entry.js';
|
|
55
56
|
import { sendControlCommand } from './modules/launcher/supervisor_control.js';
|
|
56
57
|
import { registerCleanup, setupGracefulShutdown } from './modules/graceful_shutdown.js';
|
|
@@ -134,6 +135,11 @@ function printLauncherSuccess({ botName = null, clawOnly = false, isolated = fal
|
|
|
134
135
|
console.log('='.repeat(50));
|
|
135
136
|
console.log();
|
|
136
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Print the pending "new version available" notice, if there is one.
|
|
140
|
+
* Awaited at every terminal launcher path because `process.exit()` would
|
|
141
|
+
* otherwise truncate the in-flight registry request.
|
|
142
|
+
*/
|
|
137
143
|
function makeFinishGuard(cleanup) {
|
|
138
144
|
let settled = false;
|
|
139
145
|
let timer = null;
|
|
@@ -463,6 +469,18 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
463
469
|
}
|
|
464
470
|
if (!isInternalChild)
|
|
465
471
|
printRelocationNotices();
|
|
472
|
+
// Kick off the passive version check now and await it only at the terminal
|
|
473
|
+
// paths below. It reports the installed version against the published
|
|
474
|
+
// latest — green when current, orange when a newer release exists — and
|
|
475
|
+
// appends the one-time `dexbot update` hint. The password prompt and
|
|
476
|
+
// daemon startup that follow take seconds, which hides the registry
|
|
477
|
+
// round-trip entirely. The promise never rejects and resolves to null when
|
|
478
|
+
// the check is disabled.
|
|
479
|
+
// Internal children (detached supervisor, monolithic bg) stay silent: they
|
|
480
|
+
// would re-probe and re-print a notice the launcher already handled. A
|
|
481
|
+
// --dryrun is a side-effect-free validation, so it never probes or writes
|
|
482
|
+
// the cache either.
|
|
483
|
+
const versionStatus = (isInternalChild || dryrun) ? Promise.resolve(null) : startVersionStatusCheck();
|
|
466
484
|
let effectiveBotName = botName;
|
|
467
485
|
if (creditOnly && !effectiveBotName) {
|
|
468
486
|
const creditBots = listConfiguredBots().filter((b) => b.creditOnly === true && b.active !== false);
|
|
@@ -487,6 +505,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
487
505
|
printLauncherHeader({ botName: effectiveBotName || botName, clawOnly, creditOnly, isolated, dryrun, headless });
|
|
488
506
|
console.log(`DEXBot2 already running in background (PID ${pid}).`);
|
|
489
507
|
console.log('Use `dexbot stat` to inspect it, or `dexbot restart` to restart it.');
|
|
508
|
+
await flushVersionStatus(versionStatus);
|
|
490
509
|
process.exitCode = 0;
|
|
491
510
|
return;
|
|
492
511
|
}
|
|
@@ -546,6 +565,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
546
565
|
if (pid > 0) {
|
|
547
566
|
console.log(`DEXBot2 already running in background (PID ${pid}).`);
|
|
548
567
|
console.log('Use `dexbot stat` to inspect it, or `dexbot restart` to restart it.');
|
|
568
|
+
await flushVersionStatus(versionStatus);
|
|
549
569
|
process.exitCode = 0;
|
|
550
570
|
return;
|
|
551
571
|
}
|
|
@@ -588,16 +608,22 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
588
608
|
child.unref();
|
|
589
609
|
storage.writeFile(MONOLITHIC_PID_FILE, String(child.pid), { mode: 0o600 });
|
|
590
610
|
printLauncherStartupSummary({ botNames: launchedBotNames, mode: 'background' });
|
|
611
|
+
await flushVersionStatus(versionStatus);
|
|
591
612
|
process.exit(0);
|
|
592
613
|
}
|
|
593
614
|
if (clawOnly) {
|
|
594
615
|
printLauncherSuccess({ clawOnly });
|
|
616
|
+
await flushVersionStatus(versionStatus);
|
|
595
617
|
const exitCode = await controller.waitForManagedDaemon();
|
|
596
618
|
process.exitCode = exitCode || 0;
|
|
597
619
|
return;
|
|
598
620
|
}
|
|
599
621
|
if (isolated) {
|
|
600
622
|
if (isDetachedSupervisorChild || forceForegroundIsolated) {
|
|
623
|
+
// Never delay the bot launch on the probe: this branch stays
|
|
624
|
+
// resident for the bot's lifetime, so print when the probe
|
|
625
|
+
// settles instead of awaiting it before supervisor.start().
|
|
626
|
+
printVersionStatusWhenReady(versionStatus);
|
|
601
627
|
process.exitCode = await runIsolated({
|
|
602
628
|
botName: botName ?? undefined,
|
|
603
629
|
botEntry: selectedBot,
|
|
@@ -616,6 +642,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
616
642
|
console.log(`Supervisor PID: ${supervisorPid}`);
|
|
617
643
|
console.log(`Control socket: ${Config.DEXBOT_SUPERVISOR_SOCKET || SOCKET_PATH}`);
|
|
618
644
|
console.log(`Supervisor logs: ${SUPERVISOR_OUT_LOG}`);
|
|
645
|
+
await flushVersionStatus(versionStatus);
|
|
619
646
|
process.exitCode = 0;
|
|
620
647
|
return;
|
|
621
648
|
}
|
|
@@ -688,6 +715,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
688
715
|
if (!updater?.pendingRestart) {
|
|
689
716
|
if (!isMonolithicBgChild) {
|
|
690
717
|
printLauncherStartupSummary({ botNames: launchedBotNames, mode: 'foreground' });
|
|
718
|
+
await flushVersionStatus(versionStatus);
|
|
691
719
|
}
|
|
692
720
|
}
|
|
693
721
|
const onSigint = () => forwardSignal(botProcess, 'SIGINT');
|
|
@@ -492,9 +492,16 @@ overrides the location entirely.
|
|
|
492
492
|
| `dexbot-adapter.log` / `dexbot-adapter-error.log` | Market adapter managed by the runtime |
|
|
493
493
|
| `market_adapter.log` | Standalone adapter mode |
|
|
494
494
|
| `dexbot-update.log` / `dexbot-update-error.log` | Auto-updater |
|
|
495
|
+
| `daemon-audit.jsonl` | Credential daemon audit trail (`sign_denied` and friends) |
|
|
495
496
|
|
|
496
497
|
See [LOGGING.md](LOGGING.md) for log levels, rotation, and JSON output.
|
|
497
|
-
`dexbot clear` empties the logs directory wherever it resolves
|
|
498
|
+
`dexbot clear` empties the logs directory wherever it resolves: every `*.log`, rotated
|
|
499
|
+
`*.log.N` and `*.jsonl*` — so the credential-daemon audit trail
|
|
500
|
+
(`daemon-audit.jsonl` and its rotated siblings) goes too; the preview names it.
|
|
501
|
+
Stop the runtime first (`dexbot stop`): a running daemon keeps writing to the
|
|
502
|
+
unlinked files, so the space is only freed on restart, and the scripts warn you
|
|
503
|
+
when they detect a live runtime. Siblings: `clear-orders`, `clear-market-adapter`,
|
|
504
|
+
`clear-all`.
|
|
498
505
|
|
|
499
506
|
### "I forgot the master password"
|
|
500
507
|
|
package/docs/COW_INVARIANTS.md
CHANGED
|
@@ -69,7 +69,7 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
|
|
|
69
69
|
- A hold run carrying fresh fills (>= `TIMING.BOUNDARY_HOLD_RESYNC_THRESHOLD`) requests a guard-aware structural re-center (`requestStructuralGridResync`, cooldown `TIMING.BOUNDARY_HOLD_RESYNC_COOLDOWN_MS`) instead of holding forever — the heal path when the grid is trailing the market.
|
|
70
70
|
|
|
71
71
|
- `INV-COW-008` Owed fill crawls survive unapplied commits
|
|
72
|
-
- `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots and reserve
|
|
72
|
+
- `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots, reserve slots, and window members — a window that reaches the grid edge is not a reserve, using the same window exclusion every placement picker and `countLiveReserveOrders` apply.
|
|
73
73
|
- `_commitWorkingGrid` clears them only when the plan's boundary was actually applied — a held boundary (`boundaryHeld`), a gate-rejected boundary, and a null boundary all leave them owed.
|
|
74
74
|
- `consumePendingFillCrawls` applies them onto a restored finite boundary; `applyPersistedPendingCrawls` is the shared startup/recovery wrapper used before sync/reconcile; `_clearPendingFillCrawls` drops them when the boundary is re-anchored (grid rebuild via `initializeGrid`, rejected snapshot via `rejectCorruptedGridSnapshot`, persisted snapshot wipe via `AccountOrders.clearGrid`).
|
|
75
75
|
|
|
@@ -208,7 +208,8 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
|
|
|
208
208
|
- Enforced at all six emission sites (CREATE / UPDATE / CREATE-FALLBACK, RECONCILE-CREATE / RECONCILE-UPDATE, STARTUP-CREATE): an off-grid emission is blocked, never broadcast.
|
|
209
209
|
- Range guards (`isChainPriceOutOfGrid`) are bounds checks, not membership checks — they cannot substitute for this invariant.
|
|
210
210
|
- Adoption keeps the slot's own level (a fill/chain price is metadata, not the slot's price); `loadGrid` repairs a pre-existing off-grid slot price at load.
|
|
211
|
-
-
|
|
211
|
+
- A snapshot carrying orders but no usable ladder is **refused** before any mutation (`loadGrid`, before the startup resume decision, and at the persisted-row schema), and the sync entry refuses to reconcile a ladder-less grid at all — without a ladder no consumer has authority for a slot's price, which is what this invariant exists to prevent. The tolerance matcher that used to cover that state has been removed. `config.gridLimits.MISSING_GENESIS_POLICY` picks the response: `'rebuild'` (default, structural resync) or `'halt'` (manual reset). One decision, one module: `modules/order/genesis_policy.ts`.
|
|
212
|
+
- Tests: GPI-001..015 (`tests/test_grid_price_invariant_guard.ts`), GPI-WIRE-001..009 (`tests/test_grid_price_invariant_wiring.ts`), LEGACY-ADOPT/MATERIALIZE/ADOPT-NAME (`tests/test_sync_out_of_grid_defer.ts`), GEN-01..21 (`tests/test_missing_genesis_policy.ts`).
|
|
212
213
|
|
|
213
214
|
---
|
|
214
215
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# DEXBot vs DEXBot2 — Detailed Comparison Report
|
|
2
2
|
|
|
3
3
|
> **Date:** 2026-09-02 *(metrics refreshed against local source trees)*
|
|
4
|
-
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.
|
|
4
|
+
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.8).
|
|
5
5
|
> **Audience:** Developers, contributors, and operators evaluating or migrating between the two projects.
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
| Attribute | DEXBot (original) | DEXBot2 |
|
|
38
38
|
|---|---|---|
|
|
39
|
-
| **Release Track** | 1.0.0 | v1.6.
|
|
39
|
+
| **Release Track** | 1.0.0 | v1.6.8 |
|
|
40
40
|
| **Language** | Python 3.6+ | TypeScript 5.x |
|
|
41
41
|
| **Status** | Released 1.0.0, unmaintained | Active development |
|
|
42
42
|
| **Last Repo Activity** | May 23, 2020 | 2026-09-02 |
|
|
@@ -776,7 +776,7 @@ Where:
|
|
|
776
776
|
|
|
777
777
|
| Metric | DEXBot | DEXBot2 |
|
|
778
778
|
|---|---|---|
|
|
779
|
-
| **Release Track** | 1.0.0 | v1.6.
|
|
779
|
+
| **Release Track** | 1.0.0 | v1.6.8 |
|
|
780
780
|
| **Active Since** | ~2018 | December 2025 |
|
|
781
781
|
| **Last Commit** | May 23, 2020 | 2026-09-02 |
|
|
782
782
|
| **Total Commits** | 2281 | 2,125 (v1.4.25) |
|
|
@@ -882,7 +882,7 @@ The 500× figure is not theoretical: it materializes in production when higher o
|
|
|
882
882
|
| **Security** | ★★★☆☆ | ★★★★★ (AES-256-GCM, credential daemon, authority resolution) | DEXBot2 |
|
|
883
883
|
| **Ease of Setup** | ★★☆☆☆ (PyQt5/PyInstaller/Systemd dependency hell) | ★★★★★ (`npm i -g dexbot`, zero deps) | DEXBot2 |
|
|
884
884
|
| **Accessibility** | ★★★★★ (GUI) | ★★☆☆☆ (CLI only) | DEXBot |
|
|
885
|
-
| **Testing Depth** | ★★★☆☆ | ★★★★★ (
|
|
885
|
+
| **Testing Depth** | ★★★☆☆ | ★★★★★ (305 test files; focused regressions) | DEXBot2 |
|
|
886
886
|
| **Documentation** | ★★★☆☆ | ★★★★★ (architecture/accounting/security/adapter docs) | DEXBot2 |
|
|
887
887
|
| **Dependency Footprint** | ★★☆☆☆ (heavy) | ★★★★★ (0 runtime deps) | DEXBot2 |
|
|
888
888
|
| **Extensibility** | ★★★★★ (plugins) | ★☆☆☆☆ | DEXBot |
|
package/docs/EVOLUTION.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Executive Summary
|
|
4
4
|
|
|
5
|
-
DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.6.
|
|
5
|
+
DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.6.8 release.
|
|
6
6
|
|
|
7
7
|
### Key Milestones
|
|
8
8
|
- **Project Inception**: December 2, 2025
|
|
9
|
-
- **Growth Phase**: 2,
|
|
9
|
+
- **Growth Phase**: 2,300 commits over ~9 active months
|
|
10
10
|
- **Code Maturity**: Evolution from basic utilities to a ~100,000+ LoC intelligent TypeScript system
|
|
11
|
-
- **Stability**: Progression from manual testing to a suite of
|
|
12
|
-
- **Releases**:
|
|
11
|
+
- **Stability**: Progression from manual testing to a suite of 305 automated test files
|
|
12
|
+
- **Releases**: 140 version entries in the changelog (v0.1.0 to v1.6.8)
|
|
13
13
|
|
|
14
14
|
> **Post-1.0.0 "why":** the thematic story behind the hardening releases — root cause, recurring
|
|
15
15
|
> bug families, and lessons — lives in
|
|
@@ -149,27 +149,28 @@ Evolved from a basic README to a comprehensive framework (50+ docs entries, 80%+
|
|
|
149
149
|
|
|
150
150
|
## Version History
|
|
151
151
|
|
|
152
|
-
Compact, era-level view. Per-release detail lives in [CHANGELOG.md](../CHANGELOG.md); the thematic post-1.0.0 story in [ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md](ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md).
|
|
152
|
+
Compact, era-level view; commit counts are `git rev-list --count <tag>..<tag>` over the current history (2026-09-28), so the column sums to 2,194 — the 106 commits before the `v0.1.0` tag are not attributed to an era (2,194 + 106 = 2,300). Per-release detail lives in [CHANGELOG.md](../CHANGELOG.md); the thematic post-1.0.0 story in [ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md](ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md).
|
|
153
153
|
|
|
154
154
|
| Era | Commits | Theme |
|
|
155
155
|
|-----|--------:|-------|
|
|
156
|
-
| v0.1.0 → v0.6.0 |
|
|
157
|
-
| v0.6.0 → v1.0.0 |
|
|
158
|
-
| v1.0.0 → v1.3.3 |
|
|
159
|
-
| v1.3.3 → v1.4.13 |
|
|
160
|
-
| v1.4.13 → v1.4.25 |
|
|
161
|
-
| v1.4.25 → v1.5.3 |
|
|
162
|
-
| v1.5.3 → v1.6.0 |
|
|
163
|
-
| v1.6.0 → v1.6.3 |
|
|
164
|
-
| v1.6.3 → v1.6.4 |
|
|
165
|
-
| v1.6.4 → v1.6.5 |
|
|
156
|
+
| v0.1.0 → v0.6.0 | 892 | Foundation → COW architecture, strategy/sync engine, credential daemon, AMA prototype, credit/MPA runtime |
|
|
157
|
+
| v0.6.0 → v1.0.0 | 650 | Zero-dependency & TS migration, native BitShares, fill-detection overhaul, first stable release |
|
|
158
|
+
| v1.0.0 → v1.3.3 | 210 | Post-stable hardening, PnL analytics, auto-update, broadcast-deadlock fixes, AMA refits, credit-only mode, COW recovery hardening, runtime extraction |
|
|
159
|
+
| v1.3.3 → v1.4.13 | 141 | CJS→ESM completion, concurrency correction, uncertain-broadcast & truncated-read safety, native ESM runtime, broadcast serialization, onboarding |
|
|
160
|
+
| v1.4.13 → v1.4.25 | 129 | Profile-state centralization, consolidation, per-broadcast op cap, grid boundary/recovery hardening, tsx removal, genesis-frozen price-slots, self-trade & orphan fixes |
|
|
161
|
+
| v1.4.25 → v1.5.3 | 45 | Credit overview + whitelist-scoped CR, TradingView tooling, daemon-safe reload, gap-evacuation/rail-hole hardening, sync adoption hardening, boundary ownership |
|
|
162
|
+
| v1.5.3 → v1.6.0 | 39 | Node-failure ledger, grid regeneration, reserve ladder, live-config pickup, owed-crawl persistence, fill-anchored boundary recovery, TradingView overlay |
|
|
163
|
+
| v1.6.0 → v1.6.3 | 17 | Never-run-stale hardening, whitelist range-scaling opt-in, grid-price invariant, shard candle cache, correction-queue staleness, final pre-broadcast pivot gate |
|
|
164
|
+
| v1.6.3 → v1.6.4 | 19 | Fund-driven spread correction, gapSlots+1 batch cap, VIRTUAL RMS divergence, sync-lock log fix, invariant-doc contract, analysis shared modules, window-aware profitability annualisation, portable chart exports, range-threshold restore, dead-code purge, doc consolidation |
|
|
165
|
+
| v1.6.4 → v1.6.5 | 16 | Editor-managed whitelist flags + legacy generator removal, centralized bot defaults/settings docs, log-symmetric range-scaling tilt, AMA gridPrice default + unset → startPrice normalization, Pool default/warn-color cues, Grid Health AMA-slope Δ knob, dynamic-weight chart CLI, update dist-freshness self-heal, launcher worker rename, RMS log tagging |
|
|
166
166
|
| v1.6.5 → v1.6.6 | 13 | Stale-cancellation guard hardening (live ownership, per-plan startup revalidation, COW orphan protection, settlement safety), editor label/menu realignment + colored bot list, grouped CLI help, poolRef aliases + startPrice priority, legacy SMA/MACD/RSI analyzer archived, run-relative candle-cache migration dropped, update dist-freshness tsconfig-exclude fix |
|
|
167
|
-
| v1.6.6 → v1.6.7 |
|
|
167
|
+
| v1.6.6 → v1.6.7 | 11 | Native session/fill-channel recovery (dead-but-open forced reconnect, stale api_id self-heal, COW stale-plan recheck) + clean-process ecosystem regen, `dexbot start` onboarding redirect, key-manager cancellation + empty-vault onboarding link, LAST-FILL-GUARD pivot persistence (provenance-gated snapshot mirror, genesis-bound + TTL + on-grid restore with the boundary, centralized writer, generation invalidation mirroring the owed-crawl ledger) |
|
|
168
|
+
| v1.6.7 → v1.6.8 | 12 | Correction-drain budget + broadcast-region timer/fill deferral (bounded `_gridLock` hold, backlog alarm, stale-flag-safe maintenance deferral, defer bound tied to the watchdog, per-group create yield) and its wall-clock follow-up, PM2 log-capture restore + `pm2-logrotate` enablement, passive new-version notice (bounded registry probe, notify-once latch committed only on display, install-kind hint, independent NOTICE kill switches) + review hardening (dryrun silence, status timeout, latch regression guard, terminal-path flushes, non-blocking print on the isolated-foreground launch path, AbortController-independent hard timeout backstop, centralized flush), changelog-gap close + stale-reference realignment, the genesis-less-snapshot refusal (ladder required at load; `MISSING_GENESIS_POLICY` rebuild/halt, sync-entry assert, persisted-row schema gate), and reserve window-exclusion classification (window members no longer read as reserves at any no-crawl/refill-wire site; legacy numeric `reserveOrders` read-time migration; retained-vs-dropped crawl log fix; shared rail-center helper), plus the legacy tolerance-matcher removal (frozen ladder the only price authority), the npm-tarball trim (explicit analysis asset list, sourcemaps dropped, test sources excluded, legacy Kalman suites rewired into `test:legacy`), the AMA grid-reset replay in the bot charts (with the slope-baseline, non-positive-threshold and config read-back runtime fixes), the `kalS%` default bump (1.0 → 1.11), the incremental/bounded Kibana tail refresh (timestamped coverage, per-gap settle horizon, gap merging, span cap, 48h ceiling), and the 1.4x range-threshold widening |
|
|
168
169
|
|
|
169
170
|
---
|
|
170
171
|
|
|
171
172
|
**Report Originally Generated**: February 19, 2026
|
|
172
|
-
**Last Updated**: September
|
|
173
|
-
**Total Commits**: 2,
|
|
174
|
-
**Date Range**: December 2, 2025 – September
|
|
173
|
+
**Last Updated**: September 28, 2026
|
|
174
|
+
**Total Commits**: 2,300
|
|
175
|
+
**Date Range**: December 2, 2025 – September 28, 2026
|
|
175
176
|
**Repository**: DEXBot2 (BitShares DEX Trading Bot)
|
|
@@ -801,4 +801,4 @@ To prevent "Time-of-Check to Time-of-Use" errors:
|
|
|
801
801
|
**TOCTOU protection in `processFillAccounting`.** `_buildBtsDeferredRefundAdjustment` reads `btsFeeState` from `mgr.orders` while the order lock is held — the lock is acquired before accounting runs, and the POST-RESET and BOOTSTRAP tracked-fill accounting paths follow the same locking pattern.
|
|
802
802
|
|
|
803
803
|
---
|
|
804
|
-
*Technical Reference for DEXBot2 v1.6.
|
|
804
|
+
*Technical Reference for DEXBot2 v1.6.8 release*
|
|
@@ -232,26 +232,27 @@ adopt into `slot--17` (via `slotIndexForPrice`) and **let the slot keep
|
|
|
232
232
|
placed*; it is not the slot's price, and it disappears on the next
|
|
233
233
|
rotation/cancel.
|
|
234
234
|
|
|
235
|
-
This is what
|
|
236
|
-
`
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
235
|
+
This is what `adoptChainOrderIntoSlot` does — it sets `orderId`, `state`,
|
|
236
|
+
`size`, `rawOnChain` and **never touches `price`**. It used to be stated on two
|
|
237
|
+
paths (the no-genesis legacy fallback got it wrong); the legacy path is gone, so
|
|
238
|
+
there is now exactly one adoption path.
|
|
239
|
+
|
|
240
|
+
**The rule is stated explicitly, and warns when it is broken.** Keeping the
|
|
241
|
+
slot's price by *not assigning it* is correct but invisible: nothing would catch
|
|
242
|
+
a later edit that reintroduced `price: chainOrder.price`, and nothing would
|
|
243
|
+
catch a slot whose price was **already** corrupted before it reached adoption —
|
|
244
|
+
it would simply be re-adopted. `adoptedSlotKeepsItsOwnPrice` runs on adoption
|
|
245
|
+
and warns, naming the slot, expected level and drift, when an adopted slot's
|
|
246
|
+
price is not its genesis level. A manager with no ladder is a fault, not a
|
|
247
|
+
pass: the check reports it rather than waving the adoption through.
|
|
246
248
|
|
|
247
249
|
That check is deliberately **non-blocking**: the chain order is real and must be
|
|
248
250
|
tracked, so refusing the adoption would strand it untracked on the book —
|
|
249
251
|
strictly worse than the corrupt slot it reports. It is a signal, not a gate.
|
|
250
252
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
path. Each is mutation-tested against its own path.
|
|
253
|
+
ADOPT-001 pins the rule on the nearest-slot path with a resting price that is
|
|
254
|
+
clearly off the level, and ADOPT-NAME-001 pins that a correct adoption does not
|
|
255
|
+
warn.
|
|
255
256
|
|
|
256
257
|
## Healing a pre-existing off-grid slot price
|
|
257
258
|
|
|
@@ -279,11 +280,11 @@ assertion.
|
|
|
279
280
|
### After a repair: expect one churn cycle
|
|
280
281
|
|
|
281
282
|
A repair changes `slot.price`, so any *resting* order still sitting at the old
|
|
282
|
-
corrupt price
|
|
283
|
-
price
|
|
284
|
-
repair is expected, not a new fault**. Operators seeing
|
|
285
|
-
immediately following a `[GENESIS] Slot … price repaired
|
|
286
|
-
watching the repair settle.
|
|
283
|
+
corrupt price now maps to a different ladder level than its slot. Pass 1 queues
|
|
284
|
+
it as a price mismatch and the correction re-prices it onto the slot, so **one
|
|
285
|
+
cycle of churn after a repair is expected, not a new fault**. Operators seeing
|
|
286
|
+
a burst of corrections immediately following a `[GENESIS] Slot … price repaired
|
|
287
|
+
from genesis` line are watching the repair settle.
|
|
287
288
|
|
|
288
289
|
### Repair only runs at load — so a persistent rejection escalates
|
|
289
290
|
|
|
@@ -307,11 +308,11 @@ not "rejected N times ever".
|
|
|
307
308
|
|
|
308
309
|
**Why not heal in place** (`slot.price = expected` at rejection time): the
|
|
309
310
|
checker does compute the right value, but silently rewriting it destroys the
|
|
310
|
-
diagnostic signal. The streak is what distinguishes the
|
|
311
|
-
|
|
312
|
-
unknown live writer. Auto-heal makes all
|
|
313
|
-
escalate on persistence; consider an in-place fast path only after a
|
|
314
|
-
in-process corruption is the common case.
|
|
311
|
+
diagnostic signal. The streak is what distinguishes the corruption sources —
|
|
312
|
+
a pre-ladder snapshot, the ladder-migration cross-check, a genesis-identity
|
|
313
|
+
mismatch, or an unknown live writer. Auto-heal makes them all look identical.
|
|
314
|
+
Count first, escalate on persistence; consider an in-place fast path only after a
|
|
315
|
+
soak shows in-process corruption is the common case.
|
|
315
316
|
|
|
316
317
|
The streak is **bot-scoped**, not module-scoped: the monolithic runtime
|
|
317
318
|
(`dexbot.ts`) runs every active bot in one process, so a shared count would pool
|
|
@@ -407,10 +408,115 @@ distinguishable from the hold record alone. The blast radius is bounded by
|
|
|
407
408
|
the stranded-reasons allow-list above. The designated home for a real signal
|
|
408
409
|
is divergence telemetry built on `calculateGridSideDivergenceMetric`.
|
|
409
410
|
|
|
411
|
+
## The genesis-less state: refused at load, rebuilt or halted
|
|
412
|
+
|
|
413
|
+
**A grid with no price ladder is not a degraded grid — it is an undefined one.**
|
|
414
|
+
Every consumer of the invariant reads `priceForSlot(idx, genesis)`, and each one
|
|
415
|
+
silently degrades without it: nearest-slot adoption, `computeOutOfToleranceDriftTag`,
|
|
416
|
+
the materialize descriptor-price fallback, `resolveLiveReserveEdgeAnchorPrice`
|
|
417
|
+
tiers 3/4, and the `isSlotInRail` fail-open. That degradation is the tolerance
|
|
418
|
+
matcher, which is exactly the path on which an off-grid price becomes grid
|
|
419
|
+
evidence. So the ladder is treated as a **required** part of a snapshot, not a
|
|
420
|
+
nice-to-have.
|
|
421
|
+
|
|
422
|
+
The trigger is narrow: only a *pre-v1.4.25* snapshot (one persisted before the
|
|
423
|
+
genesis was written) can reach it. Given such a snapshot:
|
|
424
|
+
|
|
425
|
+
| Trigger | Condition | Verdict |
|
|
426
|
+
|---|---|---|
|
|
427
|
+
| T1 | config rail matches the persisted slots | migration ladder is adopted (unchanged) |
|
|
428
|
+
| T2 | > `MISSING_GENESIS_MISMATCH_RATIO` (50%) of slots mismatch the config rail | **refused** — the config was edited, so the derived rail is a different generation |
|
|
429
|
+
| T3 | rail config is not numeric yet (`startPrice: "pool"`, `minPrice: "2x"`) | **refused** — nothing can be built until `initializeGrid` derives them |
|
|
430
|
+
| T4 | the ladder build throws | **refused** |
|
|
431
|
+
|
|
432
|
+
### The decision lives in one place
|
|
433
|
+
|
|
434
|
+
`modules/order/genesis_policy.ts` owns the single question "can this snapshot
|
|
435
|
+
have a ladder?" (`resolvePersistedGenesis`) and the policy
|
|
436
|
+
(`resolveOnMissingGenesisPolicy`). Three call sites, one verdict — they cannot
|
|
437
|
+
drift:
|
|
438
|
+
|
|
439
|
+
| Site | Mechanism | What it does on a refusal |
|
|
440
|
+
|---|---|---|
|
|
441
|
+
| `grid.loadGrid` | **E1**, source choke point | throws `MissingGenesisError` **before any mutation** (no asset init, no fund reset, no boundary restore) |
|
|
442
|
+
| `dexbot_startup_runtime` | **E3**, startup gate | regenerates the grid (`initializeGrid` re-derives prices, reconcile is update-first) or aborts startup |
|
|
443
|
+
| `order/sync_engine._assertGenesisInvariant` | **E2**, defence in depth | **refuses the sync** (empty result, nothing touched), reports once per generation, counts, and requests a structural resync — never throws |
|
|
444
|
+
| `AccountOrders.loadGenesis` | schema | a row with empty/absent `priceLevels` is not a ladder and is not returned |
|
|
445
|
+
|
|
446
|
+
### Policy
|
|
447
|
+
|
|
448
|
+
`config.gridLimits.MISSING_GENESIS_POLICY`:
|
|
449
|
+
|
|
450
|
+
- **`'rebuild'` (default)** — refuse the snapshot and rebuild a clean ladder
|
|
451
|
+
through the existing resync machinery. Deterministic, no operator action, and
|
|
452
|
+
fund-safe in the same sense a manual reset is: reconcile is update-first, so
|
|
453
|
+
only true surplus is cancelled and out-of-grid orders are held per the
|
|
454
|
+
out-of-bounds policy. Live orders are re-slotted — the same net effect the
|
|
455
|
+
operator would get from `dexbot reset`, which is why `'halt'` exists.
|
|
456
|
+
- **`'halt'`** — refuse to start; a human must run a manual grid reset. Strongest
|
|
457
|
+
fund safety (nothing is cancelled without consent), but the bot stays down until
|
|
458
|
+
someone acts, which is why it is opt-in.
|
|
459
|
+
|
|
460
|
+
Anything other than `'halt'` falls back to `'rebuild'`.
|
|
461
|
+
|
|
462
|
+
### Routing per caller
|
|
463
|
+
|
|
464
|
+
- **startup resume** — the E3 gate fires *before* the resume/regenerate decision,
|
|
465
|
+
so a ladder-less snapshot is regenerated rather than half-loaded.
|
|
466
|
+
- **price-match resume** (`attemptResumePersistedGridByPriceMatch`) — the throw is
|
|
467
|
+
caught and reported as "not resumed", which routes to regeneration.
|
|
468
|
+
- **recovery reload** — the throw is caught and logged with its reason. Under
|
|
469
|
+
`'rebuild'` it is returned as a failed reload, which is the existing signal for
|
|
470
|
+
"escalate to structural resync"; under `'halt'` the failure carries `halt: true`
|
|
471
|
+
so the maintenance resync path suppresses the automatic rebuild and waits for
|
|
472
|
+
the operator.
|
|
473
|
+
- **runtime E2 assert** — never fatal: it aborts the sync instead of reconciling a grid whose slots have no price authority, and it exists to make a future bypass loud.
|
|
474
|
+
|
|
475
|
+
Observability is part of the design, not an afterthought: the fault is recorded on
|
|
476
|
+
the manager as `_missingGenesis` (reason, detail, mismatch ratio, policy) and
|
|
477
|
+
cleared by the next successful load or grid build, so a log read tells an operator
|
|
478
|
+
whether T2-T4 ever fire in the wild.
|
|
479
|
+
|
|
480
|
+
### The tolerance matcher is gone
|
|
481
|
+
|
|
482
|
+
The consumers listed above no longer degrade, because there is nothing left to
|
|
483
|
+
degrade *into*:
|
|
484
|
+
|
|
485
|
+
| Former legacy behaviour | Now |
|
|
486
|
+
|---|---|
|
|
487
|
+
| pass-2 tolerance adoption, incl. the widened `ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER` spread-orphan band | nearest-slot only; no ladder means the orphan is reported as `no-genesis-deferred` and nothing is touched |
|
|
488
|
+
| pass-1 price-equality / duplicate-swap fallback to `calculatePriceTolerance` | level identity (`chainPriceOnSameLevel`: both prices map to the same slot), integer equality only when unjudgeable; a few-quanta rest-drift within one level is left in place (no re-price) until the order rotates |
|
|
489
|
+
| correction-queue staleness matched by tolerance | `priceSlotEqual` against the slot's own level, and a ladder-less entry is dropped |
|
|
490
|
+
| `computeOutOfToleranceDriftTag` + `price-drift-orphan` auto-cancel (`PRICE_DRIFT_TOLERANCE_MULTIPLIER`) | removed — an off-grid order is HELD (`out-of-grid-deferred`) and resolved structurally, never cancelled off a fuzzy price diff |
|
|
491
|
+
| `findMatchingGridOrderByOpenOrder` | removed (its last production caller was the pass-2 legacy block; the cancelOrder linkage matches by `orderId`) |
|
|
492
|
+
| `resolveLiveReserveEdgeAnchorPrice` tiers 2/3 (live slot extreme, config bound) | ladder extreme only; a ladder-less manager returns `null` (the live resolver no longer computes a config bound — consumers that want one, e.g. `reserveEdgeIdSet`, resolve it themselves) |
|
|
493
|
+
| materialize descriptor-price fallback for a `slot-N` id | kept only for an unparseable id; a `slot-N` id with no ladder logs `error` and requests a structural resync |
|
|
494
|
+
|
|
495
|
+
**E2 is fail-closed.** `syncFromOpenOrders` calls `_assertGenesisInvariant`
|
|
496
|
+
before anything else and, when slots exist without a ladder, returns an empty
|
|
497
|
+
result — no locks, no adoption, no correction queued — after logging at `error`
|
|
498
|
+
and requesting the structural resync that re-derives the ladder. It used to log
|
|
499
|
+
and continue *into* the tolerance matcher; that continuation is what made the
|
|
500
|
+
legacy path a live safety net, and it is what this removal gives up. The load
|
|
501
|
+
gates (E1/E3) own the fail-closed decision, so the state is unreachable through
|
|
502
|
+
a supported flow.
|
|
503
|
+
|
|
504
|
+
### Rejected alternatives
|
|
505
|
+
|
|
506
|
+
- **Adopt the config-derived ladder despite a >50% mismatch** (mass-virtualizing
|
|
507
|
+
live tracking and persisting a mismatched genesis) — corruption risk, rejected.
|
|
508
|
+
- **Derive the ladder from the persisted slot prices** — a truncated persisted
|
|
509
|
+
array would permanently shrink it.
|
|
510
|
+
- **Keep loading "as-is without a ladder"** — this is the state that was removed.
|
|
511
|
+
- **Keep the tolerance matcher as the E2 fallback** — it is the corruption path
|
|
512
|
+
the invariant exists to close; E2 refuses instead.
|
|
513
|
+
|
|
410
514
|
## Key constants (`modules/constants.ts`, `TIMING`)
|
|
411
515
|
|
|
412
516
|
| Constant | Value | Meaning |
|
|
413
517
|
|---|---|---|
|
|
518
|
+
| `MISSING_GENESIS_POLICY` | `'rebuild'` | `'rebuild'` (auto) or `'halt'` (manual reset) when a snapshot has no usable ladder |
|
|
519
|
+
| `MISSING_GENESIS_MISMATCH_RATIO` | 0.5 | Share of slots that must match the config rail before a migrated ladder is adopted |
|
|
414
520
|
| `GRID_PRICE_INVARIANT_RESYNC_THRESHOLD` | 3 | Consecutive rejecting batches per slot before a structural resync |
|
|
415
521
|
| `GRID_PRICE_INVARIANT_RESYNC_COOLDOWN_MS` | 15 min | Bounds repeat resyncs for the same corruption |
|
|
416
522
|
| `DEFERRED_HOLD_ESCALATE_MS` | 24 h | Age at which a stranded deferred hold escalates |
|
|
@@ -433,6 +539,8 @@ is divergence telemetry built on `calculateGridSideDivergenceMetric`.
|
|
|
433
539
|
| `[HOLD]` enrichment + slow re-warn | **landed** |
|
|
434
540
|
| Final pre-broadcast pivot gate re-checks BUILT ops on a refreshed pivot | **landed** |
|
|
435
541
|
| Fill-guard pivot persisted with the grid snapshot (provenance: fills only) | **landed** |
|
|
542
|
+
| Snapshot without a usable ladder refused at load; rebuild by default, `halt` opt-in | **landed** |
|
|
543
|
+
| Legacy tolerance matcher removed; E2 fail-closed (refuse the sync) instead of warning and continuing | **landed** |
|
|
436
544
|
| Pivot restored with the boundary (TTL → genesis → on-grid validation chain) | **landed** |
|
|
437
545
|
| Pivot mutation behind one provenance-tagged writer (`setLastFillPivot`) | **landed** |
|
|
438
546
|
| Grid generation invalidates the pivot (in-memory + persisted row) | **landed** |
|
|
@@ -452,12 +560,17 @@ reported.
|
|
|
452
560
|
rotation price is derived from the destination's genesis level (GPI-013), and
|
|
453
561
|
the derivation declines — rather than inventing a price — with no ladder
|
|
454
562
|
(GPI-014) or an out-of-ladder index (GPI-015).
|
|
455
|
-
- **Unit:**
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
keeps the slot's own level
|
|
460
|
-
(ADOPT-NAME-001)
|
|
563
|
+
- **Unit:** an out-of-grid order is held, not adopted, and keeps its genesis
|
|
564
|
+
price (ADOPT-001/002); the materialize path derives the slot price AND order
|
|
565
|
+
type from genesis (MATERIALIZE-001/003) and, on a ladder-less grid, still
|
|
566
|
+
tracks the placed order but logs the undefined grid at `error` and requests a
|
|
567
|
+
structural resync (MATERIALIZE-002); adoption keeps the slot's own level and
|
|
568
|
+
does not warn when correct (ADOPT-NAME-001)
|
|
569
|
+
(`tests/test_sync_out_of_grid_defer.ts`).
|
|
570
|
+
- **Unit:** pass-2 orphan classification is nearest-slot only — out-of-grid is
|
|
571
|
+
held, an in-grid orphan adopts into the slot its price maps to and keeps that
|
|
572
|
+
slot's level, an occupied level is a cancel-only duplicate, and a ladder-less
|
|
573
|
+
grid refuses the whole sync (`tests/test_sync_excess_orphan.ts`).
|
|
461
574
|
- **Unit:** pre-broadcast drift is reported at `warn` and the op is built from
|
|
462
575
|
the *planned* price (`tests/test_cow_orchestration_fixes.ts`).
|
|
463
576
|
- **Unit:** pivot snapping and off-ladder refusal
|
|
@@ -469,6 +582,11 @@ reported.
|
|
|
469
582
|
- **Unit:** pivot snapshot round-trip and its restore validation chain
|
|
470
583
|
(`tests/test_last_fill_pivot_persistence.ts`, LFP-1..8) — shape gates,
|
|
471
584
|
provenance, TTL, genesis binding, off-ladder refusal, full-family reset.
|
|
585
|
+
- **Unit:** the missing-genesis policy — T1 adoption, T2/T3/T4 refusals, the
|
|
586
|
+
ratio boundary, policy resolution, `loadGrid` refusing before it mutates
|
|
587
|
+
anything (and honouring `'halt'`), the `loadGenesis` schema gate, and the E2
|
|
588
|
+
sync-entry assert and the `'halt'` suppression of the recovery resync
|
|
589
|
+
(`tests/test_missing_genesis_policy.ts`, GEN-01..21).
|
|
472
590
|
- **External gate:** `analysis/grid_correction_check.ts` — target 0 sustained
|
|
473
591
|
violations at 168h/720h. **The baseline is NOT clean:** 4 of 5 bots were
|
|
474
592
|
non-zero over 7 days, so this is a live signal, not a historical one.
|
|
@@ -620,3 +620,15 @@ Removed trigger file.
|
|
|
620
620
|
- `modules/market_adapter_whitelist.ts` — Whitelist storage/read helpers (the bot editor's `6) Adapter` reads and writes the same file)
|
|
621
621
|
- `profiles/general.settings.json` — User-editable configuration
|
|
622
622
|
- `profiles/bots.json` — Per-bot configuration including AMA
|
|
623
|
+
|
|
624
|
+
## Visualizing the AMA Triggers (§3 and §4)
|
|
625
|
+
|
|
626
|
+
`dexbot tv <bot>` (and `analysis/tradingview/analyze_tradingview.js`) replays the
|
|
627
|
+
two market-adapter recentering triggers over the chart's candle history and draws
|
|
628
|
+
the accepted grid center, the range that center would own, and one marker per
|
|
629
|
+
reset (amber = AMA-price Δ, cyan = AMA-slope Δ, grey = first snapshot). The
|
|
630
|
+
thresholds are resolved through the same constants → `general.settings` →
|
|
631
|
+
`market_adapter_settings` chain the adapter uses, so the chart shows where the
|
|
632
|
+
grid would actually have moved — handy for tuning `AMA_DELTA_THRESHOLD_PERCENT`
|
|
633
|
+
and `AMA-Slope Δ` before changing them. Details:
|
|
634
|
+
[analysis/tradingview/README.md](../analysis/tradingview/README.md#grid-reset-simulation).
|
package/docs/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This directory contains the comprehensive technical documentation for the DEXBot2 trading bot. It is designed to guide developers from high-level architecture down to the nuances of fund accounting and state management.
|
|
4
4
|
|
|
5
|
-
**Version context:** v1.6.
|
|
5
|
+
**Version context:** v1.6.8 (released).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -210,6 +210,8 @@ While these docs explain the *why*, the *how* lives in the code. See the full [m
|
|
|
210
210
|
- **`modules/order/processed_fill_store.ts`**: Processed fill dedupe tracker and persistence batching
|
|
211
211
|
- **`modules/order/strategy.ts`**: Grid rebalancing, order activation, consolidation, rotation, and spread management
|
|
212
212
|
- **`modules/order/sync_engine.ts`**: Blockchain synchronization, fill detection, order reconciliation
|
|
213
|
+
- **`modules/order/genesis_policy.ts`**: Missing-ladder refusal and the `MISSING_GENESIS_POLICY` rebuild/halt decision ([GRID_PRICE_INVARIANT.md](GRID_PRICE_INVARIANT.md))
|
|
214
|
+
- **`modules/version_notice.ts`**: Passive installed-vs-published version probe and the single status-line renderer used by `start`/`pm2`/`status`
|
|
213
215
|
- **`modules/credit_runtime.ts`**: Bot-scoped debt workflow executor (MPA and credit offer accept/repay/reborrow)
|
|
214
216
|
- **`modules/cr_planner.ts`**: Shared collateral-ratio math layer for debt-first planning
|
|
215
217
|
- **`modules/order/utils/math.ts`**: Precision conversions, RMS divergence calculation, fund allocation math
|
package/docs/WORKFLOW.md
CHANGED
|
@@ -209,7 +209,7 @@ DEXBot2 runs as a **monolithic daemon** (`dexbot start`). This is the production
|
|
|
209
209
|
recommended mode:
|
|
210
210
|
|
|
211
211
|
- **Single process** — no PM2, no separate credential daemon management
|
|
212
|
-
- **
|
|
212
|
+
- **Optional auto-update** — `dexbot update` (or `UPDATER.ACTIVE` in general settings, **default off**) pulls, builds and restarts cleanly; by default the bot only *reports* that a newer release exists
|
|
213
213
|
- **Crash restart** — background mode re-spawns on failure
|
|
214
214
|
- **Per-bot log files** — each bot logs to `<profiles>/logs/<bot>.log` (`~/.config/dexbot2/profiles/logs` by default)
|
|
215
215
|
- **Built-in daemon** — the credential daemon is managed internally
|
|
@@ -260,12 +260,23 @@ the canonical name is preferred in scripts and docs.
|
|
|
260
260
|
| `dexbot reload` | `reloadall` | Reload the monolithic runtime without touching the credential daemon (unlock mode) |
|
|
261
261
|
| `dexbot restart` | `restartall` | Restart the monolithic runtime (unlock mode, re-unlocks credential daemon) |
|
|
262
262
|
| `dexbot delete` | — | Shut down and clean up the monolithic runtime (unlock mode) |
|
|
263
|
-
| `dexbot clear` | — |
|
|
264
|
-
| `dexbot clear-orders` | — |
|
|
265
|
-
| `dexbot clear-market-adapter` | — |
|
|
266
|
-
| `dexbot clear-all` | — |
|
|
263
|
+
| `dexbot clear` | — | Delete `*.log`, rotated `*.log.*` and `*.jsonl*` from the logs directory (`<profiles>/logs`) |
|
|
264
|
+
| `dexbot clear-orders` | — | Delete all persisted order files (`<profiles>/orders`); grids regenerate on next start |
|
|
265
|
+
| `dexbot clear-market-adapter` | — | Delete market adapter data, state (incl. `market_adapter.lock`), and adapter logs |
|
|
266
|
+
| `dexbot clear-all` | — | Delete orders, logs, market adapter, and claw data (all of the above) |
|
|
267
267
|
| `dexbot help` | — | Print the full CLI reference (grouped by Runtime/Trading/Config/Analysis/Files) |
|
|
268
268
|
|
|
269
|
+
> ⚠️ **The `clear*` commands are offline-only** — stop the runtime first
|
|
270
|
+
> (`dexbot stop` / `dexbot pm2 stop all`). They detect a live runtime (pid files
|
|
271
|
+
> + this install's online PM2 apps) and warn, but the warning is advisory: the
|
|
272
|
+
> deletion still runs, a live bot re-creates the state within seconds, and open
|
|
273
|
+
> log FDs keep the disk space until it restarts.
|
|
274
|
+
>
|
|
275
|
+
> `clear*` never touches config — `bots.json`, `keys.json`, the settings files and
|
|
276
|
+
> `credit_runtime/` survive. `clear` / `clear-all` do delete the credential audit
|
|
277
|
+
> trail `logs/daemon-audit.jsonl` (and its rotated siblings) along with the rest
|
|
278
|
+
> of the logs; the preview names it explicitly.
|
|
279
|
+
|
|
269
280
|
## NPM Scripts for Branch Synchronization
|
|
270
281
|
|
|
271
282
|
The following npm scripts provide safe, automated branch synchronization:
|
package/market_adapter/README.md
CHANGED
|
@@ -834,7 +834,7 @@ closed 1h candles.
|
|
|
834
834
|
|
|
835
835
|
#### Shared Month-Shard Cache and Fetch Robustness
|
|
836
836
|
|
|
837
|
-
Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`): candles live in fixed calendar-month shards (`<base>.shard_YYYY-MM.json`, UTC) whose names never shift, so a run loads only the shards overlapping its requested range, queries only genuinely missing buckets plus a bounded
|
|
837
|
+
Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`): candles live in fixed calendar-month shards (`<base>.shard_YYYY-MM.json`, UTC) whose names never shift, so a run loads only the shards overlapping its requested range, queries only genuinely missing buckets plus a bounded tail refresh, and rewrites only shards that gained buckets or query coverage — pure-reuse runs perform zero writes and zero deletes. Shard metas record the ranges actually queried (`meta.queriedRanges`, monotonically unioned) together with `at`, the time each query ran; spans merge only when they assert the same verification time, so per-bucket freshness stays exact. A missing range is pruned only when recorded query coverage genuinely covers it — the absence of local buckets alone never certifies history as empty — and only once the range ended more than `GAP_SETTLE_HORIZON_MS` ago, judged per gap rather than per window (a month-old gap at the leading edge of the newest window is as settled as one in a fully past window). The tail window re-queries only buckets that no query has seen `TAIL_SETTLE_LAG_MS` after they closed (`settleCoverage`), so a rerun costs ~lag+elapsed hours instead of a fixed 48h, and the refresh never reaches back past `TAIL_REFRESH_HOURS` (an unsettled bucket must be refreshed because index lag is still open, but a coverage hole older than 48h is past any plausible lag and must not drag the boundary back weeks); caches without `at` fall back to that fixed window. Clusters of gaps within `GAP_MERGE_TOLERANCE_BUCKETS` collapse into one query, and the sub-range path is bounded by merged span hours rather than gap count, so one extra small hole can no longer escalate a run to a full-window fetch. Because spans merge only on an identical `at`, a shard gains one span per re-verifying run; the persisted list is capped at `MAX_COVERAGE_SPANS` by dropping the oldest spans, which can never invent emptiness (it can only make those buckets look unsettled, bounded by the same 48h ceiling). A run that re-verifies the tail therefore rewrites that shard even when the candles come back identical — the moved verification time is the news, and skipping the write would throw it away; pure-reuse runs still write nothing. Partial windows merge into the run output but are never persisted. Stable month shards are the only supported cache format; obsolete run-relative cache files are ignored. Every range fetch runs through `fetchRangeWithRetry` (per-range attempts + linear backoff + abort-signal timeout; the LP path keeps a 4-attempt budget), one-shot Kibana queries retry transient errors (3 attempts), paged fetchers cap at `kibanaMaxPages` (500), and bidirectional fetches tolerate a one-direction failure.
|
|
838
838
|
|
|
839
839
|
#### AMA Warmup Window — Why Candle Length Matters
|
|
840
840
|
|