dexbot 1.6.7 → 1.6.9
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 +73 -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 +55 -16
- package/dist/market_adapter/core/market_adapter_service.d.ts +81 -1
- package/dist/market_adapter/core/market_adapter_service.js +239 -20
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +10 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js +40 -18
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +26 -2
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +132 -29
- 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/core/strategies/regime_gate.d.ts +61 -3
- package/dist/market_adapter/core/strategies/regime_gate.js +207 -7
- 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/interval_utils.d.ts +18 -1
- package/dist/market_adapter/interval_utils.js +31 -1
- package/dist/market_adapter/market_adapter.d.ts +158 -2
- package/dist/market_adapter/market_adapter.js +399 -65
- package/dist/market_adapter/test_helpers.d.ts +2 -2
- package/dist/market_adapter/test_helpers.js +2 -2
- package/dist/market_adapter/utils/file_json_cache.d.ts +29 -0
- package/dist/market_adapter/utils/file_json_cache.js +106 -0
- 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 +7 -0
- package/dist/modules/config.js +2 -0
- package/dist/modules/constants.d.ts +16 -4
- package/dist/modules/constants.js +144 -38
- 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 +172 -160
- 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 +311 -0
- package/dist/modules/version_notice.js +709 -0
- package/dist/pm2.js +16 -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 +22 -20
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +149 -31
- package/docs/GRID_RECALCULATION.md +18 -2
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +29 -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
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
* AMA_DELTA_THRESHOLD_PERCENT: % change in AMA center price that triggers grid reset
|
|
75
75
|
* DEFAULT_AMA_KEY: Default AMA profile used for `gridPrice: "ama"`
|
|
76
76
|
* AMAS: Built-in AMA1..AMA4 presets for market adapter defaults
|
|
77
|
-
* Related to bot AMA configuration (profiles/bots.json: ama.
|
|
77
|
+
* Related to bot AMA configuration (profiles/bots.json: gridPrice keyword, ama.erPeriod, etc.)
|
|
78
78
|
* Stored in: profiles/general.settings.json
|
|
79
79
|
*
|
|
80
80
|
* MAINTENANCE & MONITORING:
|
|
@@ -190,12 +190,12 @@ let DEFAULT_CONFIG = {
|
|
|
190
190
|
};
|
|
191
191
|
// Range quality zones for price bounds (minPrice/maxPrice multipliers).
|
|
192
192
|
// Used for pre-entry legend in the bot editor (mountain-style).
|
|
193
|
-
// Thresholds per user spec: green >=2x, yellow >=1.55x, orange 1.
|
|
193
|
+
// Thresholds per user spec: green >=2x, yellow >=1.55x, orange 1.4x–1.55x, red <1.4x.
|
|
194
194
|
let RANGE_QUALITY = {
|
|
195
195
|
GREEN_MIN: 2.0, // >=2.0x → green (wide)
|
|
196
196
|
YELLOW_MIN: 1.55, // >=1.55x → yellow (effeciant)
|
|
197
|
-
ORANGE_MIN: 1.
|
|
198
|
-
RED_MAX: 1.
|
|
197
|
+
ORANGE_MIN: 1.4, // >=1.4x → orange (tight)
|
|
198
|
+
RED_MAX: 1.4, // <1.4x → red (suizidal) — exclusive upper bound for red
|
|
199
199
|
};
|
|
200
200
|
// Timing constants used by OrderManager and helpers
|
|
201
201
|
let TIMING = {
|
|
@@ -263,20 +263,29 @@ let TIMING = {
|
|
|
263
263
|
DUST_CANCEL_TIMEOUT_MS: 5 * 1000, // 5 seconds
|
|
264
264
|
// BROADCAST_STALE_CLEAR_MS: a leaked/hung broadcast flag is hard-cleared
|
|
265
265
|
// after this long so it cannot permanently block rebalancing
|
|
266
|
-
// (see manager._clearStaleBroadcastFlag).
|
|
267
|
-
//
|
|
266
|
+
// (see manager._clearStaleBroadcastFlag). This is the SINGLE authority on
|
|
267
|
+
// "when is a broadcast region stale": both the maintenance-tick deferral
|
|
268
|
+
// (shouldDeferMaintenanceForBroadcast) and the fill-consumer deferral
|
|
269
|
+
// bound (FILL_BROADCAST_DEFER_MAX_MS, derived below) are expressed in
|
|
270
|
+
// terms of it, so they cannot be tuned out of agreement.
|
|
268
271
|
BROADCAST_STALE_CLEAR_MS: 120000, // 120 seconds
|
|
272
|
+
// BROADCAST_DEFER_SAFETY_MARGIN_MS: headroom added to
|
|
273
|
+
// BROADCAST_STALE_CLEAR_MS when deriving FILL_BROADCAST_DEFER_MAX_MS, so a
|
|
274
|
+
// region that is still considered live by the stale-clear watchdog cannot
|
|
275
|
+
// first trip the fill-consumer deferral bound (which would drop the
|
|
276
|
+
// consumer into the in-lock wait the deferral exists to avoid).
|
|
277
|
+
BROADCAST_DEFER_SAFETY_MARGIN_MS: 30000, // 30 seconds
|
|
269
278
|
// FILL_BROADCAST_DEFER_MAX_MS: Bound on fill-consumer deferral while a
|
|
270
279
|
// broadcast region is active. The consumer defers (instead of acquiring
|
|
271
280
|
// the fill lock and sleeping up to 30s inside it) so concurrent consumers
|
|
272
281
|
// never queue as lock waiters and time out. Past this bound a stuck flag
|
|
273
282
|
// falls through to the legacy in-lock wait, which still caps at 30s and
|
|
274
283
|
// proceeds — a leaked flag can delay fills, never starve them.
|
|
275
|
-
//
|
|
276
|
-
// (
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
FILL_BROADCAST_DEFER_MAX_MS: 120000, // 120 seconds (raised
|
|
284
|
+
// Derived after override merge from BROADCAST_STALE_CLEAR_MS +
|
|
285
|
+
// BROADCAST_DEFER_SAFETY_MARGIN_MS (see end of this module), so the
|
|
286
|
+
// ordering invariant holds by construction. The value below is only a
|
|
287
|
+
// floor for that derivation.
|
|
288
|
+
FILL_BROADCAST_DEFER_MAX_MS: 120000, // 120 seconds (raised after merge to stale-clear + margin)
|
|
280
289
|
// FILL_TOTALS_RETRY_BASE_MS / MAX_MS: Backoff for re-processing fills
|
|
281
290
|
// parked when the accountTotals refresh failed (stale snapshot). The
|
|
282
291
|
// deferred fills are held OUTSIDE the live queue and re-queued on a
|
|
@@ -432,6 +441,13 @@ let TIMING = {
|
|
|
432
441
|
// is detached from it.
|
|
433
442
|
// Derived as SYNC_LOCK_TIMEOUT_MS * 2 after override merge (see end of this module).
|
|
434
443
|
SYNC_LOCK_FORCE_RELEASE_AGE_MS: 40000, // overridden by derivation after merge
|
|
444
|
+
// GRID_LOCK_HOLD_WARN_MS: observability threshold for _gridLock hold
|
|
445
|
+
// duration. That lock has no acquisition timeout and its callers cannot
|
|
446
|
+
// safely recover from a rejected acquire, so an over-long critical
|
|
447
|
+
// section is surfaced (warn + metric) by the maintenance tick rather than
|
|
448
|
+
// timed out or force-released. A hold crossing this threshold means a
|
|
449
|
+
// section is running unbounded and should be bounded at the source.
|
|
450
|
+
GRID_LOCK_HOLD_WARN_MS: 15000,
|
|
435
451
|
// GRID_BLOAT_RESYNC_GRACE_MS: Grace period before the maintenance runtime
|
|
436
452
|
// re-triggers a structural resync for a previously detected grid bloat.
|
|
437
453
|
// Prevents immediate re-triggering when Grid.loadGrid already scheduled one
|
|
@@ -491,6 +507,36 @@ let TIMING = {
|
|
|
491
507
|
};
|
|
492
508
|
// Grid limits and scaling constants
|
|
493
509
|
let GRID_LIMITS = {
|
|
510
|
+
// MISSING_GENESIS_POLICY: what to do when a persisted grid cannot be tied
|
|
511
|
+
// to a price ladder ("no genesis" -- the genesis-less state analysed in
|
|
512
|
+
// docs/GRID_PRICE_INVARIANT.md). A genesis-less grid is NOT repairable in
|
|
513
|
+
// place: every consumer (nearest-slot adoption, the materialize
|
|
514
|
+
// descriptor-price fallback, reserve-edge anchoring) has no authority for a
|
|
515
|
+
// slot's price, which is exactly how an off-grid price became grid evidence
|
|
516
|
+
// and was re-emitted. The load and sync gates refuse that state outright —
|
|
517
|
+
// no tolerance matcher remains.
|
|
518
|
+
// 'rebuild' (default) -- refuse the snapshot and rebuild a clean ladder
|
|
519
|
+
// through the existing resync machinery
|
|
520
|
+
// (initializeGrid/recalculateGrid, which re-derive
|
|
521
|
+
// prices and reconcile update-first, so only true
|
|
522
|
+
// surplus is cancelled). Deterministic, but the
|
|
523
|
+
// live orders are re-slotted -- the same net effect
|
|
524
|
+
// as a manual `dexbot reset`.
|
|
525
|
+
// 'halt' -- refuse to start and require the operator to run a
|
|
526
|
+
// manual grid reset. Strongest fund safety (nothing
|
|
527
|
+
// is cancelled without consent); the bot stays down
|
|
528
|
+
// until a human acts, so it is opt-in, not default.
|
|
529
|
+
// Read as `config.gridLimits.MISSING_GENESIS_POLICY` (see
|
|
530
|
+
// modules/order/genesis_policy.ts); any other value falls back to 'rebuild'.
|
|
531
|
+
MISSING_GENESIS_POLICY: 'rebuild',
|
|
532
|
+
// MISSING_GENESIS_MISMATCH_RATIO: share of persisted slots that must match
|
|
533
|
+
// the config-derived rail before a migrated (genesis-less) snapshot may
|
|
534
|
+
// adopt that rail as its genesis. Above it, the config was edited since the
|
|
535
|
+
// snapshot, so the config-derived ladder is a DIFFERENT generation:
|
|
536
|
+
// adopting it would mass-virtualize live order tracking in 'enforce' mode
|
|
537
|
+
// (or flood the log in 'log' mode) and persist a genesis the live grid does
|
|
538
|
+
// not match. Treated as a missing genesis instead -- refused, never adopted.
|
|
539
|
+
MISSING_GENESIS_MISMATCH_RATIO: 0.5,
|
|
494
540
|
// MIN_SPREAD_FACTOR: Ensures spread is at least (incrementPercent × MIN_SPREAD_FACTOR) slots wide.
|
|
495
541
|
// Rationale: Spread must be sufficiently wide to:
|
|
496
542
|
// 1. Avoid order collision (orders too close get rejected by blockchain)
|
|
@@ -519,11 +565,6 @@ let GRID_LIMITS = {
|
|
|
519
565
|
// PRICE_TOLERANCE_MIN_ABSOLUTE: Floor for the price tolerance cap in price units.
|
|
520
566
|
// Ensures the cap is non-zero even for extremely cheap assets.
|
|
521
567
|
PRICE_TOLERANCE_MIN_ABSOLUTE: 0.0001,
|
|
522
|
-
// ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER: Legacy fallback multiplier for calculatePriceTolerance
|
|
523
|
-
// (sync_engine pass-2 before genesis). With genesis-frozen nearest-slot (slotIndexForPrice)
|
|
524
|
-
// this multiplier is deprecated — deterministic slotId equality replaces widening. Kept for
|
|
525
|
-
// migration fallback when genesis missing; otherwise unused.
|
|
526
|
-
ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER: 4,
|
|
527
568
|
// GRID_REGENERATION_PERCENTAGE: Trigger threshold for automatic grid size recalculation.
|
|
528
569
|
// Works in BOTH directions (bidirectional), sharing one threshold:
|
|
529
570
|
// GROW: IF (availableFunds / allocatedCapital) x 100 >= threshold -> regenerate
|
|
@@ -648,10 +689,6 @@ let GRID_LIMITS = {
|
|
|
648
689
|
// Example: 0.1 means two values are considered equal when diff < 0.1% of magnitude.
|
|
649
690
|
// Note: Final blockchain update filtering still happens with integer precision checks.
|
|
650
691
|
RELATIVE_ORDER_UPDATE_THRESHOLD_PERCENT: 0.1,
|
|
651
|
-
// PRICE_DRIFT_TOLERANCE_MULTIPLIER: Legacy for price-drift-orphan tagging when genesis missing.
|
|
652
|
-
// With genesis-frozen nearest-slot, drift is deterministic no-available-nearest-slot (gap/occupied)
|
|
653
|
-
// not a tolerance band. Kept for diagnostics fallback only.
|
|
654
|
-
PRICE_DRIFT_TOLERANCE_MULTIPLIER: 4,
|
|
655
692
|
};
|
|
656
693
|
// Increment percentage bounds for grid configuration
|
|
657
694
|
let INCREMENT_BOUNDS = {
|
|
@@ -817,17 +854,27 @@ let FILL_PROCESSING = {
|
|
|
817
854
|
// Reduced from 300s to 60s per tuning review: time-sensitive fills (e.g.,
|
|
818
855
|
// credential daemon recovery) should not wait 5 minutes between retries.
|
|
819
856
|
CONSUMER_BACKOFF_MAX_MS: 60000,
|
|
820
|
-
//
|
|
821
|
-
//
|
|
822
|
-
// (no acquisition timeout)
|
|
823
|
-
//
|
|
824
|
-
//
|
|
825
|
-
//
|
|
826
|
-
//
|
|
827
|
-
//
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
|
|
857
|
+
// CORRECTION_LOCK_HOLD_BUDGET_MS: wall-clock budget for the sequential
|
|
858
|
+
// price-update drain in correctAllPriceMismatches. That drain holds
|
|
859
|
+
// _gridLock (no acquisition timeout), so the invariant to protect is
|
|
860
|
+
// *lock-hold duration*, not update count: each update costs SYNC_DELAY_MS
|
|
861
|
+
// plus its RPC round-trip, and that round-trip grows with chain
|
|
862
|
+
// congestion. The drain stops pulling new updates once this much time has
|
|
863
|
+
// elapsed, so a slow chain drains fewer per cycle instead of holding the
|
|
864
|
+
// lock past the 20s fill-lock timeout (the "Lock acquisition timeout"
|
|
865
|
+
// cascade). Cancel-class entries (duplicate orphans / surplus / type
|
|
866
|
+
// mismatch) are ALWAYS fully drained — they are batched with no inter-op
|
|
867
|
+
// delay and are fund-safety-critical — and are never charged against this
|
|
868
|
+
// budget. Only the sequential price-update loop is budgeted; the
|
|
869
|
+
// remainder stays queued durably and re-drains on the next cycle.
|
|
870
|
+
CORRECTION_LOCK_HOLD_BUDGET_MS: 4000,
|
|
871
|
+
// CORRECTION_MAX_UPDATES_PER_CYCLE: optional hard cap on price updates
|
|
872
|
+
// drained per cycle, layered on top of CORRECTION_LOCK_HOLD_BUDGET_MS.
|
|
873
|
+
// Default null = no count cap (the hold-time budget alone governs, so the
|
|
874
|
+
// bound adapts to real RPC latency); a positive integer pins the count;
|
|
875
|
+
// 0 drains no price updates this cycle. Cancel-class entries are never
|
|
876
|
+
// budgeted by either knob.
|
|
877
|
+
CORRECTION_MAX_UPDATES_PER_CYCLE: null,
|
|
831
878
|
// CORRECTION_QUEUE_WARN_THRESHOLD: emit a rate-limited warn when the
|
|
832
879
|
// persisted correction queue reaches this size, so a growing backlog is
|
|
833
880
|
// surfaced instead of silently starving placements.
|
|
@@ -1049,7 +1096,7 @@ let MARKET_ADAPTER = {
|
|
|
1049
1096
|
// Lower values make the Kalman channel reach maximum influence more easily.
|
|
1050
1097
|
// Higher values require a stronger move before the Kalman branch reaches full effect.
|
|
1051
1098
|
// nob: kalS% (Kalman Max Slope %)
|
|
1052
|
-
DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT: 1.
|
|
1099
|
+
DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT: 1.11,
|
|
1053
1100
|
// DYNAMIC_WEIGHT_AMA_NEUTRAL_ZONE_PCT: Ignore small AMA moves around flat price action.
|
|
1054
1101
|
// Higher values create a larger neutral zone and reduce small trend reactions.
|
|
1055
1102
|
// Lower values make the AMA channel react to smaller moves.
|
|
@@ -1378,7 +1425,53 @@ let UPDATER = {
|
|
|
1378
1425
|
// │ │ │ │ ┌────── day of week (0 - 6) (0 is Sunday)
|
|
1379
1426
|
// │ │ │ │ │
|
|
1380
1427
|
// 0 0 * * * (Default: Daily at midnight)
|
|
1381
|
-
SCHEDULE: "0 0 * * *"
|
|
1428
|
+
SCHEDULE: "0 0 * * *",
|
|
1429
|
+
// ── Passive version NOTICE (modules/version_notice.ts) ──────────
|
|
1430
|
+
// Deliberately independent of ACTIVE: the notice never changes code, it
|
|
1431
|
+
// only tells the operator a newer release exists. Keeping it on a separate
|
|
1432
|
+
// switch means the default-off auto-updater does not also silence the
|
|
1433
|
+
// "you are running an outdated build" warning.
|
|
1434
|
+
NOTICE_ENABLED: true,
|
|
1435
|
+
// Minimum gap between probes AFTER A SUCCESSFUL observation (12h). A
|
|
1436
|
+
// successful answer is stable, so it is cached and costs no request on
|
|
1437
|
+
// every run that consults it. Half a day rather than a full day: the
|
|
1438
|
+
// published version does not move under us, but `dexbot stat` is the
|
|
1439
|
+
// command an operator runs to ask "am I current?", and 24h let that answer
|
|
1440
|
+
// come from an observation taken the previous morning. Set 0 to probe on
|
|
1441
|
+
// every run (an explicit opt-in to always-check, which disables the
|
|
1442
|
+
// failure backoff too).
|
|
1443
|
+
NOTICE_INTERVAL_MS: 43_200_000,
|
|
1444
|
+
// Backoff after a FAILED probe. A failure is the one observation that
|
|
1445
|
+
// decays fastest: throttling it for the full NOTICE_INTERVAL_MS turned a
|
|
1446
|
+
// 5s network hiccup into a permanent gray "?" for a day, with no retry to
|
|
1447
|
+
// disprove it. A failure is therefore re-tried after 15 minutes while the
|
|
1448
|
+
// last good answer is still served from the cache in the meantime.
|
|
1449
|
+
NOTICE_RETRY_MS: 900_000,
|
|
1450
|
+
// Total network budget for one probe, shared evenly across the configured
|
|
1451
|
+
// sources. The check never blocks startup, but a hung socket must not keep
|
|
1452
|
+
// the launcher alive either.
|
|
1453
|
+
NOTICE_TIMEOUT_MS: 4_000,
|
|
1454
|
+
// Budget for the final re-probe in `dexbot stat`. That command gives the
|
|
1455
|
+
// probe 1s at the top of the report, 1s more at the end, and then this
|
|
1456
|
+
// budget for a forced second attempt; when even that answers nothing the
|
|
1457
|
+
// verdict says "no current version information" instead of leaving the
|
|
1458
|
+
// operator to infer it from a missing line. Kept at 3s so the whole
|
|
1459
|
+
// escalation costs ~4s of waiting, all of it at the bottom of the report.
|
|
1460
|
+
NOTICE_STATUS_TIMEOUT_MS: 3_000,
|
|
1461
|
+
// How long `dexbot stat` waits for an answer before printing the rest of
|
|
1462
|
+
// the report. A valid cache or a quick registry answer lands inside this
|
|
1463
|
+
// and the command never notices the wait.
|
|
1464
|
+
NOTICE_STAGE_GRACE_MS: 1_000,
|
|
1465
|
+
// Source 1 — the npm dist-tag document. Empty disables the source.
|
|
1466
|
+
REGISTRY_URL: "https://registry.npmjs.org/dexbot/latest",
|
|
1467
|
+
// Source 2 — the GitHub "latest release" document, the fallback for a host
|
|
1468
|
+
// that cannot reach registry.npmjs.org. Empty DERIVES the URL from
|
|
1469
|
+
// REPOSITORY_URL (so a fork/self-hosted mirror is honoured); set it to a
|
|
1470
|
+
// non-GitHub value to pin the endpoint, or to 'off' to disable the source.
|
|
1471
|
+
GITHUB_RELEASE_URL: "",
|
|
1472
|
+
// Base for the derived GitHub source. Split out so a GitHub Enterprise
|
|
1473
|
+
// mirror is a config change, not a code change.
|
|
1474
|
+
GITHUB_API_BASE: "https://api.github.com"
|
|
1382
1475
|
};
|
|
1383
1476
|
let LAUNCHER = {
|
|
1384
1477
|
MONOLITHIC: {
|
|
@@ -1840,11 +1933,24 @@ if (settings) {
|
|
|
1840
1933
|
// Post-merge derivations: compute values from their documented relationships
|
|
1841
1934
|
// so that user overrides to base constants propagate automatically.
|
|
1842
1935
|
TIMING.SYNC_LOCK_FORCE_RELEASE_AGE_MS = TIMING.SYNC_LOCK_TIMEOUT_MS * 2;
|
|
1843
|
-
//
|
|
1844
|
-
//
|
|
1845
|
-
//
|
|
1846
|
-
//
|
|
1847
|
-
|
|
1936
|
+
// Broadcast deferral bounds are all expressed in terms of the single stale
|
|
1937
|
+
// authority (BROADCAST_STALE_CLEAR_MS): the maintenance-tick deferral uses it
|
|
1938
|
+
// directly (shouldDeferMaintenanceForBroadcast) and the fill-consumer bound is
|
|
1939
|
+
// staleClear + a named safety margin. Deriving rather than declaring keeps the
|
|
1940
|
+
// ordering invariant true by construction; the check below catches a future
|
|
1941
|
+
// edit or override that breaks it at load time instead of silently at runtime.
|
|
1942
|
+
const _broadcastStaleClearMs = Number(TIMING.BROADCAST_STALE_CLEAR_MS) > 0
|
|
1943
|
+
? Number(TIMING.BROADCAST_STALE_CLEAR_MS)
|
|
1944
|
+
: 120000;
|
|
1945
|
+
const _broadcastDeferSafetyMarginMs = Number(TIMING.BROADCAST_DEFER_SAFETY_MARGIN_MS) > 0
|
|
1946
|
+
? Number(TIMING.BROADCAST_DEFER_SAFETY_MARGIN_MS)
|
|
1947
|
+
: 30000;
|
|
1948
|
+
TIMING.FILL_BROADCAST_DEFER_MAX_MS = Math.max(Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) > 0 ? Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) : 0, _broadcastStaleClearMs + _broadcastDeferSafetyMarginMs);
|
|
1949
|
+
if (!(Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) > _broadcastStaleClearMs)) {
|
|
1950
|
+
throw new Error(`[constants] invariant violated: FILL_BROADCAST_DEFER_MAX_MS (${TIMING.FILL_BROADCAST_DEFER_MAX_MS}) ` +
|
|
1951
|
+
`must exceed BROADCAST_STALE_CLEAR_MS (${_broadcastStaleClearMs}) — the fill-consumer deferral bound ` +
|
|
1952
|
+
`must outlast the stale-broadcast watchdog.`);
|
|
1953
|
+
}
|
|
1848
1954
|
// Freeze objects to prevent accidental runtime modifications
|
|
1849
1955
|
Object.freeze(ORDER_TYPES);
|
|
1850
1956
|
Object.freeze(ORDER_STATES);
|
|
@@ -125,8 +125,6 @@ declare class DEXBot {
|
|
|
125
125
|
_maintenanceCooldownCycles: number;
|
|
126
126
|
_lastGridActivityAt: number;
|
|
127
127
|
_currentCycleId: number;
|
|
128
|
-
_autoCancelOrphanCycleMarker: number | null;
|
|
129
|
-
_autoCancelOrphanSubCount: number;
|
|
130
128
|
_consecutiveConsumeFailures: number;
|
|
131
129
|
_consumeFailureFirstAt: number;
|
|
132
130
|
_reconnectUnregister: any;
|
|
@@ -275,9 +273,15 @@ declare class DEXBot {
|
|
|
275
273
|
_recoverFromPersistedGrid(): Promise<{
|
|
276
274
|
success: boolean;
|
|
277
275
|
reason: string;
|
|
276
|
+
halt?: undefined;
|
|
278
277
|
} | {
|
|
279
278
|
success: boolean;
|
|
280
279
|
reason?: undefined;
|
|
280
|
+
halt?: undefined;
|
|
281
|
+
} | {
|
|
282
|
+
success: boolean;
|
|
283
|
+
reason: string;
|
|
284
|
+
halt: boolean;
|
|
281
285
|
}>;
|
|
282
286
|
/**
|
|
283
287
|
* Reject a corrupted grid snapshot when catastrophic fund drift is detected.
|
|
@@ -655,80 +659,6 @@ declare class DEXBot {
|
|
|
655
659
|
* @returns {Promise<Object>} Result object compatible with batch return shape
|
|
656
660
|
*/
|
|
657
661
|
_reconcileAfterUncertainBroadcast(err: any, opContexts: any, options?: Record<string, any>): Promise<any>;
|
|
658
|
-
/**
|
|
659
|
-
* Auto-cancel a price-drift orphan from the unmatched-order snapshot.
|
|
660
|
-
*
|
|
661
|
-
* Only cancels entries with reason === 'price-drift-orphan' — these are
|
|
662
|
-
* surplus orders that drifted away from their slot price and have no
|
|
663
|
-
* adoptable grid slot. All other unmatched orders (duplicate-price-level,
|
|
664
|
-
* already-matched-slot, etc.) are adoptable positions that the structural
|
|
665
|
-
* resync will integrate into the grid; cancelling them destroys capital.
|
|
666
|
-
*
|
|
667
|
-
* This is the post-recovery safety net: if, after
|
|
668
|
-
* _reconcileAfterUncertainBroadcast runs, there are still price-drift
|
|
669
|
-
* orphans, cancel ONE per cycle. Per-cycle cap = 1 (or 5 in recovery mode)
|
|
670
|
-
* — the next cycle will pick up the next orphan if more remain.
|
|
671
|
-
*
|
|
672
|
-
* Safety conditions (ALL must hold):
|
|
673
|
-
* 1. _pendingBroadcasts is empty (no in-flight recovery)
|
|
674
|
-
* 2. _lastUnmatchedChainOrders contains at least one price-drift-orphan
|
|
675
|
-
* 3. The current cycle has not already auto-cancelled an orphan
|
|
676
|
-
* (tracked via this._autoCancelOrphanCycleMarker)
|
|
677
|
-
*
|
|
678
|
-
* Records the cancel via _recordOwnCancelOps so the fill consumer
|
|
679
|
-
* doesn't trip the self-cancel guard.
|
|
680
|
-
*
|
|
681
|
-
* @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
|
|
682
|
-
*/
|
|
683
|
-
_autoCancelOneUnmatchedOrphan(): Promise<{
|
|
684
|
-
cancelled: boolean;
|
|
685
|
-
reason: string;
|
|
686
|
-
subCount: any;
|
|
687
|
-
message?: undefined;
|
|
688
|
-
slotId?: undefined;
|
|
689
|
-
orderId?: undefined;
|
|
690
|
-
error?: undefined;
|
|
691
|
-
} | {
|
|
692
|
-
cancelled: boolean;
|
|
693
|
-
reason: string;
|
|
694
|
-
subCount?: undefined;
|
|
695
|
-
message?: undefined;
|
|
696
|
-
slotId?: undefined;
|
|
697
|
-
orderId?: undefined;
|
|
698
|
-
error?: undefined;
|
|
699
|
-
} | {
|
|
700
|
-
cancelled: boolean;
|
|
701
|
-
reason: string;
|
|
702
|
-
message: string;
|
|
703
|
-
subCount?: undefined;
|
|
704
|
-
slotId?: undefined;
|
|
705
|
-
orderId?: undefined;
|
|
706
|
-
error?: undefined;
|
|
707
|
-
} | {
|
|
708
|
-
cancelled: boolean;
|
|
709
|
-
reason: string;
|
|
710
|
-
slotId: any;
|
|
711
|
-
subCount?: undefined;
|
|
712
|
-
message?: undefined;
|
|
713
|
-
orderId?: undefined;
|
|
714
|
-
error?: undefined;
|
|
715
|
-
} | {
|
|
716
|
-
cancelled: boolean;
|
|
717
|
-
orderId: any;
|
|
718
|
-
reason?: undefined;
|
|
719
|
-
subCount?: undefined;
|
|
720
|
-
message?: undefined;
|
|
721
|
-
slotId?: undefined;
|
|
722
|
-
error?: undefined;
|
|
723
|
-
} | {
|
|
724
|
-
cancelled: boolean;
|
|
725
|
-
reason: string;
|
|
726
|
-
error: any;
|
|
727
|
-
subCount?: undefined;
|
|
728
|
-
message?: undefined;
|
|
729
|
-
slotId?: undefined;
|
|
730
|
-
orderId?: undefined;
|
|
731
|
-
}>;
|
|
732
662
|
/**
|
|
733
663
|
* Execute operations with retry on BroadcastUncertainError.
|
|
734
664
|
* The daemon already retries internally against a 25s deadline. If it
|
|
@@ -152,8 +152,6 @@ class DEXBot {
|
|
|
152
152
|
_maintenanceCooldownCycles;
|
|
153
153
|
_lastGridActivityAt;
|
|
154
154
|
_currentCycleId;
|
|
155
|
-
_autoCancelOrphanCycleMarker;
|
|
156
|
-
_autoCancelOrphanSubCount;
|
|
157
155
|
_consecutiveConsumeFailures;
|
|
158
156
|
_consumeFailureFirstAt;
|
|
159
157
|
_reconnectUnregister;
|
|
@@ -268,8 +266,6 @@ class DEXBot {
|
|
|
268
266
|
this._lastGridActivityAt = 0;
|
|
269
267
|
this._lastDeferredDustCount = 0;
|
|
270
268
|
this._currentCycleId = 0;
|
|
271
|
-
this._autoCancelOrphanCycleMarker = null;
|
|
272
|
-
this._autoCancelOrphanSubCount = 0;
|
|
273
269
|
// Dust cancellation is driven by the periodic dust health-check timer
|
|
274
270
|
// (setupDustHealthCheckInterval) rather than per-dust state maps.
|
|
275
271
|
this._dustHealthCheckTimer = null;
|
|
@@ -912,34 +908,6 @@ class DEXBot {
|
|
|
912
908
|
async _reconcileAfterUncertainBroadcast(err, opContexts, options = {}) {
|
|
913
909
|
return cowRuntime.reconcileAfterUncertainBroadcast(this, err, opContexts, options);
|
|
914
910
|
}
|
|
915
|
-
/**
|
|
916
|
-
* Auto-cancel a price-drift orphan from the unmatched-order snapshot.
|
|
917
|
-
*
|
|
918
|
-
* Only cancels entries with reason === 'price-drift-orphan' — these are
|
|
919
|
-
* surplus orders that drifted away from their slot price and have no
|
|
920
|
-
* adoptable grid slot. All other unmatched orders (duplicate-price-level,
|
|
921
|
-
* already-matched-slot, etc.) are adoptable positions that the structural
|
|
922
|
-
* resync will integrate into the grid; cancelling them destroys capital.
|
|
923
|
-
*
|
|
924
|
-
* This is the post-recovery safety net: if, after
|
|
925
|
-
* _reconcileAfterUncertainBroadcast runs, there are still price-drift
|
|
926
|
-
* orphans, cancel ONE per cycle. Per-cycle cap = 1 (or 5 in recovery mode)
|
|
927
|
-
* — the next cycle will pick up the next orphan if more remain.
|
|
928
|
-
*
|
|
929
|
-
* Safety conditions (ALL must hold):
|
|
930
|
-
* 1. _pendingBroadcasts is empty (no in-flight recovery)
|
|
931
|
-
* 2. _lastUnmatchedChainOrders contains at least one price-drift-orphan
|
|
932
|
-
* 3. The current cycle has not already auto-cancelled an orphan
|
|
933
|
-
* (tracked via this._autoCancelOrphanCycleMarker)
|
|
934
|
-
*
|
|
935
|
-
* Records the cancel via _recordOwnCancelOps so the fill consumer
|
|
936
|
-
* doesn't trip the self-cancel guard.
|
|
937
|
-
*
|
|
938
|
-
* @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
|
|
939
|
-
*/
|
|
940
|
-
async _autoCancelOneUnmatchedOrphan() {
|
|
941
|
-
return cowRuntime.autoCancelOneUnmatchedOrphan(this);
|
|
942
|
-
}
|
|
943
911
|
/**
|
|
944
912
|
* Execute operations with retry on BroadcastUncertainError.
|
|
945
913
|
* The daemon already retries internally against a 25s deadline. If it
|
|
@@ -164,60 +164,6 @@ declare function restoreDiscardedCreates(bot: any, discarded: any[], opContexts:
|
|
|
164
164
|
* @returns {Promise<Object>}
|
|
165
165
|
*/
|
|
166
166
|
declare function reconcileAfterUncertainBroadcastImpl(bot: any, err: any, opContexts: any, _options: any): Promise<any>;
|
|
167
|
-
/**
|
|
168
|
-
* Auto-cancel one unmatched orphan (price-drift orphan) per cycle.
|
|
169
|
-
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
170
|
-
* @returns {Promise<{cancelled: boolean, reason?: string, orderId?: string}>}
|
|
171
|
-
*/
|
|
172
|
-
declare function autoCancelOneUnmatchedOrphan(bot: any): Promise<{
|
|
173
|
-
cancelled: boolean;
|
|
174
|
-
reason: string;
|
|
175
|
-
subCount: any;
|
|
176
|
-
message?: undefined;
|
|
177
|
-
slotId?: undefined;
|
|
178
|
-
orderId?: undefined;
|
|
179
|
-
error?: undefined;
|
|
180
|
-
} | {
|
|
181
|
-
cancelled: boolean;
|
|
182
|
-
reason: string;
|
|
183
|
-
subCount?: undefined;
|
|
184
|
-
message?: undefined;
|
|
185
|
-
slotId?: undefined;
|
|
186
|
-
orderId?: undefined;
|
|
187
|
-
error?: undefined;
|
|
188
|
-
} | {
|
|
189
|
-
cancelled: boolean;
|
|
190
|
-
reason: string;
|
|
191
|
-
message: string;
|
|
192
|
-
subCount?: undefined;
|
|
193
|
-
slotId?: undefined;
|
|
194
|
-
orderId?: undefined;
|
|
195
|
-
error?: undefined;
|
|
196
|
-
} | {
|
|
197
|
-
cancelled: boolean;
|
|
198
|
-
reason: string;
|
|
199
|
-
slotId: any;
|
|
200
|
-
subCount?: undefined;
|
|
201
|
-
message?: undefined;
|
|
202
|
-
orderId?: undefined;
|
|
203
|
-
error?: undefined;
|
|
204
|
-
} | {
|
|
205
|
-
cancelled: boolean;
|
|
206
|
-
orderId: any;
|
|
207
|
-
reason?: undefined;
|
|
208
|
-
subCount?: undefined;
|
|
209
|
-
message?: undefined;
|
|
210
|
-
slotId?: undefined;
|
|
211
|
-
error?: undefined;
|
|
212
|
-
} | {
|
|
213
|
-
cancelled: boolean;
|
|
214
|
-
reason: string;
|
|
215
|
-
error: any;
|
|
216
|
-
subCount?: undefined;
|
|
217
|
-
message?: undefined;
|
|
218
|
-
slotId?: undefined;
|
|
219
|
-
orderId?: undefined;
|
|
220
|
-
}>;
|
|
221
167
|
/**
|
|
222
168
|
* Check whether to execute creates in outside-in pair mode.
|
|
223
169
|
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
@@ -354,11 +300,11 @@ declare function checkGridPriceInvariant(slotId: any, price: any, genesis: any):
|
|
|
354
300
|
* copies from the destination hole's `order.price` and which is therefore only
|
|
355
301
|
* as sound as whatever last wrote that object. Deriving the emitted price here
|
|
356
302
|
* means a planner bug cannot produce a mis-priced UPDATE on its own; the
|
|
357
|
-
* invariant check remains as the backstop
|
|
303
|
+
* invariant check remains as the backstop.
|
|
358
304
|
*
|
|
359
305
|
* @returns {number} the destination's genesis level, or NaN when there is no
|
|
360
306
|
* genesis ladder / no parseable destination index (caller falls back to the
|
|
361
|
-
* planned price
|
|
307
|
+
* planned price — an undefined grid, which the load and sync gates refuse).
|
|
362
308
|
*/
|
|
363
309
|
declare function deriveRotationPrice(bot: any, newGridId: any): number;
|
|
364
310
|
/**
|
|
@@ -621,7 +567,7 @@ declare function processBatchResults(bot: any, result: any, opContexts: any): Pr
|
|
|
621
567
|
hadRotation: boolean;
|
|
622
568
|
updateOperationCount: number;
|
|
623
569
|
}>;
|
|
624
|
-
export { isLastFillGuardBlocked, resolveOnGridPivot, checkGridPriceInvariant, deriveRotationPrice, refreshLastFillPivotFromQueue, runFinalPivotGate, buildOutsideInPairGroupsForOrders, buildOutsideInPairGroupsForCreateEntries, markMissingCreateResultsAsStructuralBlocker, formatUnmatchedChainOrderForLog, recordPendingBroadcast, clearPendingBroadcasts, popPushedWorkingGrid, findChainOrderForSlot, reconcileAfterUncertainBroadcast, reconcileAfterUncertainBroadcastImpl,
|
|
570
|
+
export { isLastFillGuardBlocked, resolveOnGridPivot, checkGridPriceInvariant, deriveRotationPrice, refreshLastFillPivotFromQueue, runFinalPivotGate, buildOutsideInPairGroupsForOrders, buildOutsideInPairGroupsForCreateEntries, markMissingCreateResultsAsStructuralBlocker, formatUnmatchedChainOrderForLog, recordPendingBroadcast, clearPendingBroadcasts, popPushedWorkingGrid, findChainOrderForSlot, reconcileAfterUncertainBroadcast, reconcileAfterUncertainBroadcastImpl, executeWithRetryOnUncertain, executeChunkedWithRetryOnUncertain, formatPartialBroadcastSummary, executeOperationsWithStrategy, buildActionsFromPlan, buildCowResultFromPlan, applyRotationTransitionsToWorkingGrid, pollChainForConfirmation, updateOrdersOnChainBatchCOW, processBatchResults, adoptPlacedBatchFromChain, resolveRefillBoundaryHold, toRefillSlotIdSet, trackBoundaryHold };
|
|
625
571
|
export { restoreDiscardedCreates };
|
|
626
572
|
declare const _default: {
|
|
627
573
|
buildOutsideInPairGroupsForOrders: typeof buildOutsideInPairGroupsForOrders;
|
|
@@ -639,7 +585,6 @@ declare const _default: {
|
|
|
639
585
|
findChainOrderForSlot: typeof findChainOrderForSlot;
|
|
640
586
|
reconcileAfterUncertainBroadcast: typeof reconcileAfterUncertainBroadcast;
|
|
641
587
|
reconcileAfterUncertainBroadcastImpl: typeof reconcileAfterUncertainBroadcastImpl;
|
|
642
|
-
autoCancelOneUnmatchedOrphan: typeof autoCancelOneUnmatchedOrphan;
|
|
643
588
|
shouldExecuteCreatePairMode: typeof shouldExecuteCreatePairMode;
|
|
644
589
|
executeWithRetryOnUncertain: typeof executeWithRetryOnUncertain;
|
|
645
590
|
executeChunkedWithRetryOnUncertain: typeof executeChunkedWithRetryOnUncertain;
|