dexbot 1.6.10 → 1.6.12
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 +50 -3
- package/README.md +3 -1
- package/analysis/README.md +51 -11
- package/analysis/bot_fitting/README.md +12 -0
- package/analysis/tradingview/README.md +3 -3
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +11 -37
- package/analysis/trend_detection/README.md +31 -0
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -3
- package/claw/modules/chain_broadcast.ts +7 -1
- package/claw/modules/claw_launcher.ts +1 -1
- package/claw/modules/launcher_mode_detector.ts +9 -2
- 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/account_resolver.d.ts +1 -1
- package/dist/analysis/account_resolver.js +15 -2
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +3 -4
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +2 -7
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +4 -4
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +20 -4
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +9 -6
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +16 -12
- package/dist/analysis/analyze_args.d.ts +31 -0
- package/dist/analysis/analyze_args.js +41 -0
- package/dist/analysis/analyze_dynamic_weight.js +7 -20
- 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 +220 -12
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +55 -10
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +34 -4
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +72 -66
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.d.ts +21 -0
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +315 -0
- package/dist/analysis/bot_fitting/shared_utils.d.ts +7 -7
- package/dist/analysis/bot_fitting/shared_utils.js +2 -2
- package/dist/analysis/bot_key_utils.d.ts +18 -10
- package/dist/analysis/bot_key_utils.js +10 -17
- 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 +5 -2
- package/dist/analysis/chart_ui.js +6 -3
- package/dist/analysis/chart_utils.d.ts +5 -5
- package/dist/analysis/chart_utils.js +9 -0
- package/dist/analysis/fills_cache.d.ts +64 -0
- package/dist/analysis/fills_cache.js +254 -0
- package/dist/analysis/fills_source.d.ts +2 -2
- package/dist/analysis/fills_source.js +19 -14
- package/dist/analysis/grid_correction_check.d.ts +1 -1
- package/dist/analysis/grid_correction_check.js +12 -11
- package/dist/analysis/math_utils.d.ts +7 -6
- package/dist/analysis/math_utils.js +5 -8
- package/dist/analysis/pnl_report.d.ts +39 -0
- package/dist/analysis/pnl_report.js +325 -0
- package/dist/analysis/price_sources.d.ts +8 -8
- package/dist/analysis/price_sources.js +5 -4
- package/dist/analysis/resolve_bot_accounts.js +2 -2
- package/dist/analysis/resolve_source.d.ts +1 -2
- package/dist/analysis/trade_profitability.d.ts +32 -2
- package/dist/analysis/trade_profitability.js +232 -106
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +17 -6
- package/dist/analysis/tradingview/analyze_tradingview.js +9 -10
- package/dist/analysis/tradingview/grid_reset_config.d.ts +42 -31
- package/dist/analysis/tradingview/grid_reset_config.js +35 -6
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +75 -8
- package/dist/analysis/tradingview/grid_reset_sim.js +42 -5
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +69 -4
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +20 -20
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +102 -0
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +725 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +63 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +27 -112
- package/dist/analysis/trend_detection/huber_scale_variants.d.ts +40 -0
- package/dist/analysis/trend_detection/huber_scale_variants.js +176 -0
- 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/credential-daemon.js +34 -20
- package/dist/dexbot.js +17 -14
- package/dist/market_adapter/candle_utils.d.ts +22 -18
- package/dist/market_adapter/candle_utils.js +24 -20
- 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/kibana_candles.d.ts +53 -18
- package/dist/market_adapter/core/kibana_candles.js +9 -7
- 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 +297 -115
- package/dist/market_adapter/core/market_adapter_service.js +184 -101
- package/dist/market_adapter/core/strategies/ama.d.ts +10 -2
- package/dist/market_adapter/core/strategies/ama.js +7 -32
- 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 +36 -8
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +9 -9
- 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 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +97 -226
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +42 -7
- package/dist/market_adapter/inputs/fetch_lp_data.js +22 -15
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts +74 -15
- package/dist/market_adapter/inputs/kibana_feed_source.js +29 -22
- 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 +99 -94
- package/dist/market_adapter/inputs/window_cache.js +8 -8
- package/dist/market_adapter/interval_utils.d.ts +4 -4
- package/dist/market_adapter/log_format.d.ts +6 -6
- package/dist/market_adapter/log_format.js +28 -22
- 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 +7 -7
- 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 -33
- package/dist/market_adapter/market_adapter.js +69 -75
- 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 +4 -1
- 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/native_history.d.ts +9 -2
- package/dist/market_adapter/utils/native_history.js +35 -28
- package/dist/modules/account_bots.d.ts +577 -21
- package/dist/modules/account_bots.js +182 -158
- package/dist/modules/account_orders.d.ts +66 -30
- package/dist/modules/account_orders.js +22 -20
- 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 +38 -3
- package/dist/modules/bitshares-native/chain_client.js +45 -46
- 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/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 +55 -62
- 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 +6 -15
- 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 +2 -2
- 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 +93 -59
- package/dist/modules/chain_orders.js +31 -23
- package/dist/modules/constants.d.ts +530 -32
- package/dist/modules/constants.js +52 -60
- package/dist/modules/cr_planner.d.ts +40 -2
- 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 +42 -6
- package/dist/modules/credit_pricing.js +44 -30
- package/dist/modules/credit_runtime.d.ts +276 -118
- package/dist/modules/credit_runtime.js +462 -165
- 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/dexbot_class.d.ts +195 -139
- package/dist/modules/dexbot_class.js +78 -28
- package/dist/modules/dexbot_cow_runtime.d.ts +167 -87
- package/dist/modules/dexbot_cow_runtime.js +248 -206
- package/dist/modules/dexbot_credential_client.d.ts +19 -11
- package/dist/modules/dexbot_fill_runtime.d.ts +63 -48
- package/dist/modules/dexbot_fill_runtime.js +48 -41
- package/dist/modules/dexbot_maintenance_runtime.d.ts +109 -70
- package/dist/modules/dexbot_maintenance_runtime.js +117 -80
- package/dist/modules/dexbot_startup_runtime.d.ts +11 -10
- package/dist/modules/dexbot_startup_runtime.js +43 -43
- 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 +2 -2
- 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 -6
- 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/market_adapter_whitelist.d.ts +9 -3
- package/dist/modules/market_adapter_whitelist.js +15 -3
- 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 +40 -14
- 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 +39 -19
- package/dist/modules/order/format.js +62 -16
- package/dist/modules/order/genesis_policy.d.ts +21 -18
- package/dist/modules/order/genesis_policy.js +12 -8
- package/dist/modules/order/grid.d.ts +142 -36
- package/dist/modules/order/grid.js +148 -123
- 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 +263 -1
- package/dist/modules/order/logger.d.ts +45 -11
- package/dist/modules/order/logger.js +38 -40
- package/dist/modules/order/logger_state.d.ts +4 -4
- package/dist/modules/order/manager.d.ts +226 -180
- package/dist/modules/order/manager.js +101 -83
- 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 +99 -54
- 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 +326 -106
- package/dist/modules/order/utils/order.js +200 -99
- package/dist/modules/order/utils/slot.d.ts +1 -1
- package/dist/modules/order/utils/system.d.ts +176 -26
- package/dist/modules/order/utils/system.js +86 -69
- package/dist/modules/order/utils/validate.d.ts +89 -41
- package/dist/modules/order/utils/validate.js +24 -22
- package/dist/modules/order/utils/withPoolRef.d.ts +4 -3
- 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 +3 -4
- package/dist/modules/paths.js +3 -27
- 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 +15 -10
- 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 +7 -4
- 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 +1071 -2
- 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 +23 -1
- package/dist/modules/utils/time_range.d.ts +4 -0
- package/dist/modules/utils/time_range.js +18 -0
- package/dist/modules/validate_profiles.js +53 -43
- package/dist/modules/version_notice.d.ts +14 -3
- package/dist/modules/version_notice.js +6 -4
- package/dist/pm2.d.ts +29 -27
- package/dist/pm2.js +5 -5
- package/dist/scripts/analyze-credit.d.ts +2 -1
- package/dist/scripts/analyze-credit.js +23 -24
- package/dist/scripts/analyze-orders.d.ts +77 -9
- package/dist/scripts/analyze-orders.js +66 -84
- package/dist/scripts/chart_command.d.ts +27 -18
- package/dist/scripts/chart_command.js +16 -15
- package/dist/scripts/check_any.d.ts +18 -0
- package/dist/scripts/check_any.js +126 -0
- package/dist/scripts/diagnose-pool-history.js +12 -7
- package/dist/scripts/pnl.d.ts +3 -0
- package/dist/scripts/pnl.js +40 -0
- package/dist/scripts/print_grid.js +0 -1
- package/dist/scripts/run-tests.js +39 -7
- package/dist/scripts/runner.js +1 -1
- 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 +72 -10
- package/docs/BITSHARES_ONBOARDING.md +2 -0
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/COW_INVARIANTS.md +13 -6
- package/docs/DEXBOT_COMPARISON.md +8 -8
- package/docs/EVOLUTION.md +12 -10
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +5 -5
- package/docs/GRID_RECALCULATION.md +15 -16
- 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 +15 -4
- package/docs/WORKFLOW.md +1 -0
- package/docs/architecture.md +12 -9
- package/docs/developer_guide.md +6 -6
- package/market_adapter/README.md +9 -26
- package/modules/README.md +4 -1
- package/package.json +4 -1
- package/scripts/README.md +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.6.12] - 2026-10-08 - Type-Safety Ratchet, Shared ECC & Scrypt Correctness, Fresh-Placement Cancel Grace, Worker Drain & Partial Credit Renewal
|
|
6
|
+
|
|
7
|
+
### 2026-10-08
|
|
8
|
+
|
|
9
|
+
- **Refactor(types)**: eliminate explicit `any` project-wide behind a downward-only ratchet — explicit `any` is replaced with precise types or `unknown` across the core runtime, order engine, launcher and CLI entry points, native bridge, claw modules and storage layers, the market-adapter pipeline and analysis tooling, and scripts/tests. Shared shapes move into `modules/types.ts`, the DEXBot class / credit-runtime / COW seams and the lazy BitShares proxy are typed, the account-editor draft is typed, and `readJSON` defaults to `Record<string, unknown>`. The new `scripts/check_any.ts` plus `any-budget.json` ratchet (2,204 → 0) counts explicit type tokens only (string/template prose and member accesses such as `Promise.any` are ignored), so the count can only go down. One behavioral fix rides along: `computeCandleStaleness(null)` keeps `Number.isFinite` on the raw value (`Number(null) === 0`) and the `pairObj` cast uses optional chaining so a null pair no longer throws. A guard test pins size-less chain-order tolerance matching (`ParsedChainOrder.size` is `number | undefined`): a size-less parsed order is rejected for a sized slot rather than silently adopted, and the call does not throw. Verified: `tsc --noEmit` clean for root and tests, full suite green (`modules/types.ts`, `scripts/check_any.ts`, `market_adapter/**`, `modules/**`).
|
|
10
|
+
|
|
11
|
+
- **Refactor(crypto)**: share the ECC core between Node and browser and make pure-JS scrypt interoperable — the Node (sync/Buffer) and browser (async/Uint8Array) ECC implementations duplicated the curve math, public-key recovery, verification, DER/WIF encoding and the signing loop verbatim; `modules/bitshares-native/crypto/ecc_core.ts` now holds the platform-neutral parts and both files keep only their sync-vs-async and Buffer-vs-Uint8Array boundaries (`ecc.ts` 396 → 211 lines, `ecc.browser.ts` 350 → 232). A 405-check differential test pins byte-for-byte equality between the two implementations (the browser file previously had no coverage and is `@ts-nocheck`). The browser scrypt (`modules/crypto/pure_scrypt.ts`) had derived a different key than Node `crypto.scrypt` for the same password/salt, so a vault created in a browser could not be unlocked on Node and vice versa: ROMix phase 2 now starts from `X_N = BlockMix(X_{N-1})` per RFC 7914 §5, the single PBKDF2 `deriveBits` call is replaced by RFC 8018 block-wise PBKDF2-HMAC-SHA256 via `subtle.sign` (Firefox caps `deriveBits` output, which made scrypt's 1024-byte first call throw `OperationError`), and empty passwords are handled (WebCrypto rejects zero-length HMAC keys, but HMAC zero-pads sub-block keys). RFC 7914 §12 vectors and native cross-checks (including multi-block PBKDF2 key lengths) were added to `tests/test_browser_abstractions.ts`. Impact: browser and Node now derive identical vault keys; browser vaults created with the previous buggy derivation are not recoverable by the corrected code and would need to be recreated.
|
|
12
|
+
|
|
13
|
+
- **Fix(order-engine)**: defer cancels of freshly placed orders in COW reconcile and divergence paths — the reconcile/COW planner and divergence correction both run on target snapshots that can lag a just-placed order, so a surplus sweep on that snapshot canceled the fresh order (fee bleed, empty level) only for the next cycle to re-place it. `COWRebalanceEngine.execute` now accepts the owning manager and drops the whole slot action group (CANCEL paired with a CREATE) for orders inside `SURPLUS_CANCEL_GRACE_MS`, then re-syncs deferred slots from master via `workingGrid.syncFromMaster`; `applyGridDivergenceCorrections` drops any queued committed-size UPDATE for a not-desired/size-0 slot before skipping the cancel inside the window. The parameter stays optional so tests can drive the engine agelessly, and existing fixtures are aged via `_placedAt.clear()`. Also fixes an orphan double-count: `SyncEngine.synchronizeWithChain`'s createOrder branch kept the deferred-orphan record in `_lastUnmatchedChainOrders` after successful linkage, which fund accounting counts as committed on-chain funds, so a surviving record double-counted the order the slot now sees — the record is now pruned by chain id on successful linkage and kept on rejection or thrown errors. Covered by `tests/test_fresh_placement_cancel_grace_paths.ts` and `tests/test_sync_createorder_unmatched_prune.ts`.
|
|
14
|
+
|
|
15
|
+
- **Fix(order-engine)**: keep spread correction funded by repairing what it places — spread correction on an out-of-spread grid could plan candidates but place nothing. The edge-partial top-up target was always a PARTIAL slot, so `clampPostFillUpdateSize` clamped it to a no-op COW update yet it ran first and consumed the whole budget, leaving the following creates rejected as dust; the target is removed (spread repair is create-only, a top-up cannot move bestBuy/bestSell) and creates are funded exclusively from `funds.available[side]` and the cached `accountTotals[side]Free`, so no resting order is ever shrunk. Candidate ordering now sorts a windowed rail by distance to the live-window anchor instead of raw price, so the correction bridges contiguously from the window and cannot leave an interior hole or over-tighten. `checkSpreadCondition` reports `fundsExhausted` whenever a correction places nothing and the targeted-sync refresh clears it after a successful re-read, so it only reconciles on a concrete fund-drift or counted-shortfall signal instead of churning every cycle.
|
|
16
|
+
|
|
17
|
+
- **Fix(lifecycle)**: drain monolithic workers on stale and absent pid-file stop paths — `stop` returned as soon as the monolithic wrapper exited, but the supervisor pid file is wiped on wrapper exit and the `/proc` worker-drain loop ran only after a clean wrapper exit, so a racing `start` could spawn a SECOND worker over live orders (duplicate trades). `drainMonolithicWorkers` (same 15s deadline, 250ms poll, same warn-on-exhaustion; a failed `/proc` scan yields 0 so it stays a no-op off Linux) is extracted and also run when the pid file is stale (except on `status`) and when there is no wrapper pid file at all for targeted stop/delete and stop-all/delete/restart-all/reload-all. Cost is up to 15s block while a worker lingers, intentional best-effort. Covered by `tests/test_unlock_worker_drain.ts`.
|
|
18
|
+
|
|
19
|
+
- **Fix(credit)**: renew credit deals partially when free balance cannot cover the full deal — renewal repays before the atomic reborrow returns, so when the borrowed asset is deployed into the grid (or the market moved against the collateral) the free balance can be below principal + credit fee, the full repay fails on-chain with "Insufficient Balance", and the deal is left to expire. Each renewal is now sized to the affordable piece (floored to precision, leaving one raw unit as a drift buffer, clamped to the offer's `min_deal_amount` and the policy's `maxBorrowAmountPerOperation`) and the unrepaid remainder keeps its original `latest_repay_time` to be chipped away on later cycles. A reborrow is clamped to the collateral the repay actually released (`capBorrowToCollateral` in the shared builder), applying to the original offer, fallback offers and deferred reborrows; deferred-reborrow retries are bounded (`TIMING.CREDIT_REBORROW_MAX_ATTEMPTS`, default 6, transient offer/source-deal deferrals not counted). The stale-reborrow guard now snapshots pre-repay deal IDs so sibling deals on one offer no longer suppress a legitimate reborrow, and the borrow recompute that could inflate the borrow is dropped. `floorToBlockchainInt`, the on-chain balance-entry lookup and the retry-attempt helper are centralized; sizes are computed in raw integer units with the shared BigInt credit fee so the amount matches the chain's ceil fee and integer collateral release exactly. Covered by `tests/test_credit_runtime.ts`, `tests/test_credit_pricing.ts`, `tests/test_precision_quantization.ts`.
|
|
20
|
+
|
|
21
|
+
- **Fix(market-adapter)**: honor per-bot AMA persistence-gate overrides and align the gate with the replay — the 3-bar persistence gate had three defects: `resolveAmaSlopePersistBars` ORed the global `AMA_SLOPE_PERSIST_ENABLED = true` into the enable flag, so a per-bot `amaSlope.persistEnabled: false` was indistinguishable from unset and the documented rollback was dead (now an explicit tri-state: false disables, true enables, undefined falls back); `amaSlope.persistBars: 0` silently fell through to the global default 3 instead of disabling (now resolves to 1, legacy; negative/NaN still fall back); and `advanceAmaSlopePersistence` ran before trigger A and the grid-range-scaling whitelist check, so a non-whitelisted bot accumulated an unbounded counter and a bar whose price reset failed still advanced (now runs just before the slope reset, gated on `!triggered && !triggerSuppressedReason && isGridRangeScalingWhitelisted`, matching `grid_reset_sim`). Regression assertions cover `persistEnabled:false` (nested and flat), `persistBars:0`, `persistBars:2` and `persistEnabled:true`.
|
|
22
|
+
|
|
23
|
+
- **Fix(analyze)**: report boundary-less snapshots by slot type, not rail index — `scripts/analyze-orders.ts` sliced the buy/sell rails with `i <= boundaryIdx`, so a missing boundary (null after GRID-LOAD erases a poisoned persisted boundary) silently collapsed to index 0; live rail orders past slot 0 were hidden/misclassified and the best-buy edge fell onto slot 0 — exactly the recovery state an operator reads `dexbot order` to understand. A finite boundary is now detected explicitly; when absent, slots are classified by type, the slot-0 best-buy fallback returns null, and `boundaryLess` plus a warning banner make clear the counts are type-based not rail geometry. The numeric-boundary path is unchanged. Covered by `tests/test_analyze_orders_dynamic_weight.ts`.
|
|
24
|
+
|
|
25
|
+
- **Fix(update)**: classify the install layout instead of rejecting every non-npm install — `dexbot update` had one failure mode for everything that was not a direct npm global install, conflating two updatable and two must-refuse situations and telling local users to run a no-op `npm update`. The new `scripts/update_layout.ts` is a pure classifier (roots passed in, no fs/spawn) returning the layout, whether it can be replaced in place, and the exact command: npm global is updated in place (`npm install -g <pkg>@<latest>`); local dep is refused with `npm install <pkg>@latest` in the parent project; pnpm/yarn global is detected but refused with the exact manager command (content-addressed/version-hashed trees cannot safely re-resolve and restart the running process); linked/custom-`--prefix`/nested is refused with a reinstall hint. The manager CLI is resolved next to the running Node (`process.execPath`) so a version-manager PATH mismatch no longer rejects a valid global install; manager CLIs spawn via argv with Windows `.cmd` shims routed through `cmd.exe /c`; pnpm globals are classified when Node has resolved the store symlink; Windows paths compare case-insensitively; and the registry probe is best-effort so an unreachable registry installs `@latest` and lets the post-install check confirm. Risk: the Windows spawn branch and the pnpm/yarn refusal are reasoned from documented layouts, not exercised on this host. Covered by `tests/test_update_layout.ts` and `tests/test_update_dist_freshness.ts`.
|
|
26
|
+
|
|
27
|
+
- **Feat(bots)**: default AMA pricing on for new bots when no whitelist record exists — a newly created bot in the interactive editor now defaults the market-adapter "Price" (AMA pricing) flag to true, so a fresh bot participates in AMA recentering without a manual menu-6 toggle. An existing whitelist entry for the bot key is respected; only a genuinely absent record falls back to AMA-on, and the resolved default is persisted on save so the market adapter sees the same value the editor displayed. `modules/market_adapter_whitelist.ts` exports `AMA_ONLY_WHITELIST_FLAGS` and adds `hasWhitelistEntry()` to distinguish a stored all-off entry from an absent one. Covered by `tests/test_account_bots_adapter.ts` and `tests/test_bot_defaults_characterization.ts`.
|
|
28
|
+
|
|
29
|
+
- **Perf(tests)**: cut test-suite wall-clock time (~80s → ~49s sequential, 14.7s with `DEXBOT_TEST_CONCURRENCY=4`, all 315 tests passing) — pure-JS secp256k1 now uses Jacobian projective coordinates so a scalar multiply performs one field inversion instead of one per point operation (native ECC equivalence 8386ms → 1382ms, affine API unchanged); retry/pacing delays become injectable with production-identical defaults (`FILL_PROCESSING.CORRECTION_INTER_OP_DELAY_MS`, `TransportConfig.reconnectBaseDelayMs`, `config.kibanaRetryDelayMs`) so tests no longer sleep; the harness supports bounded concurrency, `multi_asset_distribution` uses loader-hook ESM mocks (previously-inert CJS mocks leaked real WebSocket connections), the stale-daemon watchdog timer is cleared/unref'd, and compute-heavy entropy/clip parity sweeps sample checkpoints instead of every index.
|
|
30
|
+
|
|
31
|
+
- **Refactor(centralize)**: collapse duplicated logic into single sources of truth and drop dead code — CEX candle parsing moves into `market_adapter/inputs/cex_candle_parsing.ts` with declarative `OHLC_*` index tables and a shared row mapper, reducing all nine exchange adapters' `parseCandles` to one-liners (field layout was the only real difference: standard, close-before-high/low, Gate offset, Kraken 7-field); `lp_chart_core` injects the shared `UPLOT_SHARED_SCRIPT`/chart_ui helpers instead of hand-cloning `clampXRange`/`syncXRange`/`bindWheelZoom`/`bindPan`/`bindHoverState`/`resetZoom`, with the shared `bindPan` gaining window-blur/mouseleave drag-end handling (a robustness fix for every generator); `analysis/analyze_args.ts` (`baseAnalysisConfig` + `consumeCommonAnalysisArg`) routes eight analysis runners. Module-level extractions cover credit pricing/ranking, `slotMatchPrecision`/`slotSizeMatches`, account-editor prompt loops, `_flushBatch`, `startPostBootstrapSubsystems`, `createStaleApiEscalation`, `parseBotsContent`, funds formatting, the serializer `lazy_buffer.ts`, and replay-safe fill options. Dead code removed: browser-invisible `pad2()`, unused lambda chart series, unused `decimals`/`_decimals` args that masked fixed precision, legacy draft stripping, unreferenced exports (`LEGACY_DRAFT_KEYS`, `INCREMENT_BOUNDS` factors, `OBJECT_TYPES`, `TRANSPORT RECONNECT_*`, `assertNever`/`CodedError`/`Brand`, `HOME_CONFIG_DIR`/`HOME_PROFILES_DIR`, the `_currentWorkingGrid` accessor), and the backward-compatible `EXPERT` second-pass merge override (risk: an `EXPERT` section in a live `general.settings.json` stops applying silently; `validate_profiles` now flags it as unknown, and no committed/live profile uses it).
|
|
32
|
+
|
|
33
|
+
- **Chore(dynamic-weight)**: retune the research chart's knobs — `lb` narrows 1-32 → 4-32 bars so the AMA-slope lookback can only be dialed within the range the estimator resolves on, and `kalS%` default rises 1.11 → 1.2 with its knob tightened 0.5-1.5 → 0.75-1.5 (a stronger Kalman move is now required before the composite branch reaches full directional strength). `DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT` is a live market-adapter value; the local untracked `profiles/general.settings.json` override was synced to 1.2 separately so the code default is not shadowed.
|
|
34
|
+
|
|
35
|
+
- **Docs**: refresh stale code references, index gaps and tuning guidance — audit of every document linked from `docs/README.md` corrected drifted file/line anchors, symbol names and cross-links across `architecture`, `developer_guide`, `LIFECYCLE`, `FUND_MOVEMENT_AND_ACCOUNTING`, `DEXBOT_COMPARISON`, `GRID_RECONCILE`/`COW_INVARIANTS` (documenting the `SURPLUS_CANCEL_GRACE_MS` fresh-placement deferral as INV-RECON-006), `modules/README` and `GRID_RECALCULATION`; `analysis/` and `market_adapter/` READMEs now name every source file; the never-implemented Telegram design plan and its pointers are removed; and `minPrice`/`maxPrice` tuning is pointed at `dexbot tv <bot>` so the range can be sized from historical price action. Docs-only, no behavior change.
|
|
36
|
+
|
|
37
|
+
## [1.6.11] - 2026-10-02 - AMA-Slope Persistence Gate, PnL HTML Report & Fill Cache, Five Order-Engine Safety Fixes
|
|
38
|
+
|
|
39
|
+
### 2026-10-02
|
|
40
|
+
|
|
41
|
+
- **Feat(market-adapter)**: gate AMA-slope resets behind a 3-bar persistence window and shorten the Huber lookback to 16 — two coupled default changes measured on a live 1h market-pair pool (`docs/AMA_SLOPE_WINDOW.md`). `DYNAMIC_WEIGHT_AMA_LOOKBACK_BARS` 20 → 16 buys a faster slope signal (AMA group delay 10 → 8 bars, reversal lag 22 → 20, range-tilt wrong-way 13.7% → 12.6%) at ~8% noisier bar-to-bar slope; a new persistence gate on the slope-delta reset trigger (trigger B) — `AMA_SLOPE_PERSIST_ENABLED` (true) + `AMA_SLOPE_PERSIST_BARS` (3) — requires 3 consecutive confirming bars in the same direction before the reset fires, absorbing the shorter window's extra noise. Net vs the old 20h/ungated default: resets −35% (1.45 → 0.95/day), whipsaw ~52% → ~17%, lag and tilt unchanged; the independent price/Drift trigger is unaffected. Per bot/market override via `amaSlope.persistBars` / `amaSlope.persistEnabled`; `1` = legacy fire-on-first-crossing, `0` or `persistEnabled: false` disables (the per-bot `false` beats the global default; negative/absent values fall through). The gate is mirrored everywhere the decision path is replayed so all consumers stay on one logic path: `resolveAmaSlopePersistBars` / `advanceAmaSlopePersistence` in the service (counters persist across restarts via `normalizePersistedAmaSlopeDiagnostics` and clear on every successful reset, bootstrap included), `grid_reset_config` resolves and exports `slopePersistBars` (same override chain), `grid_reset_sim` implements the gate and its panel prints `persist K`, and the backtests follow the production default unless pinned (the fitting harness gains an optional `bandTilt` hook). New tool `analysis/trend_detection/backtest_ama_slope_huber.ts` sweeps the lookback and reports lag, reset churn and noise metrics (`--data` required). Tests: new `test_grid_reset_sim_gate.ts` (K-bar latency, 1-bar blip filtered, direction flip restarts the counter) and `testAmaSlopePersistenceGate`; existing slope-trigger tests pinned to legacy (`persistBars` 1). Verified: `tsc` clean, 305/305 tests, browser bundle 40/40 (`market_adapter/core/market_adapter_service.ts`, `analysis/tradingview/grid_reset_sim.ts`, `modules/constants.ts`, `docs/AMA_SLOPE_WINDOW.md`, `tests/test_grid_reset_sim_gate.ts`).
|
|
42
|
+
|
|
43
|
+
- **Refactor(ama)**: remove the two EMA filters and align research charts with the live engine — the AMA had accreted two independent EMA filters that both add lag to address noise the estimator now handles lag-free (the slope is a Huber-robust regression and small residuals are dead-banded): the live `ama.erSmoothPeriod` (an EMA over the raw Efficiency Ratio inside the AMA) and the research `amaEmaSpan` (`--ema`, a post-AMA input EMA in the dynamic-weight chart). Both are removed so the live engine and both research charts run one canonical 3-parameter Kaufman AMA. Live: `ama.ts` gains the 3-param constructor and drops `erSmoothAlpha`/`effectiveER` and the ER-smoothing convergence term from `getAmaWarmupBars`; `AMA_ER_SMOOTH_FAST_PERIOD` is dropped from `constants.ts`; `market_adapter.ts` / `market_adapter_service.ts` / `fetch_cex_synthetic_data.ts` / `log_format.ts` drop the ER-smoothing resolution, warmup, payload fields and the `/esN` log suffix. Research: `analyze_dynamic_weight.ts` + `dynamic_weight_chart_generator.ts` drop the `ema` knob, its Raw reference line and `--ema`; `bot_key_utils` / `resolve_source` / `grid_reset_config` stop threading `erSmoothPeriod`. Two chart divergences from the live regime gate surfaced while verifying parity are also fixed: `peNodes` (the canonical key, not `pNodes`) is passed to `bilinearInterpolate`, and the per-bar multiplier is clamped to 1.0 with 3-decimal rounding before the absolute-threshold dead-band; the AMA clip threshold always comes from `computeAmaSlopeClipThreshold`, so changing the lookback with `clip% = 0` no longer keeps a stale percentile cap. Configs still carrying `ama.erSmoothPeriod` are ignored (the default was 0, so no live behavior change in practice). Docs and tests updated. Verified: `tsc` clean, full suite 303 pass / 0 fail, browser bundle 40/40 (`market_adapter/core/strategies/ama.ts`, `modules/constants.ts`, `analysis/analyze_dynamic_weight.ts`, `analysis/dynamic_weight_chart_generator.ts`).
|
|
44
|
+
|
|
45
|
+
- **Feat(analysis)**: research tooling and findings for the AMA-slope scale bias and lookback drawdown — two research surfaces, both default-preserving and production-untouched. Scale bias: the canonical estimator's robust scale is a plug-in 1.4826·MAD of the fit's own residuals, so with two fitted parameters it reads low by ~1/(bars−1) (~13% at 8 bars, ~7% at 16) and the effective Huber constant is ~1.25 at the 16-bar window, not the nominal 1.345; `analysis/trend_detection/huber_scale_variants.ts` adds three scale modes (`none` reproduces production byte-for-byte, `df` applies the sqrt(n/(n−2)) correction, `mscale` a Huber proposal-2 M-scale) plus an outlier-fraction diagnostic, exposed via `--scale-mode` on `backtest_ama_slope_huber.ts`. Measured: compensating is decision-neutral (wobble ≤0.2%, AMA lag unchanged, resets within ≤5%, wrong-way within noise) and trades away more robustness (~0.8% RMS under 10% contamination) than it recovers in efficiency (~0.4% clean), so production keeps the uncompensated plug-in scale; the `DYNAMIC_WEIGHT_AMA_HUBER` comment records this so the next reader does not "correct" it, and a guard test asserts `none == computeHuberWindowSlopePct` bar-for-bar. Lookback drawdown: `simulatePersistentGrid` gains `params.lookbackBars` and a `--lookback` flag (unset falls back to the centralized constant), and `backtest_lookback_drawdown.ts` runs paired persistent-grid comparisons across a lookback set over one geometry grid. Finding: the window has a real per-pool effect on realized drawdown and net capture but no stable sign across pools (16h beat 12h on a long-lived liquid pool, reversed on a shorter one), so it strengthens keeping the shipped 16h without converting it into a general economic proof. Both are documented in `docs/AMA_SLOPE_WINDOW.md` with reproduction commands. Behaviour: research-only; no production logic changed (one code comment). Verified: `npm run build && npm run build:tests && node dist/tests/test_huber_scale_variants.js` (`analysis/trend_detection/huber_scale_variants.ts`, `analysis/trend_detection/backtest_lookback_drawdown.ts`, `docs/AMA_SLOPE_WINDOW.md`).
|
|
46
|
+
|
|
47
|
+
- **Feat(pnl)**: add a self-contained HTML PnL report and a per-account month-shard fill cache — `dexbot pnl` was terminal-only; a self-contained HTML report now renders per-pair 2×2 card blocks, a metrics grid and a collapsible realized-lot table (`analysis/pnl_report.ts`), wired through a thin `scripts/pnl.ts` entry and the `dexbot pnl` command. The analyzer gains `--month` (default 3), a `--pair BASE/QUOTE` filter and `--html`/`--report`, and its terminal output now shows `Net inventory delta`. Per-account `fill_order` fetches are cached in calendar-month shards (`analysis/fills_cache.ts`): settled months answer from disk, only the unsettled tail re-queries Kibana, and `--refresh-account` bypasses coverage while still merging. Account resolution checks local bot profiles before the chain (`analysis/account_resolver.ts`), and on-chain-resolved asset symbols are cached so pair filters work for non-static assets (`analysis/fills_source.ts`); `PATHS.ANALYSIS.CACHE_DIR` is added for the shard root. Doc updates: `README`, `analysis/README`, `scripts/README`, `docs/README`, `docs/WORKFLOW`, `docs/EVOLUTION`. Risk: the default lookback for the analyzer / `analysis:trade-pnl` changes from 7 days to 3 months. Verified: `tsc` root + tests clean; `tests/test_pnl_report.ts`, `tests/test_fills_cache.ts`, `tests/test_trade_profitability_fees.ts`, `tests/test_paths.ts` pass; `dexbot pnl --help` and bad-flag/missing-value paths exit correctly (`analysis/pnl_report.ts`, `analysis/fills_cache.ts`, `scripts/pnl.ts`, `docs/WORKFLOW.md`).
|
|
48
|
+
|
|
49
|
+
- **Refactor(format)**: share the 4-significant-figure funds formatter and the month→hours helper — `formatFundsValue` lived privately in `scripts/analyze-orders.ts` and trimmed trailing zeros, so four valid digits rendered as `"1.01K"` instead of `"1.010K"`, and the PnL report needed the same rule. It moves into `modules/order/format.ts` (keeps significant trailing zeros, still caps large magnitudes with K/M), and the fixed 730h/month lookback conversion shared by the chart and PnL commands is extracted into `modules/utils/time_range.ts` so they cannot disagree on `--month N`. Behavioral impact: `dexbot order` now keeps significant trailing zeros (e.g. `10000` → `"10.00K"`, `1500000` → `"1.500M"`). No caller changes beyond the import; the `format.ts` TOC is realigned to its 15 exports. Verified: `tsc` root clean; `tests/test_analyze_orders_dynamic_weight.ts` and `tests/test_dw_cli.ts` pass (`modules/order/format.ts`, `modules/utils/time_range.ts`, `scripts/analyze-orders.ts`).
|
|
50
|
+
|
|
51
|
+
- **Fix(order-engine)**: five order-engine and lifecycle safety fixes — (1) **Stop could leave a live worker behind over the running orders** (`unlock.ts`): `stop` returned as soon as the monolithic wrapper exited, but `start`'s already-running guard only checks the supervisor pid file, which is wiped on wrapper exit, so a fast stop→start could spawn a SECOND worker trading the same live orders (duplicate trades); after the wrapper exits, stop now polls `/proc` up to 15s until no dexbot worker remains (best-effort/no-op off Linux). (2) **Live `bots.json` changes did not take effect until the next fill or the 240-min fetch** (`modules/dexbot_maintenance_runtime.ts`): config pickup logged "targeted maintenance will place missing / cancel excess orders" but never ran it; it now fires the targeted drift reconciliation immediately, fire-and-forget (same callee and cooldown as the poll tick, serialized via the fill-processing lock). (3) **Live-but-slotless chain orders were invisible to fund accounting** (`modules/order/accounting.ts`): an order resting on chain without a grid slot (out-of-grid/boundary-unknown deferral) locks real funds, but `recalculateFunds` counted only grid orders, so every orphan produced a fund-invariant violation equal to its size (triggering futile recovery resyncs) and sizing could double-spend the orphan-locked funds; unmatched chain orders are now added to the on-chain committed totals (`chainBuy`/`chainSell`) with type/size validation, grid totals unchanged. (4) **An adopted orphan was then double-counted** (`modules/order/sync_engine.ts`): with (3) counting orphans as committed, adopting one into a slot left the stale record in `_lastUnmatchedChainOrders`, so it was counted twice (slot + list); both success exits of `adoptChainOrderIntoSlot` and the `createOrder` materialize branch now prune the deferred-orphan record on adoption. (5) **Freshly placed orders could be cancelled seconds after placement** (`modules/constants.ts`, `modules/order/utils/order.ts`, `modules/order/manager.ts`): spread correction and surplus sweeps run on different count snapshots within one cycle, so a fill between them made the second controller cancel what the first had just placed (fee bleed, empty levels, no net change); a new 15-minute `SURPLUS_CANCEL_GRACE_MS` window timestamps placements (`_placedAt`) when a slot gains a new `orderId`, and surplus/cancel-only cancellations skip orders inside the window and leave them queued to re-drain after it expires, covering both the batched and serial cancel paths (the batch path bypasses the per-entry check, so the drain filters fresh placements before batching); load contexts (`'grid-load'`/`'grid-init'`) are excluded so restarts do not suppress sweeps. Verified by `tests/test_accounting_logic.ts` and `tests/test_surplus_cancel_grace.ts`; `npm test` 309 files, 0 failures; `tsc --noEmit` clean (`unlock.ts`, `modules/dexbot_maintenance_runtime.ts`, `modules/order/accounting.ts`, `modules/order/sync_engine.ts`, `modules/order/manager.ts`, `tests/test_surplus_cancel_grace.ts`).
|
|
52
|
+
|
|
5
53
|
## [1.6.10] - 2026-10-01 - Huber-Robust AMA Slope, Asset-Pair Canonicalization, TradingView Indicator Ownership & View Preservation
|
|
6
54
|
|
|
7
55
|
### 2026-10-01
|
|
@@ -669,7 +717,7 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
669
717
|
- **Feat(cli)**: guard raw `npm start` / `pm2 start` with launcher guidance — both previously failed with the cryptic `Missing script: "start"` error or bypassed the credential-daemon unlock, leaving bots unable to reach dexbot-cred; `package.json` gains a `start` guard that prints launcher guidance (`dexbot pm2` / `./pm2` / `npm run pm2:unlock`) and exits 1, and a new root `ecosystem.config.cjs` forwarder rejects raw `pm2 start` the same way; the forwarder ships in the publish `files` list (`package.json`, `ecosystem.config.cjs`).
|
|
670
718
|
- **Fix(analysis)**: align analysis tools/docs with the AMA optimizer's `_w` result naming — the optimizer writes results as `optimization_results_<base>_w<λ1>_<λ2>_<λ3>_<λ4>.json`, but `backtest_bot_fitting.ts` still auto-derived the legacy unsuffixed path; it now auto-derives the newest `_w*` result in `ama_fitting/` (mtime-based) with a legacy fallback; `analyze_derivatives.ts` drops dead `--pool`/`--precA`/`--precB` flags and unused fields; version:sync targets extended with `analysis/ama_fitting/package-lock.json` and `analysis/trend_detection/package.json` (`analysis/bot_fitting/backtest_bot_fitting.ts`, `analysis/analyze_derivatives.ts`, `analysis/ama_fitting/README.md`, `analysis/bot_fitting/README.md`, `scripts/sync-version.ts`, `AGENTS.md`).
|
|
671
719
|
- **Fix(claw/tests)**: add strict-mode type annotations across the remaining 16 claw test files (377 TS errors) — explicit params for `clearModule`/`registerMock` helpers, typed call-records (fixing `never[]` inference), typed mock callbacks, `let x: any[] = []` (TS7034/TS7005), `null as any` slots, and `as keyof` index assertions; annotations only, no runtime logic altered (`claw/tests/*.ts`).
|
|
672
|
-
- **Docs**: post-1.4.13 documentation audit
|
|
720
|
+
- **Docs**: post-1.4.13 documentation audit — corrected stale line references (FUND_MOVEMENT_AND_ACCOUNTING, GRID_RECONCILE, COW_INVARIANTS, LOGGING tag table pointing at the split fill/COW/startup runtimes, developer_guide env vars, MPA_CREDIT_USAGE fee rate 1/2900), feature corrections (GRID_RECALCULATION AMA presets, market_adapter warmup table, AMA fitting dataset range/output path, divergence-calc threshold 1 promille, Kalman trend signal inputs, fee_cache fees, ESM-first guidance, Node >= 22.12), Docker/docs updates (node:22 base image, `dexbot start` canonical forms, compose-mode description), and refreshed repo stats (`docs/**`, `claw/skills/**`, `README.md`, `modules/README.md`, `Dockerfile`).
|
|
673
721
|
|
|
674
722
|
### 2026-08-14
|
|
675
723
|
|
|
@@ -740,11 +788,10 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
740
788
|
- **Fix**: `dexbot start` (and `status`/`stop`/`restart`/`delete`) no longer spawn a hard-coded `dist/unlock.js` — they use `buildRuntimeScriptArgs`, which resolves the unlock entry point per runtime layout (`dist/unlock.js` compiled, `unlock.ts` via tsx in source mode). Previously the source-mode path resolved `modules/dist/unlock.js` (ENOENT → silent `process.exit(0)`), so `dexbot start` was a silent no-op; removed the now-unused `BUILD_DIR` constant (`dexbot.ts`).
|
|
741
789
|
- **Test**: retarget the CLI tests that validated the in-process one-shot flow to `dexbot test` — after the `start` alias change that flow is covered by the `test` command. `test_dexbot_start_master_password_failure_output.ts`, `test_dexbot_startup_output.ts`, and `test_dexbot_daemon_ready_output.ts` now invoke `test` (previously 282-second suite stall + spurious failures from spawning the real `dist/unlock.js` unlocked password prompts); add `test_dexbot_start_alias_unlock.ts` guarding the `start`→unlock delegation (entry point + exit-status forwarding).
|
|
742
790
|
- **Fix**: `dexbot status`/`stat` after `dexbot stop` no longer reports "No DEXBot2 processes running" while the credential daemon still runs — `stop` stops bots + market adapter by design but keeps the daemon up for fast re-unlock. `dexbot.ts` now treats a live daemon (via `monolithic-cred.pid`) as a running runtime and delegates to `unlock status`, which gained a branch rendering the daemon (PID/memory/alive/ready/socket) alongside a note that the monolithic runtime (bots + adapter) is stopped; shared `resolveCredentialDaemonForStatus`, `printCredentialDaemonStatusBlock`, and `printMarketAdapterStatusBlock` helpers (`dexbot.ts`, `unlock.ts`, `tests/test_unlock_status_cred_daemon_only.ts`).
|
|
743
|
-
- **Docs**: Telegram module implementation plan and aligned EVOLUTION entry (`docs/TELEGRAM_IMPLEMENTATION_PLAN.md`, `docs/EVOLUTION.md`).
|
|
744
791
|
|
|
745
792
|
### 2026-08-06
|
|
746
793
|
|
|
747
|
-
- **Docs**: fix stale EVOLUTION release header and broken internal doc links
|
|
794
|
+
- **Docs**: fix stale EVOLUTION release header and broken internal doc links.
|
|
748
795
|
|
|
749
796
|
### 2026-08-05
|
|
750
797
|
|
package/README.md
CHANGED
|
@@ -194,7 +194,8 @@ Keep the default settings first, and tune these:
|
|
|
194
194
|
|
|
195
195
|
6. **Tune `minPrice` / `maxPrice`** around the market's volatility range. Once
|
|
196
196
|
AMA is active, tighten them around the maximum expected market volatility
|
|
197
|
-
instead of
|
|
197
|
+
instead of an unnecessarily wide range. Use `dexbot tv <bot>` to see the
|
|
198
|
+
grid range and AMA recentering against real candles.
|
|
198
199
|
|
|
199
200
|
### Bot Options Reference
|
|
200
201
|
|
|
@@ -338,6 +339,7 @@ dexbot enable {all|<bot>} # Enable bot in config
|
|
|
338
339
|
dexbot stat # Runtime status (unlock or PM2)
|
|
339
340
|
dexbot order [<bot>] # Analyze order grids (--export → HTML to analysis/charts/)
|
|
340
341
|
dexbot tv <bot|pool|A/B> # TradingView 1h chart with AMA overlay (default: 3 months)
|
|
342
|
+
dexbot pnl <bot|account> # HTML PnL report (--month N, optional --pair A/B)
|
|
341
343
|
dexbot credit [<bot>] # Live summed MPA + borrowed-credit positions
|
|
342
344
|
dexbot export <bot> # Export trades + settings (CSV/JSON) for analysis/
|
|
343
345
|
|
package/analysis/README.md
CHANGED
|
@@ -21,6 +21,7 @@ Tools that inspect DEXBot trading behavior and the market data it operates on. O
|
|
|
21
21
|
| Tool | Ask this when… | One-line command |
|
|
22
22
|
|------|----------------|------------------|
|
|
23
23
|
| [`trade_profitability.ts`](#trade-profitability-analyzer-trade_profitabilityts) | "Is my bot making money?" — PnL, R-multiples, drawdown | `npm run analysis:trade-pnl -- <account-id>` |
|
|
24
|
+
| [`dexbot pnl`](#pnl-html-report-dexbot-pnl) | "Give me a readable PnL report" — self-contained HTML with a lot table | `dexbot pnl <bot\|account> --month 3` |
|
|
24
25
|
| [`grid_correction_check.ts`](#last-fill-guard-check-grid_correction_checkts) | "Are fills respecting the pivot ± half-increment guard?" | `npm run analysis:grid-check -- --bot-key <bot-key>` |
|
|
25
26
|
| [`analyze_risk_profile.ts`](#risk-profile-analyzer-analyze_risk_profilets) | "How wide should my Safe Range clamps be?" | `node dist/analysis/analyze_risk_profile.js --bot-key <bot-key>` |
|
|
26
27
|
| [`analyze_trade_heatmap.ts`](#trade-heatmap-analyze_trade_heatmapts) | "Where did trade volume cluster vs the AMA?" | `node dist/analysis/analyze_trade_heatmap.js --bot-key <bot-key>` |
|
|
@@ -130,20 +131,28 @@ Metrics include:
|
|
|
130
131
|
|
|
131
132
|
Fetches `fill_order` operations for a BitShares account from Kibana within a specified time range, then computes realized PnL via sequential (LIFO) or FIFO inventory tracking per asset pair.
|
|
132
133
|
|
|
133
|
-
**Pipeline:** Kibana fill query → on-chain asset precision resolution → buy/sell classification → chronological matching (sequential LIFO by default) → per-pair summary + optional per-match detail.
|
|
134
|
+
**Pipeline:** Kibana fill query → on-chain asset precision resolution → buy/sell classification → chronological matching (sequential LIFO by default) → per-pair summary + optional per-match detail, or a self-contained HTML report (`--html`).
|
|
134
135
|
|
|
135
|
-
**Account resolution:** an account name
|
|
136
|
+
**Account resolution:** a bot profile name, an account name, or a bare `1.2.x` ID is resolved through the shared `account_resolver.ts` helper. A local bot profile is checked **first** (no chain call), then a stored `accountId`, then the chain; the resolved ID is stamped onto the matching `profiles/bots.json` entry, so later runs resolve offline. `--refresh-account` forces a fresh lookup.
|
|
137
|
+
|
|
138
|
+
`dexbot pnl` is the HTML front door (see [`scripts/README.md`](../scripts/README.md)); the raw analyzer below defaults to terminal tables.
|
|
136
139
|
|
|
137
140
|
```bash
|
|
138
|
-
#
|
|
141
|
+
# HTML report for a local bot, last 3 months (dexbot pnl wraps this)
|
|
142
|
+
dexbot pnl my-bot --month 3
|
|
143
|
+
|
|
144
|
+
# HTML report for a raw account, filtered to one pair
|
|
145
|
+
dexbot pnl 1.2.123456 --month 6 --pair TOKENA/BTS
|
|
146
|
+
|
|
147
|
+
# Terminal output: account by ID, last 3 months (default)
|
|
139
148
|
node dist/analysis/trade_profitability.js 1.2.123456
|
|
140
149
|
|
|
141
|
-
# Account by name (
|
|
142
|
-
node dist/analysis/trade_profitability.js "my-account-name" --
|
|
150
|
+
# Account by profile/account name (local profiles first)
|
|
151
|
+
node dist/analysis/trade_profitability.js "my-account-name" --month 1
|
|
143
152
|
|
|
144
|
-
# Absolute window with
|
|
153
|
+
# Absolute window with pair filter
|
|
145
154
|
node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
146
|
-
--start 2026-07-01 --end 2026-07-07 --
|
|
155
|
+
--start 2026-07-01 --end 2026-07-07 --pair TOKENA/BTS
|
|
147
156
|
|
|
148
157
|
# Export trade log and full analysis
|
|
149
158
|
node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
@@ -158,25 +167,31 @@ node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
|
158
167
|
|
|
159
168
|
| Flag | Default | Description |
|
|
160
169
|
|------|---------|-------------|
|
|
170
|
+
| `--month <n>` | `3` | Lookback months (730 h each; alias `--months`) |
|
|
161
171
|
| `--start <iso>` | — | Start time (ISO 8601) |
|
|
162
172
|
| `--end <iso>` | — | End time |
|
|
163
|
-
| `--hours <n>` |
|
|
173
|
+
| `--hours <n>` | — | Lookback hours (alternative to month/start/end) |
|
|
174
|
+
| `--pair <BASE/QUOTE>` | all | Filter to one pair by symbol or `1.3.x` id |
|
|
164
175
|
| `--asset <id>` | all | Filter to one base asset ID |
|
|
165
|
-
| `--refresh-account` | off | Force re-resolution and
|
|
176
|
+
| `--refresh-account` | off | Force re-resolution and bypass the fills cache (re-query the range) |
|
|
177
|
+
| `--html` | off | Write a self-contained HTML report instead of terminal tables |
|
|
178
|
+
| `--report <file>` | auto | Override the report path (implies `--html`) |
|
|
166
179
|
| `--csv <file>` | — | Export chronologically sorted trade list |
|
|
167
180
|
| `--json <file>` | — | Export full analysis with per-pair PnL data |
|
|
168
181
|
| `--match-mode <mode>` | `sequential` | Matching mode: `sequential` (LIFO, default) or `fifo` |
|
|
169
|
-
| `--trades` | off | Show per-order PnL detail (
|
|
182
|
+
| `--trades` | off | Show per-order PnL detail (terminal mode only) |
|
|
170
183
|
| `--fee-per-order <bts>` | `0.09652` | Blockchain fee per limit_order_create op (BTS); approximate |
|
|
171
184
|
| `--verbose` | off | Print per-pair trade counts during processing |
|
|
172
185
|
|
|
173
186
|
</details>
|
|
174
187
|
|
|
188
|
+
**Fill cache:** per-account `fill_order` fetches are cached in calendar-month shards under `<analysis>/cache/fills/<accountId>.shard_YYYY-MM.json` (see `fills_cache.ts`). A settled month is answered from disk with zero queries; only the still-unsettled tail (the last ~6 h before the previous query, where Kibana may still index late fills) is re-queried. `--refresh-account` ignores coverage and re-queries the requested range (merging, so it never drops fills outside that span). Delete the shard files to reset the cache.
|
|
189
|
+
|
|
175
190
|
**Asset precision handling:**
|
|
176
191
|
|
|
177
192
|
1. Assets listed in the static `ASSETS` table (BTS, TWENTIX, XBTSX.*, HONEST.*, IOB.*, etc.) resolve instantly.
|
|
178
193
|
2. Unknown assets are resolved on-chain via `get_assets` against the built-in node pool, with results cached at runtime.
|
|
179
|
-
3. If resolution fails or an asset is not found on chain, the affected fills are **skipped** with a warning (no abort).
|
|
194
|
+
3. If resolution fails or an asset is not found on chain, the affected fills are **skipped** with a warning (no abort). Symbols learned on-chain are cached too, so `--pair SYMBOL/QUOTE` works even for assets absent from the static table.
|
|
180
195
|
|
|
181
196
|
**PnL methodology:**
|
|
182
197
|
|
|
@@ -220,6 +235,27 @@ node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
|
220
235
|
|
|
221
236
|
</details>
|
|
222
237
|
|
|
238
|
+
### PnL HTML Report (`dexbot pnl`)
|
|
239
|
+
|
|
240
|
+
`dexbot pnl` is the HTML front door: it resolves the account, fetches fills (through the fill cache), computes the same realized-lot PnL as the terminal analyzer, and renders a single self-contained HTML file via `analysis/pnl_report.ts`. No network, CDN, or sibling assets — it opens from a `file://` link anywhere. The file lands under the analysis `charts/` directory (or the path given to `--report`).
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Local bot profile, last 3 months
|
|
244
|
+
dexbot pnl my-bot
|
|
245
|
+
|
|
246
|
+
# Raw account, one pair, generated path printed on exit
|
|
247
|
+
dexbot pnl 1.2.123456 --month 6 --pair TOKENA/BTS
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Per pair the report shows:
|
|
251
|
+
|
|
252
|
+
- **Hero** — account (bot name + `1.2.x` id), period, pair/lot counts, match mode, active filters.
|
|
253
|
+
- **Card blocks (2x2 left + 2x2 right)** — left = money (Gross PnL, Net PnL, Volume, Fees); right = position/activity (Realized lots, Net inventory Δ, Avg buy/sell, Unmatched sold). When both market and blockchain fees exist they collapse into one `Fees` card so the block stays 2x2.
|
|
254
|
+
- **Metrics grid** — Edge, Risk, Distribution, Behavior & activity: the same metric set as the terminal output (see the metrics glossary above).
|
|
255
|
+
- **Realized lots table** — collapsible per-match detail (entry/exit time, prices, gross/net PnL, fees, maker/taker legs), capped at 2,000 rows — use `--csv` for the full list.
|
|
256
|
+
|
|
257
|
+
All amounts use the shared 4-significant-figure formatter (compact `K`/`M`, significant trailing zeros kept) — the same one `dexbot order` uses. `--refresh-account` re-resolves the account and bypasses the fill cache (see [Fill cache](#trade-profitability-analyzer-trade_profitabilityts)).
|
|
258
|
+
|
|
223
259
|
### LAST-FILL-GUARD Check (`grid_correction_check.ts`)
|
|
224
260
|
|
|
225
261
|
Validates LAST-FILL-GUARD discipline from the same Kibana fill pipeline as `trade_profitability.ts`. For a previous fill at price `x` and grid increment `i`, the next order must satisfy `BUY < x × (1 − i/2/100)` and `SELL > x × (1 + i/2/100)`, regardless of the previous fill's side. A violation is a buy or sell fill inside the prohibited half-increment band around its pivot.
|
|
@@ -487,11 +523,15 @@ Details: [bot_fitting/README.md](bot_fitting/README.md)
|
|
|
487
523
|
| `resolve_source.ts` | Shared source resolution: bot-key → candle file, AMA config, `--list-bots` |
|
|
488
524
|
| `price_sources.ts` | Unified candle source abstraction (`json`, `market_adapter`) |
|
|
489
525
|
| `chart_utils.ts` | Shared chart rendering utilities |
|
|
526
|
+
| `chart_css.ts` | Shared uPlot CSS fragments for generated charts |
|
|
527
|
+
| `chart_ui.ts` | Shared browser-side uPlot helpers (cursor, hover, zoom-reset, sizing) |
|
|
490
528
|
| `math_utils.ts` | Shared math utilities |
|
|
491
529
|
| `bot_key_utils.ts` | Bot-key resolution, candle file lookup, `accountId` persistence (`persistBotAccountId`) |
|
|
492
530
|
| `account_resolver.ts` | Account resolution for all tools: `preferredAccount` / `--account` → `1.2.x`, stamping the result into `profiles/bots.json` |
|
|
493
531
|
| `chain_pool.ts` | Ephemeral read-only chain client over the built-in node pool (account + asset lookups) |
|
|
494
532
|
| `fills_source.ts` | Shared `fill_order` Kibana fetch/query and the static asset-precision table + on-chain cache |
|
|
533
|
+
| `fills_cache.ts` | Per-account month-shard cache for `fill_order` fetches (settled months reused, unsettled tail refreshed) |
|
|
534
|
+
| `pnl_report.ts` | Self-contained HTML PnL renderer: hero, card blocks, metrics grid, realized-lots table |
|
|
495
535
|
|
|
496
536
|
On-chain account and asset lookups in the fill-based tools go through `account_resolver.ts` / `fills_source.ts` (both built on `chain_pool.ts`): tool scripts must not open their own read-only clients or carry their own node list. The batch backfill `resolve_bot_accounts.ts` is the exception — it reuses the production chain client over one connection.
|
|
497
537
|
|
|
@@ -14,6 +14,9 @@ For each of the 4 AMA strategies, it searches for best:
|
|
|
14
14
|
|
|
15
15
|
- `backtest_bot_fitting.ts` — lightweight sweep across spread / increment / ratio with unit-size percentage-point accounting and risk scoring
|
|
16
16
|
- `backtest_ama_sweep.ts` — persistent grid simulation with capital-weighted sizing, weight profiles, and worker-thread parallelization
|
|
17
|
+
- `backtest_lookback_drawdown.ts` — paired Huber-lookback comparison of
|
|
18
|
+
drawdown / net capture / reset churn (geometry fixed); see
|
|
19
|
+
`docs/AMA_SLOPE_WINDOW.md`
|
|
17
20
|
- `shared_utils.ts` — shared helpers (argument parsing, data loading, formatting)
|
|
18
21
|
|
|
19
22
|
Both simulators share the same production grid model (ported once in
|
|
@@ -84,8 +87,17 @@ node dist/analysis/bot_fitting/backtest_bot_fitting.js \
|
|
|
84
87
|
node dist/analysis/bot_fitting/backtest_ama_sweep.js \
|
|
85
88
|
--data <path-to-lp-candles.json> \
|
|
86
89
|
--results <path-to-optimization-results.json>
|
|
90
|
+
|
|
91
|
+
# Paired lookback drawdown comparison (no --results needed)
|
|
92
|
+
node dist/analysis/bot_fitting/backtest_lookback_drawdown.js \
|
|
93
|
+
--data market_adapter/data/lp/<market-pair> \
|
|
94
|
+
--lookbacks 12,14,16,20
|
|
87
95
|
```
|
|
88
96
|
|
|
97
|
+
> `backtest_ama_sweep.ts` accepts `--lookback <bars>` to override the slope
|
|
98
|
+
> window (`DYNAMIC_WEIGHT_AMA_LOOKBACK_BARS`); `backtest_lookback_drawdown.ts`
|
|
99
|
+
> builds on it and reports the paired per-lookback deltas.
|
|
100
|
+
|
|
89
101
|
> `backtest_bot_fitting.ts` auto-derives `--results` from the `--data` filename
|
|
90
102
|
> (`analysis/ama_fitting/optimization_results_<base>_w<λ1>_<λ2>_<λ3>_<λ4>.json`,
|
|
91
103
|
> newest `_w*` file matching the base name; falls back to the legacy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TradingView HTML Exporter
|
|
2
2
|
|
|
3
|
-
This exporter generates a standalone HTML chart in the `analysis/charts/` folder using the local `uPlot`-based TradingView-style renderer.
|
|
3
|
+
This exporter generates a standalone HTML chart in the `analysis/charts/` folder using the local `uPlot`-based TradingView-style renderer. The renderer lives in `analysis/tradingview/tradingview_uplot_chart_generator.ts`; `analysis/tradingview/analyze_tradingview.ts` is the CLI entry point.
|
|
4
4
|
|
|
5
5
|
## Recommended: `dexbot tv` (One Step)
|
|
6
6
|
|
|
@@ -271,7 +271,7 @@ so the chart cannot drift from the runtime. The panel labels the winning layer;
|
|
|
271
271
|
|
|
272
272
|
The replay runs in the page, so the AMA series (and therefore the trigger
|
|
273
273
|
points) follows the AMA inputs and preset buttons; the gating parameters that
|
|
274
|
-
would come from config (`erPeriod`, lookback, warmup, clip percentile) are fixed
|
|
274
|
+
would come from config (`erPeriod`, lookback, warmup, clip percentile, persistence gate) are fixed
|
|
275
275
|
at generation time. One slope window is shared by every consumer: the resolved
|
|
276
276
|
`lookbackBars` drives both the replayed `Δs` trigger and the `Scale` band tilt,
|
|
277
277
|
so a bot-configured lookback can no longer leave the plotted band measuring a
|
|
@@ -284,7 +284,7 @@ canonical `simulateGridResetSeries()` from
|
|
|
284
284
|
|
|
285
285
|
## Notes
|
|
286
286
|
|
|
287
|
-
- **Slope averaging.** The AMA slope is a **Huber-robust linear regression of `ln(AMA)` over the lookback window** — `computeHuberWindowSlopePct` in `market_adapter/core/strategies/dynamic_weight_series.ts`, which is the live adapter's own definition and is embedded here verbatim, so the chart and the bot run one logic path. Its tuning (`C`, `ITERATIONS`, `SCALE_FLOOR`, `ZERO_EPSILON`) is centralized in `MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_HUBER` and injected into the page as `const AMA_SLOPE_HUBER`, so a constant change flows to both. The output is in %/bar over the same window, so the tilt scale (`clamp(slope/maxSlopePct) * maxSlopeOffset`) and the `Δs` gate (`|Δslope| >= 8% of maxSlopePct`) keep their existing units. Measured on the repo's 1h pools with the shipped AMA preset at
|
|
287
|
+
- **Slope averaging.** The AMA slope is a **Huber-robust linear regression of `ln(AMA)` over the lookback window** — `computeHuberWindowSlopePct` in `market_adapter/core/strategies/dynamic_weight_series.ts`, which is the live adapter's own definition and is embedded here verbatim, so the chart and the bot run one logic path. Its tuning (`C`, `ITERATIONS`, `SCALE_FLOOR`, `ZERO_EPSILON`) is centralized in `MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_HUBER` and injected into the page as `const AMA_SLOPE_HUBER`, so a constant change flows to both. The output is in %/bar over the same window, so the tilt scale (`clamp(slope/maxSlopePct) * maxSlopeOffset`) and the `Δs` gate (`|Δslope| >= 8% of maxSlopePct`) keep their existing units. Measured on the repo's 1h pools with the shipped AMA preset at the shipped 16-bar window: a single-bar AMA impulse is **strongly bounded** (a 1%/3%/5%/10% one-bar spike shifts the two-point endpoint reading by ≈ `spike/lookbackBars` %/bar ≈ 0.06/0.19/0.31/0.63 — 8x to 80x the reset gate — while the robust fit barely moves), and the fit is the smoothest robust option measured (second-difference energy ~25x lower than the old median's). Set `CHART_SLOPE_ESTIMATOR = 'endpoint'` in the page to render the reference two-point definition instead (kept in the core for comparison); the live adapter does not use it.
|
|
288
288
|
- The chart embeds the vendored `uPlot` runtime inline (no CDN, no sibling `uplot/` dir, no DEXBot2 install needed). Each export is a single self-contained HTML file that renders anywhere, even after being copied or mailed to a machine without DEXBot2.
|
|
289
289
|
- The displayed indicators are computed from the 1h base candles and then sampled onto the selected timeframe.
|
|
290
290
|
- The current volume-weighted overlay is a rolling `VWMA`, not a session-reset VWAP.
|
|
@@ -96,8 +96,7 @@ Output: `analysis/charts/dynamic_weight_chart.html` (open in browser)
|
|
|
96
96
|
| `--chart` | `analysis/charts/dynamic_weight_chart.html` | Output HTML path |
|
|
97
97
|
| `--alpha` | `0.5` | Initial α blend (0 = pure Kalman, 1 = pure AMA) |
|
|
98
98
|
| `--dw` | `0.50` | Initial displacement weight (0 = pure velocity, 1 = full displacement) |
|
|
99
|
-
| `--lb` | `
|
|
100
|
-
| `--ema` | `0` | Initial AMA input EMA span in bars (0 = off, 0-32) |
|
|
99
|
+
| `--lb` | `16` | Initial lookback bars (4-32) for AMA slope calculation |
|
|
101
100
|
| `--gain` | `1.0` | Initial gain multiplier |
|
|
102
101
|
| `--clip` | `10` | Initial clip percentile |
|
|
103
102
|
| `--quiet` | `false` | Suppress console output |
|
|
@@ -115,7 +114,6 @@ All panels share aligned vertical time grid lines, and the bottom output panel s
|
|
|
115
114
|
|
|
116
115
|
### Panel 2 — AMA Slope Input (14%)
|
|
117
116
|
- **Orange line**: AMA3 slope percentage
|
|
118
|
-
- **Gray dashed line**: raw (unfiltered) slope — the reference when the `ema` knob > 0
|
|
119
117
|
- Shows the directional strength of the slow KAMA's trend movement
|
|
120
118
|
- Values outside the clip threshold are flattened before entering the offset formula
|
|
121
119
|
- Background shading mirrors the output signal direction
|
|
@@ -155,7 +153,7 @@ All panels share aligned vertical time grid lines, and the bottom output panel s
|
|
|
155
153
|
- `kf = 100` → current adaptive EMA result
|
|
156
154
|
- `kf > 100` → pushes further toward the adaptive signal (up to 200)
|
|
157
155
|
|
|
158
|
-
**dsp (displacement scale)**: Controls how fast displacement confidence saturates. Smaller values make it saturate faster (less displacement needed for full confidence); larger values require more displacement. The live adapter clamps `
|
|
156
|
+
**dsp (displacement scale)**: Controls how fast displacement confidence saturates. Smaller values make it saturate faster (less displacement needed for full confidence); larger values require more displacement. The live default is `1.0` (`DYNAMIC_WEIGHT_DISP_SCALE_MIN_PCT`); neither the live adapter nor the chart clamps it above or below that, so the slider's `0.25` floor is usable in both.
|
|
159
157
|
|
|
160
158
|
**Latched signal (cf)**: Prevents the output from flip-flopping on every bar. It holds the last direction for `cf` bars before allowing a reversal:
|
|
161
159
|
- `cf = 0` → raw signal (instant flips)
|
|
@@ -167,11 +165,10 @@ All panels share aligned vertical time grid lines, and the bottom output panel s
|
|
|
167
165
|
| Knob | Range | Default | Purpose |
|
|
168
166
|
|------|-------|---------|---------|
|
|
169
167
|
| **nz%** | 0–1 | 0.00 | Neutral zone: dead-band below which offset is forced to 0 |
|
|
170
|
-
| **lb** |
|
|
171
|
-
| **
|
|
172
|
-
| **
|
|
173
|
-
| **
|
|
174
|
-
| **clip%** | 0–55 | 10 | Percentile clip: filters extreme inputs (0 = off) |
|
|
168
|
+
| **lb** | 4–32 | 16 | Logarithmic. Lookback bars for AMA slope calculation |
|
|
169
|
+
| **amaS%** | 0.06–0.12 | 0.09 | Logarithmic. Gear ratio for per-bar AMA slope saturation |
|
|
170
|
+
| **kalS%** | 0.75–1.5 | 1.2 | Logarithmic. Gear ratio for Kalman composite saturation |
|
|
171
|
+
| **clip%** | 0–20 | 10 | Percentile clip: filters extreme inputs (0 = off) |
|
|
175
172
|
|
|
176
173
|
### Output Controls
|
|
177
174
|
| Knob | Range | Default | Purpose |
|
|
@@ -182,7 +179,7 @@ All panels share aligned vertical time grid lines, and the bottom output panel s
|
|
|
182
179
|
|
|
183
180
|
## Copy / Paste Parameters
|
|
184
181
|
|
|
185
|
-
The **copy** button serializes all knob values (α, dw, kf, kfd, dsp, kdt, kfs, cf, lb,
|
|
182
|
+
The **copy** button serializes all knob values (α, dw, kf, kfd, dsp, kdt, kfs, cf, lb, amaS%, kalS%, th%, gain, clip%, nz%, regi) to JSON and writes them to both the clipboard and `localStorage`.
|
|
186
183
|
|
|
187
184
|
The **paste** button first checks `localStorage` for parameters from a previous copy in the same browser session. If none found, it prompts for Ctrl+V input. A confirmation popup shows the parsed values before applying them. Click **Apply** to set the knobs, **Cancel** or press **Escape** to dismiss.
|
|
188
185
|
|
|
@@ -192,7 +189,7 @@ The **paste** button first checks `localStorage` for parameters from a previous
|
|
|
192
189
|
|
|
193
190
|
### AMA slope
|
|
194
191
|
|
|
195
|
-
Taking the slope of the AMA produces a signal that is already noise-filtered at the source — a near-zero slope genuinely means sideways, not oscillation that happened to average out. The
|
|
192
|
+
Taking the slope of the AMA produces a signal that is already noise-filtered at the source — a near-zero slope genuinely means sideways, not oscillation that happened to average out. The canonical slope is a Huber-robust linear regression of `ln(AMA)` over the lookback window (per-bar log-return ×100, `MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_HUBER`), so a single outlier bar is discounted instead of getting full endpoint weight; the same estimator runs in the live adapter, both research charts, and the reset replay. The neutral zone (`nz%` knob) dead-bands any remaining micro-slope residuals.
|
|
196
193
|
|
|
197
194
|
### Kalman filter
|
|
198
195
|
|
|
@@ -287,7 +284,6 @@ The lookup table can be customized per-market or per-bot (see [Custom Configurat
|
|
|
287
284
|
## Formulas
|
|
288
285
|
|
|
289
286
|
### AMA Offset
|
|
290
|
-
With `ema` > 0, `AMA_now` / `AMA_lb_bars_ago` below are read from the EMA-filtered AMA input instead of the raw AMA series (everything else identical):
|
|
291
287
|
```
|
|
292
288
|
amaSlope% = ((AMA_now − AMA_lb_bars_ago) / AMA_lb_bars_ago × 100) / lb
|
|
293
289
|
amaClip = clamp(amaSlope%, ±clipThreshold) // percentile-based clip
|
|
@@ -360,31 +356,10 @@ Formula: `kalComp = clippedV × (1 − dw + dw × dispConf × momAlign)`
|
|
|
360
356
|
### lb (lookback bars)
|
|
361
357
|
Number of bars to look back when computing AMA slope:
|
|
362
358
|
- `lb = 4`: Very short-term, highly responsive to recent price action
|
|
363
|
-
- `lb =
|
|
359
|
+
- `lb = 16` (default): ~16 hours of hourly candles, balanced responsiveness and smoothing
|
|
364
360
|
- `lb = 32`: ~1.3 days of hourly candles, stable but slower to react
|
|
365
361
|
|
|
366
|
-
AMA slope is
|
|
367
|
-
|
|
368
|
-
### ema (AMA input EMA span)
|
|
369
|
-
Optional low-pass EMA over the AMA values before the slope is taken (span in bars, α = 2/(span+1), `0` = off). Because differencing and an EMA are both linear filters, they commute — smoothing the AMA input produces exactly the smoothed slope series, modulo the seeding transient.
|
|
370
|
-
|
|
371
|
-
| `ema` | noise reduction* | added lag | verdict |
|
|
372
|
-
|---|---|---|---|
|
|
373
|
-
| 0 | 1× (off) | 0 bars | default, current behavior |
|
|
374
|
-
| 4 | ~2× | ~+1.5 bars | light |
|
|
375
|
-
| 9 (= lb) | ~3× | ~+4 bars | sweet spot |
|
|
376
|
-
| 16 | ~4× | ~+7.5 bars | heavy but usable |
|
|
377
|
-
| 32 | ~5.7× | ~+15.5 bars | upper-bound demo, too laggy to trade |
|
|
378
|
-
|
|
379
|
-
\* standard-deviation reduction for white-ish noise ≈ `sqrt(span)`; lag ≈ `(span-1)/2` bars (EMA group delay) on top of the slope window's `(lb-1)/2`.
|
|
380
|
-
|
|
381
|
-
Measured on ~8.7k hourly bars with the default AMA profile (`lb = 9`): the slow AMA's slope is dominated by low-frequency moves rather than white noise, so the `sqrt(span)` rule overstates the standard-deviation gain — `ema = 9` cut slope std only ~3% but trimmed the largest peaks ~22% and zero-crossings 86 → 74; `ema = 32` cut std ~11%, peaks ~48%, crossings 86 → 44, with a measured lag of ~3 bars at span 9 (theory 4). On this input the knob acts mainly as a peak-trimmer and sign-flip reducer, not as a general noise killer.
|
|
382
|
-
|
|
383
|
-
Effects while tuning:
|
|
384
|
-
- Zero-crossings get rarer, so the `cf` latch matters less and the `nz%` dead-band sits on a smooth curve instead of on noise.
|
|
385
|
-
- |slope| peaks shrink, so the same `amaS%` reaches full offset strength less often — expect to lower `amaS%` (or raise `gain`) to restore output amplitude. The `clip%` percentile pool is rebuilt from the filtered input, which partially self-compensates.
|
|
386
|
-
- Keep total lag in mind: ~`lb/2 + ema/2` bars before the slope reflects a move; at defaults that is ~8 bars (~8 h on the 1 h chart).
|
|
387
|
-
- Panel 2 plots the smoothed slope (orange) over the raw slope (gray dashed) so the noise/lag trade-off is directly visible.
|
|
362
|
+
AMA slope is a per-bar log-return (Huber regression of `ln(AMA)`), not the cumulative move across the full lookback. Lower values = more noise, faster reaction. Higher values = smoother signals, more lag without adding gain just because the measurement window is longer.
|
|
388
363
|
|
|
389
364
|
### regi (regime sensitivity)
|
|
390
365
|
- 0 = regime multiplier is always 1.0 (Hurst+PE ignored)
|
|
@@ -415,8 +390,7 @@ The 3×3 regime multiplier table can be customized per-market or per-bot (defaul
|
|
|
415
390
|
Candle Data
|
|
416
391
|
├── AMA3 (slow KAMA, erPeriod=781)
|
|
417
392
|
│ ├── calculateAMA() → AMA3 values per bar [price panel overlay]
|
|
418
|
-
│ ├──
|
|
419
|
-
│ ├── computeAmaSlopeWeights() → slope%
|
|
393
|
+
│ ├── computeAmaSlopeWeights() → Huber slope% (ln-return per bar)
|
|
420
394
|
│ └── Percentile clip → amaClip → amaOff
|
|
421
395
|
│
|
|
422
396
|
├── Kalman Filter (tactical + modal)
|
|
@@ -17,6 +17,37 @@ This folder contains the chart generators and re-export shims used by the analys
|
|
|
17
17
|
- `regime_chart_generator.ts`
|
|
18
18
|
- `volatility_chart_generator.ts`
|
|
19
19
|
|
|
20
|
+
## Backtests
|
|
21
|
+
|
|
22
|
+
- `huber_scale_variants.ts` — research-only Huber scale variants (`none`/`df`/
|
|
23
|
+
`mscale`) plus an outlier-fraction diagnostic; the canonical estimator lives in
|
|
24
|
+
`market_adapter/core/strategies/dynamic_weight_series.ts` and is untouched.
|
|
25
|
+
- `backtest_ama_slope_huber.ts` — sweeps the Huber slope lookback window
|
|
26
|
+
(`--lookback`, default 8..28 bars; the live default is
|
|
27
|
+
`DYNAMIC_WEIGHT_AMA_LOOKBACK_BARS` = 16) over an LP candle
|
|
28
|
+
shard directory and reports **lag** (cross-correlation group delay vs centred
|
|
29
|
+
price/AMA slope, plus reversal-confirmation delay), **resets** (the canonical
|
|
30
|
+
`simulateGridResetSeries` drift + slope-delta decision path: counts, reason
|
|
31
|
+
split, rate, gap distribution, whipsaws) and **noise** (slope std, bar-to-bar
|
|
32
|
+
wobble, second-difference energy, zero-crossing rate, saturation, range tilt).
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run build
|
|
36
|
+
node dist/analysis/trend_detection/backtest_ama_slope_huber.js \
|
|
37
|
+
--data market_adapter/data/lp/<market-pair> --lookback 8:28:2
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run `--help` for the full option list (AMA preset/overrides, reset thresholds,
|
|
41
|
+
confirmation gate, whipsaw definition, `--scale-mode`, JSON output path).
|
|
42
|
+
|
|
43
|
+
`--scale-mode none|df|mscale` swaps the Huber robust-scale estimate (production
|
|
44
|
+
is `none`); see `huber_scale_variants.ts` and `docs/AMA_SLOPE_WINDOW.md` for
|
|
45
|
+
why the plug-in scale is kept.
|
|
46
|
+
|
|
47
|
+
`revLag` is measured against a centred reference whose half-window is
|
|
48
|
+
`--truth-window` (default = max lookback), so compare it across runs only at a
|
|
49
|
+
fixed truth window; `amaLag` (cross-correlation group delay) is reference-robust.
|
|
50
|
+
|
|
20
51
|
The Kalman/Hurst/PE analyzers below are re-export shims; the implementations live in `market_adapter/core/signals/` and are shared with the live market adapter:
|
|
21
52
|
|
|
22
53
|
- `hurst_analyzer.ts` → `market_adapter/core/signals/hurst_analyzer.ts`
|
|
@@ -41,7 +41,7 @@ That is the practical split:
|
|
|
41
41
|
| Basic | `0.5%` | `2.0%` | `20 / 20` | Safe default starting point |
|
|
42
42
|
| Competitive | `0.4%` | `1.6%` | `10-20 / 10-20` | Liquid enough for tighter quoting |
|
|
43
43
|
| Very competitive | `0.3%` | `1.2%` | `5-15 / 5-15` | Mature market, higher maintenance, lower slack |
|
|
44
|
-
|
|
|
44
|
+
| Aggressive | `0.2%` | `0.8%` | `3-10 / 3-10` | Only when liquidity, fees, and precision support it |
|
|
45
45
|
|
|
46
46
|
The main tradeoff is always the same:
|
|
47
47
|
|
|
@@ -121,7 +121,8 @@ These define the outer range of the grid.
|
|
|
121
121
|
- around `2x` = competitive
|
|
122
122
|
- around `3x` = conservative
|
|
123
123
|
- above `3x` = very conservative
|
|
124
|
-
- treat range ratio as a slow-moving
|
|
124
|
+
- treat range ratio as a slow-moving setting driven by former price action, not a fast tactical knob
|
|
125
|
+
- use `dexbot tv <bot>` to see the grid range and AMA recentering against real candles before fixing the bounds
|
|
125
126
|
|
|
126
127
|
### `gridPrice`
|
|
127
128
|
|
|
@@ -182,7 +183,7 @@ AMA is the recentering mechanism.
|
|
|
182
183
|
- it is calculated from 1h candle closes
|
|
183
184
|
- it watches how far the adaptive center moves
|
|
184
185
|
- once the move crosses the configured threshold, DEXBot2 triggers a grid recalculation
|
|
185
|
-
- **AMA
|
|
186
|
+
- **AMA recentering requires whitelisting the bot for the market adapter to work live (otherwise it only logs).**
|
|
186
187
|
- `gridPrice: "ama"` tells the rebuilt grid to center itself on that AMA reference
|
|
187
188
|
- `gridPrice: "pool"` or `gridPrice: "book"` centers the rebuilt grid on the live pair price instead
|
|
188
189
|
- `gridPrice: null` falls back to the current `startPrice` reference
|
|
@@ -236,6 +236,9 @@ async function executeOperations(operations: any, options: Record<string, any> =
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
const client = await getSigningClient(options);
|
|
239
|
+
if (!client) {
|
|
240
|
+
throw new Error('Signing client unavailable');
|
|
241
|
+
}
|
|
239
242
|
if (client.initPromise) {
|
|
240
243
|
await client.initPromise;
|
|
241
244
|
}
|
|
@@ -252,7 +255,7 @@ async function executeOperations(operations: any, options: Record<string, any> =
|
|
|
252
255
|
if (typeof tx[op.op_name] !== 'function') {
|
|
253
256
|
throw new Error(`Transaction builder does not support ${op.op_name}`);
|
|
254
257
|
}
|
|
255
|
-
tx[op.op_name](op.op_data);
|
|
258
|
+
(tx[op.op_name] as (data: unknown) => unknown)(op.op_data);
|
|
256
259
|
}
|
|
257
260
|
|
|
258
261
|
// Direct-key broadcasts must be classified: a timeout/drop here surfaces as
|
|
@@ -303,6 +306,9 @@ async function broadcastOperation(operation: any, options: Record<string, any> =
|
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
const client = await getSigningClient(options);
|
|
309
|
+
if (!client) {
|
|
310
|
+
throw new Error('Signing client unavailable');
|
|
311
|
+
}
|
|
306
312
|
try {
|
|
307
313
|
return await client.broadcast(operation);
|
|
308
314
|
} catch (err: any) {
|
|
@@ -185,7 +185,7 @@ async function launcherReset(botName: string | null, options: Record<string, any
|
|
|
185
185
|
|
|
186
186
|
for (const bot of targets) {
|
|
187
187
|
try {
|
|
188
|
-
const triggerFile = getTriggerFile(options, bot.botKey);
|
|
188
|
+
const triggerFile = getTriggerFile(options, bot.botKey || '');
|
|
189
189
|
storage.writeFile(triggerFile, new Date().toISOString());
|
|
190
190
|
triggered.push({
|
|
191
191
|
botName: bot.name,
|
|
@@ -33,12 +33,19 @@ function getConfigPath(options: Record<string, any> = {}) {
|
|
|
33
33
|
* @param {Object} [options={}]
|
|
34
34
|
* @returns {Object} { preferredMode, lastUsed, history: [...] }
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
interface LauncherConfig {
|
|
37
|
+
preferredMode?: string | null;
|
|
38
|
+
lastUsed?: string | null;
|
|
39
|
+
history?: Array<{ mode: string; timestamp: string }>;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function loadConfig(options: Record<string, any> = {}): LauncherConfig {
|
|
37
44
|
const configPath = getConfigPath(options);
|
|
38
45
|
|
|
39
46
|
try {
|
|
40
47
|
if (storage.exists(configPath)) {
|
|
41
|
-
return readJSON(configPath);
|
|
48
|
+
return readJSON<LauncherConfig>(configPath);
|
|
42
49
|
}
|
|
43
50
|
} catch (err: any) {
|
|
44
51
|
// Ignore parse errors, return empty
|
package/claw/package.json
CHANGED