dexbot 1.3.2 → 1.4.0
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/dist/analysis/chart_utils.d.ts +11 -9
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +21 -16
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +4 -13
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +16 -18
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +3 -7
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +38 -34
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +1 -4
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +10 -7
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +6 -6
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +23 -15
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +12 -13
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +16 -16
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +1 -4
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +10 -7
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +6 -13
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts.map +1 -1
- package/dist/credential-daemon.js +74 -35
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +16 -15
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.d.ts +1 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +8 -20
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.d.ts +2 -10
- package/dist/market_adapter/candle_utils.d.ts.map +1 -1
- package/dist/market_adapter/candle_utils.js +7 -8
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +12 -7
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +4 -5
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.d.ts +4 -9
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +9 -9
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.d.ts +16 -20
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +16 -15
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.d.ts +8 -11
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +13 -11
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts +5 -12
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +12 -21
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +75 -53
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +102 -98
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.d.ts +21 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +10 -10
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +7 -11
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +23 -30
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +5 -4
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +5 -3
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +4 -7
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +5 -4
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +11 -19
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +22 -22
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/index.d.ts +24 -2
- package/dist/market_adapter/index.d.ts.map +1 -1
- package/dist/market_adapter/index.js +82 -56
- package/dist/market_adapter/index.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +26 -37
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +4 -12
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +100 -66
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts +4 -9
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +17 -18
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/interval_utils.d.ts +1 -4
- package/dist/market_adapter/interval_utils.d.ts.map +1 -1
- package/dist/market_adapter/interval_utils.js +2 -3
- package/dist/market_adapter/interval_utils.js.map +1 -1
- package/dist/market_adapter/log_format.d.ts +1 -9
- package/dist/market_adapter/log_format.d.ts.map +1 -1
- package/dist/market_adapter/log_format.js +7 -8
- package/dist/market_adapter/log_format.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.d.ts +1 -4
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +22 -20
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +13 -24
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +58 -56
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +4 -17
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +36 -36
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +51 -72
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +227 -192
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/merge_lp_data.js +17 -16
- package/dist/market_adapter/merge_lp_data.js.map +1 -1
- package/dist/market_adapter/test_helpers.d.ts +9 -13
- package/dist/market_adapter/test_helpers.d.ts.map +1 -1
- package/dist/market_adapter/test_helpers.js +14 -14
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.d.ts +6 -14
- package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +16 -15
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.d.ts +2 -5
- package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +5 -5
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts +19 -21
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +15 -16
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.d.ts +1 -4
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +10 -10
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +1 -6
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +14 -14
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.d.ts +1 -7
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +21 -25
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.d.ts +12 -12
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
- package/dist/market_adapter/utils/native_history.js +15 -15
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/market_adapter/utils/paths.d.ts +2 -4
- package/dist/market_adapter/utils/paths.d.ts.map +1 -1
- package/dist/market_adapter/utils/paths.js +6 -5
- package/dist/market_adapter/utils/paths.js.map +1 -1
- package/dist/modules/account_bots.d.ts +7 -8
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +92 -114
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +5 -9
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +69 -32
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.d.ts +32 -1
- package/dist/modules/authority_resolver.d.ts.map +1 -1
- package/dist/modules/authority_resolver.js +18 -12
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.d.ts +3 -8
- package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +21 -16
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +21 -29
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +72 -38
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts +9 -36
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.js +40 -83
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +14 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -3
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts +10 -2
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +68 -31
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts +1 -4
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +6 -3
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.d.ts +3 -6
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +11 -9
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +53 -55
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +28 -27
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts +5 -9
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +46 -12
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts +102 -100
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +473 -471
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts +2 -7
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +8 -3
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.d.ts +26 -41
- package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +76 -42
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.d.ts +1 -5
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +49 -11
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts +1 -4
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +47 -84
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.d.ts +1 -8
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
- package/dist/modules/bitshares-native/transport.js +22 -15
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts +3 -8
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +61 -23
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts +1 -8
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +21 -17
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +12 -23
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +109 -56
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts +1 -13
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +34 -34
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts +3 -9
- package/dist/modules/bots_file_lock.d.ts.map +1 -1
- package/dist/modules/bots_file_lock.js +8 -9
- package/dist/modules/bots_file_lock.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +7 -39
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +126 -90
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +46 -52
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +152 -104
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts +50 -57
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +28 -24
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +492 -492
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +79 -39
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.d.ts +1 -13
- package/dist/modules/cr_planner.d.ts.map +1 -1
- package/dist/modules/cr_planner.js +28 -28
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +18 -33
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +114 -87
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +11 -21
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +40 -40
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credential_session_cache.d.ts +8 -8
- package/dist/modules/credential_session_cache.d.ts.map +1 -1
- package/dist/modules/credential_session_cache.js +41 -8
- package/dist/modules/credential_session_cache.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts +51 -316
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +257 -183
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/browser_provider.js +6 -6
- package/dist/modules/crypto/browser_provider.js.map +1 -1
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +2 -0
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/sync.js +3 -3
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +124 -73
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +198 -3577
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +322 -0
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_cow_runtime.js +1836 -0
- package/dist/modules/dexbot_cow_runtime.js.map +1 -0
- package/dist/modules/dexbot_credential_client.d.ts +5 -11
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
- package/dist/modules/dexbot_credential_client.js +32 -30
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +47 -15
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +565 -22
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +79 -10
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +294 -55
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +26 -0
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_startup_runtime.js +575 -0
- package/dist/modules/dexbot_startup_runtime.js.map +1 -0
- package/dist/modules/dexbot_state_recovery.d.ts +115 -0
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -0
- package/dist/modules/dexbot_state_recovery.js +431 -0
- package/dist/modules/dexbot_state_recovery.js.map +1 -0
- package/dist/modules/fund_registry.d.ts +1 -13
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +23 -22
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.d.ts +3 -7
- package/dist/modules/general_settings.d.ts.map +1 -1
- package/dist/modules/general_settings.js +15 -15
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts +1 -6
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +19 -16
- 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 +53 -20
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +23 -66
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +115 -107
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.d.ts +2 -5
- package/dist/modules/launcher/child_env.d.ts.map +1 -1
- package/dist/modules/launcher/child_env.js +4 -4
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts +4 -8
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.js +30 -26
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
- package/dist/modules/launcher/credential_daemon.d.ts +8 -15
- package/dist/modules/launcher/credential_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/credential_daemon.js +72 -41
- package/dist/modules/launcher/credential_daemon.js.map +1 -1
- package/dist/modules/launcher/credential_secret.d.ts +1 -4
- package/dist/modules/launcher/credential_secret.d.ts.map +1 -1
- package/dist/modules/launcher/credential_secret.js +36 -4
- package/dist/modules/launcher/credential_secret.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +32 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +25 -28
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/headless_password.d.ts +1 -4
- package/dist/modules/launcher/headless_password.d.ts.map +1 -1
- package/dist/modules/launcher/headless_password.js +11 -11
- package/dist/modules/launcher/headless_password.js.map +1 -1
- package/dist/modules/launcher/launch_modes.d.ts +15 -14
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
- package/dist/modules/launcher/launch_modes.js +8 -8
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +10 -19
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +33 -34
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts +10 -17
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +42 -39
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +28 -57
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +135 -108
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts +5 -10
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +14 -14
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +17 -37
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +35 -34
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.d.ts +1 -4
- package/dist/modules/launcher/supervisor_control.d.ts.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +9 -4
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/logger.d.ts +3 -1
- package/dist/modules/logger.d.ts.map +1 -1
- package/dist/modules/logger.js +38 -28
- package/dist/modules/logger.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +2 -10
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +18 -16
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_health_cache.d.ts +2 -12
- package/dist/modules/node_health_cache.d.ts.map +1 -1
- package/dist/modules/node_health_cache.js +24 -24
- 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 -38
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.d.ts +12 -12
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +111 -76
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +1 -2
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +4 -4
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.d.ts +8 -14
- package/dist/modules/order/export.d.ts.map +1 -1
- package/dist/modules/order/export.js +77 -42
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +17 -22
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +25 -31
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +18 -104
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +246 -188
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts +8 -8
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile.js +24 -24
- package/dist/modules/order/grid_reconcile.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts +224 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +145 -72
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/index.d.ts +1 -1
- package/dist/modules/order/index.d.ts.map +1 -1
- package/dist/modules/order/index.js +42 -7
- package/dist/modules/order/index.js.map +1 -1
- package/dist/modules/order/logger.d.ts +6 -16
- package/dist/modules/order/logger.d.ts.map +1 -1
- package/dist/modules/order/logger.js +76 -53
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +4 -4
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +3 -1
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +160 -37
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +166 -128
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.d.ts +6 -10
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
- package/dist/modules/order/processed_fill_store.js +10 -9
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.d.ts +3 -3
- package/dist/modules/order/strategy.d.ts.map +1 -1
- package/dist/modules/order/strategy.js +29 -27
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts +9 -19
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +176 -126
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +55 -85
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +155 -88
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +27 -72
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +144 -105
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +74 -44
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +188 -149
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +21 -43
- package/dist/modules/order/utils/validate.d.ts.map +1 -1
- package/dist/modules/order/utils/validate.js +140 -110
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/working_grid.d.ts +1 -4
- package/dist/modules/order/working_grid.d.ts.map +1 -1
- package/dist/modules/order/working_grid.js +9 -7
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/path_api.js +2 -2
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts +51 -55
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +72 -52
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.d.ts +1 -1
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +7 -7
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime.d.ts +1 -1
- package/dist/modules/runtime.d.ts.map +1 -1
- package/dist/modules/runtime.js +4 -4
- package/dist/modules/runtime.js.map +1 -1
- package/dist/modules/runtime_settings.d.ts +1 -0
- package/dist/modules/runtime_settings.d.ts.map +1 -1
- package/dist/modules/runtime_settings.js +15 -10
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +1 -4
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +2 -1
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/storage/browser_adapter.d.ts +7 -3
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
- package/dist/modules/storage/browser_adapter.js +2 -0
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +2 -2
- package/dist/modules/storage/index.d.ts.map +1 -1
- package/dist/modules/storage/index.js +2 -5
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/modules/storage/node_adapter.d.ts +3 -3
- package/dist/modules/storage/node_adapter.d.ts.map +1 -1
- package/dist/modules/storage/node_adapter.js +9 -7
- package/dist/modules/storage/node_adapter.js.map +1 -1
- package/dist/modules/storage/types.d.ts +13 -10
- package/dist/modules/storage/types.d.ts.map +1 -1
- package/dist/modules/types.d.ts +0 -2
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/utils/base58check.d.ts +1 -9
- package/dist/modules/utils/base58check.d.ts.map +1 -1
- package/dist/modules/utils/base58check.js +14 -16
- package/dist/modules/utils/base58check.js.map +1 -1
- package/dist/modules/utils/build_dir.d.ts +2 -5
- package/dist/modules/utils/build_dir.d.ts.map +1 -1
- package/dist/modules/utils/build_dir.js +6 -3
- package/dist/modules/utils/build_dir.js.map +1 -1
- package/dist/modules/utils/errors.d.ts +2 -0
- package/dist/modules/utils/errors.d.ts.map +1 -0
- package/dist/modules/utils/errors.js +12 -0
- package/dist/modules/utils/errors.js.map +1 -0
- package/dist/modules/utils/fs_utils.d.ts +1 -8
- package/dist/modules/utils/fs_utils.d.ts.map +1 -1
- package/dist/modules/utils/fs_utils.js +8 -3
- package/dist/modules/utils/fs_utils.js.map +1 -1
- package/dist/modules/utils/math_utils.d.ts +2 -6
- package/dist/modules/utils/math_utils.d.ts.map +1 -1
- package/dist/modules/utils/math_utils.js +6 -2
- package/dist/modules/utils/math_utils.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts +1 -11
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +25 -27
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts +7 -6
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +132 -106
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.d.ts.map +1 -1
- package/dist/scripts/analyze-git.js +15 -11
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts +146 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +81 -105
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +9 -8
- 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 +11 -8
- package/dist/scripts/divergence-calc.js.map +1 -1
- package/dist/scripts/fix-err-message.d.ts +3 -0
- package/dist/scripts/fix-err-message.d.ts.map +1 -0
- package/dist/scripts/fix-err-message.js +198 -0
- package/dist/scripts/fix-err-message.js.map +1 -0
- package/dist/scripts/generate_lp_chart.d.ts +2 -9
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
- package/dist/scripts/generate_lp_chart.js +14 -10
- package/dist/scripts/generate_lp_chart.js.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.js +4 -4
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +17 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +23 -20
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/dist/scripts/migrate_bot_keys.d.ts +1 -4
- package/dist/scripts/migrate_bot_keys.d.ts.map +1 -1
- package/dist/scripts/migrate_bot_keys.js +48 -124
- package/dist/scripts/migrate_bot_keys.js.map +1 -1
- package/dist/scripts/native_release_gates.d.ts.map +1 -1
- package/dist/scripts/native_release_gates.js +18 -14
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.js +1 -1
- package/dist/scripts/print_grid.js.map +1 -1
- package/dist/scripts/run-tests.js +1 -0
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts +1 -11
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +21 -19
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
- package/dist/scripts/test-credit-renewal.js +2 -1
- package/dist/scripts/test-credit-renewal.js.map +1 -1
- package/dist/scripts/update.d.ts.map +1 -1
- package/dist/scripts/update.js +85 -79
- package/dist/scripts/update.js.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 +25 -1
- package/dist/scripts/verify-browser-bundle.js.map +1 -1
- package/dist/unlock.d.ts +4 -17
- package/dist/unlock.d.ts.map +1 -1
- package/dist/unlock.js +141 -108
- package/dist/unlock.js.map +1 -1
- package/package.json +7 -2
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +0 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +0 -149
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +0 -3
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +0 -387
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +0 -3
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -200
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +0 -3
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +0 -212
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +0 -31
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +0 -249
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +0 -2
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +0 -782
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_derivatives.d.ts +0 -95
- package/dist/analysis/analyze_derivatives.d.ts.map +0 -1
- package/dist/analysis/analyze_derivatives.js +0 -295
- package/dist/analysis/analyze_derivatives.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts +0 -14
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js +0 -207
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts +0 -13
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js +0 -123
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts +0 -20
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js +0 -139
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts +0 -19
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js +0 -413
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts +0 -3
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js +0 -159
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts +0 -3
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js +0 -367
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts +0 -22
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js +0 -172
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +0 -99
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +0 -804
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +0 -2
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +0 -347
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts +0 -15
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js +0 -48
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts +0 -22
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js +0 -162
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +0 -3
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js +0 -498
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +0 -546
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +0 -427
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/derivative_chart_generator.d.ts +0 -18
- package/dist/analysis/derivative_chart_generator.d.ts.map +0 -1
- package/dist/analysis/derivative_chart_generator.js +0 -896
- package/dist/analysis/derivative_chart_generator.js.map +0 -1
- package/dist/analysis/price_sources.d.ts +0 -34
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js +0 -103
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts +0 -115
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js +0 -1247
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +0 -36
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +0 -172
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +0 -250
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/derivative_analyzer.js +0 -903
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +0 -1450
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +0 -408
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +0 -345
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -130
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -38
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +0 -732
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
|
@@ -1,782 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
|
|
7
|
-
const { calculateAMA } = require('../../market_adapter/core/strategies/ama');
|
|
8
|
-
const { toIntervalLabel } = require('../../market_adapter/interval_utils');
|
|
9
|
-
const { generateHTML } = require('../../market_adapter/lp_chart_core');
|
|
10
|
-
const { loadLpDataFile, } = require('../../market_adapter/lp_chart_runner');
|
|
11
|
-
const { PATHS } = require('../../modules/paths');
|
|
12
|
-
const AMA_PROFILES_FILE = PATHS.PROFILES.MARKET_PROFILES_JSON;
|
|
13
|
-
/**
|
|
14
|
-
* AMA GEOMETRIC OPTIMIZER
|
|
15
|
-
*
|
|
16
|
-
* Finds AMA parameters (ER, Fast, Slow) using geometric metrics only.
|
|
17
|
-
*
|
|
18
|
-
* Objective flow:
|
|
19
|
-
* 1. Compute a per-AMA max-distance cap from the max candle deviation percentile.
|
|
20
|
-
* 2. Keep only candidates at or below that cap.
|
|
21
|
-
* 3. Select the candidate with the lowest additive linear score.
|
|
22
|
-
*
|
|
23
|
-
* Distance to price is still tracked for reporting.
|
|
24
|
-
* Winner selection uses an additive tradeoff between AMA movement and
|
|
25
|
-
* AMA-to-price distance, so candidates must stay close enough while also
|
|
26
|
-
* being smooth.
|
|
27
|
-
*
|
|
28
|
-
* Usage (build first, then run compiled JS):
|
|
29
|
-
* npm run build && node dist/analysis/ama_fitting/optimizer_high_resolution.js --data <path-to-lp-candles.json>
|
|
30
|
-
* node dist/analysis/ama_fitting/optimizer_high_resolution.js --data <path-to-lp-candles.json> --write-profiles
|
|
31
|
-
* node dist/analysis/ama_fitting/optimizer_high_resolution.js --data <path-to-lp-candles.json> --erMax 400 --fastMax 20 --slowMax 200
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
const DEFAULT_SEARCH = {
|
|
35
|
-
er: { min: 500, max: 1000, count: 15, step: null, quantum: 1 },
|
|
36
|
-
fast: { min: 2, max: 8, count: 30, step: null, quantum: 0.01 },
|
|
37
|
-
slow: { min: 35, max: 140, count: 30, step: null, quantum: 0.1 },
|
|
38
|
-
};
|
|
39
|
-
// ── Default per-AMA distance weights ────────────────────────────────────────
|
|
40
|
-
// Each AMA has its own λ that controls the movement-vs-distance tradeoff.
|
|
41
|
-
// Override individually via --ama1Weight, --ama2Weight, etc. CLI flags.
|
|
42
|
-
const AMA_OBJECTIVES = [
|
|
43
|
-
{ key: 'AMA1', name: 'AMA1 (min move, cap 25%)', distanceCapQuantile: 0.25, distanceWeight: 0.0031 },
|
|
44
|
-
{ key: 'AMA2', name: 'AMA2 (min move, cap 30%)', distanceCapQuantile: 0.30, distanceWeight: 0.0025 },
|
|
45
|
-
{ key: 'AMA3', name: 'AMA3 (min move, cap 35%)', distanceCapQuantile: 0.35, distanceWeight: 0.00185 },
|
|
46
|
-
{ key: 'AMA4', name: 'AMA4 (min move, cap 40%)', distanceCapQuantile: 0.40, distanceWeight: 0.0013 },
|
|
47
|
-
];
|
|
48
|
-
function cloneObjectives() {
|
|
49
|
-
return AMA_OBJECTIVES.map((o) => ({ ...o }));
|
|
50
|
-
}
|
|
51
|
-
// ── Parameter ranges ──────────────────────────────────────────────────────────
|
|
52
|
-
function quantize(value, quantum) {
|
|
53
|
-
if (!Number.isFinite(quantum) || quantum <= 0)
|
|
54
|
-
return value;
|
|
55
|
-
return Math.round(value / quantum) * quantum;
|
|
56
|
-
}
|
|
57
|
-
function geometricRange(min, max, count, quantum = null) {
|
|
58
|
-
const out = [];
|
|
59
|
-
const ratio = Math.pow(max / min, 1 / (count - 1));
|
|
60
|
-
for (let i = 0; i < count; i++) {
|
|
61
|
-
let v = min * Math.pow(ratio, i);
|
|
62
|
-
if (i === 0)
|
|
63
|
-
v = min;
|
|
64
|
-
if (i === count - 1)
|
|
65
|
-
v = max;
|
|
66
|
-
v = quantize(v, quantum);
|
|
67
|
-
v = Math.max(min, Math.min(max, v));
|
|
68
|
-
out.push(parseFloat(v.toFixed(6)));
|
|
69
|
-
}
|
|
70
|
-
return [...new Set(out)].sort((a, b) => a - b);
|
|
71
|
-
}
|
|
72
|
-
function buildDimension(label, cfg) {
|
|
73
|
-
const min = Number(cfg.min);
|
|
74
|
-
const max = Number(cfg.max);
|
|
75
|
-
const step = Number(cfg.step);
|
|
76
|
-
const count = Number(cfg.count);
|
|
77
|
-
const quantum = Number(cfg.quantum);
|
|
78
|
-
if (Number.isFinite(step) && step > 0) {
|
|
79
|
-
const values = range(min, max, step, 2);
|
|
80
|
-
return {
|
|
81
|
-
values,
|
|
82
|
-
meta: {
|
|
83
|
-
mode: 'linear',
|
|
84
|
-
min: values[0],
|
|
85
|
-
max: values[values.length - 1],
|
|
86
|
-
step,
|
|
87
|
-
quantum: Number.isFinite(quantum) && quantum > 0 ? quantum : null,
|
|
88
|
-
count: values.length,
|
|
89
|
-
ratio: null,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const ratio = Math.pow(max / min, 1 / (count - 1));
|
|
94
|
-
const values = geometricRange(min, max, count, quantum);
|
|
95
|
-
return {
|
|
96
|
-
values,
|
|
97
|
-
meta: {
|
|
98
|
-
mode: 'geometric',
|
|
99
|
-
min: values[0],
|
|
100
|
-
max: values[values.length - 1],
|
|
101
|
-
step: null,
|
|
102
|
-
quantum: Number.isFinite(quantum) && quantum > 0 ? quantum : null,
|
|
103
|
-
count: values.length,
|
|
104
|
-
ratio,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
109
|
-
const args = Array.isArray(argv) ? argv : [];
|
|
110
|
-
const out = {
|
|
111
|
-
dataFile: null,
|
|
112
|
-
er: { ...DEFAULT_SEARCH.er },
|
|
113
|
-
fast: { ...DEFAULT_SEARCH.fast },
|
|
114
|
-
slow: { ...DEFAULT_SEARCH.slow },
|
|
115
|
-
workers: null,
|
|
116
|
-
writeProfiles: false,
|
|
117
|
-
fixedEr: null,
|
|
118
|
-
fixedFast: null,
|
|
119
|
-
ama1Cap: null,
|
|
120
|
-
ama2Cap: null,
|
|
121
|
-
ama3Cap: null,
|
|
122
|
-
ama4Cap: null,
|
|
123
|
-
ama1Weight: null,
|
|
124
|
-
ama2Weight: null,
|
|
125
|
-
ama3Weight: null,
|
|
126
|
-
ama4Weight: null,
|
|
127
|
-
};
|
|
128
|
-
for (let i = 0; i < args.length; i++) {
|
|
129
|
-
const a = args[i];
|
|
130
|
-
const v = args[i + 1];
|
|
131
|
-
switch (a) {
|
|
132
|
-
case '--data':
|
|
133
|
-
out.dataFile = v || null;
|
|
134
|
-
i++;
|
|
135
|
-
break;
|
|
136
|
-
case '--fixEr': {
|
|
137
|
-
const n = Number(v);
|
|
138
|
-
if (!Number.isFinite(n))
|
|
139
|
-
throw new Error(`--fixEr requires a finite number, got "${v}"`);
|
|
140
|
-
out.fixedEr = n;
|
|
141
|
-
i++;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
case '--fixFast': {
|
|
145
|
-
const n = Number(v);
|
|
146
|
-
if (!Number.isFinite(n))
|
|
147
|
-
throw new Error(`--fixFast requires a finite number, got "${v}"`);
|
|
148
|
-
out.fixedFast = n;
|
|
149
|
-
i++;
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
case '--erMin':
|
|
153
|
-
out.er.min = Number(v);
|
|
154
|
-
i++;
|
|
155
|
-
break;
|
|
156
|
-
case '--erMax':
|
|
157
|
-
out.er.max = Number(v);
|
|
158
|
-
i++;
|
|
159
|
-
break;
|
|
160
|
-
case '--erStep':
|
|
161
|
-
out.er.step = Number(v);
|
|
162
|
-
i++;
|
|
163
|
-
break;
|
|
164
|
-
case '--erCount':
|
|
165
|
-
out.er.count = Number(v);
|
|
166
|
-
i++;
|
|
167
|
-
break;
|
|
168
|
-
case '--fastMin':
|
|
169
|
-
out.fast.min = Number(v);
|
|
170
|
-
i++;
|
|
171
|
-
break;
|
|
172
|
-
case '--fastMax':
|
|
173
|
-
out.fast.max = Number(v);
|
|
174
|
-
i++;
|
|
175
|
-
break;
|
|
176
|
-
case '--fastStep':
|
|
177
|
-
out.fast.step = Number(v);
|
|
178
|
-
i++;
|
|
179
|
-
break;
|
|
180
|
-
case '--fastCount':
|
|
181
|
-
out.fast.count = Number(v);
|
|
182
|
-
i++;
|
|
183
|
-
break;
|
|
184
|
-
case '--slowMin':
|
|
185
|
-
out.slow.min = Number(v);
|
|
186
|
-
i++;
|
|
187
|
-
break;
|
|
188
|
-
case '--slowMax':
|
|
189
|
-
out.slow.max = Number(v);
|
|
190
|
-
i++;
|
|
191
|
-
break;
|
|
192
|
-
case '--slowStep':
|
|
193
|
-
out.slow.step = Number(v);
|
|
194
|
-
i++;
|
|
195
|
-
break;
|
|
196
|
-
case '--slowCount':
|
|
197
|
-
out.slow.count = Number(v);
|
|
198
|
-
i++;
|
|
199
|
-
break;
|
|
200
|
-
case '--ama1Cap':
|
|
201
|
-
out.ama1Cap = Number(v);
|
|
202
|
-
i++;
|
|
203
|
-
break;
|
|
204
|
-
case '--ama2Cap':
|
|
205
|
-
out.ama2Cap = Number(v);
|
|
206
|
-
i++;
|
|
207
|
-
break;
|
|
208
|
-
case '--ama3Cap':
|
|
209
|
-
out.ama3Cap = Number(v);
|
|
210
|
-
i++;
|
|
211
|
-
break;
|
|
212
|
-
case '--ama4Cap':
|
|
213
|
-
out.ama4Cap = Number(v);
|
|
214
|
-
i++;
|
|
215
|
-
break;
|
|
216
|
-
case '--ama1Weight':
|
|
217
|
-
out.ama1Weight = Number(v);
|
|
218
|
-
i++;
|
|
219
|
-
break;
|
|
220
|
-
case '--ama2Weight':
|
|
221
|
-
out.ama2Weight = Number(v);
|
|
222
|
-
i++;
|
|
223
|
-
break;
|
|
224
|
-
case '--ama3Weight':
|
|
225
|
-
out.ama3Weight = Number(v);
|
|
226
|
-
i++;
|
|
227
|
-
break;
|
|
228
|
-
case '--ama4Weight':
|
|
229
|
-
out.ama4Weight = Number(v);
|
|
230
|
-
i++;
|
|
231
|
-
break;
|
|
232
|
-
case '--workers':
|
|
233
|
-
out.workers = Number(v);
|
|
234
|
-
i++;
|
|
235
|
-
break;
|
|
236
|
-
case '--write-profiles':
|
|
237
|
-
out.writeProfiles = true;
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return out;
|
|
242
|
-
}
|
|
243
|
-
function percentile(values, q) {
|
|
244
|
-
if (!Array.isArray(values) || values.length === 0)
|
|
245
|
-
return null;
|
|
246
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
247
|
-
const qq = Math.max(0, Math.min(1, q));
|
|
248
|
-
const pos = (sorted.length - 1) * qq;
|
|
249
|
-
const lo = Math.floor(pos);
|
|
250
|
-
const hi = Math.ceil(pos);
|
|
251
|
-
if (lo === hi)
|
|
252
|
-
return sorted[lo];
|
|
253
|
-
const t = pos - lo;
|
|
254
|
-
return sorted[lo] * (1 - t) + sorted[hi] * t;
|
|
255
|
-
}
|
|
256
|
-
function getAmaObjectivesFromArgs(args) {
|
|
257
|
-
const objectives = cloneObjectives();
|
|
258
|
-
for (const o of objectives) {
|
|
259
|
-
const id = o.key.toLowerCase();
|
|
260
|
-
const cap = args[`${id}Cap`];
|
|
261
|
-
if (Number.isFinite(cap))
|
|
262
|
-
o.distanceCapQuantile = cap;
|
|
263
|
-
if (!Number.isFinite(o.distanceCapQuantile) || o.distanceCapQuantile <= 0 || o.distanceCapQuantile > 1) {
|
|
264
|
-
throw new Error(`Invalid cap for ${o.key}: ${o.distanceCapQuantile}. Use 0 < cap <= 1`);
|
|
265
|
-
}
|
|
266
|
-
const w = args[`${id}Weight`];
|
|
267
|
-
if (Number.isFinite(w)) {
|
|
268
|
-
if (w <= 0)
|
|
269
|
-
throw new Error(`${o.key} distanceWeight must be positive, got ${w}`);
|
|
270
|
-
o.distanceWeight = w;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return objectives;
|
|
274
|
-
}
|
|
275
|
-
function ensureValidRange(label, cfg) {
|
|
276
|
-
const { min, max, step, count } = cfg;
|
|
277
|
-
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) {
|
|
278
|
-
throw new Error(`Invalid ${label} range: min=${min}, max=${max}`);
|
|
279
|
-
}
|
|
280
|
-
if (Number.isFinite(step) && step > 0)
|
|
281
|
-
return;
|
|
282
|
-
if (!Number.isFinite(count) || count < 2) {
|
|
283
|
-
throw new Error(`Invalid ${label} geometric sampling count: ${count}`);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
function boundaryFlags(winner, erValues, fastValues, slowValues, fixedEr = null, fixedFast = null) {
|
|
287
|
-
if (!winner)
|
|
288
|
-
return { er: null, fast: null, slow: null, any: false };
|
|
289
|
-
const eps = 1e-9;
|
|
290
|
-
const minEr = erValues[0], maxEr = erValues[erValues.length - 1];
|
|
291
|
-
const minFast = fastValues[0], maxFast = fastValues[fastValues.length - 1];
|
|
292
|
-
const minSlow = slowValues[0], maxSlow = slowValues[slowValues.length - 1];
|
|
293
|
-
const er = Number.isFinite(fixedEr) ? null : (Math.abs(winner.er - minEr) < eps ? 'min' : (Math.abs(winner.er - maxEr) < eps ? 'max' : null));
|
|
294
|
-
const fast = Number.isFinite(fixedFast) ? null : (Math.abs(winner.fast - minFast) < eps ? 'min' : (Math.abs(winner.fast - maxFast) < eps ? 'max' : null));
|
|
295
|
-
const slow = Math.abs(winner.slow - minSlow) < eps ? 'min' : (Math.abs(winner.slow - maxSlow) < eps ? 'max' : null);
|
|
296
|
-
return { er, fast, slow, any: !!(er || fast || slow) };
|
|
297
|
-
}
|
|
298
|
-
const { ensureDir } = require('../../modules/order/utils/system');
|
|
299
|
-
const { range } = require('../math_utils');
|
|
300
|
-
const { readJSON, writeJSON } = require('../../modules/utils/fs_utils');
|
|
301
|
-
// ── Data loaders ──────────────────────────────────────────────────────────────
|
|
302
|
-
function normalizeSymbol(value) {
|
|
303
|
-
return String(value || '').trim().toUpperCase();
|
|
304
|
-
}
|
|
305
|
-
function inferIntervalLabel(dataFile, meta) {
|
|
306
|
-
const fromMeta = Number(meta?.intervalSeconds);
|
|
307
|
-
if (Number.isFinite(fromMeta) && fromMeta > 0) {
|
|
308
|
-
return toIntervalLabel(fromMeta);
|
|
309
|
-
}
|
|
310
|
-
const m = String(path.basename(dataFile || '')).match(/_(\d+)([mhd])\.json$/i);
|
|
311
|
-
return m ? `${m[1]}${m[2].toLowerCase()}` : '1h';
|
|
312
|
-
}
|
|
313
|
-
function updateAmaProfilesFile({ dataFile, meta, winners, sourceResultsFile }) {
|
|
314
|
-
const assetASymbol = normalizeSymbol(meta?.assetA?.symbol);
|
|
315
|
-
const assetBSymbol = normalizeSymbol(meta?.assetB?.symbol);
|
|
316
|
-
const assetAId = normalizeSymbol(meta?.assetA?.id);
|
|
317
|
-
const assetBId = normalizeSymbol(meta?.assetB?.id);
|
|
318
|
-
const assetA = assetASymbol || assetAId;
|
|
319
|
-
const assetB = assetBSymbol || assetBId;
|
|
320
|
-
if (!assetA || !assetB)
|
|
321
|
-
return;
|
|
322
|
-
const intervalSeconds = Number(meta?.intervalSeconds);
|
|
323
|
-
const intervalLabel = inferIntervalLabel(dataFile, meta);
|
|
324
|
-
const key = `${assetA}|${assetB}|${Number.isFinite(intervalSeconds) && intervalSeconds > 0 ? intervalSeconds : intervalLabel}`;
|
|
325
|
-
const payload = {
|
|
326
|
-
version: 1,
|
|
327
|
-
updatedAt: new Date().toISOString(),
|
|
328
|
-
profiles: [],
|
|
329
|
-
};
|
|
330
|
-
if (fs.existsSync(AMA_PROFILES_FILE)) {
|
|
331
|
-
try {
|
|
332
|
-
const current = readJSON(AMA_PROFILES_FILE);
|
|
333
|
-
if (current && typeof current === 'object') {
|
|
334
|
-
payload.version = Number(current.version) || 1;
|
|
335
|
-
payload.profiles = Array.isArray(current.profiles) ? current.profiles : [];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
catch (_) { }
|
|
339
|
-
}
|
|
340
|
-
const profile = {
|
|
341
|
-
key,
|
|
342
|
-
assetA,
|
|
343
|
-
assetB,
|
|
344
|
-
assetAId: assetAId || null,
|
|
345
|
-
assetBId: assetBId || null,
|
|
346
|
-
poolId: meta?.pool || null,
|
|
347
|
-
intervalSeconds: Number.isFinite(intervalSeconds) && intervalSeconds > 0 ? intervalSeconds : null,
|
|
348
|
-
intervalLabel,
|
|
349
|
-
defaultAma: 'AMA3',
|
|
350
|
-
sourceResultsFile,
|
|
351
|
-
updatedAt: payload.updatedAt,
|
|
352
|
-
amas: {
|
|
353
|
-
AMA1: {
|
|
354
|
-
name: winners.ama1.label,
|
|
355
|
-
erPeriod: winners.ama1.er,
|
|
356
|
-
fastPeriod: winners.ama1.fast,
|
|
357
|
-
slowPeriod: winners.ama1.slow,
|
|
358
|
-
},
|
|
359
|
-
AMA2: {
|
|
360
|
-
name: winners.ama2.label,
|
|
361
|
-
erPeriod: winners.ama2.er,
|
|
362
|
-
fastPeriod: winners.ama2.fast,
|
|
363
|
-
slowPeriod: winners.ama2.slow,
|
|
364
|
-
},
|
|
365
|
-
AMA3: {
|
|
366
|
-
name: winners.ama3.label,
|
|
367
|
-
erPeriod: winners.ama3.er,
|
|
368
|
-
fastPeriod: winners.ama3.fast,
|
|
369
|
-
slowPeriod: winners.ama3.slow,
|
|
370
|
-
},
|
|
371
|
-
AMA4: {
|
|
372
|
-
name: winners.ama4.label,
|
|
373
|
-
erPeriod: winners.ama4.er,
|
|
374
|
-
fastPeriod: winners.ama4.fast,
|
|
375
|
-
slowPeriod: winners.ama4.slow,
|
|
376
|
-
},
|
|
377
|
-
},
|
|
378
|
-
};
|
|
379
|
-
const idx = payload.profiles.findIndex((p) => String(p?.key || '') === key);
|
|
380
|
-
if (idx >= 0)
|
|
381
|
-
payload.profiles[idx] = profile;
|
|
382
|
-
else
|
|
383
|
-
payload.profiles.push(profile);
|
|
384
|
-
ensureDir(path.dirname(AMA_PROFILES_FILE));
|
|
385
|
-
writeJSON(AMA_PROFILES_FILE, payload);
|
|
386
|
-
}
|
|
387
|
-
function calcTotalAmaMovement(amaValues, erPeriod) {
|
|
388
|
-
const skip = erPeriod + 1;
|
|
389
|
-
let total = 0;
|
|
390
|
-
for (let i = skip + 1; i < amaValues.length; i++) {
|
|
391
|
-
total += Math.abs(amaValues[i] - amaValues[i - 1]) / amaValues[i - 1];
|
|
392
|
-
}
|
|
393
|
-
return total;
|
|
394
|
-
}
|
|
395
|
-
// ── Informational: area above/below AMA ──────────────────────────────────────
|
|
396
|
-
function calcArea(amaValues, candles, erPeriod) {
|
|
397
|
-
const skip = erPeriod + 1;
|
|
398
|
-
let above = 0, below = 0, maxUp = 0, maxDown = 0;
|
|
399
|
-
for (let i = skip; i < candles.length; i++) {
|
|
400
|
-
const ama = amaValues[i];
|
|
401
|
-
if (candles[i].high > ama) {
|
|
402
|
-
const d = (candles[i].high - ama) / ama;
|
|
403
|
-
above += d;
|
|
404
|
-
if (d > maxUp)
|
|
405
|
-
maxUp = d;
|
|
406
|
-
}
|
|
407
|
-
if (candles[i].low < ama) {
|
|
408
|
-
const d = (ama - candles[i].low) / ama;
|
|
409
|
-
below += d;
|
|
410
|
-
if (d > maxDown)
|
|
411
|
-
maxDown = d;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
const total = above + below;
|
|
415
|
-
const maxDist = Math.max(maxUp, maxDown);
|
|
416
|
-
return { above, below, total, maxUp, maxDown, maxDist };
|
|
417
|
-
}
|
|
418
|
-
function calcTotalRelativeDistance(amaValues, candles, erPeriod) {
|
|
419
|
-
const skip = erPeriod + 1;
|
|
420
|
-
let total = 0;
|
|
421
|
-
for (let i = skip; i < candles.length; i++) {
|
|
422
|
-
const ama = amaValues[i];
|
|
423
|
-
const close = candles[i].close;
|
|
424
|
-
total += Math.abs(close - ama) / ama;
|
|
425
|
-
}
|
|
426
|
-
return total;
|
|
427
|
-
}
|
|
428
|
-
function runSearchShard(payload, onProgress = null) {
|
|
429
|
-
const { workerId, erShard, fastValues, slowValues, candles, closes, } = payload;
|
|
430
|
-
const totalCombos = erShard.length * fastValues.length * slowValues.length;
|
|
431
|
-
const progressStep = Math.max(2000, Math.floor(totalCombos / 20));
|
|
432
|
-
let checked = 0;
|
|
433
|
-
let valid = 0;
|
|
434
|
-
const entries = [];
|
|
435
|
-
const startMs = Date.now();
|
|
436
|
-
for (const er of erShard) {
|
|
437
|
-
for (const fast of fastValues) {
|
|
438
|
-
for (const slow of slowValues) {
|
|
439
|
-
checked++;
|
|
440
|
-
if (fast >= slow) {
|
|
441
|
-
if (onProgress && (checked % progressStep === 0 || checked === totalCombos)) {
|
|
442
|
-
const elapsedSec = (Date.now() - startMs) / 1000;
|
|
443
|
-
onProgress({ workerId, checked, total: totalCombos, elapsedSec });
|
|
444
|
-
}
|
|
445
|
-
continue;
|
|
446
|
-
}
|
|
447
|
-
valid++;
|
|
448
|
-
const ama = calculateAMA(closes, { erPeriod: er, fastPeriod: fast, slowPeriod: slow });
|
|
449
|
-
const area = calcArea(ama, candles, er);
|
|
450
|
-
const amaMovementTotal = calcTotalAmaMovement(ama, er);
|
|
451
|
-
const distanceTotal = calcTotalRelativeDistance(ama, candles, er);
|
|
452
|
-
const bandFactorPct = area.maxDist * 200;
|
|
453
|
-
const entry = {
|
|
454
|
-
er, fast, slow,
|
|
455
|
-
area,
|
|
456
|
-
amaMovementTotal,
|
|
457
|
-
bandFactorPct,
|
|
458
|
-
distanceTotal,
|
|
459
|
-
};
|
|
460
|
-
entries.push(entry);
|
|
461
|
-
if (onProgress && (checked % progressStep === 0 || checked === totalCombos)) {
|
|
462
|
-
const elapsedSec = (Date.now() - startMs) / 1000;
|
|
463
|
-
onProgress({ workerId, checked, total: totalCombos, elapsedSec });
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return { workerId, entries, totalCombos, validCombos: valid };
|
|
469
|
-
}
|
|
470
|
-
function spawnShardWorker(payload, onProgress) {
|
|
471
|
-
return new Promise((resolve, reject) => {
|
|
472
|
-
const worker = new Worker(__filename, { workerData: { type: 'search_shard', payload } });
|
|
473
|
-
worker.on('message', (msg) => {
|
|
474
|
-
if (!msg || typeof msg !== 'object')
|
|
475
|
-
return;
|
|
476
|
-
if (msg.type === 'progress') {
|
|
477
|
-
if (onProgress)
|
|
478
|
-
onProgress(msg);
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
if (msg.type === 'done')
|
|
482
|
-
resolve(msg.result);
|
|
483
|
-
});
|
|
484
|
-
worker.on('error', reject);
|
|
485
|
-
worker.on('exit', (code) => {
|
|
486
|
-
if (code !== 0)
|
|
487
|
-
reject(new Error(`Worker exited with code ${code}`));
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
function splitIntoShards(values, shardCount) {
|
|
492
|
-
const out = [];
|
|
493
|
-
const size = Math.ceil(values.length / shardCount);
|
|
494
|
-
for (let i = 0; i < values.length; i += size) {
|
|
495
|
-
out.push(values.slice(i, i + size));
|
|
496
|
-
}
|
|
497
|
-
return out.filter((s) => s.length > 0);
|
|
498
|
-
}
|
|
499
|
-
// ── Main ───────────────────────────────────────────────────────────────────────
|
|
500
|
-
async function run() {
|
|
501
|
-
const args = parseArgs();
|
|
502
|
-
let dataFile = args.dataFile;
|
|
503
|
-
const objectives = getAmaObjectivesFromArgs(args);
|
|
504
|
-
ensureValidRange('ER', args.er);
|
|
505
|
-
ensureValidRange('Fast', args.fast);
|
|
506
|
-
ensureValidRange('Slow', args.slow);
|
|
507
|
-
const erDim = buildDimension('ER', args.er);
|
|
508
|
-
const fastDim = buildDimension('Fast', args.fast);
|
|
509
|
-
const slowDim = buildDimension('Slow', args.slow);
|
|
510
|
-
const ER_VALUES = Number.isFinite(args.fixedEr) ? [args.fixedEr] : erDim.values;
|
|
511
|
-
const FAST_VALUES = Number.isFinite(args.fixedFast) ? [args.fixedFast] : fastDim.values;
|
|
512
|
-
const SLOW_VALUES_AREA = slowDim.values;
|
|
513
|
-
const totalCombos = ER_VALUES.length * FAST_VALUES.length * SLOW_VALUES_AREA.length;
|
|
514
|
-
const startMs = Date.now();
|
|
515
|
-
const erLabel = Number.isFinite(args.fixedEr) ? `fixed(${args.fixedEr})` : `${ER_VALUES[0]}–${ER_VALUES[ER_VALUES.length - 1]}`;
|
|
516
|
-
const fastLabel = Number.isFinite(args.fixedFast) ? `fixed(${args.fixedFast})` : `${FAST_VALUES[0]}–${FAST_VALUES[FAST_VALUES.length - 1]}`;
|
|
517
|
-
console.log('================================================================================');
|
|
518
|
-
console.log(' AMA GEOMETRIC OPTIMIZER');
|
|
519
|
-
console.log('================================================================================');
|
|
520
|
-
console.log(` 4 AMAs — pure geometric, no grid or bot settings`);
|
|
521
|
-
console.log(' Objective: minimise movement + λ·distance under per-AMA max distance caps');
|
|
522
|
-
for (const o of objectives) {
|
|
523
|
-
console.log(` ${o.key}: distance cap q=${o.distanceCapQuantile.toFixed(2)} λ=${o.distanceWeight.toFixed(6)}`);
|
|
524
|
-
}
|
|
525
|
-
console.log(` Ranges: ER ${erLabel} Fast ${fastLabel} Slow ${SLOW_VALUES_AREA[0]}–${SLOW_VALUES_AREA[SLOW_VALUES_AREA.length - 1]}`);
|
|
526
|
-
if (!Number.isFinite(args.fixedEr) && !Number.isFinite(args.fixedFast)) {
|
|
527
|
-
console.log(` Sampling: ER ${erDim.meta.mode}(${erDim.meta.count}${erDim.meta.ratio ? `,x${erDim.meta.ratio.toFixed(3)}` : ''}) Fast ${fastDim.meta.mode}(${fastDim.meta.count}${fastDim.meta.ratio ? `,x${fastDim.meta.ratio.toFixed(3)}` : ''}) Slow ${slowDim.meta.mode}(${slowDim.meta.count}${slowDim.meta.ratio ? `,x${slowDim.meta.ratio.toFixed(3)}` : ''})`);
|
|
528
|
-
}
|
|
529
|
-
console.log(` Combos: ${totalCombos}\n`);
|
|
530
|
-
// Load data
|
|
531
|
-
let candles, dataLabel, dataMeta = null;
|
|
532
|
-
if (!dataFile) {
|
|
533
|
-
throw new Error('Optimizer requires --data <lp_pool_*.json>. Use --write-profiles to also update profiles/market_profiles.json.');
|
|
534
|
-
}
|
|
535
|
-
const loaded = loadLpDataFile(path.resolve(dataFile));
|
|
536
|
-
candles = loaded.candleObjects;
|
|
537
|
-
const m = loaded.meta;
|
|
538
|
-
dataMeta = m;
|
|
539
|
-
dataLabel = m ? `LP Pool ${m.pool} (${m.assetA?.symbol}/${m.assetB?.symbol})` : path.basename(dataFile);
|
|
540
|
-
const closes = candles.map(c => c.close);
|
|
541
|
-
console.log(` Data: ${dataLabel} (${candles.length} candles)\n`);
|
|
542
|
-
// ── Run: core-parallel full-grid scan split by ER shards ──────────────────
|
|
543
|
-
const cpuCount = Math.max(1, os.cpus().length);
|
|
544
|
-
const requestedWorkers = Number.isFinite(args.workers) && args.workers > 0 ? Math.floor(args.workers) : cpuCount;
|
|
545
|
-
const workerCount = Math.max(1, Math.min(requestedWorkers, ER_VALUES.length));
|
|
546
|
-
const erShards = splitIntoShards(ER_VALUES, workerCount);
|
|
547
|
-
const shardTotals = erShards.map((shard) => shard.length * FAST_VALUES.length * SLOW_VALUES_AREA.length);
|
|
548
|
-
const shardProgress = new Map();
|
|
549
|
-
console.log(` Parallel workers: ${erShards.length} shard workers (CPU cores available: ${cpuCount})`);
|
|
550
|
-
const shardResults = await Promise.all(erShards.map((erShard, idx) => {
|
|
551
|
-
const workerPayload = {
|
|
552
|
-
workerId: idx + 1,
|
|
553
|
-
erShard,
|
|
554
|
-
fastValues: FAST_VALUES,
|
|
555
|
-
slowValues: SLOW_VALUES_AREA,
|
|
556
|
-
candles,
|
|
557
|
-
closes,
|
|
558
|
-
};
|
|
559
|
-
return spawnShardWorker(workerPayload, (msg) => {
|
|
560
|
-
shardProgress.set(msg.workerId, msg.checked);
|
|
561
|
-
const done = shardTotals.reduce((acc, total, i) => acc + Math.min(total, shardProgress.get(i + 1) || 0), 0);
|
|
562
|
-
const pct = ((done / totalCombos) * 100).toFixed(1);
|
|
563
|
-
console.log(` [scan] ${pct}% (${done}/${totalCombos}) w${msg.workerId} ${msg.elapsedSec.toFixed(1)}s`);
|
|
564
|
-
});
|
|
565
|
-
}));
|
|
566
|
-
const entries = shardResults.flatMap((r) => r.entries);
|
|
567
|
-
const validCombos = shardResults.reduce((acc, r) => acc + r.validCombos, 0);
|
|
568
|
-
const maxDistVals = entries.map((e) => e.area.maxDist);
|
|
569
|
-
// When both ER and Fast are fixed, the search is 1D over Slow only. Slow
|
|
570
|
-
// variation rarely produces maxDist outliers, so the distance cap filter adds
|
|
571
|
-
// no value here — λ alone cleanly separates the candidates.
|
|
572
|
-
const skipCap = Number.isFinite(args.fixedEr) && Number.isFinite(args.fixedFast);
|
|
573
|
-
const objectiveResults = objectives.map((objective) => {
|
|
574
|
-
const distanceWeight = objective.distanceWeight;
|
|
575
|
-
const computedCap = skipCap ? null : percentile(maxDistVals, objective.distanceCapQuantile);
|
|
576
|
-
const cappedEntries = skipCap ? entries : entries.filter((e) => e.area.maxDist <= computedCap);
|
|
577
|
-
let best = null;
|
|
578
|
-
for (const e of cappedEntries) {
|
|
579
|
-
const score = e.amaMovementTotal + (distanceWeight * e.distanceTotal);
|
|
580
|
-
const bestScore = best ? best.weightedScore : Infinity;
|
|
581
|
-
if (!best || score < bestScore || (score === bestScore && e.amaMovementTotal < best.amaMovementTotal) || (score === bestScore && e.amaMovementTotal === best.amaMovementTotal && e.distanceTotal < best.distanceTotal)) {
|
|
582
|
-
best = {
|
|
583
|
-
...e,
|
|
584
|
-
weightedScore: score,
|
|
585
|
-
normDistance: null,
|
|
586
|
-
normMovement: null,
|
|
587
|
-
key: objective.key,
|
|
588
|
-
label: objective.name,
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return {
|
|
593
|
-
objective,
|
|
594
|
-
distanceWeight,
|
|
595
|
-
best,
|
|
596
|
-
totalCombos,
|
|
597
|
-
validCombos,
|
|
598
|
-
candidatesUnderCap: cappedEntries.length,
|
|
599
|
-
maxDistanceCap: computedCap,
|
|
600
|
-
};
|
|
601
|
-
});
|
|
602
|
-
const elapsedSec = (Date.now() - startMs) / 1000;
|
|
603
|
-
console.log(` Completed parallel search in ${elapsedSec.toFixed(1)}s (valid combos: ${validCombos})\n`);
|
|
604
|
-
const selected = objectiveResults.map((r) => r.best).filter(Boolean);
|
|
605
|
-
const failed = objectiveResults.filter((r) => !r.best).map((r) => r.objective?.key || '?');
|
|
606
|
-
if (failed.length > 0) {
|
|
607
|
-
throw new Error(`No candidate under distance cap for: ${failed.join(', ')}. Increase corresponding cap (e.g. --ama4Cap 0.35).`);
|
|
608
|
-
}
|
|
609
|
-
const ama1 = selected.find((s) => s.key === 'AMA1') || null;
|
|
610
|
-
const ama2 = selected.find((s) => s.key === 'AMA2') || null;
|
|
611
|
-
const ama3 = selected.find((s) => s.key === 'AMA3') || null;
|
|
612
|
-
const ama4 = selected.find((s) => s.key === 'AMA4') || null;
|
|
613
|
-
function detail(label, r, optimisedFor) {
|
|
614
|
-
if (!r) {
|
|
615
|
-
console.log(` ${label}`);
|
|
616
|
-
console.log(' └─ No valid candidate under constraint\n');
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
const asymmetry = Math.abs(r.area.above - r.area.below);
|
|
620
|
-
const bias = r.area.above > r.area.below ? 'AMA below price' : 'AMA above price';
|
|
621
|
-
console.log(` ${label}`);
|
|
622
|
-
console.log(` ├─ Optimised for: ${optimisedFor}`);
|
|
623
|
-
console.log(` ├─ Params: ER=${r.er} Fast=${r.fast} Slow=${r.slow}`);
|
|
624
|
-
console.log(` ├─ Area total: ${r.area.total.toFixed(2)} (above ${r.area.above.toFixed(2)} below ${r.area.below.toFixed(2)})`);
|
|
625
|
-
console.log(` ├─ Asymmetry: ${asymmetry.toFixed(2)} (${bias})`);
|
|
626
|
-
console.log(` └─ Movement: ${r.amaMovementTotal.toFixed(4)}\n`);
|
|
627
|
-
}
|
|
628
|
-
console.log('================================================================================');
|
|
629
|
-
console.log(` 4 AMAs — pure geometric (${ER_VALUES.length}×${FAST_VALUES.length}×${SLOW_VALUES_AREA.length} combinations)`);
|
|
630
|
-
console.log('================================================================================\n');
|
|
631
|
-
for (const w of selected) {
|
|
632
|
-
detail(w.label, w, `score=${w.weightedScore.toFixed(6)} λ=${objectiveResults.find((r) => r.objective?.key === w.key)?.distanceWeight?.toFixed(4) || 'n/a'} rawDist=${w.distanceTotal.toFixed(2)} rawMove=${w.amaMovementTotal.toFixed(2)}`);
|
|
633
|
-
}
|
|
634
|
-
for (const r of objectiveResults) {
|
|
635
|
-
if (Number.isFinite(r.maxDistanceCap)) {
|
|
636
|
-
console.log(` ${r.objective.key} cap value: ${r.maxDistanceCap.toFixed(4)} (candidates under cap: ${r.candidatesUnderCap})`);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
console.log();
|
|
640
|
-
// ── Side-by-side summary ───────────────────────────────────────────────────
|
|
641
|
-
console.log('================================================================================');
|
|
642
|
-
console.log(' SUMMARY');
|
|
643
|
-
console.log('================================================================================\n');
|
|
644
|
-
console.log(' | ER | Fast | Slow | Dist | Move | Area | MaxDist');
|
|
645
|
-
console.log('────────────────┼──────┼──────┼──────┼─────────┼─────────┼─────────┼─────────');
|
|
646
|
-
for (const r of selected) {
|
|
647
|
-
const name = r.key;
|
|
648
|
-
if (!r)
|
|
649
|
-
continue;
|
|
650
|
-
console.log(`${name.padEnd(15)} | ` +
|
|
651
|
-
`${r.er.toString().padStart(4)} | ` +
|
|
652
|
-
`${r.fast.toFixed(1).padStart(4)} | ` +
|
|
653
|
-
`${r.slow.toFixed(1).padStart(4)} | ` +
|
|
654
|
-
`${r.distanceTotal.toFixed(2).padStart(7)} | ` +
|
|
655
|
-
`${r.amaMovementTotal.toFixed(2).padStart(7)} | ` +
|
|
656
|
-
`${r.area.total.toFixed(2).padStart(7)} | ` +
|
|
657
|
-
`${(r.area.maxDist * 100).toFixed(1).padStart(7)}%`);
|
|
658
|
-
}
|
|
659
|
-
console.log();
|
|
660
|
-
const boundarySummary = {
|
|
661
|
-
AMA1: boundaryFlags(ama1, ER_VALUES, FAST_VALUES, SLOW_VALUES_AREA, args.fixedEr, args.fixedFast),
|
|
662
|
-
AMA2: boundaryFlags(ama2, ER_VALUES, FAST_VALUES, SLOW_VALUES_AREA, args.fixedEr, args.fixedFast),
|
|
663
|
-
AMA3: boundaryFlags(ama3, ER_VALUES, FAST_VALUES, SLOW_VALUES_AREA, args.fixedEr, args.fixedFast),
|
|
664
|
-
AMA4: boundaryFlags(ama4, ER_VALUES, FAST_VALUES, SLOW_VALUES_AREA, args.fixedEr, args.fixedFast),
|
|
665
|
-
};
|
|
666
|
-
console.log(' Boundary Check');
|
|
667
|
-
console.log('────────────────────────────────────────────────────────────────────────────────');
|
|
668
|
-
for (const [name, b] of Object.entries(boundarySummary)) {
|
|
669
|
-
const txt = b.any ? `ER:${b.er || '-'} Fast:${b.fast || '-'} Slow:${b.slow || '-'}` : 'none';
|
|
670
|
-
console.log(`${name.padEnd(24)} ${txt}`);
|
|
671
|
-
}
|
|
672
|
-
console.log();
|
|
673
|
-
// ── Chart ─────────────────────────────────────────────────────────────────
|
|
674
|
-
const ws = (v) => String(v).replace('.', '_');
|
|
675
|
-
const lambdaSuffix = `_w${objectives.map((o) => ws(String(o.distanceWeight))).join('_')}`;
|
|
676
|
-
const COLOR_CYCLE = ['#26a69a', '#fb8c00', '#5c9ee6', '#ef5350'];
|
|
677
|
-
const DASH_CYCLE = ['dot', 'solid', 'dash', 'dashdot'];
|
|
678
|
-
const candleArrays = candles.map(c => [c.timestamp, c.open, c.high, c.low, c.close, c.volume]);
|
|
679
|
-
const chartMeta = {
|
|
680
|
-
...(dataMeta || {}),
|
|
681
|
-
assetA: dataMeta?.assetA || { symbol: '?' },
|
|
682
|
-
assetB: dataMeta?.assetB || { symbol: '?' },
|
|
683
|
-
intervalSeconds: dataMeta?.intervalSeconds || 3600,
|
|
684
|
-
fetchedAt: dataMeta?.fetchedAt || new Date().toISOString(),
|
|
685
|
-
};
|
|
686
|
-
const amaResults = selected.map((w, i) => {
|
|
687
|
-
const ama = calculateAMA(closes, { erPeriod: w.er, fastPeriod: w.fast, slowPeriod: w.slow });
|
|
688
|
-
return {
|
|
689
|
-
name: w.label,
|
|
690
|
-
erPeriod: w.er,
|
|
691
|
-
fastPeriod: w.fast,
|
|
692
|
-
slowPeriod: w.slow,
|
|
693
|
-
color: COLOR_CYCLE[i % COLOR_CYCLE.length],
|
|
694
|
-
dash: DASH_CYCLE[i % DASH_CYCLE.length],
|
|
695
|
-
lineWidth: i === 0 ? 2 : 1.5,
|
|
696
|
-
values: ama,
|
|
697
|
-
};
|
|
698
|
-
});
|
|
699
|
-
const chartName = dataFile
|
|
700
|
-
? `optimization_chart_${path.basename(dataFile, '.json')}${lambdaSuffix}.html`
|
|
701
|
-
: `optimization_chart_high_resolution${lambdaSuffix}.html`;
|
|
702
|
-
const chartPath = path.join(PATHS.ANALYSIS.CHARTS_DIR, chartName);
|
|
703
|
-
ensureDir(path.dirname(chartPath));
|
|
704
|
-
const html = generateHTML(chartMeta, candleArrays, amaResults);
|
|
705
|
-
fs.writeFileSync(chartPath, html, 'utf8');
|
|
706
|
-
console.log(` Chart: ${path.relative(process.cwd(), chartPath)}\n`);
|
|
707
|
-
// ── Save ──────────────────────────────────────────────────────────────────
|
|
708
|
-
const outName = dataFile
|
|
709
|
-
? `optimization_results_${path.basename(dataFile, '.json')}${lambdaSuffix}.json`
|
|
710
|
-
: `optimization_results_high_resolution${lambdaSuffix}.json`;
|
|
711
|
-
const outPath = path.join(__dirname, outName);
|
|
712
|
-
writeJSON(outPath, {
|
|
713
|
-
meta: {
|
|
714
|
-
dataLabel,
|
|
715
|
-
candles: candles.length,
|
|
716
|
-
totalCombos,
|
|
717
|
-
ranges: {
|
|
718
|
-
er: { ...erDim.meta },
|
|
719
|
-
fast: { ...fastDim.meta },
|
|
720
|
-
slow: { ...slowDim.meta },
|
|
721
|
-
fixedEr: Number.isFinite(args.fixedEr) ? args.fixedEr : null,
|
|
722
|
-
fixedFast: Number.isFinite(args.fixedFast) ? args.fixedFast : null,
|
|
723
|
-
},
|
|
724
|
-
boundaryFlags: boundarySummary,
|
|
725
|
-
objective: {
|
|
726
|
-
type: 'per_ama_distance_weights',
|
|
727
|
-
distanceMetric: 'sum(abs(close-ama)/ama)',
|
|
728
|
-
movementMetric: 'sum(abs(ama_t-ama_t-1)/ama_t-1)',
|
|
729
|
-
distanceWeightByAma: Object.fromEntries(objectiveResults.map((r) => [r.objective.key, r.distanceWeight])),
|
|
730
|
-
weights: objectives,
|
|
731
|
-
maxDistanceCap: {
|
|
732
|
-
value: null,
|
|
733
|
-
quantileByAma: Object.fromEntries(objectives.map((o) => [o.key, o.distanceCapQuantile])),
|
|
734
|
-
appliedValueByAma: Object.fromEntries(objectiveResults.map((r) => [r.objective.key, r.maxDistanceCap])),
|
|
735
|
-
},
|
|
736
|
-
},
|
|
737
|
-
amas: {
|
|
738
|
-
AMA1: ama1,
|
|
739
|
-
AMA2: ama2,
|
|
740
|
-
AMA3: ama3,
|
|
741
|
-
AMA4: ama4,
|
|
742
|
-
},
|
|
743
|
-
},
|
|
744
|
-
});
|
|
745
|
-
if (args.writeProfiles && dataFile && ama1 && ama2 && ama3 && ama4) {
|
|
746
|
-
updateAmaProfilesFile({
|
|
747
|
-
dataFile,
|
|
748
|
-
meta: dataMeta,
|
|
749
|
-
winners: { ama1, ama2, ama3, ama4 },
|
|
750
|
-
sourceResultsFile: outName,
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
console.log(`================================================================================`);
|
|
754
|
-
console.log(` Saved: ${outName}\n`);
|
|
755
|
-
if (args.writeProfiles && dataFile) {
|
|
756
|
-
console.log(` Updated: ${path.relative(process.cwd(), AMA_PROFILES_FILE)}\n`);
|
|
757
|
-
}
|
|
758
|
-
else {
|
|
759
|
-
console.log(` Profiles unchanged. Add --write-profiles to update ${path.relative(process.cwd(), AMA_PROFILES_FILE)}.\n`);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (!isMainThread) {
|
|
763
|
-
if (workerData?.type === 'search_shard') {
|
|
764
|
-
const result = runSearchShard(workerData.payload, (p) => {
|
|
765
|
-
parentPort.postMessage({ type: 'progress', ...p });
|
|
766
|
-
});
|
|
767
|
-
parentPort.postMessage({ type: 'done', result });
|
|
768
|
-
}
|
|
769
|
-
else {
|
|
770
|
-
throw new Error('Unknown worker task type');
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
else if (require.main === module) {
|
|
774
|
-
run().catch((err) => {
|
|
775
|
-
console.error('Fatal:', err);
|
|
776
|
-
process.exit(1);
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
module.exports = {
|
|
780
|
-
parseArgs,
|
|
781
|
-
};
|
|
782
|
-
//# sourceMappingURL=optimizer_high_resolution.js.map
|