dexbot 1.6.11 → 1.6.13
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 +67 -4
- package/README.md +2 -1
- package/analysis/README.md +11 -11
- package/analysis/ama_fitting/README.md +5 -3
- package/analysis/tradingview/README.md +1 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +3 -3
- package/claw/README.md +1 -0
- package/claw/docs/AI_BOT_LIBRARY_API.md +2 -0
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -3
- package/claw/modules/chain_broadcast.ts +7 -1
- package/claw/modules/claw_bridge.ts +0 -3
- package/claw/modules/claw_launcher.ts +1 -1
- package/claw/modules/claw_skill_md.ts +1 -0
- package/claw/modules/launcher_mode_detector.ts +9 -2
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/tsconfig.json +2 -2
- package/dist/analysis/account_resolver.d.ts +1 -1
- package/dist/analysis/account_resolver.js +2 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +3 -4
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +3 -21
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +55 -45
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -8
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +45 -24
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +34 -78
- package/dist/analysis/analyze_args.d.ts +43 -0
- package/dist/analysis/analyze_args.js +61 -0
- package/dist/analysis/analyze_dynamic_weight.js +7 -17
- package/dist/analysis/analyze_kalman.js +7 -17
- package/dist/analysis/analyze_regime.js +7 -17
- package/dist/analysis/analyze_regime_windows.js +8 -18
- package/dist/analysis/analyze_risk_profile.js +8 -18
- package/dist/analysis/analyze_trade_heatmap.js +7 -17
- package/dist/analysis/analyze_volatility.js +7 -17
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +221 -28
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +23 -103
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +34 -4
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +32 -150
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
- package/dist/analysis/bot_fitting/shared_utils.d.ts +77 -9
- package/dist/analysis/bot_fitting/shared_utils.js +125 -9
- package/dist/analysis/bot_key_utils.d.ts +18 -10
- package/dist/analysis/bot_key_utils.js +7 -4
- package/dist/analysis/bot_usage/discover_bot_accounts.js +44 -47
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +1 -21
- package/dist/analysis/chain_pool.d.ts +3 -1
- package/dist/analysis/chart_ui.d.ts +35 -3
- package/dist/analysis/chart_ui.js +43 -4
- package/dist/analysis/chart_utils.d.ts +5 -5
- package/dist/analysis/chart_utils.js +9 -0
- package/dist/analysis/fills_cache.d.ts +4 -24
- package/dist/analysis/fills_cache.js +3 -84
- package/dist/analysis/fills_source.d.ts +33 -3
- package/dist/analysis/fills_source.js +83 -13
- package/dist/analysis/grid_correction_check.d.ts +2 -24
- package/dist/analysis/grid_correction_check.js +27 -69
- package/dist/analysis/math_utils.d.ts +91 -6
- package/dist/analysis/math_utils.js +119 -7
- package/dist/analysis/pnl_report.js +29 -29
- package/dist/analysis/price_sources.d.ts +30 -9
- package/dist/analysis/price_sources.js +28 -4
- package/dist/analysis/resolve_bot_accounts.js +2 -2
- package/dist/analysis/resolve_source.d.ts +1 -1
- package/dist/analysis/resolve_source.js +31 -10
- package/dist/analysis/trade_profitability.d.ts +29 -2
- package/dist/analysis/trade_profitability.js +73 -147
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +3 -8
- package/dist/analysis/tradingview/analyze_tradingview.js +7 -6
- package/dist/analysis/tradingview/grid_reset_config.d.ts +41 -32
- package/dist/analysis/tradingview/grid_reset_config.js +23 -11
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +75 -9
- package/dist/analysis/tradingview/grid_reset_sim.js +4 -3
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +69 -4
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +20 -34
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +26 -84
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +63 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +16 -41
- package/dist/analysis/trend_detection/huber_scale_variants.d.ts +9 -3
- package/dist/analysis/trend_detection/huber_scale_variants.js +4 -4
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +30 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +3 -3
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts +31 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +2 -2
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +33 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
- package/dist/analysis/worker_pool.d.ts +38 -0
- package/dist/analysis/worker_pool.js +67 -0
- package/dist/credential-daemon.js +34 -20
- package/dist/dexbot.js +78 -59
- package/dist/market_adapter/ama_signal_runner.js +21 -54
- package/dist/market_adapter/candle_utils.d.ts +29 -19
- package/dist/market_adapter/candle_utils.js +35 -21
- package/dist/market_adapter/cli_args.d.ts +22 -0
- package/dist/market_adapter/cli_args.js +30 -0
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +13 -4
- package/dist/market_adapter/core/config_normalizers.d.ts +3 -3
- package/dist/market_adapter/core/config_normalizers.js +11 -6
- package/dist/market_adapter/core/kibana_candles.d.ts +56 -19
- package/dist/market_adapter/core/kibana_candles.js +12 -9
- package/dist/market_adapter/core/kibana_client.d.ts +9 -1
- package/dist/market_adapter/core/kibana_client.js +8 -7
- package/dist/market_adapter/core/kibana_market_candles.d.ts +3 -2
- package/dist/market_adapter/core/market_adapter_service.d.ts +320 -153
- package/dist/market_adapter/core/market_adapter_service.js +228 -269
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
- package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
- package/dist/market_adapter/core/strategies/ama.d.ts +10 -2
- package/dist/market_adapter/core/strategies/ama.js +2 -4
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +14 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +12 -34
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +7 -2
- package/dist/market_adapter/core/strategies/atr/calculator.js +2 -34
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +7 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +0 -22
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +34 -6
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +7 -7
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +24 -15
- package/dist/market_adapter/core/strategies/regime_gate.js +4 -31
- package/dist/market_adapter/core/strategies/regime_interp.d.ts +7 -1
- package/dist/market_adapter/core/strategies/regime_interp.js +14 -22
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts +11 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js +0 -13
- package/dist/market_adapter/inputs/cex_candle_parsing.d.ts +29 -0
- package/dist/market_adapter/inputs/cex_candle_parsing.js +52 -0
- package/dist/market_adapter/inputs/fetch_book_data.d.ts +20 -4
- package/dist/market_adapter/inputs/fetch_book_data.js +3 -2
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +160 -332
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +50 -8
- package/dist/market_adapter/inputs/fetch_lp_data.js +47 -22
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts +74 -15
- package/dist/market_adapter/inputs/kibana_feed_source.js +26 -41
- package/dist/market_adapter/inputs/kibana_source.d.ts +25 -3
- package/dist/market_adapter/inputs/kibana_source.js +2 -2
- package/dist/market_adapter/inputs/window_cache.d.ts +93 -156
- package/dist/market_adapter/inputs/window_cache.js +59 -184
- package/dist/market_adapter/interval_utils.d.ts +15 -5
- package/dist/market_adapter/interval_utils.js +16 -1
- package/dist/market_adapter/log_format.d.ts +6 -6
- package/dist/market_adapter/log_format.js +28 -21
- package/dist/market_adapter/lp_chart_core.d.ts +22 -1
- package/dist/market_adapter/lp_chart_core.js +26 -192
- package/dist/market_adapter/lp_chart_runner.d.ts +10 -7
- package/dist/market_adapter/lp_chart_runner.js +37 -19
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +41 -6
- package/dist/market_adapter/lp_chart_strategy_loader.js +8 -7
- package/dist/market_adapter/market_adapter.d.ts +94 -32
- package/dist/market_adapter/market_adapter.js +94 -120
- package/dist/market_adapter/utils/adapter_client.d.ts +3 -3
- package/dist/market_adapter/utils/adapter_client.js +2 -2
- package/dist/market_adapter/utils/atomic_write.d.ts +8 -1
- package/dist/market_adapter/utils/chain.d.ts +50 -41
- package/dist/market_adapter/utils/chain.js +40 -46
- package/dist/market_adapter/utils/data_discovery.d.ts +49 -2
- package/dist/market_adapter/utils/data_discovery.js +220 -27
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +12 -3
- package/dist/market_adapter/utils/file_json_cache.d.ts +2 -2
- package/dist/market_adapter/utils/file_lock.d.ts +28 -14
- package/dist/market_adapter/utils/file_lock.js +36 -32
- package/dist/market_adapter/utils/month_shards.d.ts +84 -0
- package/dist/market_adapter/utils/month_shards.js +237 -0
- package/dist/market_adapter/utils/native_history.d.ts +9 -2
- package/dist/market_adapter/utils/native_history.js +35 -28
- package/dist/modules/account_bots.d.ts +578 -21
- package/dist/modules/account_bots.js +272 -267
- package/dist/modules/account_orders.d.ts +79 -30
- package/dist/modules/account_orders.js +60 -64
- package/dist/modules/authority_resolver.d.ts +12 -2
- package/dist/modules/authority_resolver.js +15 -8
- package/dist/modules/bitshares-native/chain_client.d.ts +39 -4
- package/dist/modules/bitshares-native/chain_client.js +59 -59
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +11 -171
- package/dist/modules/bitshares-native/crypto/ecc.js +13 -176
- package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +33 -0
- package/dist/modules/bitshares-native/crypto/ecc_core.js +213 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +2 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +1 -13
- package/dist/modules/bitshares-native/index.d.ts +1 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts +7 -7
- package/dist/modules/bitshares-native/resolvers.d.ts +18 -6
- package/dist/modules/bitshares-native/resolvers.js +22 -25
- package/dist/modules/bitshares-native/serial/lazy_buffer.d.ts +4 -0
- package/dist/modules/bitshares-native/serial/lazy_buffer.js +21 -0
- package/dist/modules/bitshares-native/serial/operations.d.ts +1 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts +16 -12
- package/dist/modules/bitshares-native/serial/serializer.js +7 -13
- package/dist/modules/bitshares-native/serial/types.d.ts +25 -16
- package/dist/modules/bitshares-native/serial/types.js +73 -108
- package/dist/modules/bitshares-native/signing_client.d.ts +32 -2
- package/dist/modules/bitshares-native/signing_client.js +19 -14
- package/dist/modules/bitshares-native/subscriptions.d.ts +81 -1
- package/dist/modules/bitshares-native/subscriptions.js +12 -12
- package/dist/modules/bitshares-native/transport.d.ts +5 -4
- package/dist/modules/bitshares-native/transport.js +5 -4
- package/dist/modules/bitshares-native/tx/builder.d.ts +40 -5
- package/dist/modules/bitshares-native/tx/builder.js +4 -3
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts +4 -4
- package/dist/modules/bitshares_client.d.ts +45 -13
- package/dist/modules/bitshares_client.js +28 -19
- package/dist/modules/bot_defaults.d.ts +8 -16
- package/dist/modules/bot_defaults.js +1 -5
- package/dist/modules/bot_settings.d.ts +44 -10
- package/dist/modules/bot_settings.js +11 -8
- package/dist/modules/bots_file_lock.d.ts +6 -6
- package/dist/modules/bots_file_lock.js +16 -12
- package/dist/modules/broadcast_failure.d.ts +4 -3
- package/dist/modules/broadcast_failure.js +5 -4
- package/dist/modules/chain_keys.d.ts +42 -40
- package/dist/modules/chain_keys.js +53 -45
- package/dist/modules/chain_orders.d.ts +94 -60
- package/dist/modules/chain_orders.js +81 -118
- package/dist/modules/cli_start_onboarding.d.ts +2 -1
- package/dist/modules/constants.d.ts +534 -32
- package/dist/modules/constants.js +35 -48
- package/dist/modules/cr_planner.d.ts +41 -3
- package/dist/modules/cr_planner.js +1 -5
- package/dist/modules/credential_policy.d.ts +68 -8
- package/dist/modules/credential_policy.js +37 -31
- package/dist/modules/credential_session_cache.d.ts +2 -2
- package/dist/modules/credit_pricing.d.ts +43 -6
- package/dist/modules/credit_pricing.js +70 -60
- package/dist/modules/credit_runtime.d.ts +283 -118
- package/dist/modules/credit_runtime.js +500 -231
- package/dist/modules/crypto/browser_provider.js +6 -4
- package/dist/modules/crypto/node_provider.js +1 -1
- package/dist/modules/crypto/pure_scrypt.js +35 -4
- package/dist/modules/crypto/pure_secp256k1.js +72 -26
- package/dist/modules/crypto/sync.d.ts +9 -9
- package/dist/modules/crypto/sync.js +16 -9
- package/dist/modules/daemon_node_health.d.ts +4 -3
- package/dist/modules/dexbot_class.d.ts +213 -146
- package/dist/modules/dexbot_class.js +183 -86
- package/dist/modules/dexbot_cow_runtime.d.ts +160 -87
- package/dist/modules/dexbot_cow_runtime.js +302 -234
- package/dist/modules/dexbot_credential_client.d.ts +19 -18
- package/dist/modules/dexbot_credential_client.js +1 -2
- package/dist/modules/dexbot_fill_runtime.d.ts +63 -49
- package/dist/modules/dexbot_fill_runtime.js +53 -47
- package/dist/modules/dexbot_maintenance_runtime.d.ts +127 -71
- package/dist/modules/dexbot_maintenance_runtime.js +187 -147
- package/dist/modules/dexbot_startup_runtime.d.ts +11 -11
- package/dist/modules/dexbot_startup_runtime.js +56 -57
- package/dist/modules/dexbot_state_recovery.d.ts +13 -12
- package/dist/modules/dexbot_state_recovery.js +18 -13
- package/dist/modules/fund_registry.d.ts +4 -2
- package/dist/modules/fund_registry.js +10 -10
- package/dist/modules/general_settings.d.ts +30 -4
- package/dist/modules/graceful_shutdown.d.ts +3 -3
- package/dist/modules/graceful_shutdown.js +19 -13
- package/dist/modules/grid_price_source.d.ts +1 -1
- package/dist/modules/key_store.d.ts +14 -8
- package/dist/modules/key_store.js +7 -7
- package/dist/modules/launcher/adapter_requirement.d.ts +11 -5
- package/dist/modules/launcher/adapter_requirement.js +5 -5
- package/dist/modules/launcher/bot_supervisor.d.ts +106 -24
- package/dist/modules/launcher/bot_supervisor.js +12 -11
- package/dist/modules/launcher/credential_bootstrap.d.ts +1 -1
- package/dist/modules/launcher/credential_bootstrap.js +1 -1
- package/dist/modules/launcher/credential_daemon.d.ts +4 -4
- package/dist/modules/launcher/credential_daemon.js +2 -2
- package/dist/modules/launcher/credential_secret.d.ts +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +2 -2
- package/dist/modules/launcher/market_adapter_runtime.d.ts +61 -6
- package/dist/modules/launcher/market_adapter_watchdog.d.ts +10 -2
- package/dist/modules/launcher/market_adapter_watchdog.js +4 -0
- package/dist/modules/launcher/monolithic_runtime.d.ts +18 -16
- package/dist/modules/launcher/status_reporting.d.ts +22 -14
- package/dist/modules/launcher/supervisor_control.d.ts +8 -1
- package/dist/modules/launcher/supervisor_control.js +4 -2
- package/dist/modules/lazy_shim.d.ts +11 -0
- package/dist/modules/lazy_shim.js +16 -0
- package/dist/modules/market_adapter_whitelist.d.ts +9 -3
- package/dist/modules/market_adapter_whitelist.js +15 -3
- package/dist/modules/node_connect_policy.d.ts +3 -2
- package/dist/modules/node_failure_ledger.d.ts +6 -5
- package/dist/modules/node_manager.d.ts +41 -11
- package/dist/modules/node_manager.js +5 -4
- package/dist/modules/order/accounting.d.ts +53 -24
- package/dist/modules/order/accounting.js +16 -15
- package/dist/modules/order/async_lock.d.ts +5 -2
- package/dist/modules/order/async_lock.js +1 -1
- package/dist/modules/order/export.d.ts +7 -6
- package/dist/modules/order/export.js +1 -7
- package/dist/modules/order/format.d.ts +16 -7
- package/dist/modules/order/format.js +15 -3
- package/dist/modules/order/genesis_policy.d.ts +24 -21
- package/dist/modules/order/genesis_policy.js +17 -10
- package/dist/modules/order/grid.d.ts +144 -36
- package/dist/modules/order/grid.js +226 -145
- package/dist/modules/order/grid_reconcile.d.ts +21 -20
- package/dist/modules/order/grid_reconcile.js +13 -12
- package/dist/modules/order/grid_reconcile_internal.d.ts +85 -72
- package/dist/modules/order/grid_reconcile_internal.js +28 -19
- package/dist/modules/order/index.d.ts +264 -1
- package/dist/modules/order/logger.d.ts +46 -19
- package/dist/modules/order/logger.js +38 -49
- package/dist/modules/order/logger_state.d.ts +4 -4
- package/dist/modules/order/manager.d.ts +232 -191
- package/dist/modules/order/manager.js +110 -130
- package/dist/modules/order/processed_fill_store.d.ts +18 -3
- package/dist/modules/order/processed_fill_store.js +16 -27
- package/dist/modules/order/strategy.d.ts +21 -13
- package/dist/modules/order/strategy.js +5 -6
- package/dist/modules/order/sync_engine.d.ts +91 -33
- package/dist/modules/order/sync_engine.js +84 -53
- package/dist/modules/order/utils/math.d.ts +157 -102
- package/dist/modules/order/utils/math.js +77 -38
- package/dist/modules/order/utils/order.d.ts +310 -110
- package/dist/modules/order/utils/order.js +153 -126
- package/dist/modules/order/utils/slot.d.ts +1 -1
- package/dist/modules/order/utils/system.d.ts +156 -26
- package/dist/modules/order/utils/system.js +103 -71
- package/dist/modules/order/utils/validate.d.ts +89 -41
- package/dist/modules/order/utils/validate.js +26 -24
- package/dist/modules/order/utils/withPoolRef.d.ts +6 -4
- package/dist/modules/order/utils/withPoolRef.js +18 -12
- package/dist/modules/order/working_grid.d.ts +14 -13
- package/dist/modules/paths.d.ts +1 -4
- package/dist/modules/paths.js +33 -61
- package/dist/modules/process_discovery.d.ts +1 -1
- package/dist/modules/process_discovery.js +2 -1
- package/dist/modules/runtime.d.ts +7 -3
- package/dist/modules/runtime.js +4 -3
- package/dist/modules/runtime_settings.d.ts +14 -11
- package/dist/modules/runtime_settings.js +30 -24
- package/dist/modules/settings_merge.d.ts +29 -3
- package/dist/modules/settings_merge.js +56 -78
- package/dist/modules/socket_json_client.d.ts +9 -5
- package/dist/modules/storage/browser_adapter.d.ts +38 -53
- package/dist/modules/storage/browser_adapter.js +7 -30
- package/dist/modules/storage/index.d.ts +1 -1
- package/dist/modules/storage/node_adapter.d.ts +45 -27
- package/dist/modules/storage/node_adapter.js +9 -9
- package/dist/modules/storage/types.d.ts +5 -4
- package/dist/modules/types.d.ts +1090 -6
- package/dist/modules/types.js +4 -1
- package/dist/modules/utils/asset_symbols.d.ts +2 -1
- package/dist/modules/utils/asset_symbols.js +2 -1
- package/dist/modules/utils/errors.d.ts +9 -0
- package/dist/modules/utils/errors.js +24 -4
- package/dist/modules/utils/time_range.d.ts +1 -12
- package/dist/modules/utils/time_range.js +1 -1
- package/dist/modules/validate_profiles.js +53 -43
- package/dist/modules/version_notice.d.ts +23 -11
- package/dist/modules/version_notice.js +6 -4
- package/dist/pm2.d.ts +28 -27
- package/dist/pm2.js +61 -40
- package/dist/scripts/analyze-credit.d.ts +2 -1
- package/dist/scripts/analyze-credit.js +23 -24
- package/dist/scripts/analyze-git.js +2 -15
- package/dist/scripts/analyze-orders.d.ts +77 -9
- package/dist/scripts/analyze-orders.js +65 -40
- package/dist/scripts/chart_command.d.ts +27 -18
- package/dist/scripts/chart_command.js +15 -13
- package/dist/scripts/check_any.d.ts +22 -0
- package/dist/scripts/check_any.js +158 -0
- package/dist/scripts/diagnose-pool-history.js +13 -13
- package/dist/scripts/print_grid.js +0 -1
- package/dist/scripts/run-tests.js +39 -8
- package/dist/scripts/runner.js +1 -1
- package/dist/scripts/sync-version.js +0 -10
- package/dist/scripts/test-credit-renewal.js +30 -21
- package/dist/scripts/update.d.ts +10 -5
- package/dist/scripts/update.js +168 -103
- package/dist/scripts/update_dist_freshness.js +1 -0
- package/dist/scripts/update_layout.d.ts +61 -0
- package/dist/scripts/update_layout.js +180 -0
- package/dist/scripts/validate_bots.js +2 -1
- package/dist/scripts/verify-browser-bundle.js +8 -0
- package/dist/unlock.d.ts +28 -3
- package/dist/unlock.js +63 -35
- package/docs/BITSHARES_ONBOARDING.md +10 -12
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -2
- package/docs/COW_INVARIANTS.md +13 -6
- package/docs/DEXBOT_COMPARISON.md +8 -8
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +5 -5
- package/docs/GRID_RECALCULATION.md +4 -2
- package/docs/GRID_RECONCILE.md +14 -3
- package/docs/LIFECYCLE.md +11 -11
- package/docs/MPA_CREDIT_USAGE.md +22 -3
- package/docs/README.md +14 -3
- package/docs/WORKFLOW.md +1 -0
- package/docs/architecture.md +31 -19
- package/docs/developer_guide.md +6 -6
- package/market_adapter/README.md +12 -5
- package/modules/README.md +4 -1
- package/package.json +9 -9
- package/scripts/README.md +43 -38
- package/tests/README.md +25 -10
- package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
- package/dist/scripts/diagnose-kibana-candles.js +0 -82
- package/scripts/git-viewer.sh +0 -489
- package/scripts/postinstall.js +0 -16
package/docs/MPA_CREDIT_USAGE.md
CHANGED
|
@@ -266,6 +266,26 @@ When a deal's `latest_repay_time` is within `CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS`
|
|
|
266
266
|
|
|
267
267
|
If inline reborrow cannot be built safely, the runtime stores a deferred reborrow request in `profiles/credit_runtime/<botKey>.json` and retries later.
|
|
268
268
|
|
|
269
|
+
#### Shortfall-Aware Partial Renewal
|
|
270
|
+
|
|
271
|
+
The repay leg is funded from the borrower's *free* debt-asset balance before the atomic reborrow returns anything. If that balance is below principal + credit fee (the borrowed asset was spent into the grid), a full renewal fails on-chain with `Insufficient Balance`. The runtime renews the largest affordable piece instead:
|
|
272
|
+
|
|
273
|
+
- `free >= principal + fee` → full renewal (legacy behaviour).
|
|
274
|
+
- Otherwise repay/reborrow the largest piece that fits, floored to the debt-asset precision, clamped to the offer's `min_deal_amount` and the policy's `maxBorrowAmountPerOperation`, and leaving one raw unit unspent as a balance-drift buffer.
|
|
275
|
+
- The remainder keeps its original `latest_repay_time` (the rolled piece gets a fresh one), so later cycles chip it away.
|
|
276
|
+
- If no piece can be formed, it falls back to the full renewal so the chain error still surfaces.
|
|
277
|
+
|
|
278
|
+
The reborrow snapshots the pre-repay deal IDs, so the stale-entry guard only drops a request when a deal *appeared after* the repay on the same offer — sibling deals no longer block a legitimate reborrow.
|
|
279
|
+
|
|
280
|
+
#### Collateral Shortfall Scaling
|
|
281
|
+
|
|
282
|
+
A reborrow can only lock the collateral the repay just released. If the market moved against the collateral, the full debt needs more than the deal holds, so the runtime clamps the borrow to the released collateral rather than emit an op that fails the collateral check:
|
|
283
|
+
|
|
284
|
+
- `buildCreditOfferAcceptOperation` takes an optional raw `availableCollateralAmount` budget and shrinks the borrow to the maximum that budget can back at the offer price (`capBorrowToCollateral`). It lives in the shared builder, so original, fallback, and deferred reborrows all get it.
|
|
285
|
+
- A clamped borrow below `min_deal_amount` is deferred and retried (up to `TIMING.CREDIT_REBORROW_MAX_ATTEMPTS`, default `6`) so a price recovery can revive it; after the limit it is dropped. The repay still proceeds, so the position deleverages.
|
|
286
|
+
- The collateral-switch flow passes the new asset's balance as the budget.
|
|
287
|
+
- Each accept records `requestedBorrowAmount` vs `borrowAmount` and `clampedByCollateral` in `lastBorrowRequest`.
|
|
288
|
+
|
|
269
289
|
### Collateral Switching on Renewal
|
|
270
290
|
|
|
271
291
|
You can switch a credit deal's collateral to a different asset on its next renewal by changing `lendingItem.collateralAsset` to the new asset in `bots.json`. The runtime detects existing deals whose collateral no longer matches the policy and migrates them during proactive expiry repay+reborrow. Requirements:
|
|
@@ -322,7 +342,7 @@ The file tracks discovered chain state and pending work, including:
|
|
|
322
342
|
- `positions` — per-position state map keyed as `debtAssetId:collateralAssetId`
|
|
323
343
|
- Active MPA call-order state and credit deal IDs per position
|
|
324
344
|
- `assignedCollateralBudget` per position
|
|
325
|
-
- Pending reborrow requests (including deferred split pieces when an oversized-deal cycle hits `CREDIT_DEAL_SPLIT_MAX_PIECES`)
|
|
345
|
+
- Pending reborrow requests (including deferred split pieces when an oversized-deal cycle hits `CREDIT_DEAL_SPLIT_MAX_PIECES`, and the `reborrowAttempts` counter that bounds retries)
|
|
326
346
|
- Last repay timestamp and grid reset request
|
|
327
347
|
- Debt snapshot across all assets
|
|
328
348
|
|
|
@@ -343,8 +363,7 @@ Treat this file as runtime state, not primary configuration. The source of truth
|
|
|
343
363
|
|
|
344
364
|
- `modules/credit_runtime.ts`: debt workflow executor (Phase 0 oversized-deal splitter lives here)
|
|
345
365
|
- `modules/credit_pricing.ts`: canonical credit-pricing math (offer orientation, conversion rates, CR, fees) shared by runtime and analyzer
|
|
346
|
-
- `modules/cr_planner.ts`: MPA debt-first planner
|
|
347
|
-
- `modules/cr_planner.ts`: `DebtFirstCrPlanOptions` — planner options carrying `maxBorrowAmountPerOperation`; lending-item shapes are validated inline in `bot_settings.ts`
|
|
366
|
+
- `modules/cr_planner.ts`: MPA debt-first planner (`DebtFirstCrPlanOptions`, clamps `debtDelta` by `maxBorrowAmountPerOperation`); lending-item shapes are validated in `modules/bot_settings.ts`
|
|
348
367
|
- `modules/dexbot_class.ts`: runtime startup and watchdog lifecycle
|
|
349
368
|
- `modules/bot_settings.ts`: `debtPolicy` validation
|
|
350
369
|
- `market_adapter/README.md`: AMA pricing, grid triggers, and dynamic-weight runtime
|
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.13 (released).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -62,10 +62,16 @@ This directory contains the comprehensive technical documentation for the DEXBot
|
|
|
62
62
|
- **Configuration**: Per-source thresholds, whitelist requirements, and defaults
|
|
63
63
|
- **Trigger Execution**: How `profiles/recalculate.<botKey>.trigger` is consumed under the fill-processing lock
|
|
64
64
|
|
|
65
|
+
### 📉 [AMA-Slope Window](AMA_SLOPE_WINDOW.md)
|
|
66
|
+
*Why the Huber slope window is 16h and gated by a 3-bar persistence check.*
|
|
67
|
+
- **Decision**: `DYNAMIC_WEIGHT_AMA_LOOKBACK_BARS` 20 → 16, `AMA_SLOPE_PERSIST_ENABLED` false → true (`AMA_SLOPE_PERSIST_BARS = 3`)
|
|
68
|
+
- **Rationale**: shorter, more responsive window plus the persistence gate cuts slope-reset churn (~35%) and whipsaw without changing the estimator
|
|
69
|
+
- **Evidence**: measured reset/lag/whipsaw table from a live 1h pool via `backtest_ama_slope_huber.ts`
|
|
70
|
+
|
|
65
71
|
### 🔁 [Grid Reconciliation](GRID_RECONCILE.md)
|
|
66
72
|
*How the bot re-aligns its intended grid with on-chain reality at startup.*
|
|
67
73
|
- **3-Phase Plan-then-Execute**: Phase 1 pure in-memory planning under `_gridLock`, Phase 2 blockchain execution outside the lock, Phase 3 fresh re-read and stale surplus cleanup
|
|
68
|
-
- **Safety Guardrails**: Fresh-grid `matchedOnGrid > 0` guard, exact slot-price duplicate cancel, freshly-assigned deferral, and truncated-read ambiguity handling
|
|
74
|
+
- **Safety Guardrails**: Fresh-grid `matchedOnGrid > 0` guard, exact slot-price duplicate cancel, freshly-assigned deferral, the `SURPLUS_CANCEL_GRACE_MS` fresh-placement grace, and truncated-read ambiguity handling
|
|
69
75
|
- **Partial Failure State**: No rollback on partial Phase 2 success; remaining mismatches caught by the next maintenance or startup cycle
|
|
70
76
|
- **Lock Hierarchy**: Canonical `_syncLock`/`_gridLock` level reference and the 1.4.6 ABBA deadlock correction
|
|
71
77
|
|
|
@@ -161,7 +167,7 @@ This directory contains the comprehensive technical documentation for the DEXBot
|
|
|
161
167
|
- **Signal Concepts**: Dynamic weights, regime detection, and market adapter integration
|
|
162
168
|
- **Debt Policy**: Native MPA and credit offer configuration and runtime rules
|
|
163
169
|
- **Practical How-Tos**: Adding features step by step, common pitfalls to avoid, and useful debugging commands.
|
|
164
|
-
- **Glossary**: Definitions of project-specific terminology (e.g., "
|
|
170
|
+
- **Glossary**: Definitions of project-specific terminology (e.g., "VIRTUAL order state", "Rotation", "Pipeline Safety", "WorkingGrid", "Atomic Commit", "Dynamic Weight", "Regime Detection").
|
|
165
171
|
|
|
166
172
|
### 🔄 [Workflow](WORKFLOW.md)
|
|
167
173
|
*How we build and release.*
|
|
@@ -189,6 +195,11 @@ This directory contains the comprehensive technical documentation for the DEXBot
|
|
|
189
195
|
*Release notes and documentation history.*
|
|
190
196
|
- **Scope**: Versioned notes per release
|
|
191
197
|
|
|
198
|
+
### 📐 [DEXBot2 vs the Power-Law Liquidity Curve](DEXBOT2_VS_POWER_LAW_CURVE.md)
|
|
199
|
+
*Design proposal comparing DEXBot2's weight + range allocation with AMM liquidity curves.*
|
|
200
|
+
- **Scope**: Constant-product, weighted-geometric-mean, and Reciprocal-CES curves vs the bot's order-book allocation
|
|
201
|
+
- **Audience**: Protocol designers evaluating an AMM that reproduces DEXBot2's allocation
|
|
202
|
+
|
|
192
203
|
### 🧮 [DEXBot vs DEXBot2 Comparison](DEXBOT_COMPARISON.md)
|
|
193
204
|
*Architectural, functional, and operational comparison with the original Python DEXBot.*
|
|
194
205
|
- **Scope**: Full side-by-side of technology stack, architecture, trading strategies, order management, configuration, blockchain integration, fund accounting, and concurrency safety
|
package/docs/WORKFLOW.md
CHANGED
|
@@ -255,6 +255,7 @@ the canonical name is preferred in scripts and docs.
|
|
|
255
255
|
| `dexbot tv <target>` | — | TradingView 1h chart for `<bot|pool-id|AssetA/AssetB>` over `--month N` (default 3) |
|
|
256
256
|
| `dexbot dw <target>` | — | Dynamic-weight research chart: same targets/flags as `tv` |
|
|
257
257
|
| `dexbot pnl <account>` | — | HTML PnL report for a bot/account over `--month N`, optional `--pair BASE/QUOTE` filter |
|
|
258
|
+
| `dexbot git` | — | Analyze repository git history and write an added/deleted-lines HTML chart (`repo-stats.html`; source checkouts only) |
|
|
258
259
|
| `dexbot status` | `stat`, `stats` | Unified runtime health — daemon, adapter, bots |
|
|
259
260
|
| `dexbot start` | `unlock` | Run credential daemon + bot (equivalent to running the `unlock` runtime, `dist/unlock.js`) |
|
|
260
261
|
| `dexbot stop` | `stp`, `stopall` | Stop the monolithic runtime (unlock mode) |
|
package/docs/architecture.md
CHANGED
|
@@ -146,6 +146,7 @@ graph TB
|
|
|
146
146
|
|
|
147
147
|
WORKGRID[WorkingGrid<br/>working_grid.ts]
|
|
148
148
|
GRID_RECONCILE[GridReconcile<br/>grid_reconcile.ts]
|
|
149
|
+
COW_RUNTIME[COWRuntime<br/>dexbot_cow_runtime.ts]
|
|
149
150
|
UTILS[Utils<br/>utils/]
|
|
150
151
|
LOGGER[Logger<br/>logger.ts]
|
|
151
152
|
FILL_STORE[ProcessedFillStore<br/>processed_fill_store.ts]
|
|
@@ -190,7 +191,7 @@ graph TB
|
|
|
190
191
|
MANAGER --> GRID_RECONCILE
|
|
191
192
|
MANAGER --> UTILS
|
|
192
193
|
MANAGER --> LOGGER
|
|
193
|
-
MANAGER -->
|
|
194
|
+
MANAGER --> COW_RUNTIME
|
|
194
195
|
MANAGER --> FILL_STORE
|
|
195
196
|
|
|
196
197
|
ACCOUNTANT --> FUND_REGISTRY
|
|
@@ -198,7 +199,7 @@ graph TB
|
|
|
198
199
|
SYNC --> UTILS
|
|
199
200
|
GRID --> UTILS
|
|
200
201
|
|
|
201
|
-
|
|
202
|
+
COW_RUNTIME --> CHAIN_ORDERS
|
|
202
203
|
SYNC --> ACCOUNT_ORDERS
|
|
203
204
|
MANAGER --> ACCOUNT_BOTS
|
|
204
205
|
|
|
@@ -475,16 +476,25 @@ The correction path is fund-only and never manufactures budget by shrinking a re
|
|
|
475
476
|
|
|
476
477
|
```
|
|
477
478
|
1. Detect that the live window is wider than targetSpreadPercent.
|
|
478
|
-
2. Select up to `outOfSpread`
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
479
|
+
2. Select up to `outOfSpread` spread-tightening empty slots (below the lowest
|
|
480
|
+
live sell / above the highest live buy), ordered window-contiguous first, with
|
|
481
|
+
a market-nearest fallback when the rail has no live order.
|
|
482
|
+
3. Create those slots from free available/chainFree funds only. A resting PARTIAL
|
|
483
|
+
is never a correction target: a top-up grows an order at its current price, so
|
|
484
|
+
it cannot move bestBuy/bestSell and cannot narrow the spread.
|
|
485
|
+
4. Contiguous gap-slot promotion may extend the window while preserving
|
|
486
|
+
MIN_SPREAD_ORDERS and the opposite placed rail.
|
|
487
|
+
5. If free funds cannot cover every target, place the affordable prefix, stop
|
|
488
|
+
without shrinking inventory, and log the fund-constrained remainder.
|
|
489
|
+
6. If neither side places an effective order, `checkSpreadCondition` reports a
|
|
490
|
+
`stall` cause (`no-free-funds` / `unfunded` / `no-candidates` /
|
|
491
|
+
`batch-not-executed` / `apply-error`). Every cause arms the targeted
|
|
492
|
+
balances + open-orders refresh: the local snapshot the check reasoned over
|
|
493
|
+
may be stale (`no-candidates` can mean a missed fill left an ACTIVE slot
|
|
494
|
+
occupying the window edge, so no tightening slot appears to exist), and only
|
|
495
|
+
a chain sync can tell a stale snapshot from structural geometry. The
|
|
496
|
+
out-of-spread staleness watchdog remains the backstop if the sync heals
|
|
497
|
+
nothing. No resting order is ever recycled.
|
|
488
498
|
```
|
|
489
499
|
|
|
490
500
|
Detected dust partials never enter this path: `cancelDustOrders()` cancels them
|
|
@@ -1110,13 +1120,15 @@ The system continuously monitors three mathematical invariants:
|
|
|
1110
1120
|
### Metrics Tracking
|
|
1111
1121
|
|
|
1112
1122
|
```javascript
|
|
1113
|
-
|
|
1114
|
-
// Returns:
|
|
1115
|
-
// -
|
|
1116
|
-
// -
|
|
1117
|
-
// - lockAcquisitions
|
|
1118
|
-
// -
|
|
1119
|
-
// -
|
|
1123
|
+
bot.getMetrics()
|
|
1124
|
+
// Returns (OrderManager._metrics plus live pipeline state):
|
|
1125
|
+
// - fillsProcessed, batchesExecuted, fillProcessingTimeMs, maxQueueDepth
|
|
1126
|
+
// - fundRecalcCount, lastSyncDurationMs, metricsStartTime
|
|
1127
|
+
// - lockAcquisitions, lockContentionEvents, lockContentionSkips, gridLockContention
|
|
1128
|
+
// - spreadRoleConversionBlocked
|
|
1129
|
+
// - queueDepth, fillProcessingLockActive, divergenceLockActive, shadowLocksActive
|
|
1130
|
+
// - recoveryExhaustedAt, recentFillsTracked
|
|
1131
|
+
// - unmatchedChainOrders, heldChainOrders, blockingChainOrders
|
|
1120
1132
|
```
|
|
1121
1133
|
|
|
1122
1134
|
---
|
package/docs/developer_guide.md
CHANGED
|
@@ -44,8 +44,8 @@ Follow this path through the codebase:
|
|
|
44
44
|
- `modules/constants.ts::MARKET_ADAPTER` - AMA, dynamic weight, and regime detection defaults
|
|
45
45
|
- `modules/constants.ts::REGIME_TABLE` - Hurst/PE regime signal-strength table
|
|
46
46
|
- `modules/dexbot_class.ts::_handleBatchHardAbort()` - Hard-abort recovery handler
|
|
47
|
-
- `modules/
|
|
48
|
-
- `
|
|
47
|
+
- `bot._staleCleanedOrderIds` (`modules/dexbot_fill_runtime.ts`, typed in `modules/types.ts`) - Orphan-fill deduplication tracking
|
|
48
|
+
- `bot._cancelDustOrders()` (`modules/dexbot_maintenance_runtime.ts` / `modules/dexbot_fill_runtime.ts`) - Auto-cancel dust partials on-chain immediately (no timer)
|
|
49
49
|
- `modules/credit_runtime.ts` - Debt workflow executor (MPA and credit offer)
|
|
50
50
|
- `market_adapter/core/market_adapter_service.ts` - Signal pipeline (AMA, dynamic weights, collateral advisory)
|
|
51
51
|
|
|
@@ -909,7 +909,7 @@ convention marker — AsyncLock does not enforce it at runtime.
|
|
|
909
909
|
|
|
910
910
|
**`adjustTotalBalance` Locking Contract** (v1.4.7):
|
|
911
911
|
|
|
912
|
-
The public `adjustTotalBalance()` (Level 4) is now async and **acquires `_fundLock` internally**. Callers that already hold `_fundLock` (e.g. `
|
|
912
|
+
The public `adjustTotalBalance()` (Level 4) is now async and **acquires `_fundLock` internally**. Callers that already hold `_fundLock` (e.g. the fee-settlement paths inside `modules/order/accounting.ts`) must use the private `_adjustTotalBalanceLocked()` sync helper instead to avoid redundant nested re-entrancy. Callers outside any `_fundLock` region (e.g. `_applyBalanceAdjustments`, rollback, and the maintenance/sync/cow-runtime call sites) should continue using `adjustTotalBalance()` with `await`.
|
|
913
913
|
|
|
914
914
|
**Example: Safe Pattern**
|
|
915
915
|
|
|
@@ -976,9 +976,9 @@ async start() {
|
|
|
976
976
|
|
|
977
977
|
All new orders pass through two validation gates:
|
|
978
978
|
|
|
979
|
-
1. **Strategy/Grid Logic** (`strategy.ts`, `grid.ts`):
|
|
979
|
+
1. **Strategy/Grid Logic** (`strategy.ts`, `grid.ts`, `utils/validate.ts`):
|
|
980
980
|
- Check: `size >= getMinOrderSize(type, assets, factor)`
|
|
981
|
-
- Double-dust threshold: `size >=
|
|
981
|
+
- Double-dust threshold: `size >= getDoubleDustThreshold(idealSize, dustThresholdPercent)` (`utils/validate.ts` `isCreateHealthy`)
|
|
982
982
|
- Prevents undersized placement attempts
|
|
983
983
|
|
|
984
984
|
2. **Broadcast Validation** (`dexbot_class.ts`):
|
|
@@ -1490,7 +1490,7 @@ manager.logger.logFundsStatus(manager, 'CONTEXT');
|
|
|
1490
1490
|
|
|
1491
1491
|
### View Metrics
|
|
1492
1492
|
```javascript
|
|
1493
|
-
console.log(
|
|
1493
|
+
console.log(dexbot.getMetrics()); // OrderManager._metrics plus live pipeline state
|
|
1494
1494
|
```
|
|
1495
1495
|
|
|
1496
1496
|
### Check Order Map Integrity
|
package/market_adapter/README.md
CHANGED
|
@@ -12,9 +12,11 @@ The live signal layer for AMA-priced bots. It reads candles, computes the AMA ce
|
|
|
12
12
|
- [Symmetric Weight Shift](#symmetric-weight-shift)
|
|
13
13
|
- [Trigger Threshold](#trigger-threshold)
|
|
14
14
|
- [Settings and Overrides](#settings-and-overrides)
|
|
15
|
+
- [Off-Hour Idle Behavior](#off-hour-idle-behavior)
|
|
15
16
|
- [Live Writes and Dry-Run](#live-writes-and-dry-run)
|
|
16
17
|
- [Useful Commands](#useful-commands)
|
|
17
18
|
- [Troubleshooting](#troubleshooting)
|
|
19
|
+
- [Related Tools](#related-tools)
|
|
18
20
|
- [Technical Reference](#technical-reference)
|
|
19
21
|
|
|
20
22
|
## Which section do I need?
|
|
@@ -408,6 +410,7 @@ node dist/analysis/ama_fitting/calibrate_convergence_er.js --data market_adapter
|
|
|
408
410
|
|
|
409
411
|
More tools:
|
|
410
412
|
|
|
413
|
+
- [`dexbot tv`](../analysis/tradingview/README.md) — one-step candle fetch + chart, with the grid range and AMA recentering overlaid (handy for tuning `minPrice` / `maxPrice`)
|
|
411
414
|
- [Analysis](../analysis/README.md)
|
|
412
415
|
- [Scripts](../scripts/README.md)
|
|
413
416
|
|
|
@@ -578,7 +581,7 @@ market_adapter/
|
|
|
578
581
|
|-- market_adapter.ts main adapter daemon
|
|
579
582
|
|-- ama_signal_runner.ts one-cycle JSON signal CLI
|
|
580
583
|
|-- candle_utils.ts candle transforms, gap detection, pruning
|
|
581
|
-
|-- interval_utils.ts shared interval label helpers
|
|
584
|
+
|-- interval_utils.ts shared interval label + chain-time helpers
|
|
582
585
|
|-- lp_chart_core.ts chart HTML renderer
|
|
583
586
|
|-- lp_chart_strategy_loader.ts AMA strategy/profile resolver for charts
|
|
584
587
|
|-- lp_chart_runner.ts LP chart orchestration
|
|
@@ -589,7 +592,7 @@ market_adapter/
|
|
|
589
592
|
| |-- market_adapter_service.ts full signal pipeline service
|
|
590
593
|
| |-- config_normalizers.ts shared config normalization
|
|
591
594
|
| |-- kibana_client.ts low-level Kibana/ES query client
|
|
592
|
-
| |-- kibana_candles.ts
|
|
595
|
+
| |-- kibana_candles.ts generic Kibana candle fetch engine (LP/book/feed)
|
|
593
596
|
| |-- kibana_market_candles.ts book candle fetch and transform
|
|
594
597
|
| |-- signals/
|
|
595
598
|
| | |-- hurst_analyzer.ts Hurst Exponent analysis
|
|
@@ -611,13 +614,16 @@ market_adapter/
|
|
|
611
614
|
| |-- fetch_book_data.ts order-book candle exporter
|
|
612
615
|
| |-- kibana_feed_source.ts MPA feed candle source
|
|
613
616
|
| |-- window_cache.ts shared month-shard candle cache
|
|
614
|
-
|
|
|
617
|
+
| |-- fetch_cex_synthetic_data.ts public CEX synthetic-candle seed importer
|
|
618
|
+
| `-- cex_candle_parsing.ts CEX OHLC row layouts and parsing
|
|
615
619
|
|-- utils/
|
|
616
620
|
| |-- chain.ts blockchain query helpers
|
|
617
621
|
| |-- adapter_client.ts inter-process credential daemon client
|
|
618
622
|
| |-- native_history.ts native BitShares market history fetch
|
|
619
623
|
| |-- file_lock.ts single-instance file lock
|
|
620
|
-
| |--
|
|
624
|
+
| |-- file_json_cache.ts write-through JSON read cache
|
|
625
|
+
| |-- month_shards.ts calendar-month shard naming + coverage-span primitives (shared by candle and fills caches)
|
|
626
|
+
| |-- data_discovery.ts data directory auto-discovery + shard-family assembly
|
|
621
627
|
| |-- atomic_write.ts atomic file write utility
|
|
622
628
|
| |-- dynamic_grid_snapshot.ts dynamic grid snapshot helpers
|
|
623
629
|
|-- data/ runtime candle caches and exports
|
|
@@ -801,7 +807,8 @@ Main override knobs live in `profiles/market_adapter_settings.json`:
|
|
|
801
807
|
| `gain` | Output amplitude |
|
|
802
808
|
| `amaSlopePercentMode` | Slope override units: `perBar` for percent per bar, or `window`/unset for legacy cumulative percent over the lookback |
|
|
803
809
|
| `amaSlope.lookbackBars` | AMA slope lookback; slope is averaged per bar over this window (default 16) |
|
|
804
|
-
| `amaSlope.persistBars` | Slope-delta persistence gate: consecutive confirming bars required before the slope reset fires (default 3
|
|
810
|
+
| `amaSlope.persistBars` | Slope-delta persistence gate: consecutive confirming bars required before the slope reset fires (default `MARKET_ADAPTER.AMA_SLOPE_PERSIST_BARS`, 3). `1` = legacy fire-on-first-crossing; `0` = disable. Negative/absent values fall through to the global flag |
|
|
811
|
+
| `amaSlope.persistEnabled` | Per-bot tri-state override of the master switch: `false` disables the gate for this bot/market even when `AMA_SLOPE_PERSIST_ENABLED` is on, `true` forces it on, unset follows the global flag |
|
|
805
812
|
| `amaSlope.neutralZonePct` | Dead band around flat average AMA slope |
|
|
806
813
|
| `amaSlope.maxSlopePct` | Average AMA slope saturation |
|
|
807
814
|
| `amaSlopeDeltaThresholdPercent` | Average AMA slope delta threshold for slope-based resets |
|
package/modules/README.md
CHANGED
|
@@ -113,6 +113,7 @@ modules/
|
|
|
113
113
|
│ └── withPoolRef.ts startPrice mode + poolRef resolution
|
|
114
114
|
│
|
|
115
115
|
├── launcher/ process lifecycle (PM2, unlock, isolated)
|
|
116
|
+
│ ├── adapter_requirement.ts canonical market-adapter requirement (single source of truth)
|
|
116
117
|
│ ├── bot_supervisor.ts per-bot process supervision
|
|
117
118
|
│ ├── child_env.ts child process environment
|
|
118
119
|
│ ├── credential_bootstrap.ts daemon startup
|
|
@@ -141,12 +142,14 @@ modules/
|
|
|
141
142
|
│ └── crypto/ cryptographic primitives
|
|
142
143
|
│
|
|
143
144
|
└── utils/
|
|
145
|
+
├── asset_symbols.ts asset symbol/object-id canonicalization helpers
|
|
144
146
|
├── base58check.ts Base58Check encoding
|
|
145
147
|
├── build_dir.ts BUILD_DIR constant helper
|
|
146
148
|
├── chain_logs.ts shared chain log helpers
|
|
147
149
|
├── errors.ts getErrorMessage helper
|
|
148
150
|
├── sanitize_key.ts shared sanitizeKey helper
|
|
149
|
-
|
|
151
|
+
├── text_width.ts display-width-aware text measurement (CJK/emoji tables)
|
|
152
|
+
└── time_range.ts month→hour lookback conversion (analysis range flags)
|
|
150
153
|
```
|
|
151
154
|
|
|
152
155
|
## Key Relationships
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dexbot",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "The first open source trading bot with zero runtime dependencies and a fully adaptive market making strategy.",
|
|
5
5
|
"main": "dist/modules/dexbot_class.js",
|
|
6
6
|
"exports": {
|
|
@@ -26,13 +26,11 @@
|
|
|
26
26
|
"scripts/clear-orders.sh",
|
|
27
27
|
"scripts/create-bot-symlinks.sh",
|
|
28
28
|
"scripts/dexbot",
|
|
29
|
-
"scripts/git-viewer.sh",
|
|
30
29
|
"scripts/keys",
|
|
31
30
|
"scripts/lib/dexbot-paths.sh",
|
|
32
31
|
"scripts/pdev.sh",
|
|
33
32
|
"scripts/pm2",
|
|
34
33
|
"scripts/pmain.sh",
|
|
35
|
-
"scripts/postinstall.js",
|
|
36
34
|
"scripts/ptest.sh",
|
|
37
35
|
"scripts/README.md",
|
|
38
36
|
"scripts/reset-settings.sh",
|
|
@@ -88,8 +86,8 @@
|
|
|
88
86
|
"unlock:start": "npm run unlock",
|
|
89
87
|
"claw:unlock": "npm run build && node dist/unlock.js --claw-only",
|
|
90
88
|
"claw:start": "npm run claw:unlock",
|
|
91
|
-
"pm2:start": "
|
|
92
|
-
"pm2:stop": "
|
|
89
|
+
"pm2:start": "npm run pm2:unlock",
|
|
90
|
+
"pm2:stop": "node dist/pm2.js stop all",
|
|
93
91
|
"pmain": "bash scripts/pmain.sh",
|
|
94
92
|
"pdev": "bash scripts/pdev.sh",
|
|
95
93
|
"ptest": "bash scripts/ptest.sh",
|
|
@@ -105,7 +103,6 @@
|
|
|
105
103
|
"native:ecc-invariants": "npm run build && npm run build:tests && node dist/tests/test_native_ecc.js",
|
|
106
104
|
"native:corpus": "npm run build && node dist/scripts/generate_mainnet_corpus_report.js",
|
|
107
105
|
"test:credit-renewal": "npm run build && node dist/scripts/test-credit-renewal.js",
|
|
108
|
-
"test:legacy": "npm run build && npm run build:tests && node dist/analysis/legacy/tests/test_derivative_chart.js && node dist/analysis/legacy/tests/test_derivative_entry_bias.js && node dist/analysis/legacy/tests/test_derivative_momentum_gate.js && node dist/analysis/legacy/tests/test_derivative_signal_trap_regression.js && node dist/analysis/legacy/tests/test_kalman_trend.js && node dist/analysis/legacy/tests/test_kalman_velocity_smoothing.js",
|
|
109
106
|
"version:sync": "npm run build && node dist/scripts/sync-version.js",
|
|
110
107
|
"version:check": "npm run build && node dist/scripts/sync-version.js --check",
|
|
111
108
|
"verify:browser-bundle": "npm run build && node dist/scripts/verify-browser-bundle.js",
|
|
@@ -114,15 +111,17 @@
|
|
|
114
111
|
"clean": "node scripts/clean-dist.js",
|
|
115
112
|
"build": "echo \"tsc is compiling ...\" && tsc && chmod +x dist/dexbot.js dist/bot.js dist/unlock.js dist/pm2.js dist/credential-daemon.js",
|
|
116
113
|
"build:clean": "npm run clean && npm run build",
|
|
117
|
-
"build:tests": "tsc -p tsconfig.tests.json && cp tests/package.json dist/tests/package.json && cp tests/helpers/esm_mock_hooks.mjs tests/helpers/esm_mock_loader.mjs dist/tests/helpers/
|
|
114
|
+
"build:tests": "tsc -p tsconfig.tests.json && cp tests/package.json dist/tests/package.json && cp tests/helpers/esm_mock_hooks.mjs tests/helpers/esm_mock_loader.mjs dist/tests/helpers/",
|
|
118
115
|
"typecheck": "tsc --noEmit",
|
|
116
|
+
"check:any": "npm run build && node dist/scripts/check_any.js",
|
|
117
|
+
"check:any:update": "npm run build && node dist/scripts/check_any.js --update",
|
|
118
|
+
"check:any:list": "npm run build && node dist/scripts/check_any.js --list",
|
|
119
119
|
"typecheck:tests": "tsc -p tsconfig.tests.json --noEmit",
|
|
120
120
|
"build:watch": "tsc --watch",
|
|
121
121
|
"version": "npm run version:sync && npm run build:clean",
|
|
122
122
|
"postversion": "npm run build:clean",
|
|
123
123
|
"prepack": "npm run build:clean",
|
|
124
|
-
"prepare": "npm run build:clean"
|
|
125
|
-
"postinstall": "node scripts/postinstall.js"
|
|
124
|
+
"prepare": "npm run build:clean"
|
|
126
125
|
},
|
|
127
126
|
"repository": {
|
|
128
127
|
"type": "git",
|
|
@@ -167,6 +166,7 @@
|
|
|
167
166
|
"./dist/modules/dexbot_state_recovery.js": false,
|
|
168
167
|
"./dist/modules/dexbot_startup_runtime.js": false,
|
|
169
168
|
"./dist/modules/dexbot_class.js": false,
|
|
169
|
+
"./dist/modules/lazy_shim.js": false,
|
|
170
170
|
"./dist/modules/graceful_shutdown.js": false,
|
|
171
171
|
"./dist/modules/process_discovery.js": false,
|
|
172
172
|
"./dist/modules/credential_runtime.js": false,
|
package/scripts/README.md
CHANGED
|
@@ -7,7 +7,7 @@ This guide provides a terminal-focused reference for the maintenance and diagnos
|
|
|
7
7
|
## 🛠️ CORE MAINTENANCE
|
|
8
8
|
|
|
9
9
|
### Update DEXBot2
|
|
10
|
-
**File:** `update.ts` (shim: `update.js`)
|
|
10
|
+
**File:** `update.ts` (shim: `update.js`), install-layout detection in `update_layout.ts`
|
|
11
11
|
**Purpose:** Perform a safe, production-ready update.
|
|
12
12
|
```bash
|
|
13
13
|
# Pull latest code, install deps, and restart PM2
|
|
@@ -143,12 +143,17 @@ shows live weights with color: higher = red (losing), lower = green (winning),
|
|
|
143
143
|
static = grey. Stale snapshot appends a red `(adapter offline)` alert to the
|
|
144
144
|
static weights.
|
|
145
145
|
|
|
146
|
-
###
|
|
147
|
-
**File:** `
|
|
148
|
-
**Purpose:**
|
|
146
|
+
### Credit Analysis
|
|
147
|
+
**File:** `analyze-credit.ts` (CLI: `dexbot credit`)
|
|
148
|
+
**Purpose:** Live-chain overview of active MPA (margin) and credit (borrowed-deal) positions, summed per asset per bot — the credit counterpart to `analyze-orders.ts` / `dexbot order`.
|
|
149
149
|
```bash
|
|
150
|
-
|
|
150
|
+
# Credit-enabled bots only
|
|
151
|
+
node dist/scripts/analyze-credit.js
|
|
152
|
+
|
|
153
|
+
# Single bot (name or key)
|
|
154
|
+
node dist/scripts/analyze-credit.js <bot>
|
|
151
155
|
```
|
|
156
|
+
Credit deals report per-pair and average CR, but only for pairs whitelisted in `bots.json` (`debtPolicy.lending`) and listed on the current credit offer; everything else is shown as ignored/unpriced and excluded from the average. A borrow-now preview per configured pair shows today's rate.
|
|
152
157
|
|
|
153
158
|
### Pool History Diagnostics
|
|
154
159
|
**File:** `diagnose-pool-history.ts`
|
|
@@ -195,36 +200,6 @@ The corpus report lands in `<profiles>/native_validation/mainnet_corpus_report.j
|
|
|
195
200
|
|
|
196
201
|
---
|
|
197
202
|
|
|
198
|
-
## 🔍 GIT & DEVELOPMENT WORKFLOW
|
|
199
|
-
|
|
200
|
-
### Interactive Git Changes Monitor
|
|
201
|
-
**File:** `git-viewer.sh`
|
|
202
|
-
**Purpose:** Interactive monitor for uncommitted, committed, and pushed changes.
|
|
203
|
-
```bash
|
|
204
|
-
# Launch interactive git changes viewer with fzf search
|
|
205
|
-
bash scripts/git-viewer.sh
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**Features**:
|
|
209
|
-
- View uncommitted (working tree) changes
|
|
210
|
-
- View committed (staged) changes
|
|
211
|
-
- View pushed vs. remote-tracking changes
|
|
212
|
-
- Smart auto-refresh (1s for local, 15s for remote)
|
|
213
|
-
- Fuzzy search with `fzf` for finding files
|
|
214
|
-
- Toggle between full file view and diff-only view
|
|
215
|
-
|
|
216
|
-
**Usage**:
|
|
217
|
-
```bash
|
|
218
|
-
# Press '1' to view all changes
|
|
219
|
-
# Press '2' to search uncommitted files (with fzf)
|
|
220
|
-
# Press '3' to search unpushed commits (with fzf)
|
|
221
|
-
# Press '4' to search pushed commits (with fzf)
|
|
222
|
-
# Press 'q' to quit
|
|
223
|
-
```
|
|
224
|
-
Inside file viewer: `f` full file, `d` diff view, `q` back to search, `b` main menu.
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
203
|
## 💻 DEVELOPMENT UTILITIES
|
|
229
204
|
|
|
230
205
|
### Test Suite Setup
|
|
@@ -234,11 +209,31 @@ through `dist/scripts/run-tests.js` (with a per-test watchdog and diagnostics
|
|
|
234
209
|
summary). See [tests/README.md](../tests/README.md) for details.
|
|
235
210
|
|
|
236
211
|
### Repository Statistics Analyzer
|
|
237
|
-
**File:** `analyze-git.ts`
|
|
212
|
+
**File:** `analyze-git.ts` (CLI: `dexbot git`)
|
|
238
213
|
**Purpose:** Analyze git history and generate a chart of lines added vs deleted by file.
|
|
214
|
+
**Git-only:** Requires a source checkout (`.git` directory); it does not work with global npm installs.
|
|
239
215
|
```bash
|
|
216
|
+
# Preferred CLI entry point
|
|
217
|
+
dexbot git
|
|
218
|
+
|
|
219
|
+
# Direct invocation
|
|
240
220
|
node dist/scripts/analyze-git.js
|
|
241
221
|
```
|
|
222
|
+
The report is written to `analysis/charts/repo-stats.html`.
|
|
223
|
+
|
|
224
|
+
### Explicit-`any` Budget Ratchet
|
|
225
|
+
**File:** `check_any.ts`
|
|
226
|
+
**Purpose:** Count explicit `any` tokens on code lines (comments/JSDoc excluded) and fail when the count rises above the committed budget in `any-budget.json`, keeping `any` removal monotonic. Two scopes are tracked independently: `root` (`modules/`, `market_adapter/`, `analysis/`, `scripts/`, plus root-level `*.ts`) and `claw` (the experimental `claw/` subtree, tests excluded), so the clean root count is not inflated by claw.
|
|
227
|
+
```bash
|
|
228
|
+
# Compare against any-budget.json
|
|
229
|
+
npm run check:any
|
|
230
|
+
|
|
231
|
+
# Print per-file counts
|
|
232
|
+
npm run check:any:list
|
|
233
|
+
|
|
234
|
+
# Write the current count as the new budget
|
|
235
|
+
npm run check:any:update
|
|
236
|
+
```
|
|
242
237
|
|
|
243
238
|
### Credit Renewal Test
|
|
244
239
|
**File:** `test-credit-renewal.ts`
|
|
@@ -271,6 +266,7 @@ npm run version:check
|
|
|
271
266
|
# Rewrite aligned manifests from root package.json
|
|
272
267
|
npm run version:sync
|
|
273
268
|
```
|
|
269
|
+
|
|
274
270
|
---
|
|
275
271
|
|
|
276
272
|
## 🌳 BRANCH SYNCHRONIZATION
|
|
@@ -340,6 +336,13 @@ The following scripts allow you to call `dexbot` commands directly from the `scr
|
|
|
340
336
|
| `npm test` | Build + compile tests + run full suite (excludes live-chain tests) |
|
|
341
337
|
| `npm run test:live` | Build + compile tests + run full suite including live-chain tests |
|
|
342
338
|
|
|
339
|
+
### Code Quality
|
|
340
|
+
| Command | Purpose |
|
|
341
|
+
|:---|:---|
|
|
342
|
+
| `npm run check:any` | Fail if the explicit-`any` count rises above `any-budget.json` |
|
|
343
|
+
| `npm run check:any:list` | Print per-file explicit-`any` counts |
|
|
344
|
+
| `npm run check:any:update` | Write the current explicit-`any` count as the new budget |
|
|
345
|
+
|
|
343
346
|
### Runtime
|
|
344
347
|
| Command | Purpose |
|
|
345
348
|
|:---|:---|
|
|
@@ -347,8 +350,8 @@ The following scripts allow you to call `dexbot` commands directly from the `scr
|
|
|
347
350
|
| `npm run claw:unlock` | Build + single-prompt unlock (claw-only mode) |
|
|
348
351
|
| `npm run pm2:unlock` | Build + launch full bot via PM2 ecosystem |
|
|
349
352
|
| `npm run pm2:claw-only` | Build + launch claw-only PM2 process |
|
|
350
|
-
| `npm run pm2:start` |
|
|
351
|
-
| `npm run pm2:stop` | Stop PM2 processes
|
|
353
|
+
| `npm run pm2:start` | Unlock + start bots via PM2 (alias of `pm2:unlock`) |
|
|
354
|
+
| `npm run pm2:stop` | Stop all dexbot PM2 processes via the launcher |
|
|
352
355
|
|
|
353
356
|
### Branch Sync *(git checkout only)*
|
|
354
357
|
| Command | Purpose |
|
|
@@ -369,6 +372,8 @@ The following scripts allow you to call `dexbot` commands directly from the `scr
|
|
|
369
372
|
| `npm run market-adapter:fetch-cex-synthetic` | Fetch CEX synthetic data for market adapter |
|
|
370
373
|
| `npm run analysis:tradingview` | TradingView-style chart export |
|
|
371
374
|
| `npm run analysis:trade-pnl` | Trade PnL analysis from fill data |
|
|
375
|
+
| `npm run analysis:grid-check` | Last-fill-guard check (`grid_correction_check.ts`) |
|
|
376
|
+
| `npm run analysis:resolve-accounts` | Batch-resolve on-chain bot accounts (`resolve_bot_accounts.ts`) |
|
|
372
377
|
| `npm run ama:chart:lp-local` | Generate local LP comparison chart |
|
|
373
378
|
| `npm run lp:chart` | Generate uPlot LP chart |
|
|
374
379
|
| `npm run test:credit-renewal` | Test credit offer renewal for a specific bot |
|
package/tests/README.md
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
# DEXBot2 Test Suite
|
|
2
2
|
|
|
3
|
-
Tests live as standalone `.ts` files
|
|
3
|
+
Tests live as standalone `.ts` files under `tests/` (plus `claw/tests/` for the Claw integration). They are compiled to `dist/tests/` and `dist/claw/tests/` by the build and run from there with plain `node` — no test framework, no TypeScript loader. The suite uses Node's native `assert`.
|
|
4
|
+
|
|
5
|
+
`scripts/run-tests.ts` discovers every compiled `test_*.js` and runs them sequentially, echoing output and appending a timestamped log to `tests/tmp/`. Live-blockchain tests are opt-in via `RUN_LIVE_BITSHARES_TESTS=1` (see *Runner & environment* below).
|
|
4
6
|
|
|
5
7
|
## Quick Start
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
# Run all tests (builds production code + tests first)
|
|
10
|
+
# Run all offline tests (builds production code + tests first)
|
|
9
11
|
npm test
|
|
10
12
|
|
|
13
|
+
# Run including live-blockchain tests
|
|
14
|
+
npm run test:live
|
|
15
|
+
|
|
11
16
|
# Run a single test file
|
|
12
17
|
npm run build:tests
|
|
13
18
|
node dist/tests/<file>.js
|
|
14
|
-
|
|
15
|
-
# Run the archived legacy suites (excluded from `npm test`)
|
|
16
|
-
npm run test:legacy
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
## Directory Layout
|
|
@@ -21,22 +23,35 @@ npm run test:legacy
|
|
|
21
23
|
```
|
|
22
24
|
tests/
|
|
23
25
|
helpers/ # Shared test infrastructure (stubs, mocks, utilities)
|
|
24
|
-
tmp/ # Scratch space
|
|
26
|
+
tmp/ # Scratch space + per-run logs (gitignored)
|
|
25
27
|
tsconfig.json # Test-specific TS config (extends root)
|
|
26
28
|
<name>.ts # Test files (one file per module or concern)
|
|
29
|
+
claw/tests/ # Claw integration tests (same conventions, run by npm test)
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
`helpers/` contains reusable test support:
|
|
30
33
|
- `bitshares_client_stub.ts` — mock blockchain client
|
|
31
|
-
- `bitshares_native_stub.ts` — mock native chain client
|
|
32
|
-
- `chain_keys_stub.ts` — key derivation test doubles
|
|
33
34
|
- `chain_orders_stub.ts` — order lifecycle test doubles
|
|
34
35
|
- `fee_cache_init.ts` — fee cache seeding for tests
|
|
35
36
|
- `order_test_helpers.ts` — order construction utilities
|
|
36
37
|
- `silent_logger.ts` — suppresses log output during tests
|
|
37
38
|
- `module_cache_stub.ts` — isolates module state per test
|
|
39
|
+
- `vault_fixture.ts` — chain-key vault fixtures
|
|
40
|
+
- `pm2_path_shim.ts` — PM2 path isolation for `pm2.ts` tests
|
|
41
|
+
- `esm_mocks.ts` + `esm_mock_hooks.mjs` / `esm_mock_loader.mjs` — loader-hook harness for stubbing compiled ESM named exports
|
|
38
42
|
- `unlock_test_helpers.ts`, `foreign_cred_stub.js`, `dynamic_weight_files.ts` — domain-specific helpers
|
|
39
43
|
|
|
44
|
+
## Runner & environment
|
|
45
|
+
|
|
46
|
+
`scripts/run-tests.ts` runs each compiled `test_*.js` file as its own `node` process (no shared state between tests). Knobs:
|
|
47
|
+
|
|
48
|
+
- `RUN_LIVE_BITSHARES_TESTS=1` — also run the live-chain tests; without it they are skipped and counted as `skippedLive`. The live set is the `liveTestFiles` allow-list in `scripts/run-tests.ts`.
|
|
49
|
+
- `DEXBOT_TEST_CONCURRENCY=N` — run N files in parallel (default `1`; several tests share `tests/tmp` paths, so parallelism must be requested deliberately).
|
|
50
|
+
- `DEXBOT_TEST_TIMEOUT_MS=N` — per-file watchdog (default `240000`); on expiry the child is `SIGTERM`/`SIGKILL`ed and marked `TIMEOUT`.
|
|
51
|
+
- `DEXBOT_SUPPRESS_WARNINGS=1` — add `--no-warnings` to children (hides the warnings the diagnostics summary is meant to surface).
|
|
52
|
+
|
|
53
|
+
Every run appends to `tests/tmp/test-run-<timestamp>.log` and prints an aggregate summary (per-test pass/fail, slowest tests, and a diagnostics scan for warn/error/circular-dependency/deprecation/leak patterns).
|
|
54
|
+
|
|
40
55
|
## Test Categories
|
|
41
56
|
|
|
42
57
|
Tests are organized by concern, **not** by directory — patterns like `test_<area>*.ts` indicate the focus area. Below is a thematic guide with representative files (run `ls tests/*.ts` for the full list).
|
|
@@ -47,7 +62,7 @@ Connection, subscriptions, node management, native chain client.
|
|
|
47
62
|
|
|
48
63
|
### Account & Authentication
|
|
49
64
|
Key validation, balance queries, account selection.
|
|
50
|
-
*Examples:* `test_key_validation.ts`, `test_account_totals.ts`, `
|
|
65
|
+
*Examples:* `test_key_validation.ts`, `test_account_totals.ts`, `test_chain_keys_vault.ts`
|
|
51
66
|
|
|
52
67
|
### Market Data & Pricing
|
|
53
68
|
Price derivation, orderbook inspection, tolerance checks.
|
|
@@ -150,4 +165,4 @@ Shared utility functions, precision handling, chain helpers.
|
|
|
150
165
|
|
|
151
166
|
---
|
|
152
167
|
|
|
153
|
-
**Note:** Interactive/diagnostic scripts (`connection_test.ts`, `diag_
|
|
168
|
+
**Note:** Interactive/diagnostic scripts (`connection_test.ts`, `diag_*`, `benchmark_cow.ts`, `sim_batching.ts`, `repro_phantom_orders.ts`) require network access or real state and are **not** run by `npm test` — the runner only globs `test_*.js`. Run these manually when debugging.
|