dexbot 1.4.10 → 1.4.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/README.md +6 -5
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +9 -18
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +6 -16
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +31 -38
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +7 -10
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +10 -14
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +10 -15
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +7 -10
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +4 -12
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts +0 -1
- package/dist/credential-daemon.d.ts.map +1 -1
- package/dist/credential-daemon.js +3 -123
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts +0 -87
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +54 -23
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +8 -9
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.js +1 -7
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +1 -4
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +5 -9
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +8 -15
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +7 -13
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +6 -12
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +2 -0
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +100 -101
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +5 -10
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +21 -24
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +3 -5
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +4 -6
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +15 -22
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/index.d.ts +23 -23
- package/dist/market_adapter/index.d.ts.map +1 -1
- package/dist/market_adapter/index.js +24 -82
- package/dist/market_adapter/index.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +59 -98
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +11 -17
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/interval_utils.js +1 -2
- package/dist/market_adapter/interval_utils.js.map +1 -1
- package/dist/market_adapter/log_format.js +1 -7
- package/dist/market_adapter/log_format.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +20 -22
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +41 -57
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +30 -34
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +2 -2
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +163 -222
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/merge_lp_data.js +17 -18
- package/dist/market_adapter/merge_lp_data.js.map +1 -1
- package/dist/market_adapter/test_helpers.js +3 -14
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +7 -16
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +3 -5
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +9 -17
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +8 -10
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +11 -14
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +14 -19
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.js +8 -14
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/market_adapter/utils/paths.js +3 -6
- package/dist/market_adapter/utils/paths.js.map +1 -1
- package/dist/modules/account_bots.d.ts +1 -1
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +90 -97
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +0 -9
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +26 -121
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.js +12 -18
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +16 -21
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +12 -72
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.js +13 -40
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -6
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts +8 -8
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +11 -68
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +3 -6
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +9 -11
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +3 -28
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts +4 -4
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +5 -46
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts +98 -98
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +372 -473
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +3 -8
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +9 -74
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +11 -48
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +24 -27
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
- package/dist/modules/bitshares-native/transport.js +14 -26
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +29 -72
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +12 -21
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +21 -0
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +32 -86
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +30 -49
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts.map +1 -1
- package/dist/modules/bots_file_lock.js +5 -13
- package/dist/modules/bots_file_lock.js.map +1 -1
- package/dist/modules/broadcast_failure.js +1 -3
- package/dist/modules/broadcast_failure.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +4 -9
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +77 -182
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +2 -2
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +81 -144
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +23 -28
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +4 -14
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +46 -78
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.js +15 -26
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +3 -6
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +62 -153
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +1 -1
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +34 -41
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credential_session_cache.d.ts +1 -1
- package/dist/modules/credential_session_cache.d.ts.map +1 -1
- package/dist/modules/credential_session_cache.js +5 -42
- package/dist/modules/credential_session_cache.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +126 -162
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/browser_provider.d.ts +1 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +1 -1
- package/dist/modules/crypto/browser_provider.js +7 -11
- package/dist/modules/crypto/browser_provider.js.map +1 -1
- package/dist/modules/crypto/index.d.ts +6 -6
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +12 -30
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/node_provider.d.ts +1 -1
- package/dist/modules/crypto/node_provider.d.ts.map +1 -1
- package/dist/modules/crypto/node_provider.js +3 -5
- package/dist/modules/crypto/node_provider.js.map +1 -1
- package/dist/modules/crypto/provider.js +1 -2
- package/dist/modules/crypto/pure_ripemd160.js +1 -3
- package/dist/modules/crypto/pure_ripemd160.js.map +1 -1
- package/dist/modules/crypto/pure_scrypt.js +1 -4
- package/dist/modules/crypto/pure_scrypt.js.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.js +1 -16
- package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
- package/dist/modules/crypto/sync.d.ts.map +1 -1
- package/dist/modules/crypto/sync.js +16 -17
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/daemon_node_health.js +14 -16
- package/dist/modules/daemon_node_health.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +19 -14
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +127 -164
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +28 -27
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +55 -45
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_credential_client.d.ts +6 -2
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
- package/dist/modules/dexbot_credential_client.js +21 -31
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +23 -23
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +119 -77
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +46 -38
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +81 -81
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +3 -3
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +43 -81
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +11 -11
- package/dist/modules/dexbot_state_recovery.js +32 -78
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/env.js +3 -7
- package/dist/modules/env.js.map +1 -1
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +12 -24
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.js +10 -16
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +12 -19
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +27 -65
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +89 -118
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.js +1 -5
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.js +22 -31
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
- package/dist/modules/launcher/credential_daemon.js +37 -75
- package/dist/modules/launcher/credential_daemon.js.map +1 -1
- package/dist/modules/launcher/credential_secret.js +2 -37
- package/dist/modules/launcher/credential_secret.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +25 -31
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/headless_password.js +10 -12
- package/dist/modules/launcher/headless_password.js.map +1 -1
- package/dist/modules/launcher/launch_modes.js +3 -9
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +25 -35
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +42 -45
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +3 -2
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +97 -138
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts +1 -11
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +12 -15
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +15 -36
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +4 -9
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/logger.d.ts +1 -1
- package/dist/modules/logger.d.ts.map +1 -1
- package/dist/modules/logger.js +3 -38
- package/dist/modules/logger.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +9 -18
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_failure_ledger.js +1 -3
- package/dist/modules/node_failure_ledger.js.map +1 -1
- package/dist/modules/node_health_cache.d.ts.map +1 -1
- package/dist/modules/node_health_cache.js +15 -25
- package/dist/modules/node_health_cache.js.map +1 -1
- package/dist/modules/node_manager.d.ts +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +44 -43
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +102 -118
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +3 -15
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +6 -26
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.js +34 -75
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +1 -3
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +4 -24
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +8 -8
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +254 -266
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile.js +77 -94
- package/dist/modules/order/grid_reconcile.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +117 -149
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/index.d.ts.map +1 -1
- package/dist/modules/order/index.js +11 -45
- package/dist/modules/order/index.js.map +1 -1
- package/dist/modules/order/logger.d.ts +0 -8
- package/dist/modules/order/logger.d.ts.map +1 -1
- package/dist/modules/order/logger.js +28 -141
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +3 -4
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +10 -79
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +131 -247
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.js +2 -7
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.js +23 -25
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts +27 -0
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +232 -181
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +1 -25
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +49 -172
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +46 -2
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +165 -143
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +3 -1
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +152 -211
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/timeout.js +1 -4
- package/dist/modules/order/utils/timeout.js.map +1 -1
- package/dist/modules/order/utils/validate.js +91 -142
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/utils/withPoolRef.js +21 -61
- package/dist/modules/order/utils/withPoolRef.js.map +1 -1
- package/dist/modules/order/working_grid.js +6 -9
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/path_api.d.ts.map +1 -1
- package/dist/modules/path_api.js +8 -11
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +61 -67
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +14 -23
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime.js +7 -11
- package/dist/modules/runtime.js.map +1 -1
- package/dist/modules/runtime_settings.d.ts.map +1 -1
- package/dist/modules/runtime_settings.js +14 -16
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.js +1 -3
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/socket_json_client.js +3 -5
- package/dist/modules/socket_json_client.js.map +1 -1
- package/dist/modules/storage/browser_adapter.js +1 -4
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +3 -2
- package/dist/modules/storage/index.d.ts.map +1 -1
- package/dist/modules/storage/index.js +5 -8
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/modules/storage/node_adapter.d.ts +3 -4
- package/dist/modules/storage/node_adapter.d.ts.map +1 -1
- package/dist/modules/storage/node_adapter.js +12 -16
- package/dist/modules/storage/node_adapter.js.map +1 -1
- package/dist/modules/storage/types.js +1 -2
- package/dist/modules/types.d.ts +0 -6
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/types.js +1 -2
- package/dist/modules/types.js.map +1 -1
- package/dist/modules/utils/base58check.js +8 -15
- package/dist/modules/utils/base58check.js.map +1 -1
- package/dist/modules/utils/build_dir.js +3 -7
- package/dist/modules/utils/build_dir.js.map +1 -1
- package/dist/modules/utils/errors.js +1 -5
- package/dist/modules/utils/errors.js.map +1 -1
- package/dist/modules/utils/math_utils.d.ts +1 -1
- package/dist/modules/utils/math_utils.d.ts.map +1 -1
- package/dist/modules/utils/math_utils.js +2 -7
- package/dist/modules/utils/math_utils.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +18 -25
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts +4 -70
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +106 -132
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.js +13 -17
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +48 -63
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -1
- package/dist/scripts/diagnose-kibana-candles.js +2 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +2 -1
- package/dist/scripts/diagnose-pool-history.js.map +1 -1
- package/dist/scripts/divergence-calc.d.ts.map +1 -1
- package/dist/scripts/divergence-calc.js +2 -2
- package/dist/scripts/divergence-calc.js.map +1 -1
- package/dist/scripts/fix-err-message.js +17 -22
- package/dist/scripts/fix-err-message.js.map +1 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
- package/dist/scripts/generate_lp_chart.js +7 -15
- package/dist/scripts/generate_lp_chart.js.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.js +3 -2
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +18 -24
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/dist/scripts/native_release_gates.js +15 -19
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.d.ts.map +1 -1
- package/dist/scripts/print_grid.js +2 -2
- package/dist/scripts/print_grid.js.map +1 -1
- package/dist/scripts/run-tests.js +12 -17
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +18 -20
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/sync-version.js +2 -2
- package/dist/scripts/sync-version.js.map +1 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
- package/dist/scripts/test-credit-renewal.js +4 -3
- package/dist/scripts/test-credit-renewal.js.map +1 -1
- package/dist/scripts/update.js +93 -95
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/validate_bots.d.ts.map +1 -1
- package/dist/scripts/validate_bots.js +2 -2
- package/dist/scripts/validate_bots.js.map +1 -1
- package/dist/scripts/verify-browser-bundle.js +12 -17
- package/dist/scripts/verify-browser-bundle.js.map +1 -1
- package/dist/unlock.d.ts +0 -30
- package/dist/unlock.d.ts.map +1 -1
- package/dist/unlock.js +258 -222
- package/dist/unlock.js.map +1 -1
- package/package.json +5 -8
- package/scripts/README.md +1 -1
- package/scripts/create-bot-symlinks.sh +2 -2
- package/dist/modules/utils/fs_utils.d.ts +0 -18
- package/dist/modules/utils/fs_utils.d.ts.map +0 -1
- package/dist/modules/utils/fs_utils.js +0 -32
- package/dist/modules/utils/fs_utils.js.map +0 -1
- package/dist/scripts/migrate_bot_keys.d.ts +0 -3
- package/dist/scripts/migrate_bot_keys.d.ts.map +0 -1
- package/dist/scripts/migrate_bot_keys.js +0 -225
- package/dist/scripts/migrate_bot_keys.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* modules/account_bots.ts - Bot Configuration Management
|
|
4
3
|
*
|
|
@@ -96,27 +95,20 @@
|
|
|
96
95
|
*
|
|
97
96
|
* ===============================================================================
|
|
98
97
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
const fs_utils_1 = require("./utils/fs_utils");
|
|
114
|
-
const bot_settings_1 = require("./bot_settings");
|
|
115
|
-
const settings_merge_1 = require("./settings_merge");
|
|
116
|
-
const errors_1 = require("./utils/errors");
|
|
117
|
-
const storage = (0, storage_1.getStorage)();
|
|
118
|
-
const BOTS_FILE = paths_1.PATHS.PROFILES.BOTS_JSON;
|
|
119
|
-
const PROFILES_DIR = paths_1.PATHS.PROFILES_DIR;
|
|
98
|
+
import { path } from './path_api.js';
|
|
99
|
+
import { getStorage } from './storage/index.js';
|
|
100
|
+
import { ensureProfilesDirectory, readInput } from './order/utils/system.js';
|
|
101
|
+
import { DEFAULT_CONFIG, GRID_LIMITS, TIMING, LOG_LEVEL, UPDATER, MARKET_ADAPTER, NODE_MANAGEMENT, FILL_PROCESSING, PIPELINE_TIMING, CREDENTIAL_PROMPTS, MAINTENANCE, COW_PERFORMANCE, INCREMENT_BOUNDS, FEE_PARAMETERS, API_LIMITS, LOGGING_CONFIG, NATIVE_CLIENT, LAUNCHER } from './constants.js';
|
|
102
|
+
import { PATHS } from './paths.js';
|
|
103
|
+
import { SETTINGS_FILE, readGeneralSettings, writeGeneralSettings } from './general_settings.js';
|
|
104
|
+
import { parseJsonWithComments } from './order/utils/system.js';
|
|
105
|
+
import { assertNoDuplicateBotKeys } from './bot_settings.js';
|
|
106
|
+
import { mergeSettings } from './settings_merge.js';
|
|
107
|
+
import { getErrorMessage } from './utils/errors.js';
|
|
108
|
+
const storage = getStorage();
|
|
109
|
+
const { writeJSON } = storage;
|
|
110
|
+
const BOTS_FILE = PATHS.PROFILES.BOTS_JSON;
|
|
111
|
+
const PROFILES_DIR = PATHS.PROFILES_DIR;
|
|
120
112
|
/**
|
|
121
113
|
* Loads the bots configuration from profiles/bots.json.
|
|
122
114
|
* @returns {Object} An object containing the config and the file path.
|
|
@@ -129,13 +121,13 @@ function loadBotsConfig() {
|
|
|
129
121
|
const content = storage.readFile(BOTS_FILE);
|
|
130
122
|
if (!content || !content.trim())
|
|
131
123
|
return { config: { bots: [] }, filePath: BOTS_FILE };
|
|
132
|
-
const parsed =
|
|
124
|
+
const parsed = parseJsonWithComments(content);
|
|
133
125
|
if (!Array.isArray(parsed.bots))
|
|
134
126
|
parsed.bots = [];
|
|
135
127
|
return { config: parsed, filePath: BOTS_FILE };
|
|
136
128
|
}
|
|
137
129
|
catch (err) {
|
|
138
|
-
console.error('Failed to load bots configuration:',
|
|
130
|
+
console.error('Failed to load bots configuration:', getErrorMessage(err));
|
|
139
131
|
return { config: { bots: [] }, filePath: BOTS_FILE };
|
|
140
132
|
}
|
|
141
133
|
}
|
|
@@ -147,14 +139,14 @@ function loadBotsConfig() {
|
|
|
147
139
|
*/
|
|
148
140
|
function saveBotsConfig(config, filePath) {
|
|
149
141
|
try {
|
|
150
|
-
|
|
142
|
+
ensureProfilesDirectory(PROFILES_DIR);
|
|
151
143
|
const entries = Array.isArray(config?.bots) ? config.bots : Array.isArray(config) ? config : [];
|
|
152
144
|
if (entries.length >= 2)
|
|
153
|
-
|
|
154
|
-
|
|
145
|
+
assertNoDuplicateBotKeys(entries, 'account_bots');
|
|
146
|
+
writeJSON(filePath, config);
|
|
155
147
|
}
|
|
156
148
|
catch (err) {
|
|
157
|
-
console.error('Failed to save bots configuration:',
|
|
149
|
+
console.error('Failed to save bots configuration:', getErrorMessage(err));
|
|
158
150
|
throw err;
|
|
159
151
|
}
|
|
160
152
|
}
|
|
@@ -167,37 +159,37 @@ function saveBotsConfig(config, filePath) {
|
|
|
167
159
|
*/
|
|
168
160
|
function loadGeneralSettings() {
|
|
169
161
|
const defaults = {
|
|
170
|
-
LOG_LEVEL:
|
|
171
|
-
GRID_LIMITS: { ...
|
|
172
|
-
TIMING: { ...
|
|
173
|
-
UPDATER: { ...
|
|
174
|
-
MARKET_ADAPTER: { ...
|
|
175
|
-
NODE_MANAGEMENT: { ...
|
|
176
|
-
DEFAULT_CONFIG: { ...
|
|
177
|
-
FILL_PROCESSING: { ...
|
|
178
|
-
PIPELINE_TIMING: { ...
|
|
179
|
-
CREDENTIAL_PROMPTS: { ...
|
|
180
|
-
MAINTENANCE: { ...
|
|
181
|
-
COW_PERFORMANCE: { ...
|
|
182
|
-
INCREMENT_BOUNDS: { ...
|
|
183
|
-
FEE_PARAMETERS: { ...
|
|
184
|
-
API_LIMITS: { ...
|
|
185
|
-
LOGGING_CONFIG: { ...
|
|
186
|
-
NATIVE_CLIENT: { ...
|
|
187
|
-
LAUNCHER: { ...
|
|
162
|
+
LOG_LEVEL: LOG_LEVEL,
|
|
163
|
+
GRID_LIMITS: { ...GRID_LIMITS },
|
|
164
|
+
TIMING: { ...TIMING },
|
|
165
|
+
UPDATER: { ...UPDATER },
|
|
166
|
+
MARKET_ADAPTER: { ...MARKET_ADAPTER },
|
|
167
|
+
NODE_MANAGEMENT: { ...NODE_MANAGEMENT },
|
|
168
|
+
DEFAULT_CONFIG: { ...DEFAULT_CONFIG },
|
|
169
|
+
FILL_PROCESSING: { ...FILL_PROCESSING },
|
|
170
|
+
PIPELINE_TIMING: { ...PIPELINE_TIMING },
|
|
171
|
+
CREDENTIAL_PROMPTS: { ...CREDENTIAL_PROMPTS },
|
|
172
|
+
MAINTENANCE: { ...MAINTENANCE },
|
|
173
|
+
COW_PERFORMANCE: { ...COW_PERFORMANCE },
|
|
174
|
+
INCREMENT_BOUNDS: { ...INCREMENT_BOUNDS },
|
|
175
|
+
FEE_PARAMETERS: { ...FEE_PARAMETERS },
|
|
176
|
+
API_LIMITS: { ...API_LIMITS },
|
|
177
|
+
LOGGING_CONFIG: { ...LOGGING_CONFIG },
|
|
178
|
+
NATIVE_CLIENT: { ...NATIVE_CLIENT },
|
|
179
|
+
LAUNCHER: { ...LAUNCHER },
|
|
188
180
|
};
|
|
189
|
-
const settings =
|
|
181
|
+
const settings = readGeneralSettings({
|
|
190
182
|
fallback: null,
|
|
191
183
|
onError: (err) => {
|
|
192
|
-
console.error('Failed to load general settings:',
|
|
184
|
+
console.error('Failed to load general settings:', getErrorMessage(err));
|
|
193
185
|
}
|
|
194
186
|
});
|
|
195
|
-
const merged =
|
|
187
|
+
const merged = mergeSettings(settings, defaults);
|
|
196
188
|
// MARKET_ADAPTER validation for AMA_DELTA_THRESHOLD_PERCENT
|
|
197
189
|
const configuredDeltaPercent = Number(merged.MARKET_ADAPTER.AMA_DELTA_THRESHOLD_PERCENT);
|
|
198
190
|
const effectiveDeltaPercent = Number.isFinite(configuredDeltaPercent) && configuredDeltaPercent > 0
|
|
199
191
|
? configuredDeltaPercent
|
|
200
|
-
:
|
|
192
|
+
: MARKET_ADAPTER.AMA_DELTA_THRESHOLD_PERCENT;
|
|
201
193
|
merged.MARKET_ADAPTER.AMA_DELTA_THRESHOLD_PERCENT = effectiveDeltaPercent;
|
|
202
194
|
return merged;
|
|
203
195
|
}
|
|
@@ -207,11 +199,11 @@ function loadGeneralSettings() {
|
|
|
207
199
|
*/
|
|
208
200
|
function saveGeneralSettings(settings) {
|
|
209
201
|
try {
|
|
210
|
-
|
|
211
|
-
console.log(`\n✓ General settings saved to ${
|
|
202
|
+
writeGeneralSettings(settings);
|
|
203
|
+
console.log(`\n✓ General settings saved to ${path.basename(SETTINGS_FILE)}`);
|
|
212
204
|
}
|
|
213
205
|
catch (err) {
|
|
214
|
-
console.error('Failed to save general settings:',
|
|
206
|
+
console.error('Failed to save general settings:', getErrorMessage(err));
|
|
215
207
|
}
|
|
216
208
|
}
|
|
217
209
|
/**
|
|
@@ -240,7 +232,7 @@ async function selectBotIndex(bots, promptMessage) {
|
|
|
240
232
|
if (!bots.length)
|
|
241
233
|
return null;
|
|
242
234
|
listBots(bots);
|
|
243
|
-
const raw = (await
|
|
235
|
+
const raw = (await readInput(`${promptMessage} [1-${bots.length}]: `)).trim();
|
|
244
236
|
if (raw === '\x1b')
|
|
245
237
|
return '\x1b';
|
|
246
238
|
const idx = Number(raw);
|
|
@@ -259,7 +251,7 @@ async function selectBotIndex(bots, promptMessage) {
|
|
|
259
251
|
*/
|
|
260
252
|
async function askString(promptText, defaultValue) {
|
|
261
253
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
262
|
-
const answer = await
|
|
254
|
+
const answer = await readInput(`${promptText}${suffix}: `);
|
|
263
255
|
if (answer === '\x1b')
|
|
264
256
|
return '\x1b';
|
|
265
257
|
if (!answer)
|
|
@@ -355,7 +347,7 @@ async function askAsset(promptText, defaultValue) {
|
|
|
355
347
|
while (true) {
|
|
356
348
|
const displayDefault = defaultValue ? String(defaultValue).toUpperCase() : undefined;
|
|
357
349
|
const suffix = displayDefault !== undefined && displayDefault !== null ? ` [${displayDefault}]` : '';
|
|
358
|
-
const answer = await
|
|
350
|
+
const answer = await readInput(`${promptText}${suffix}: `);
|
|
359
351
|
if (answer === '\x1b')
|
|
360
352
|
return '\x1b';
|
|
361
353
|
if (!answer) {
|
|
@@ -378,7 +370,7 @@ async function askAssetB(promptText, defaultValue, assetA) {
|
|
|
378
370
|
while (true) {
|
|
379
371
|
const displayDefault = defaultValue ? String(defaultValue).toUpperCase() : undefined;
|
|
380
372
|
const suffix = displayDefault !== undefined && displayDefault !== null ? ` [${displayDefault}]` : '';
|
|
381
|
-
const answer = await
|
|
373
|
+
const answer = await readInput(`${promptText}${suffix}: `);
|
|
382
374
|
if (answer === '\x1b')
|
|
383
375
|
return '\x1b';
|
|
384
376
|
if (!answer) {
|
|
@@ -407,7 +399,7 @@ async function askWeightDistribution(promptText, defaultValue) {
|
|
|
407
399
|
const MAX_WEIGHT = 2;
|
|
408
400
|
console.log(' \x1b[38;5;45m-1=SuperValley\x1b[0m ←→ \x1b[38;5;39m0=Valley\x1b[0m ←→ \x1b[38;5;250m0.5=Neutral\x1b[0m ←→ \x1b[38;5;208m1=Mountain\x1b[0m ←→ \x1b[38;5;196m2=SuperMountain\x1b[0m');
|
|
409
401
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
410
|
-
const raw = (await
|
|
402
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
411
403
|
if (raw === '\x1b')
|
|
412
404
|
return '\x1b';
|
|
413
405
|
if (raw === '')
|
|
@@ -433,7 +425,7 @@ async function askWeightDistributionNoLegend(promptText, defaultValue) {
|
|
|
433
425
|
const MIN_WEIGHT = -1;
|
|
434
426
|
const MAX_WEIGHT = 2;
|
|
435
427
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
436
|
-
const raw = (await
|
|
428
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
437
429
|
if (raw === '\x1b')
|
|
438
430
|
return '\x1b';
|
|
439
431
|
if (raw === '')
|
|
@@ -504,7 +496,7 @@ function deltaToCron(days, time) {
|
|
|
504
496
|
*/
|
|
505
497
|
async function askNumberWithBounds(promptText, defaultValue, minVal = 0, maxVal = 100) {
|
|
506
498
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
507
|
-
const raw = (await
|
|
499
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
508
500
|
if (raw === '\x1b')
|
|
509
501
|
return '\x1b';
|
|
510
502
|
if (raw === '')
|
|
@@ -538,14 +530,14 @@ async function askNumberWithBounds(promptText, defaultValue, minVal = 0, maxVal
|
|
|
538
530
|
* @param {number} minSpreadFactor - The minimum spread factor from GRID_LIMITS.
|
|
539
531
|
* @returns {Promise<number|string>} The spread percentage or '\x1b' if ESC.
|
|
540
532
|
*/
|
|
541
|
-
async function askTargetSpreadPercent(promptText, defaultValue, incrementPercent = 0, minSpreadFactor =
|
|
533
|
+
async function askTargetSpreadPercent(promptText, defaultValue, incrementPercent = 0, minSpreadFactor = GRID_LIMITS.MIN_SPREAD_FACTOR) {
|
|
542
534
|
const safeIncrement = Number.isFinite(incrementPercent) ? incrementPercent : 0;
|
|
543
|
-
const safeMinSpreadFactor = Number.isFinite(minSpreadFactor) ? minSpreadFactor :
|
|
535
|
+
const safeMinSpreadFactor = Number.isFinite(minSpreadFactor) ? minSpreadFactor : GRID_LIMITS.MIN_SPREAD_FACTOR;
|
|
544
536
|
const minRequired = safeIncrement * safeMinSpreadFactor;
|
|
545
537
|
const minRequiredLabel = minRequired.toFixed(6);
|
|
546
538
|
const effectiveDefault = Number.isFinite(defaultValue) ? Math.max(defaultValue, minRequired) : defaultValue;
|
|
547
539
|
const suffix = effectiveDefault !== undefined && effectiveDefault !== null ? ` [${effectiveDefault.toFixed(2)}]` : '';
|
|
548
|
-
const raw = (await
|
|
540
|
+
const raw = (await readInput(`${promptText} (>= ${minRequiredLabel})${suffix}: `)).trim();
|
|
549
541
|
if (raw === '\x1b')
|
|
550
542
|
return '\x1b';
|
|
551
543
|
if (raw === '')
|
|
@@ -582,7 +574,7 @@ async function askTargetSpreadPercent(promptText, defaultValue, incrementPercent
|
|
|
582
574
|
*/
|
|
583
575
|
async function askIntegerInRange(promptText, defaultValue, minVal = 0, maxVal = 100) {
|
|
584
576
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
585
|
-
const raw = (await
|
|
577
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
586
578
|
if (raw === '\x1b')
|
|
587
579
|
return '\x1b';
|
|
588
580
|
if (raw === '')
|
|
@@ -612,7 +604,7 @@ async function askIntegerInRange(promptText, defaultValue, minVal = 0, maxVal =
|
|
|
612
604
|
*/
|
|
613
605
|
async function askNumberOrMultiplier(promptText, defaultValue) {
|
|
614
606
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
615
|
-
const raw = (await
|
|
607
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
616
608
|
if (raw === '\x1b')
|
|
617
609
|
return '\x1b';
|
|
618
610
|
if (raw === '')
|
|
@@ -647,7 +639,7 @@ async function askNumberOrMultiplier(promptText, defaultValue) {
|
|
|
647
639
|
*/
|
|
648
640
|
async function askMaxPrice(promptText, defaultValue, minPrice) {
|
|
649
641
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
650
|
-
const raw = (await
|
|
642
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
651
643
|
if (raw === '\x1b')
|
|
652
644
|
return '\x1b';
|
|
653
645
|
if (raw === '')
|
|
@@ -703,7 +695,7 @@ function normalizePercentageInput(value) {
|
|
|
703
695
|
*/
|
|
704
696
|
async function askNumberOrPercentage(promptText, defaultValue) {
|
|
705
697
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
706
|
-
const raw = (await
|
|
698
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
707
699
|
if (raw === '\x1b')
|
|
708
700
|
return '\x1b';
|
|
709
701
|
if (raw === '')
|
|
@@ -726,7 +718,7 @@ async function askNumberOrPercentage(promptText, defaultValue) {
|
|
|
726
718
|
*/
|
|
727
719
|
async function askBoolean(promptText, defaultValue) {
|
|
728
720
|
const label = defaultValue ? 'Y/n' : 'y/N';
|
|
729
|
-
const raw = (await
|
|
721
|
+
const raw = (await readInput(`${promptText} (${label}): `)).trim().toLowerCase();
|
|
730
722
|
if (raw === '\x1b')
|
|
731
723
|
return '\x1b';
|
|
732
724
|
if (!raw)
|
|
@@ -742,7 +734,7 @@ async function askBoolean(promptText, defaultValue) {
|
|
|
742
734
|
async function askStartPrice(promptText, defaultValue) {
|
|
743
735
|
while (true) {
|
|
744
736
|
const suffix = defaultValue !== undefined && defaultValue !== null ? ` [${defaultValue}]` : '';
|
|
745
|
-
const raw = (await
|
|
737
|
+
const raw = (await readInput(`${promptText}${suffix}: `)).trim();
|
|
746
738
|
if (raw === '\x1b')
|
|
747
739
|
return '\x1b';
|
|
748
740
|
if (!raw) {
|
|
@@ -775,7 +767,7 @@ async function askStartPrice(promptText, defaultValue) {
|
|
|
775
767
|
async function askPoolRef(promptText, currentValue) {
|
|
776
768
|
while (true) {
|
|
777
769
|
const suffix = currentValue ? ` [${currentValue}]` : ' [none]';
|
|
778
|
-
const raw = (await
|
|
770
|
+
const raw = (await readInput(`${promptText}${suffix} (none to clear): `)).trim();
|
|
779
771
|
if (raw === '\x1b')
|
|
780
772
|
return '\x1b';
|
|
781
773
|
if (!raw)
|
|
@@ -801,7 +793,7 @@ async function askPoolRef(promptText, currentValue) {
|
|
|
801
793
|
async function askGridPriceMode(promptText, defaultValue) {
|
|
802
794
|
while (true) {
|
|
803
795
|
const shownDefault = defaultValue === null || defaultValue === undefined ? 'startPrice' : defaultValue;
|
|
804
|
-
const raw = (await
|
|
796
|
+
const raw = (await readInput(`${promptText} [${shownDefault}]: `)).trim();
|
|
805
797
|
if (raw === '\x1b')
|
|
806
798
|
return '\x1b';
|
|
807
799
|
if (!raw)
|
|
@@ -830,25 +822,25 @@ async function askGridPriceMode(promptText, defaultValue) {
|
|
|
830
822
|
function normalizeBotDraft(base = {}) {
|
|
831
823
|
const data = JSON.parse(JSON.stringify(base));
|
|
832
824
|
if (!data.weightDistribution)
|
|
833
|
-
data.weightDistribution = { ...
|
|
825
|
+
data.weightDistribution = { ...DEFAULT_CONFIG.weightDistribution };
|
|
834
826
|
if (!data.botFunds)
|
|
835
|
-
data.botFunds = { ...
|
|
827
|
+
data.botFunds = { ...DEFAULT_CONFIG.botFunds };
|
|
836
828
|
if (!data.activeOrders)
|
|
837
|
-
data.activeOrders = { ...
|
|
829
|
+
data.activeOrders = { ...DEFAULT_CONFIG.activeOrders };
|
|
838
830
|
if (data.active === undefined)
|
|
839
|
-
data.active =
|
|
831
|
+
data.active = DEFAULT_CONFIG.active;
|
|
840
832
|
if (data.dryRun === undefined)
|
|
841
|
-
data.dryRun =
|
|
833
|
+
data.dryRun = DEFAULT_CONFIG.dryRun;
|
|
842
834
|
if (data.minPrice === undefined)
|
|
843
|
-
data.minPrice =
|
|
835
|
+
data.minPrice = DEFAULT_CONFIG.minPrice;
|
|
844
836
|
if (data.maxPrice === undefined)
|
|
845
|
-
data.maxPrice =
|
|
837
|
+
data.maxPrice = DEFAULT_CONFIG.maxPrice;
|
|
846
838
|
if (data.incrementPercent === undefined)
|
|
847
|
-
data.incrementPercent =
|
|
839
|
+
data.incrementPercent = DEFAULT_CONFIG.incrementPercent;
|
|
848
840
|
if (data.targetSpreadPercent === undefined)
|
|
849
|
-
data.targetSpreadPercent =
|
|
841
|
+
data.targetSpreadPercent = DEFAULT_CONFIG.targetSpreadPercent;
|
|
850
842
|
if (data.startPrice === undefined)
|
|
851
|
-
data.startPrice = data.startPrice ||
|
|
843
|
+
data.startPrice = data.startPrice || DEFAULT_CONFIG.startPrice || 'pool';
|
|
852
844
|
if (data.gridPrice === undefined)
|
|
853
845
|
data.gridPrice = null;
|
|
854
846
|
delete data.gridPriceOffsetPct;
|
|
@@ -878,7 +870,7 @@ async function promptBotData(base = {}) {
|
|
|
878
870
|
console.log('\x1b[97mC) Cancel (Discard changes)\x1b[0m');
|
|
879
871
|
showMenu = false;
|
|
880
872
|
}
|
|
881
|
-
const choice = (await
|
|
873
|
+
const choice = (await readInput('Select section to edit or action: ', {
|
|
882
874
|
validate: (input) => ['1', '2', '3', '4', '5', 's', 'c'].includes(input.toLowerCase())
|
|
883
875
|
})).trim().toLowerCase();
|
|
884
876
|
if (choice === '\x1b') {
|
|
@@ -947,7 +939,7 @@ async function promptBotData(base = {}) {
|
|
|
947
939
|
const wBuy = await askWeightDistributionNoLegend('Weight distribution (buy)', data.weightDistribution.buy);
|
|
948
940
|
if (wBuy === '\x1b')
|
|
949
941
|
break;
|
|
950
|
-
const incrP = await askNumberWithBounds('incrementPercent', data.incrementPercent,
|
|
942
|
+
const incrP = await askNumberWithBounds('incrementPercent', data.incrementPercent, INCREMENT_BOUNDS.MIN_PERCENT, INCREMENT_BOUNDS.MAX_PERCENT);
|
|
951
943
|
if (incrP === '\x1b')
|
|
952
944
|
break;
|
|
953
945
|
const defaultSpread = data.targetSpreadPercent || incrP * 4;
|
|
@@ -991,7 +983,7 @@ async function promptBotData(base = {}) {
|
|
|
991
983
|
const currentSettings = loadGeneralSettings();
|
|
992
984
|
const spreadFactor = Number.isFinite(currentSettings.GRID_LIMITS.MIN_SPREAD_FACTOR)
|
|
993
985
|
? currentSettings.GRID_LIMITS.MIN_SPREAD_FACTOR
|
|
994
|
-
:
|
|
986
|
+
: GRID_LIMITS.MIN_SPREAD_FACTOR;
|
|
995
987
|
const minRequiredSpread = data.incrementPercent * spreadFactor;
|
|
996
988
|
if (data.targetSpreadPercent + Number.EPSILON < minRequiredSpread) {
|
|
997
989
|
console.log(`\x1b[38;5;160mError: targetSpreadPercent (${data.targetSpreadPercent}) must be >= ${spreadFactor}x incrementPercent (${minRequiredSpread.toFixed(6)}).\x1b[0m`);
|
|
@@ -1028,7 +1020,7 @@ async function promptGeneralSettings() {
|
|
|
1028
1020
|
console.log(`\x1b[1;33m1) Grid Health:\x1b[0m \x1b[38;5;208mRatio:\x1b[0m ${settings.GRID_LIMITS.GRID_REGENERATION_PERCENTAGE}%, \x1b[38;5;208mRMS:\x1b[0m ${settings.GRID_LIMITS.GRID_COMPARISON.RMS_PERCENTAGE}%, \x1b[38;5;208mAMA Delta:\x1b[0m ${settings.MARKET_ADAPTER.AMA_DELTA_THRESHOLD_PERCENT}%`);
|
|
1029
1021
|
console.log(`\x1b[1;33m2) Order Recovery:\x1b[0m \x1b[38;5;208mDust Threshold:\x1b[0m ${settings.GRID_LIMITS.PARTIAL_DUST_THRESHOLD_PERCENTAGE}%`);
|
|
1030
1022
|
const nodeCount = (settings.NODES.list || []).length;
|
|
1031
|
-
const hcIntervalMin = ((settings.NODES.healthCheck?.intervalMs ||
|
|
1023
|
+
const hcIntervalMin = ((settings.NODES.healthCheck?.intervalMs || NODE_MANAGEMENT.HEALTH_CHECK_INTERVAL_MS) / 60000).toFixed(0);
|
|
1032
1024
|
const prefNodeDisplay = settings.NODES.selection?.preferredNode || 'none';
|
|
1033
1025
|
console.log(`\x1b[1;33m3) Node Config:\x1b[0m \x1b[38;5;208mNodes:\x1b[0m ${nodeCount}, \x1b[38;5;208mHealthChk:\x1b[0m ${hcIntervalMin}min, \x1b[38;5;208mPrefNode:\x1b[0m ${prefNodeDisplay}`);
|
|
1034
1026
|
console.log(`\x1b[1;33m4) Log lvl:\x1b[0m \x1b[38;5;208m${settings.LOG_LEVEL}\x1b[0m (debug, info, warn, error)`);
|
|
@@ -1038,7 +1030,7 @@ async function promptGeneralSettings() {
|
|
|
1038
1030
|
console.log('--------------------------------------------------');
|
|
1039
1031
|
console.log('\x1b[1;32mS) Save & Exit\x1b[0m');
|
|
1040
1032
|
console.log('\x1b[97mC) Cancel (Discard changes)\x1b[0m');
|
|
1041
|
-
const choice = (await
|
|
1033
|
+
const choice = (await readInput('Select section to edit or action: ', {
|
|
1042
1034
|
validate: (input) => ['1', '2', '3', '4', '5', 's', 'c'].includes(input)
|
|
1043
1035
|
})).trim().toLowerCase();
|
|
1044
1036
|
if (choice === '\x1b') {
|
|
@@ -1071,7 +1063,7 @@ async function promptGeneralSettings() {
|
|
|
1071
1063
|
{
|
|
1072
1064
|
const currentList = settings.NODES.list && settings.NODES.list.length > 0
|
|
1073
1065
|
? settings.NODES.list
|
|
1074
|
-
:
|
|
1066
|
+
: NODE_MANAGEMENT.DEFAULT_NODES;
|
|
1075
1067
|
let nodeList = [...currentList];
|
|
1076
1068
|
let editorCancelled = false;
|
|
1077
1069
|
while (true) {
|
|
@@ -1082,7 +1074,7 @@ async function promptGeneralSettings() {
|
|
|
1082
1074
|
console.log(' \x1b[1;32mA) Add node\x1b[0m');
|
|
1083
1075
|
console.log(' \x1b[1;31mR) Remove node\x1b[0m');
|
|
1084
1076
|
console.log(' \x1b[1;33mD) Done\x1b[0m');
|
|
1085
|
-
const nodeChoice = (await
|
|
1077
|
+
const nodeChoice = (await readInput(' Choice: ')).trim().toLowerCase();
|
|
1086
1078
|
if (nodeChoice === '\x1b') {
|
|
1087
1079
|
editorCancelled = true;
|
|
1088
1080
|
break;
|
|
@@ -1115,7 +1107,7 @@ async function promptGeneralSettings() {
|
|
|
1115
1107
|
if (editorCancelled)
|
|
1116
1108
|
break;
|
|
1117
1109
|
}
|
|
1118
|
-
const hcInterval = await askIntegerInRange('Health Check Interval (min)', (settings.NODES.healthCheck?.intervalMs ||
|
|
1110
|
+
const hcInterval = await askIntegerInRange('Health Check Interval (min)', (settings.NODES.healthCheck?.intervalMs || NODE_MANAGEMENT.HEALTH_CHECK_INTERVAL_MS) / 60000, 1, 43200);
|
|
1119
1111
|
if (hcInterval === '\x1b')
|
|
1120
1112
|
break;
|
|
1121
1113
|
if (!settings.NODES.healthCheck)
|
|
@@ -1178,7 +1170,7 @@ async function main() {
|
|
|
1178
1170
|
console.log(' 5) List bots');
|
|
1179
1171
|
console.log(' 6) General settings');
|
|
1180
1172
|
console.log(' 7) Exit (or press Enter)');
|
|
1181
|
-
const selection = (await
|
|
1173
|
+
const selection = (await readInput('Choose an action [1-7]: ')).trim();
|
|
1182
1174
|
console.log('');
|
|
1183
1175
|
if (selection === '\x1b' || selection === '7' || selection === '') {
|
|
1184
1176
|
exit = true;
|
|
@@ -1193,10 +1185,10 @@ async function main() {
|
|
|
1193
1185
|
break;
|
|
1194
1186
|
config.bots.push(entry);
|
|
1195
1187
|
saveBotsConfig(config, filePath);
|
|
1196
|
-
console.log(`\nAdded bot '${entry.name}' to ${
|
|
1188
|
+
console.log(`\nAdded bot '${entry.name}' to ${path.basename(filePath)}.`);
|
|
1197
1189
|
}
|
|
1198
1190
|
catch (err) {
|
|
1199
|
-
console.log(`\n❌ Invalid input: ${
|
|
1191
|
+
console.log(`\n❌ Invalid input: ${getErrorMessage(err)}\n`);
|
|
1200
1192
|
break;
|
|
1201
1193
|
}
|
|
1202
1194
|
}
|
|
@@ -1212,11 +1204,11 @@ async function main() {
|
|
|
1212
1204
|
if (entry) {
|
|
1213
1205
|
config.bots[idx] = entry;
|
|
1214
1206
|
saveBotsConfig(config, filePath);
|
|
1215
|
-
console.log(`saved settings '${entry.name}' in ${
|
|
1207
|
+
console.log(`saved settings '${entry.name}' in ${path.basename(filePath)}.\n`);
|
|
1216
1208
|
}
|
|
1217
1209
|
}
|
|
1218
1210
|
catch (err) {
|
|
1219
|
-
console.log(`\n❌ Invalid input: ${
|
|
1211
|
+
console.log(`\n❌ Invalid input: ${getErrorMessage(err)}\n`);
|
|
1220
1212
|
}
|
|
1221
1213
|
}
|
|
1222
1214
|
break;
|
|
@@ -1233,7 +1225,7 @@ async function main() {
|
|
|
1233
1225
|
if (confirm) {
|
|
1234
1226
|
const removed = config.bots.splice(idx, 1)[0];
|
|
1235
1227
|
saveBotsConfig(config, filePath);
|
|
1236
|
-
console.log(`Removed bot '${removed.name || placeholderName}' from ${
|
|
1228
|
+
console.log(`Removed bot '${removed.name || placeholderName}' from ${path.basename(filePath)}.\n`);
|
|
1237
1229
|
}
|
|
1238
1230
|
else {
|
|
1239
1231
|
console.log('\nDeletion cancelled.');
|
|
@@ -1251,11 +1243,11 @@ async function main() {
|
|
|
1251
1243
|
if (entry) {
|
|
1252
1244
|
config.bots.splice(idx + 1, 0, entry);
|
|
1253
1245
|
saveBotsConfig(config, filePath);
|
|
1254
|
-
console.log(`Copied bot '${entry.name}' into ${
|
|
1246
|
+
console.log(`Copied bot '${entry.name}' into ${path.basename(filePath)}.\n`);
|
|
1255
1247
|
}
|
|
1256
1248
|
}
|
|
1257
1249
|
catch (err) {
|
|
1258
|
-
console.log(`\n❌ Invalid input: ${
|
|
1250
|
+
console.log(`\n❌ Invalid input: ${getErrorMessage(err)}\n`);
|
|
1259
1251
|
}
|
|
1260
1252
|
}
|
|
1261
1253
|
break;
|
|
@@ -1275,4 +1267,5 @@ async function main() {
|
|
|
1275
1267
|
}
|
|
1276
1268
|
console.log('Botmanager closed!');
|
|
1277
1269
|
}
|
|
1270
|
+
export { main, normalizeBotDraft, parseJsonWithComments, parseCronToDelta, deltaToCron };
|
|
1278
1271
|
//# sourceMappingURL=account_bots.js.map
|