dexbot 1.6.7 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +3 -3
- package/analysis/README.md +2 -3
- package/analysis/tradingview/README.md +78 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
- package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
- package/dist/analysis/tradingview/grid_reset_config.js +235 -0
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
- package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
- package/dist/dexbot.js +22 -6
- package/dist/market_adapter/core/market_adapter_service.js +14 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
- package/dist/market_adapter/inputs/window_cache.js +302 -48
- package/dist/market_adapter/market_adapter.d.ts +8 -1
- package/dist/market_adapter/market_adapter.js +22 -4
- package/dist/modules/account_bots.js +10 -0
- package/dist/modules/account_orders.d.ts +24 -2
- package/dist/modules/account_orders.js +41 -4
- package/dist/modules/bot_settings.js +10 -1
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.js +1 -0
- package/dist/modules/constants.d.ts +11 -3
- package/dist/modules/constants.js +116 -37
- package/dist/modules/dexbot_class.d.ts +6 -76
- package/dist/modules/dexbot_class.js +0 -32
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
- package/dist/modules/dexbot_cow_runtime.js +4 -87
- package/dist/modules/dexbot_maintenance_runtime.d.ts +15 -1
- package/dist/modules/dexbot_maintenance_runtime.js +59 -11
- package/dist/modules/dexbot_startup_runtime.js +73 -20
- package/dist/modules/dexbot_state_recovery.d.ts +6 -0
- package/dist/modules/dexbot_state_recovery.js +21 -0
- package/dist/modules/order/async_lock.d.ts +8 -0
- package/dist/modules/order/async_lock.js +15 -0
- package/dist/modules/order/genesis_policy.d.ts +162 -0
- package/dist/modules/order/genesis_policy.js +267 -0
- package/dist/modules/order/grid.js +76 -134
- package/dist/modules/order/grid_reconcile.d.ts +9 -0
- package/dist/modules/order/grid_reconcile.js +13 -4
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/manager.d.ts +4 -0
- package/dist/modules/order/manager.js +14 -1
- package/dist/modules/order/sync_engine.d.ts +19 -0
- package/dist/modules/order/sync_engine.js +284 -344
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +64 -1
- package/dist/modules/order/utils/order.d.ts +43 -58
- package/dist/modules/order/utils/order.js +220 -197
- package/dist/modules/order/utils/system.js +8 -1
- package/dist/modules/paths.d.ts +1 -0
- package/dist/modules/paths.js +1 -0
- package/dist/modules/version_notice.d.ts +165 -0
- package/dist/modules/version_notice.js +364 -0
- package/dist/pm2.js +9 -0
- package/dist/unlock.js +28 -0
- package/docs/BITSHARES_ONBOARDING.md +8 -1
- package/docs/COW_INVARIANTS.md +3 -2
- package/docs/DEXBOT_COMPARISON.md +4 -4
- package/docs/EVOLUTION.md +20 -19
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +149 -31
- package/docs/GRID_RECALCULATION.md +12 -0
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +1 -1
- package/modules/README.md +18 -1
- package/package.json +13 -5
- package/scripts/README.md +28 -2
- package/scripts/clear-all.sh +13 -4
- package/scripts/clear-logs.sh +13 -4
- package/scripts/clear-market-adapter.sh +6 -0
- package/scripts/clear-orders.sh +5 -0
- package/scripts/lib/dexbot-paths.sh +108 -0
- package/tests/README.md +11 -3
- package/analysis/account_resolver.ts +0 -161
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
- package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
- package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
- package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
- package/analysis/analyze_dynamic_weight.ts +0 -243
- package/analysis/analyze_kalman.ts +0 -157
- package/analysis/analyze_regime.ts +0 -158
- package/analysis/analyze_regime_windows.ts +0 -470
- package/analysis/analyze_risk_profile.ts +0 -199
- package/analysis/analyze_trade_heatmap.ts +0 -362
- package/analysis/analyze_volatility.ts +0 -182
- package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
- package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
- package/analysis/bot_fitting/shared_utils.ts +0 -52
- package/analysis/bot_key_utils.ts +0 -426
- package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
- package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
- package/analysis/chain_pool.ts +0 -47
- package/analysis/chart_css.ts +0 -62
- package/analysis/chart_ui.ts +0 -105
- package/analysis/chart_utils.ts +0 -210
- package/analysis/fills_source.ts +0 -228
- package/analysis/grid_correction_check.ts +0 -786
- package/analysis/math_utils.ts +0 -53
- package/analysis/price_sources.ts +0 -136
- package/analysis/resolve_bot_accounts.ts +0 -199
- package/analysis/resolve_source.ts +0 -99
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/trade_profitability.ts +0 -1335
- package/analysis/tradingview/analyze_tradingview.ts +0 -280
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
- package/analysis/trend_detection/hurst_analyzer.ts +0 -7
- package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
- package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
- package/analysis/trend_detection/package.json +0 -23
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
- package/analysis/trend_detection/regime_chart_generator.ts +0 -338
- package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
- package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
- package/analysis/tsconfig.json +0 -29
- package/claw/tests/package.json +0 -3
- package/claw/tests/test_claw_bridge.ts +0 -570
- package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
- package/claw/tests/test_claw_chain_layer.ts +0 -739
- package/claw/tests/test_claw_data_flow.ts +0 -525
- package/claw/tests/test_claw_domain_logic.ts +0 -471
- package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
- package/claw/tests/test_claw_mcp_transport.ts +0 -243
- package/claw/tests/test_claw_regressions.ts +0 -711
- package/claw/tests/test_claw_skill_generation.ts +0 -103
- package/claw/tests/test_claw_state_store.ts +0 -44
- package/claw/tests/test_dexbot_profiles.ts +0 -654
- package/claw/tests/test_memu_bridge.ts +0 -189
- package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
- package/claw/tests/test_position_health.ts +0 -343
- package/claw/tests/test_position_manager.ts +0 -429
- package/claw/tests/test_position_manager_watch_health.ts +0 -100
- package/claw/tests/test_short_mpa_strategy.ts +0 -232
- package/dist/analysis/account_resolver.d.ts.map +0 -1
- package/dist/analysis/account_resolver.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/chain_pool.d.ts.map +0 -1
- package/dist/analysis/chain_pool.js.map +0 -1
- package/dist/analysis/chart_css.d.ts.map +0 -1
- package/dist/analysis/chart_css.js.map +0 -1
- package/dist/analysis/chart_ui.d.ts.map +0 -1
- package/dist/analysis/chart_ui.js.map +0 -1
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/fills_source.d.ts.map +0 -1
- package/dist/analysis/fills_source.js.map +0 -1
- package/dist/analysis/grid_correction_check.d.ts.map +0 -1
- package/dist/analysis/grid_correction_check.js.map +0 -1
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/resolve_bot_accounts.js.map +0 -1
- package/dist/analysis/resolve_source.d.ts.map +0 -1
- package/dist/analysis/resolve_source.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
- package/dist/bot.d.ts.map +0 -1
- package/dist/bot.js.map +0 -1
- package/dist/credential-daemon.d.ts.map +0 -1
- package/dist/credential-daemon.js.map +0 -1
- package/dist/dexbot.d.ts.map +0 -1
- package/dist/dexbot.js.map +0 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
- package/dist/market_adapter/ama_signal_runner.js.map +0 -1
- package/dist/market_adapter/candle_utils.d.ts.map +0 -1
- package/dist/market_adapter/candle_utils.js.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
- package/dist/market_adapter/core/config_normalizers.js.map +0 -1
- package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_candles.js.map +0 -1
- package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_client.js.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
- package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
- package/dist/market_adapter/inputs/window_cache.js.map +0 -1
- package/dist/market_adapter/interval_utils.d.ts.map +0 -1
- package/dist/market_adapter/interval_utils.js.map +0 -1
- package/dist/market_adapter/log_format.d.ts.map +0 -1
- package/dist/market_adapter/log_format.js.map +0 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_core.js.map +0 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_runner.js.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
- package/dist/market_adapter/market_adapter.d.ts.map +0 -1
- package/dist/market_adapter/market_adapter.js.map +0 -1
- package/dist/market_adapter/test_helpers.d.ts.map +0 -1
- package/dist/market_adapter/test_helpers.js.map +0 -1
- package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
- package/dist/market_adapter/utils/adapter_client.js.map +0 -1
- package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
- package/dist/market_adapter/utils/atomic_write.js.map +0 -1
- package/dist/market_adapter/utils/chain.d.ts.map +0 -1
- package/dist/market_adapter/utils/chain.js.map +0 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
- package/dist/market_adapter/utils/data_discovery.js.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
- package/dist/market_adapter/utils/file_lock.js.map +0 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
- package/dist/market_adapter/utils/native_history.js.map +0 -1
- package/dist/modules/account_bots.d.ts.map +0 -1
- package/dist/modules/account_bots.js.map +0 -1
- package/dist/modules/account_orders.d.ts.map +0 -1
- package/dist/modules/account_orders.js.map +0 -1
- package/dist/modules/authority_resolver.d.ts.map +0 -1
- package/dist/modules/authority_resolver.js.map +0 -1
- package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/chain_client.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
- package/dist/modules/bitshares-native/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/index.js.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
- package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
- package/dist/modules/bitshares-native/resolvers.js.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/index.js.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
- package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/types.js.map +0 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/signing_client.js.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
- package/dist/modules/bitshares-native/transport.js.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
- package/dist/modules/bitshares_client.d.ts.map +0 -1
- package/dist/modules/bitshares_client.js.map +0 -1
- package/dist/modules/bot_defaults.d.ts.map +0 -1
- package/dist/modules/bot_defaults.js.map +0 -1
- package/dist/modules/bot_settings.d.ts.map +0 -1
- package/dist/modules/bot_settings.js.map +0 -1
- package/dist/modules/bots_file_lock.d.ts.map +0 -1
- package/dist/modules/bots_file_lock.js.map +0 -1
- package/dist/modules/broadcast_failure.d.ts.map +0 -1
- package/dist/modules/broadcast_failure.js.map +0 -1
- package/dist/modules/chain_keys.d.ts.map +0 -1
- package/dist/modules/chain_keys.js.map +0 -1
- package/dist/modules/chain_orders.d.ts.map +0 -1
- package/dist/modules/chain_orders.js.map +0 -1
- package/dist/modules/cli_colors.d.ts.map +0 -1
- package/dist/modules/cli_colors.js.map +0 -1
- package/dist/modules/cli_start_onboarding.d.ts.map +0 -1
- package/dist/modules/cli_start_onboarding.js.map +0 -1
- package/dist/modules/cli_start_output.d.ts.map +0 -1
- package/dist/modules/cli_start_output.js.map +0 -1
- package/dist/modules/config.d.ts.map +0 -1
- package/dist/modules/config.js.map +0 -1
- package/dist/modules/constants.d.ts.map +0 -1
- package/dist/modules/constants.js.map +0 -1
- package/dist/modules/cr_planner.d.ts.map +0 -1
- package/dist/modules/cr_planner.js.map +0 -1
- package/dist/modules/credential_policy.d.ts.map +0 -1
- package/dist/modules/credential_policy.js.map +0 -1
- package/dist/modules/credential_runtime.d.ts.map +0 -1
- package/dist/modules/credential_runtime.js.map +0 -1
- package/dist/modules/credential_session_cache.d.ts.map +0 -1
- package/dist/modules/credential_session_cache.js.map +0 -1
- package/dist/modules/credit_pricing.d.ts.map +0 -1
- package/dist/modules/credit_pricing.js.map +0 -1
- package/dist/modules/credit_runtime.d.ts.map +0 -1
- package/dist/modules/credit_runtime.js.map +0 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
- package/dist/modules/crypto/browser_provider.js.map +0 -1
- package/dist/modules/crypto/index.d.ts.map +0 -1
- package/dist/modules/crypto/index.js.map +0 -1
- package/dist/modules/crypto/node_provider.d.ts.map +0 -1
- package/dist/modules/crypto/node_provider.js.map +0 -1
- package/dist/modules/crypto/provider.d.ts.map +0 -1
- package/dist/modules/crypto/provider.js.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
- package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
- package/dist/modules/crypto/pure_scrypt.js.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
- package/dist/modules/crypto/sync.d.ts.map +0 -1
- package/dist/modules/crypto/sync.js.map +0 -1
- package/dist/modules/daemon_node_health.d.ts.map +0 -1
- package/dist/modules/daemon_node_health.js.map +0 -1
- package/dist/modules/dexbot_class.d.ts.map +0 -1
- package/dist/modules/dexbot_class.js.map +0 -1
- package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_cow_runtime.js.map +0 -1
- package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
- package/dist/modules/dexbot_credential_client.js.map +0 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_fill_runtime.js.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_startup_runtime.js.map +0 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
- package/dist/modules/dexbot_state_recovery.js.map +0 -1
- package/dist/modules/env.d.ts.map +0 -1
- package/dist/modules/env.js.map +0 -1
- package/dist/modules/fund_registry.d.ts.map +0 -1
- package/dist/modules/fund_registry.js.map +0 -1
- package/dist/modules/general_settings.d.ts.map +0 -1
- package/dist/modules/general_settings.js.map +0 -1
- package/dist/modules/graceful_shutdown.d.ts.map +0 -1
- package/dist/modules/graceful_shutdown.js.map +0 -1
- package/dist/modules/grid_price_source.d.ts.map +0 -1
- package/dist/modules/grid_price_source.js.map +0 -1
- package/dist/modules/key_store.d.ts.map +0 -1
- package/dist/modules/key_store.js.map +0 -1
- package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
- package/dist/modules/launcher/adapter_requirement.js.map +0 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
- package/dist/modules/launcher/bot_supervisor.js.map +0 -1
- package/dist/modules/launcher/child_env.d.ts.map +0 -1
- package/dist/modules/launcher/child_env.js.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/credential_daemon.js.map +0 -1
- package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
- package/dist/modules/launcher/credential_secret.js.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
- package/dist/modules/launcher/headless_password.d.ts.map +0 -1
- package/dist/modules/launcher/headless_password.js.map +0 -1
- package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
- package/dist/modules/launcher/launch_modes.js.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
- package/dist/modules/launcher/runtime_entry.js.map +0 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
- package/dist/modules/launcher/status_reporting.js.map +0 -1
- package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
- package/dist/modules/launcher/supervisor_control.js.map +0 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
- package/dist/modules/market_adapter_whitelist.js.map +0 -1
- package/dist/modules/node_connect_policy.d.ts.map +0 -1
- package/dist/modules/node_connect_policy.js.map +0 -1
- package/dist/modules/node_failure_ledger.d.ts.map +0 -1
- package/dist/modules/node_failure_ledger.js.map +0 -1
- package/dist/modules/node_health_cache.d.ts.map +0 -1
- package/dist/modules/node_health_cache.js.map +0 -1
- package/dist/modules/node_manager.d.ts.map +0 -1
- package/dist/modules/node_manager.js.map +0 -1
- package/dist/modules/order/accounting.d.ts.map +0 -1
- package/dist/modules/order/accounting.js.map +0 -1
- package/dist/modules/order/async_lock.d.ts.map +0 -1
- package/dist/modules/order/async_lock.js.map +0 -1
- package/dist/modules/order/export.d.ts.map +0 -1
- package/dist/modules/order/export.js.map +0 -1
- package/dist/modules/order/format.d.ts.map +0 -1
- package/dist/modules/order/format.js.map +0 -1
- package/dist/modules/order/grid.d.ts.map +0 -1
- package/dist/modules/order/grid.js.map +0 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile.js.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
- package/dist/modules/order/index.d.ts.map +0 -1
- package/dist/modules/order/index.js.map +0 -1
- package/dist/modules/order/logger.d.ts.map +0 -1
- package/dist/modules/order/logger.js.map +0 -1
- package/dist/modules/order/logger_state.d.ts.map +0 -1
- package/dist/modules/order/logger_state.js.map +0 -1
- package/dist/modules/order/manager.d.ts.map +0 -1
- package/dist/modules/order/manager.js.map +0 -1
- package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
- package/dist/modules/order/processed_fill_store.js.map +0 -1
- package/dist/modules/order/strategy.d.ts.map +0 -1
- package/dist/modules/order/strategy.js.map +0 -1
- package/dist/modules/order/sync_engine.d.ts.map +0 -1
- package/dist/modules/order/sync_engine.js.map +0 -1
- package/dist/modules/order/utils/math.d.ts.map +0 -1
- package/dist/modules/order/utils/math.js.map +0 -1
- package/dist/modules/order/utils/order.d.ts.map +0 -1
- package/dist/modules/order/utils/order.js.map +0 -1
- package/dist/modules/order/utils/slot.d.ts.map +0 -1
- package/dist/modules/order/utils/slot.js.map +0 -1
- package/dist/modules/order/utils/system.d.ts.map +0 -1
- package/dist/modules/order/utils/system.js.map +0 -1
- package/dist/modules/order/utils/timeout.d.ts.map +0 -1
- package/dist/modules/order/utils/timeout.js.map +0 -1
- package/dist/modules/order/utils/validate.d.ts.map +0 -1
- package/dist/modules/order/utils/validate.js.map +0 -1
- package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
- package/dist/modules/order/utils/withPoolRef.js.map +0 -1
- package/dist/modules/order/working_grid.d.ts.map +0 -1
- package/dist/modules/order/working_grid.js.map +0 -1
- package/dist/modules/path_api.d.ts.map +0 -1
- package/dist/modules/path_api.js.map +0 -1
- package/dist/modules/paths.d.ts.map +0 -1
- package/dist/modules/paths.js.map +0 -1
- package/dist/modules/process_discovery.d.ts.map +0 -1
- package/dist/modules/process_discovery.js.map +0 -1
- package/dist/modules/runtime.d.ts.map +0 -1
- package/dist/modules/runtime.js.map +0 -1
- package/dist/modules/runtime_settings.d.ts.map +0 -1
- package/dist/modules/runtime_settings.js.map +0 -1
- package/dist/modules/settings_merge.d.ts.map +0 -1
- package/dist/modules/settings_merge.js.map +0 -1
- package/dist/modules/socket_json_client.d.ts.map +0 -1
- package/dist/modules/socket_json_client.js.map +0 -1
- package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
- package/dist/modules/storage/browser_adapter.js.map +0 -1
- package/dist/modules/storage/index.d.ts.map +0 -1
- package/dist/modules/storage/index.js.map +0 -1
- package/dist/modules/storage/node_adapter.d.ts.map +0 -1
- package/dist/modules/storage/node_adapter.js.map +0 -1
- package/dist/modules/storage/types.d.ts.map +0 -1
- package/dist/modules/storage/types.js.map +0 -1
- package/dist/modules/types.d.ts.map +0 -1
- package/dist/modules/types.js.map +0 -1
- package/dist/modules/utils/base58check.d.ts.map +0 -1
- package/dist/modules/utils/base58check.js.map +0 -1
- package/dist/modules/utils/build_dir.d.ts.map +0 -1
- package/dist/modules/utils/build_dir.js.map +0 -1
- package/dist/modules/utils/chain_logs.d.ts.map +0 -1
- package/dist/modules/utils/chain_logs.js.map +0 -1
- package/dist/modules/utils/errors.d.ts.map +0 -1
- package/dist/modules/utils/errors.js.map +0 -1
- package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
- package/dist/modules/utils/sanitize_key.js.map +0 -1
- package/dist/modules/utils/text_width.d.ts.map +0 -1
- package/dist/modules/utils/text_width.js.map +0 -1
- package/dist/modules/validate_profiles.d.ts.map +0 -1
- package/dist/modules/validate_profiles.js.map +0 -1
- package/dist/pm2.d.ts.map +0 -1
- package/dist/pm2.js.map +0 -1
- package/dist/scripts/analyze-credit.d.ts.map +0 -1
- package/dist/scripts/analyze-credit.js.map +0 -1
- package/dist/scripts/analyze-git.d.ts.map +0 -1
- package/dist/scripts/analyze-git.js.map +0 -1
- package/dist/scripts/analyze-orders.d.ts.map +0 -1
- package/dist/scripts/analyze-orders.js.map +0 -1
- package/dist/scripts/chart_command.d.ts.map +0 -1
- package/dist/scripts/chart_command.js.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
- package/dist/scripts/diagnose-pool-history.js.map +0 -1
- package/dist/scripts/divergence-calc.d.ts.map +0 -1
- package/dist/scripts/divergence-calc.js.map +0 -1
- package/dist/scripts/dw.d.ts.map +0 -1
- package/dist/scripts/dw.js.map +0 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
- package/dist/scripts/generate_lp_chart.js.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
- package/dist/scripts/native_release_gates.d.ts.map +0 -1
- package/dist/scripts/native_release_gates.js.map +0 -1
- package/dist/scripts/print_grid.d.ts.map +0 -1
- package/dist/scripts/print_grid.js.map +0 -1
- package/dist/scripts/run-tests.d.ts.map +0 -1
- package/dist/scripts/run-tests.js.map +0 -1
- package/dist/scripts/runner.d.ts.map +0 -1
- package/dist/scripts/runner.js.map +0 -1
- package/dist/scripts/sync-version.d.ts.map +0 -1
- package/dist/scripts/sync-version.js.map +0 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
- package/dist/scripts/test-credit-renewal.js.map +0 -1
- package/dist/scripts/tv.d.ts.map +0 -1
- package/dist/scripts/tv.js.map +0 -1
- package/dist/scripts/update.d.ts.map +0 -1
- package/dist/scripts/update.js.map +0 -1
- package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
- package/dist/scripts/update_dist_freshness.js.map +0 -1
- package/dist/scripts/validate_bots.d.ts.map +0 -1
- package/dist/scripts/validate_bots.js.map +0 -1
- package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
- package/dist/scripts/verify-browser-bundle.js.map +0 -1
- package/dist/unlock.d.ts.map +0 -1
- package/dist/unlock.js.map +0 -1
package/modules/README.md
CHANGED
|
@@ -28,10 +28,16 @@ modules/
|
|
|
28
28
|
├── dexbot_state_recovery.ts state recovery after restart
|
|
29
29
|
├── bitshares_client.ts blockchain connection manager
|
|
30
30
|
├── node_manager.ts multi-node health and failover
|
|
31
|
+
├── node_connect_policy.ts node connection/failover policy
|
|
31
32
|
├── chain_orders.ts blockchain order operations
|
|
32
33
|
├── account_orders.ts account order queries
|
|
33
34
|
├── credit_runtime.ts MPA/credit deal workflow executor
|
|
35
|
+
├── credit_pricing.ts credit/debt pricing helpers
|
|
34
36
|
├── cr_planner.ts collateral-ratio planning
|
|
37
|
+
├── version_notice.ts passive npm-registry version check + status line
|
|
38
|
+
├── cli_start_onboarding.ts first-run setup routing for `dexbot start`
|
|
39
|
+
├── cli_start_output.ts launcher notice formatting
|
|
40
|
+
├── cli_colors.ts shared CLI color helpers
|
|
35
41
|
├── credential_runtime.ts credential daemon lifecycle
|
|
36
42
|
├── credential_policy.ts signing policy validation
|
|
37
43
|
├── credential_session_cache.ts encrypted session cache
|
|
@@ -48,6 +54,7 @@ modules/
|
|
|
48
54
|
├── authority_resolver.ts signing key resolution
|
|
49
55
|
├── key_store.ts key storage (node-only)
|
|
50
56
|
├── process_discovery.ts Linux /proc/* filesystem reads
|
|
57
|
+
├── grid_price_source.ts grid center price source resolution
|
|
51
58
|
├── validate_profiles.ts profile validation
|
|
52
59
|
├── general_settings.ts global settings loader
|
|
53
60
|
├── bot_settings.ts per-bot settings loader
|
|
@@ -86,6 +93,7 @@ modules/
|
|
|
86
93
|
│ ├── strategy.ts grid rebalancing, consolidation, rotation
|
|
87
94
|
│ ├── accounting.ts fund tracking, fee accounting
|
|
88
95
|
│ ├── sync_engine.ts blockchain sync, fill detection, reconciliation
|
|
96
|
+
│ ├── genesis_policy.ts missing-ladder refusal + rebuild/halt policy ([doc](../docs/GRID_PRICE_INVARIANT.md))
|
|
89
97
|
│ ├── grid_reconcile.ts startup grid reconciliation ([doc](../docs/GRID_RECONCILE.md))
|
|
90
98
|
│ ├── grid_reconcile_internal.ts internal grid reconciliation helpers
|
|
91
99
|
│ ├── index.ts barrel export
|
|
@@ -96,6 +104,13 @@ modules/
|
|
|
96
104
|
│ ├── format.ts numeric formatting helpers
|
|
97
105
|
│ ├── export.ts trade history export
|
|
98
106
|
│ └── utils/ math, order predicates, validation, system helpers
|
|
107
|
+
│ ├── math.ts precision conversion, RMS divergence, rail geometry
|
|
108
|
+
│ ├── order.ts order state predicates, grid indexing, reconciliation helpers
|
|
109
|
+
│ ├── slot.ts slot/price-level helpers
|
|
110
|
+
│ ├── system.ts system utilities, price derivation, fill deduplication
|
|
111
|
+
│ ├── timeout.ts bounded wait helpers
|
|
112
|
+
│ ├── validate.ts order validation, grid reconciliation, COW action building
|
|
113
|
+
│ └── withPoolRef.ts startPrice mode + poolRef resolution
|
|
99
114
|
│
|
|
100
115
|
├── launcher/ process lifecycle (PM2, unlock, isolated)
|
|
101
116
|
│ ├── bot_supervisor.ts per-bot process supervision
|
|
@@ -128,8 +143,10 @@ modules/
|
|
|
128
143
|
└── utils/
|
|
129
144
|
├── base58check.ts Base58Check encoding
|
|
130
145
|
├── build_dir.ts BUILD_DIR constant helper
|
|
146
|
+
├── chain_logs.ts shared chain log helpers
|
|
131
147
|
├── errors.ts getErrorMessage helper
|
|
132
|
-
|
|
148
|
+
├── sanitize_key.ts shared sanitizeKey helper
|
|
149
|
+
└── text_width.ts display-width-aware text measurement (CJK/emoji tables)
|
|
133
150
|
```
|
|
134
151
|
|
|
135
152
|
## Key Relationships
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dexbot",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
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": {
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"!dist/analysis/legacy",
|
|
18
|
+
"!dist/**/*.js.map",
|
|
19
|
+
"!dist/**/*.d.ts.map",
|
|
18
20
|
"ecosystem.config.cjs",
|
|
19
21
|
"scripts/bots",
|
|
20
22
|
"scripts/clean-dist.js",
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
"scripts/unlock",
|
|
38
40
|
"scripts/update.js",
|
|
39
41
|
"claw",
|
|
42
|
+
"!claw/tests",
|
|
40
43
|
"docs/BITSHARES_ONBOARDING.md",
|
|
41
44
|
"docs/CREDENTIAL_SECURITY.md",
|
|
42
45
|
"docs/GRID_RECALCULATION.md",
|
|
@@ -57,9 +60,13 @@
|
|
|
57
60
|
"docs/docker.md",
|
|
58
61
|
"market_adapter/README.md",
|
|
59
62
|
"modules/README.md",
|
|
60
|
-
"analysis",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
+
"analysis/README.md",
|
|
64
|
+
"analysis/ama_fitting/README.md",
|
|
65
|
+
"analysis/bot_fitting/README.md",
|
|
66
|
+
"analysis/tradingview/README.md",
|
|
67
|
+
"analysis/trend_detection/README.md",
|
|
68
|
+
"analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md",
|
|
69
|
+
"analysis/uplot",
|
|
63
70
|
"tests/README.md",
|
|
64
71
|
"CHANGELOG.md",
|
|
65
72
|
"README.md",
|
|
@@ -98,7 +105,7 @@
|
|
|
98
105
|
"native:ecc-invariants": "npm run build && npm run build:tests && node dist/tests/test_native_ecc.js",
|
|
99
106
|
"native:corpus": "npm run build && node dist/scripts/generate_mainnet_corpus_report.js",
|
|
100
107
|
"test:credit-renewal": "npm run build && node dist/scripts/test-credit-renewal.js",
|
|
101
|
-
"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",
|
|
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",
|
|
102
109
|
"version:sync": "npm run build && node dist/scripts/sync-version.js",
|
|
103
110
|
"version:check": "npm run build && node dist/scripts/sync-version.js --check",
|
|
104
111
|
"verify:browser-bundle": "npm run build && node dist/scripts/verify-browser-bundle.js",
|
|
@@ -165,6 +172,7 @@
|
|
|
165
172
|
"./dist/modules/credential_runtime.js": false,
|
|
166
173
|
"./dist/modules/dexbot_credential_client.js": false,
|
|
167
174
|
"./dist/modules/node_health_cache.js": false,
|
|
175
|
+
"./dist/modules/version_notice.js": false,
|
|
168
176
|
"./dist/modules/daemon_node_health.js": false,
|
|
169
177
|
"./dist/modules/storage/node_adapter.js": false,
|
|
170
178
|
"./dist/modules/key_store.js": false,
|
package/scripts/README.md
CHANGED
|
@@ -32,12 +32,37 @@ Env overrides: `DEXBOT_PROFILE_ROOT`, `DEXBOT_MARKET_ADAPTER_DATA_DIR`,
|
|
|
32
32
|
`dexbot` CLI, the resolved runtime dirs are passed automatically, so the CLI
|
|
33
33
|
always clears the same dirs the runtime uses.
|
|
34
34
|
|
|
35
|
+
**Two behaviors are shared by all four `clear-*` scripts** (helpers in
|
|
36
|
+
`scripts/lib/dexbot-paths.sh`):
|
|
37
|
+
|
|
38
|
+
- **Advisory live-runtime warning.** Before the confirmation prompt, the scripts
|
|
39
|
+
read `<profiles>/{monolithic,monolithic-bot,monolithic-cred}.pid` and — only when
|
|
40
|
+
the PM2 daemon is already up, so a cleanup script can never spawn one — the
|
|
41
|
+
online PM2 apps belonging to this install (`pm2 jlist`, filtered to
|
|
42
|
+
`cwd`/`script_path` under the project or profiles root). If anything is found, a
|
|
43
|
+
`YELLOW` warning is printed. It is **advisory**: the prompt still runs, the
|
|
44
|
+
deletion still happens, and the exit code is unchanged. The reason it matters:
|
|
45
|
+
a live bot re-persists its grid within seconds, a live adapter rewrites its
|
|
46
|
+
state file *and* `market_adapter.lock` (a deleted lock lets a second adapter
|
|
47
|
+
start), and open log FDs mean the disk space is only reclaimed on restart. Stop
|
|
48
|
+
first with `dexbot stop` / `dexbot pm2 stop all`.
|
|
49
|
+
- **One log predicate.** Every `find` over the logs directory goes through
|
|
50
|
+
`log_files` (`*.log`, rotated `*.log.*`, `*.jsonl*`), so the preview, the count,
|
|
51
|
+
the delete and the verification can never disagree. `*.jsonl*` also sweeps the
|
|
52
|
+
credential audit trail `logs/daemon-audit.jsonl` **and** its rotated
|
|
53
|
+
`daemon-audit.jsonl.1` siblings, which match no other pattern — they used to
|
|
54
|
+
survive a "clear" and leave a partial wipe. The audit trail is deleted with
|
|
55
|
+
everything else, with no extra prompt and no opt-in flag; it is only named in
|
|
56
|
+
the preview (`Includes the credential audit trail: daemon-audit.jsonl*`) so the
|
|
57
|
+
deletion is never a surprise.
|
|
58
|
+
|
|
35
59
|
### Wipe Logs
|
|
36
60
|
**File:** `clear-logs.sh`
|
|
37
61
|
**Purpose:** Delete all bot `.log` and `.jsonl` files, including `profiles/logs/market_adapter.log`.
|
|
38
62
|
```bash
|
|
39
63
|
# IRREVERSIBLE: Deletes all files in profiles/logs/*.log and *.jsonl, including market_adapter.log
|
|
40
|
-
#
|
|
64
|
+
# (also the credential audit trail daemon-audit.jsonl and its rotated siblings)
|
|
65
|
+
# Prompts for confirmation before deleting; warns first if a runtime is live.
|
|
41
66
|
bash scripts/clear-logs.sh
|
|
42
67
|
```
|
|
43
68
|
|
|
@@ -67,7 +92,8 @@ bash scripts/clear-market-adapter.sh
|
|
|
67
92
|
# IRREVERSIBLE: Deletes profiles/orders/*, profiles/logs/*.{log,jsonl},
|
|
68
93
|
# market_adapter/{data,state}/*, and claw data (positions.json, watcher-health.json, memu/) under
|
|
69
94
|
# <profiles>/claw/data (or <repo>/claw/data for source checkouts).
|
|
70
|
-
#
|
|
95
|
+
# Also deletes daemon-audit.jsonl and its rotated siblings.
|
|
96
|
+
# Prompts for confirmation before deleting; warns first if a runtime is live.
|
|
71
97
|
bash scripts/clear-all.sh
|
|
72
98
|
```
|
|
73
99
|
|
package/scripts/clear-all.sh
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
# This combines the behavior of clear-orders.sh, clear-logs.sh, and
|
|
5
5
|
# clear-market-adapter.sh while using a single confirmation prompt. It also
|
|
6
6
|
# removes claw data (positions, watcher health, memu) from <profiles>/claw/data.
|
|
7
|
+
# That includes the credential daemon's audit trail (daemon-audit.jsonl and its
|
|
8
|
+
# rotated siblings), which is named in the preview so the wipe is never a surprise.
|
|
9
|
+
# Advisory only: if a runtime is detected, a warning is printed (the deletion
|
|
10
|
+
# still runs — stop with `dexbot stop` first if you want it to take effect).
|
|
7
11
|
# Usage: ./scripts/clear-all.sh or bash scripts/clear-all.sh
|
|
8
12
|
|
|
9
13
|
set -e
|
|
@@ -66,7 +70,7 @@ else
|
|
|
66
70
|
fi
|
|
67
71
|
|
|
68
72
|
if [ -d "$LOGS_DIR" ]; then
|
|
69
|
-
LOG_COUNT=$(
|
|
73
|
+
LOG_COUNT=$(log_files "$LOGS_DIR" | wc -l)
|
|
70
74
|
else
|
|
71
75
|
log_warning "Logs directory does not exist: $LOGS_DIR"
|
|
72
76
|
fi
|
|
@@ -111,7 +115,7 @@ fi
|
|
|
111
115
|
|
|
112
116
|
if [ "$LOG_COUNT" -gt 0 ]; then
|
|
113
117
|
log_info "Log files to be deleted:"
|
|
114
|
-
|
|
118
|
+
log_files "$LOGS_DIR" | while read -r file; do
|
|
115
119
|
SIZE=$(du -h "$file" | cut -f1)
|
|
116
120
|
echo -e "${BLUE} -${NC} $(realpath --relative-to="$PROJECT_ROOT" "$file") ($SIZE)"
|
|
117
121
|
done
|
|
@@ -145,6 +149,11 @@ if [ "$CLAW_COUNT" -gt 0 ]; then
|
|
|
145
149
|
log_info ""
|
|
146
150
|
fi
|
|
147
151
|
|
|
152
|
+
# Warn (advisory) when a live runtime would undo the deletion
|
|
153
|
+
warn_if_runtime_running
|
|
154
|
+
note_audit_included "$LOGS_DIR"
|
|
155
|
+
log_info ""
|
|
156
|
+
|
|
148
157
|
# Ask for confirmation
|
|
149
158
|
read -p "Delete all listed files? (y/n): " -r CONFIRM
|
|
150
159
|
|
|
@@ -159,7 +168,7 @@ if [ "$ORDER_COUNT" -gt 0 ]; then
|
|
|
159
168
|
fi
|
|
160
169
|
|
|
161
170
|
if [ "$LOG_COUNT" -gt 0 ]; then
|
|
162
|
-
|
|
171
|
+
log_files "$LOGS_DIR" | while read -r file; do rm -f "$file"; done
|
|
163
172
|
fi
|
|
164
173
|
|
|
165
174
|
if [ "$MA_DATA_COUNT" -gt 0 ]; then
|
|
@@ -188,7 +197,7 @@ if [ -d "$ORDERS_DIR" ]; then
|
|
|
188
197
|
fi
|
|
189
198
|
|
|
190
199
|
if [ -d "$LOGS_DIR" ]; then
|
|
191
|
-
REMAINING_LOGS=$(
|
|
200
|
+
REMAINING_LOGS=$(log_files "$LOGS_DIR" | wc -l)
|
|
192
201
|
fi
|
|
193
202
|
|
|
194
203
|
if [ -d "$MA_DATA_DIR" ]; then
|
package/scripts/clear-logs.sh
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
# Clear all log files from profiles/logs directory
|
|
3
3
|
#
|
|
4
4
|
# This script safely removes all log files while preserving the logs directory structure.
|
|
5
|
+
# That includes the credential daemon's audit trail (daemon-audit.jsonl and its
|
|
6
|
+
# rotated siblings), which is named in the preview so the wipe is never a surprise.
|
|
7
|
+
# Advisory only: if a runtime is detected, a warning is printed (the deletion still
|
|
8
|
+
# runs — stop with `dexbot stop` first if you want it to take effect).
|
|
5
9
|
# Usage: ./scripts/clear-logs.sh or bash scripts/clear-logs.sh
|
|
6
10
|
|
|
7
11
|
set -e
|
|
@@ -49,7 +53,7 @@ if [ ! -d "$LOGS_DIR" ]; then
|
|
|
49
53
|
fi
|
|
50
54
|
|
|
51
55
|
# Count log files
|
|
52
|
-
LOG_COUNT=$(
|
|
56
|
+
LOG_COUNT=$(log_files "$LOGS_DIR" | wc -l)
|
|
53
57
|
|
|
54
58
|
if [ "$LOG_COUNT" -eq 0 ]; then
|
|
55
59
|
log_info "No log files found in $LOGS_DIR"
|
|
@@ -61,13 +65,18 @@ log_info ""
|
|
|
61
65
|
|
|
62
66
|
# Show what will be deleted
|
|
63
67
|
log_info "Log files to be deleted:"
|
|
64
|
-
|
|
68
|
+
log_files "$LOGS_DIR" | while read file; do
|
|
65
69
|
SIZE=$(du -h "$file" | cut -f1)
|
|
66
70
|
echo -e "${BLUE} -${NC} $(basename "$file") ($SIZE)"
|
|
67
71
|
done
|
|
68
72
|
|
|
69
73
|
log_info ""
|
|
70
74
|
|
|
75
|
+
# Warn (advisory) when a live runtime would undo the deletion
|
|
76
|
+
warn_if_runtime_running
|
|
77
|
+
note_audit_included "$LOGS_DIR"
|
|
78
|
+
log_info ""
|
|
79
|
+
|
|
71
80
|
# Ask for confirmation
|
|
72
81
|
read -p "Delete these log files? (y/n): " -r CONFIRM
|
|
73
82
|
|
|
@@ -77,11 +86,11 @@ if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then
|
|
|
77
86
|
fi
|
|
78
87
|
|
|
79
88
|
# Delete log files
|
|
80
|
-
|
|
89
|
+
log_files "$LOGS_DIR" | while read -r file; do rm -f "$file"; done
|
|
81
90
|
DELETED=$?
|
|
82
91
|
|
|
83
92
|
# Re-count to confirm
|
|
84
|
-
REMAINING=$(
|
|
93
|
+
REMAINING=$(log_files "$LOGS_DIR" | wc -l)
|
|
85
94
|
|
|
86
95
|
log_info "=========================================="
|
|
87
96
|
if [ "$REMAINING" -eq 0 ]; then
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
# and market_adapter/state/, plus profiles/logs/market_adapter.log,
|
|
6
6
|
# dexbot-adapter.log, and dexbot-adapter-error.log. The market
|
|
7
7
|
# adapter will bootstrap fresh from Kibana and regenerate state on next run.
|
|
8
|
+
# Advisory only: if a runtime is detected, a warning is printed (the deletion still
|
|
9
|
+
# runs — stop with `dexbot stop` first, since a live adapter rewrites its state file
|
|
10
|
+
# and its market_adapter.lock, and a deleted lock lets a second adapter start).
|
|
8
11
|
#
|
|
9
12
|
# Usage: ./scripts/clear-market-adapter.sh or bash scripts/clear-market-adapter.sh
|
|
10
13
|
|
|
@@ -127,6 +130,9 @@ if [ "$LOG_COUNT" -gt 0 ]; then
|
|
|
127
130
|
log_info ""
|
|
128
131
|
fi
|
|
129
132
|
|
|
133
|
+
# Warn (advisory) when a live runtime would undo the deletion
|
|
134
|
+
warn_if_runtime_running
|
|
135
|
+
|
|
130
136
|
# Ask for confirmation
|
|
131
137
|
read -p "Delete all listed market adapter files? (y/n): " -r CONFIRM
|
|
132
138
|
|
package/scripts/clear-orders.sh
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# This script safely removes all bot order state files while preserving the orders directory.
|
|
5
5
|
# Use this to reset bot order grids and start fresh (clears cached order data).
|
|
6
6
|
# WARNING: This will lose all persisted grid information. Bots will regenerate grids on next run.
|
|
7
|
+
# Advisory only: if a runtime is detected, a warning is printed (the deletion still
|
|
8
|
+
# runs — stop with `dexbot stop` first, since a running bot re-persists its grid).
|
|
7
9
|
# Usage: ./scripts/clear-orders.sh or bash scripts/clear-orders.sh
|
|
8
10
|
|
|
9
11
|
set -e
|
|
@@ -74,6 +76,9 @@ done
|
|
|
74
76
|
|
|
75
77
|
log_info ""
|
|
76
78
|
|
|
79
|
+
# Warn (advisory) when a live runtime would undo the deletion
|
|
80
|
+
warn_if_runtime_running
|
|
81
|
+
|
|
77
82
|
# Ask for confirmation
|
|
78
83
|
read -p "Delete these order files? (y/n): " -r CONFIRM
|
|
79
84
|
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
# source "$SCRIPT_DIR/lib/dexbot-paths.sh"
|
|
12
12
|
#
|
|
13
13
|
# Defines: PROFILE_ROOT, MA_DATA_DIR, MA_STATE_DIR, CLAW_DATA_DIR
|
|
14
|
+
#
|
|
15
|
+
# Also provides the advisory runtime-detection and log-predicate helpers used by
|
|
16
|
+
# the clear-* scripts: live_pid_from_file, runtime_processes,
|
|
17
|
+
# warn_if_runtime_running, log_files, note_audit_included.
|
|
14
18
|
|
|
15
19
|
# Well-known files that mark a profiles dir as populated (any one suffices) —
|
|
16
20
|
# mirrors PROFILE_STATE_MARKERS in modules/paths.ts. Not just bots.json, so a
|
|
@@ -121,3 +125,107 @@ elif [ "$PROFILE_ROOT" = "${PROJECT_ROOT}/profiles" ]; then
|
|
|
121
125
|
else
|
|
122
126
|
CLAW_DATA_DIR="${PROFILE_ROOT}/claw/data"
|
|
123
127
|
fi
|
|
128
|
+
|
|
129
|
+
# ---------------------------------------------------------------------------
|
|
130
|
+
# Runtime detection (advisory only — never blocks, never changes exit codes)
|
|
131
|
+
#
|
|
132
|
+
# The clear-* scripts delete runtime state. When the runtime is up it re-creates
|
|
133
|
+
# that state within seconds (grid snapshots; adapter state *and* its lock) and
|
|
134
|
+
# keeps the deleted log files open, so the space is only reclaimed on restart.
|
|
135
|
+
# Detecting that here keeps the warning identical in every script.
|
|
136
|
+
#
|
|
137
|
+
# Deliberately side-effect free: liveness is read from pid files, and `pm2 jlist`
|
|
138
|
+
# is probed only when the PM2 daemon is already up — otherwise a cleanup script
|
|
139
|
+
# would spawn a daemon as a side effect. Mirrors the runtime locations in
|
|
140
|
+
# modules/paths.ts (MONOLITHIC_PID, MONOLITHIC_BOT_PID, MONOLITHIC_CRED_PID).
|
|
141
|
+
# ---------------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
# Echo the pid recorded in $1 when that process is alive, nothing otherwise.
|
|
144
|
+
# A recycled pid can produce a false positive; the warning is advisory, so that
|
|
145
|
+
# is preferable to the cost of a full process-table scan.
|
|
146
|
+
live_pid_from_file() {
|
|
147
|
+
[ -f "$1" ] || return 0
|
|
148
|
+
_lpf_pid="$(tr -dc '0-9' < "$1" 2>/dev/null)"
|
|
149
|
+
[ -n "$_lpf_pid" ] || return 0
|
|
150
|
+
kill -0 "$_lpf_pid" 2>/dev/null || return 0
|
|
151
|
+
echo "$_lpf_pid"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
# Echo one "<label> <pid>" line per live runtime process: the monolithic
|
|
155
|
+
# runtime's pid files first, then PM2 apps belonging to this install.
|
|
156
|
+
runtime_processes() {
|
|
157
|
+
for _rp_file in monolithic.pid monolithic-bot.pid monolithic-cred.pid; do
|
|
158
|
+
_rp_pid="$(live_pid_from_file "${PROFILE_ROOT}/${_rp_file}")"
|
|
159
|
+
if [ -n "$_rp_pid" ]; then
|
|
160
|
+
echo "${_rp_file} ${_rp_pid}"
|
|
161
|
+
fi
|
|
162
|
+
done
|
|
163
|
+
|
|
164
|
+
_rp_pm2_home="${PM2_HOME:-${HOME}/.pm2}"
|
|
165
|
+
_rp_pm2_pid="$(live_pid_from_file "${_rp_pm2_home}/pm2.pid")"
|
|
166
|
+
if [ -n "$_rp_pm2_pid" ] && command -v pm2 >/dev/null 2>&1; then
|
|
167
|
+
# Filter to online apps whose cwd/exec path is this install, so an
|
|
168
|
+
# unrelated PM2 daemon on the same host is not reported. `process.argv`
|
|
169
|
+
# after -e starts at index 1 (no script path is prepended).
|
|
170
|
+
pm2 jlist 2>/dev/null | node -e '
|
|
171
|
+
let raw = "";
|
|
172
|
+
process.stdin.on("data", (chunk) => { raw += chunk; }).on("end", () => {
|
|
173
|
+
let apps;
|
|
174
|
+
try { apps = JSON.parse(raw); } catch { process.exit(0); }
|
|
175
|
+
const roots = process.argv.slice(1).filter(Boolean);
|
|
176
|
+
for (const app of apps || []) {
|
|
177
|
+
const env = app.pm2_env || {};
|
|
178
|
+
if (env.status && env.status !== "online") continue;
|
|
179
|
+
const scope = env.cwd || env.pm_exec_path || "";
|
|
180
|
+
if (roots.some((root) => scope === root || scope.startsWith(root + "/"))) {
|
|
181
|
+
console.log("pm2:" + (app.name || "?") + " " + (app.pid || "?"));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});' "${PROJECT_ROOT}" "${PROFILE_ROOT}" 2>/dev/null || true
|
|
185
|
+
fi
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Print a warning when a live runtime is detected. Advisory: prints and returns,
|
|
189
|
+
# never prompts, never exits, never changes the script's exit code.
|
|
190
|
+
warn_if_runtime_running() {
|
|
191
|
+
_wirr_found="$(runtime_processes)"
|
|
192
|
+
[ -n "$_wirr_found" ] || return 0
|
|
193
|
+
if command -v log_warning >/dev/null 2>&1; then
|
|
194
|
+
log_warning "A DEXBot2 runtime appears to be RUNNING:"
|
|
195
|
+
echo "${_wirr_found}" | while read -r _wirr_line; do
|
|
196
|
+
log_warning " - ${_wirr_line}"
|
|
197
|
+
done
|
|
198
|
+
log_warning "The deletion below is unreliable while it runs: bots re-persist"
|
|
199
|
+
log_warning "their grids within seconds, the market adapter rewrites its state"
|
|
200
|
+
log_warning "file and lock, and open log handles keep the disk space until the"
|
|
201
|
+
log_warning "processes restart. Stop first: dexbot stop (or dexbot pm2 stop all)."
|
|
202
|
+
else
|
|
203
|
+
echo "WARNING: a DEXBot2 runtime appears to be running:" >&2
|
|
204
|
+
echo "${_wirr_found}" >&2
|
|
205
|
+
fi
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
# ---------------------------------------------------------------------------
|
|
209
|
+
# Log file predicate
|
|
210
|
+
#
|
|
211
|
+
# One predicate for every find over the logs directory, so the preview, the
|
|
212
|
+
# count, the delete and the verification can never disagree. `*.jsonl*` (not
|
|
213
|
+
# `*.jsonl`) so the credential daemon's rotated audit siblings
|
|
214
|
+
# (daemon-audit.jsonl.1) are wiped together with daemon-audit.jsonl — they match
|
|
215
|
+
# no other pattern, and leaving them behind would make "clear" a partial wipe.
|
|
216
|
+
# ---------------------------------------------------------------------------
|
|
217
|
+
log_files() {
|
|
218
|
+
find "$1" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl*" \) 2>/dev/null
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
# The audit trail is log content as far as these commands are concerned, so it is
|
|
222
|
+
# deleted with everything else — it is only named in the preview so the deletion
|
|
223
|
+
# is never a surprise. No extra prompt, no opt-in flag.
|
|
224
|
+
note_audit_included() {
|
|
225
|
+
[ -n "$(find "$1" -type f -name 'daemon-audit.jsonl*' 2>/dev/null | head -n 1)" ] || return 0
|
|
226
|
+
if command -v log_info >/dev/null 2>&1; then
|
|
227
|
+
log_info "Includes the credential audit trail: daemon-audit.jsonl*"
|
|
228
|
+
else
|
|
229
|
+
echo "Includes the credential audit trail: daemon-audit.jsonl*" >&2
|
|
230
|
+
fi
|
|
231
|
+
}
|
package/tests/README.md
CHANGED
|
@@ -11,6 +11,9 @@ npm test
|
|
|
11
11
|
# Run a single test file
|
|
12
12
|
npm run build:tests
|
|
13
13
|
node dist/tests/<file>.js
|
|
14
|
+
|
|
15
|
+
# Run the archived legacy suites (excluded from `npm test`)
|
|
16
|
+
npm run test:legacy
|
|
14
17
|
```
|
|
15
18
|
|
|
16
19
|
## Directory Layout
|
|
@@ -54,6 +57,10 @@ Price derivation, orderbook inspection, tolerance checks.
|
|
|
54
57
|
AMA signal processing, price offset, bound clamping, signal gates.
|
|
55
58
|
*Examples:* `test_market_adapter_logic.ts`, `test_market_adapter_service.ts`, `test_market_adapter_signal_gates.ts`, `test_market_adapter_integration_core.ts`
|
|
56
59
|
|
|
60
|
+
### Analysis & Charting
|
|
61
|
+
Research/analysis tools: chart generators, backtests, and the grid-reset replay used by the TradingView exporter ([GRID_RECALCULATION.md](../docs/GRID_RECALCULATION.md)).
|
|
62
|
+
*Examples:* `test_grid_reset_sim.ts`, `test_tradingview_chart_storage_key.ts`, `test_backtest_bot_fitting_logic.ts`
|
|
63
|
+
|
|
57
64
|
### Order Management & Execution
|
|
58
65
|
Order lifecycle, fill processing, trade history, batch execution.
|
|
59
66
|
*Examples:* `test_open_orders.ts`, `test_fills.ts`, `test_fill_batch_chunking.ts`, `test_fill_replay_guards.ts`, `test_uncertain_broadcast.ts`
|
|
@@ -79,8 +86,8 @@ Credential management, daemon lifecycle, session caching, debt policy.
|
|
|
79
86
|
*Examples:* `test_credential_daemon.ts`, `test_credential_runtime.ts`, `test_credential_session_cache.ts`, `test_credit_runtime.ts`
|
|
80
87
|
|
|
81
88
|
### PM2 & Process Management
|
|
82
|
-
PM2 lifecycle, startup ordering, bot supervision.
|
|
83
|
-
*Examples:* `test_pm2_logic.ts`, `test_pm2_main_output.ts`, `test_bot_supervisor.ts`, `test_unlock_main.ts`
|
|
89
|
+
PM2 lifecycle, startup ordering, bot supervision, launcher version reporting.
|
|
90
|
+
*Examples:* `test_pm2_logic.ts`, `test_pm2_main_output.ts`, `test_bot_supervisor.ts`, `test_unlock_main.ts`, `test_version_notice.ts`
|
|
84
91
|
|
|
85
92
|
### Diagnostics & Benchmarks
|
|
86
93
|
Interactive tools and performance benchmarks (not part of CI).
|
|
@@ -124,10 +131,11 @@ Shared utility functions, precision handling, chain helpers.
|
|
|
124
131
|
- Every emitted order's price must equal its slot's genesis level (`priceForSlot(idx, genesis)`); off-grid emissions are blocked, not counted
|
|
125
132
|
- The guard itself plus the live batch wiring, escalation thresholds, and per-order stranded-hold clocks are each pinned and mutation-tested
|
|
126
133
|
- Adoption keeps the slot's own level; `loadGrid` repairs a pre-existing off-grid slot price
|
|
134
|
+
- A snapshot with no usable ladder is refused at load (`MISSING_GENESIS_POLICY` rebuild/halt) and the sync entry refuses rather than falling back to a tolerance matcher
|
|
127
135
|
|
|
128
136
|
**Reference:** [docs/GRID_PRICE_INVARIANT.md](../docs/GRID_PRICE_INVARIANT.md)
|
|
129
137
|
|
|
130
|
-
**Examples:** `test_grid_price_invariant_guard.ts`, `test_grid_price_invariant_wiring.ts`, `test_grid_price_slot_invariant.ts`, `test_final_pivot_gate.ts`, `test_hold_and_center_guards.ts`, `test_sync_out_of_grid_defer.ts`
|
|
138
|
+
**Examples:** `test_grid_price_invariant_guard.ts`, `test_grid_price_invariant_wiring.ts`, `test_grid_price_slot_invariant.ts`, `test_final_pivot_gate.ts`, `test_hold_and_center_guards.ts`, `test_sync_out_of_grid_defer.ts`, `test_missing_genesis_policy.ts`, `test_last_fill_pivot_persistence.ts`
|
|
131
139
|
|
|
132
140
|
---
|
|
133
141
|
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SHARED ACCOUNT RESOLUTION (analysis)
|
|
5
|
-
*
|
|
6
|
-
* Central implementation of "preferredAccount / bare account reference →
|
|
7
|
-
* 1.2.x accountId" for every analysis tool, including stamping the resolved ID
|
|
8
|
-
* back into profiles/bots.json so later runs skip the chain lookup.
|
|
9
|
-
*
|
|
10
|
-
* trade_profitability.ts and grid_correction_check.ts used to each carry a
|
|
11
|
-
* private copy of this decision tree, of the chain lookup and of the node
|
|
12
|
-
* handling — all of it lives here now.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { findBotKeyByAccountRef, loadBotMeta, persistBotAccountId } from './bot_key_utils.js';
|
|
16
|
-
import { withReadOnlyClient } from './chain_pool.js';
|
|
17
|
-
|
|
18
|
-
const ACCOUNT_ID_RE = /^1\.2\.\d+$/;
|
|
19
|
-
|
|
20
|
-
/** Chain lookup seam: batch tools can reuse one connection across lookups. */
|
|
21
|
-
type NameLookup = (name: string) => Promise<string | null>;
|
|
22
|
-
|
|
23
|
-
/** Default lookup: ephemeral read-only client over the built-in node pool. */
|
|
24
|
-
async function lookupNameOnChain(name: string): Promise<string | null> {
|
|
25
|
-
try {
|
|
26
|
-
return await withReadOnlyClient(async (client) => {
|
|
27
|
-
const accounts = await client.db('lookup_account_names', [[name]]);
|
|
28
|
-
return Array.isArray(accounts) && accounts[0]?.id ? String(accounts[0].id) : null;
|
|
29
|
-
});
|
|
30
|
-
} catch (e: any) {
|
|
31
|
-
console.warn(` [warn] Account resolution failed: ${e.message}`);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type ResolveSource = 'typed-id' | 'override-id' | 'override-resolved' | 'preferred-id' | 'stored' | 'resolved';
|
|
37
|
-
type ResolveFailure = 'bot-not-found' | 'no-preferred-account' | 'override-unresolved' | 'name-unresolved';
|
|
38
|
-
|
|
39
|
-
interface ResolveOptions {
|
|
40
|
-
/** Explicit override (--account). Wins over the bot entry and is never persisted. */
|
|
41
|
-
overrideAccount?: string | null;
|
|
42
|
-
/** Ignore a stored accountId and re-resolve on chain (--refresh-account). */
|
|
43
|
-
refresh?: boolean;
|
|
44
|
-
/** Suppress informational output; failures are reported via `reason`. */
|
|
45
|
-
quiet?: boolean;
|
|
46
|
-
/** Chain lookup override (batch tools reuse one connection, tests stub it). */
|
|
47
|
-
lookup?: NameLookup;
|
|
48
|
-
/** Override profiles/bots.json (tests use a temp file). */
|
|
49
|
-
botsFile?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface ResolvedAccount {
|
|
53
|
-
accountId: string | null;
|
|
54
|
-
botKey: string | null;
|
|
55
|
-
botMeta: any | null;
|
|
56
|
-
source: ResolveSource | null;
|
|
57
|
-
reason: ResolveFailure | null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Persist a resolved ID onto the bot entry (no-op when it already matches) and
|
|
62
|
-
* report the outcome. `previous` is the stored value the write replaces, if any.
|
|
63
|
-
*/
|
|
64
|
-
function persistResolvedAccountId(botKey: string, accountId: string, previous: string | null, quiet: boolean, botsFile?: string): boolean {
|
|
65
|
-
const wrote = persistBotAccountId(botKey, accountId, botsFile);
|
|
66
|
-
if (quiet) return wrote;
|
|
67
|
-
if (wrote) {
|
|
68
|
-
console.log(previous && previous !== accountId
|
|
69
|
-
? ` Updated stored accountId ${previous} → ${accountId} in profiles/bots.json for '${botKey}'`
|
|
70
|
-
: ` Stored accountId ${accountId} in profiles/bots.json for '${botKey}'`);
|
|
71
|
-
} else if (previous === accountId) {
|
|
72
|
-
console.log(` Stored accountId ${accountId} confirmed up to date`);
|
|
73
|
-
} else {
|
|
74
|
-
console.warn(` [warn] Could not store accountId ${accountId} in profiles/bots.json for '${botKey}'`);
|
|
75
|
-
}
|
|
76
|
-
return wrote;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Resolve the chain account for a bot entry:
|
|
81
|
-
* explicit override > typed 1.2.x preferredAccount > stored accountId >
|
|
82
|
-
* fresh chain lookup of the name.
|
|
83
|
-
* The resolved ID is persisted onto the entry whenever it differs from the
|
|
84
|
-
* stored one (an explicit override is never persisted — it is not the bot's
|
|
85
|
-
* preferredAccount).
|
|
86
|
-
*/
|
|
87
|
-
async function resolveBotAccount(botKey: string, options: ResolveOptions = {}): Promise<ResolvedAccount> {
|
|
88
|
-
const { overrideAccount = null, refresh = false, quiet = false, lookup = lookupNameOnChain, botsFile } = options;
|
|
89
|
-
const botMeta = botKey ? loadBotMeta(botKey, botsFile) : null;
|
|
90
|
-
|
|
91
|
-
// An explicit override always wins and is never persisted.
|
|
92
|
-
const override = overrideAccount != null ? String(overrideAccount).trim() : '';
|
|
93
|
-
if (override) {
|
|
94
|
-
if (ACCOUNT_ID_RE.test(override)) {
|
|
95
|
-
return { accountId: override, botKey, botMeta, source: 'override-id', reason: null };
|
|
96
|
-
}
|
|
97
|
-
if (!quiet) console.log(` Resolving account name '${override}'...`);
|
|
98
|
-
const id = await lookup(override);
|
|
99
|
-
if (!id) return { accountId: null, botKey, botMeta, source: null, reason: 'override-unresolved' };
|
|
100
|
-
if (!quiet) console.log(` → ${id}`);
|
|
101
|
-
return { accountId: String(id), botKey, botMeta, source: 'override-resolved', reason: null };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (!botMeta) return { accountId: null, botKey, botMeta: null, source: null, reason: 'bot-not-found' };
|
|
105
|
-
|
|
106
|
-
const prefRaw = botMeta.preferredAccount != null ? String(botMeta.preferredAccount).trim() : '';
|
|
107
|
-
if (!prefRaw) return { accountId: null, botKey, botMeta, source: null, reason: 'no-preferred-account' };
|
|
108
|
-
|
|
109
|
-
const stored = ACCOUNT_ID_RE.test(String(botMeta.accountId ?? '')) ? String(botMeta.accountId) : null;
|
|
110
|
-
|
|
111
|
-
// A typed 1.2.x preferredAccount is authoritative — the stored accountId is
|
|
112
|
-
// a derived cache and must never override it. Self-heal the cache.
|
|
113
|
-
if (ACCOUNT_ID_RE.test(prefRaw)) {
|
|
114
|
-
if (stored !== prefRaw) persistResolvedAccountId(botKey, prefRaw, stored, quiet, botsFile);
|
|
115
|
-
return { accountId: prefRaw, botKey, botMeta, source: 'preferred-id', reason: null };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Name + fresh-enough cache + no refresh requested: offline-friendly fast path.
|
|
119
|
-
if (stored && !refresh) {
|
|
120
|
-
if (!quiet) console.log(` Using stored accountId ${stored} from profiles/bots.json (no lookup needed; pass --refresh-account to re-verify)`);
|
|
121
|
-
return { accountId: stored, botKey, botMeta, source: 'stored', reason: null };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (!quiet) console.log(` Resolving account name '${prefRaw}'...`);
|
|
125
|
-
const id = await lookup(prefRaw);
|
|
126
|
-
if (!id) return { accountId: null, botKey, botMeta, source: null, reason: 'name-unresolved' };
|
|
127
|
-
if (!quiet) console.log(` → ${id}`);
|
|
128
|
-
persistResolvedAccountId(botKey, String(id), stored, quiet, botsFile);
|
|
129
|
-
return { accountId: String(id), botKey, botMeta, source: 'resolved', reason: null };
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Resolve a bare account reference (1.2.x ID or name) to a chain account ID.
|
|
134
|
-
* When a bot in profiles/bots.json claims the name, the resolved ID is
|
|
135
|
-
* persisted onto that entry via resolveBotAccount.
|
|
136
|
-
*/
|
|
137
|
-
async function resolveAccountRef(accountRef: string, options: ResolveOptions = {}): Promise<ResolvedAccount> {
|
|
138
|
-
const ref = String(accountRef ?? '').trim();
|
|
139
|
-
if (ACCOUNT_ID_RE.test(ref)) {
|
|
140
|
-
return { accountId: ref, botKey: null, botMeta: null, source: 'typed-id', reason: null };
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// A bot claiming this name is the persist target; its preferredAccount is
|
|
144
|
-
// the same name, so resolveBotAccount owns the whole decision tree.
|
|
145
|
-
let match: { botKey: string; meta: any } | null = null;
|
|
146
|
-
try {
|
|
147
|
-
match = findBotKeyByAccountRef(ref, options.botsFile);
|
|
148
|
-
} catch (_) {
|
|
149
|
-
// bots.json issues must never break resolution; fall through to chain.
|
|
150
|
-
}
|
|
151
|
-
if (match) return resolveBotAccount(match.botKey, options);
|
|
152
|
-
|
|
153
|
-
const lookup = options.lookup ?? lookupNameOnChain;
|
|
154
|
-
if (!options.quiet) console.log(` Resolving account name '${ref}'...`);
|
|
155
|
-
const id = await lookup(ref);
|
|
156
|
-
if (!id) return { accountId: null, botKey: null, botMeta: null, source: null, reason: 'name-unresolved' };
|
|
157
|
-
if (!options.quiet) console.log(` → ${id}`);
|
|
158
|
-
return { accountId: String(id), botKey: null, botMeta: null, source: 'resolved', reason: null };
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export { resolveBotAccount, resolveAccountRef };
|