dexbot 1.3.3 → 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 +21 -22
- 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 -494
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +69 -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 +262 -81
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +156 -123
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +12 -9
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +132 -60
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- 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 +5 -20
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +55 -116
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +12 -12
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +55 -45
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +2 -6
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +115 -79
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +11 -24
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +62 -28
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- 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 -21
- 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 -14
- 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 -19
- 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 -33
- 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 -38
- 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 -23
- 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 -109
- 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 +50 -56
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +66 -57
- 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/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 +1 -1
- 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,1450 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { DEFAULT_CONFIG, MARKET_ADAPTER } = require('../../modules/constants');
|
|
3
|
-
const { buildKalmanVelocitySeries, } = require('./kalman_velocity_smoothing');
|
|
4
|
-
const { getAmaWarmupBars } = require('../../market_adapter/core/strategies/ama');
|
|
5
|
-
const { escapeHtml, serializeJsonForScript, toEpochSeconds, UPLOT_SHARED_SCRIPT } = require('../chart_utils');
|
|
6
|
-
const { roundTo } = require('../../modules/utils/math_utils');
|
|
7
|
-
function generateHTML(data, title = 'Dynamic Weight Research') {
|
|
8
|
-
const results = data.allResults || [];
|
|
9
|
-
if (results.length === 0)
|
|
10
|
-
throw new Error('No analysis results in input');
|
|
11
|
-
const ma = data.marketAdapter || {};
|
|
12
|
-
const amaWeightConfig = data.amaWeightConfig || {};
|
|
13
|
-
const defaultAlpha = data.alpha ?? ma.alpha ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_ALPHA;
|
|
14
|
-
const defaultGain = data.gain ?? ma.gain ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_GAIN;
|
|
15
|
-
const defaultNeutralZone = amaWeightConfig.neutralZonePct ?? ma.amaNeutralZonePct ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_NEUTRAL_ZONE_PCT;
|
|
16
|
-
const defaultDispWeight = data.dispWeight ?? ma.dispWeight ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_DW;
|
|
17
|
-
const defaultAmaMaxSlopePct = amaWeightConfig.amaMaxSlopePct
|
|
18
|
-
?? ma.amaMaxSlopePct
|
|
19
|
-
?? MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_MAX_SLOPE_PCT;
|
|
20
|
-
const defaultKalmanMaxSlopePct = amaWeightConfig.kalmanMaxSlopePct
|
|
21
|
-
?? ma.kalmanMaxSlopePct
|
|
22
|
-
?? defaultAmaMaxSlopePct
|
|
23
|
-
?? MARKET_ADAPTER.DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT;
|
|
24
|
-
const defaultClipPct = data.clipPct ?? ma.clipPercentile ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_CLIP_PERCENTILE;
|
|
25
|
-
const defaultMinOutputThresholdRaw = data.minOutputThreshold ?? ma.minOutputThreshold ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_ASYMMETRIC_TREND_THRESHOLD;
|
|
26
|
-
const defaultMinOutputThreshold = Math.min(Math.max(defaultMinOutputThresholdRaw, 0), 0.5);
|
|
27
|
-
const defaultOutputClamp = data.outputClamp ?? ma.outputClamp ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_ASYMMETRIC_OFFSET_CLAMP;
|
|
28
|
-
const lookbackBarsRaw = amaWeightConfig.lookbackBars ?? ma.amaLookbackBars ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_AMA_LOOKBACK_BARS;
|
|
29
|
-
const lookbackBars = Math.ceil(Math.max(1, Math.min(32, Number.isFinite(lookbackBarsRaw) ? lookbackBarsRaw : 1)));
|
|
30
|
-
// Log mapping for lookback slider (1 to 32 bars)
|
|
31
|
-
const LB_LOG_MIN_N = Math.log(1);
|
|
32
|
-
const LB_LOG_MAX_N = Math.log(32);
|
|
33
|
-
const clampedLb = Math.min(Math.max(lookbackBars, 1), 32);
|
|
34
|
-
const lbInitSlider = Math.round((Math.log(clampedLb) - LB_LOG_MIN_N) / (LB_LOG_MAX_N - LB_LOG_MIN_N) * 1000);
|
|
35
|
-
// Log mapping for gain slider
|
|
36
|
-
const GAIN_LOG_MIN_N = Math.log(0.5);
|
|
37
|
-
const GAIN_LOG_MAX_N = Math.log(2.0);
|
|
38
|
-
const clampedGain = Math.min(Math.max(defaultGain, 0.5), 2.0);
|
|
39
|
-
const gainInitSlider = Math.round((Math.log(clampedGain) - GAIN_LOG_MIN_N) / (GAIN_LOG_MAX_N - GAIN_LOG_MIN_N) * 1000);
|
|
40
|
-
// Log mapping for slope saturation sliders
|
|
41
|
-
const AMA_MS_MIN = 0.04;
|
|
42
|
-
const AMA_MS_MAX = 0.12;
|
|
43
|
-
const AMA_MS_LOG_MIN_N = Math.log(AMA_MS_MIN);
|
|
44
|
-
const AMA_MS_LOG_MAX_N = Math.log(AMA_MS_MAX);
|
|
45
|
-
const KAL_MS_MIN = 0.15;
|
|
46
|
-
const KAL_MS_MAX = 1.5;
|
|
47
|
-
const KAL_MS_LOG_MIN_N = Math.log(KAL_MS_MIN);
|
|
48
|
-
const KAL_MS_LOG_MAX_N = Math.log(KAL_MS_MAX);
|
|
49
|
-
const clampedAmaMs = Math.min(Math.max(defaultAmaMaxSlopePct, AMA_MS_MIN), AMA_MS_MAX);
|
|
50
|
-
const clampedKalMs = Math.min(Math.max(defaultKalmanMaxSlopePct, KAL_MS_MIN), KAL_MS_MAX);
|
|
51
|
-
const amaMsInitSlider = Math.round((Math.log(clampedAmaMs) - AMA_MS_LOG_MIN_N) / (AMA_MS_LOG_MAX_N - AMA_MS_LOG_MIN_N) * 1000);
|
|
52
|
-
const kalMsInitSlider = Math.round((Math.log(clampedKalMs) - KAL_MS_LOG_MIN_N) / (KAL_MS_LOG_MAX_N - KAL_MS_LOG_MIN_N) * 1000);
|
|
53
|
-
const defaultRegimeSensitivity = data.regimeSensitivity ?? ma.regimeSensitivity ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_REGIME_SENSITIVITY;
|
|
54
|
-
const defaultAbsoluteThreshold = ma.absoluteThreshold ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_ABSOLUTE_THRESHOLD_DEFAULT;
|
|
55
|
-
const defaultDispScaleMinPct = data.dispScaleMinPct ?? ma.dispScaleMinPct ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_DISP_SCALE_MIN_PCT;
|
|
56
|
-
const defaultKalmanSmoothPct = data.kalmanSmoothPct ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_KALMAN_SMOOTH_PCT_DEFAULT;
|
|
57
|
-
const defaultKalmanDispScaleMult = data.kalmanDispScaleMult ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_KALMAN_DISP_SCALE_MULT_DEFAULT;
|
|
58
|
-
const defaultKalmanDispThresholdMult = data.kalmanDispThresholdMult ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_KALMAN_DISP_THRESHOLD_MULT_DEFAULT;
|
|
59
|
-
const defaultKalmanSmoothSpanPct = data.kalmanSmoothSpanPct ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_KALMAN_SMOOTH_SPAN_PCT_DEFAULT;
|
|
60
|
-
const defaultSignalConfirmBars = data.signalConfirmBars ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_SIGNAL_CONFIRM_BARS_DEFAULT;
|
|
61
|
-
const regimeInitSlider = Math.round(defaultRegimeSensitivity * 100);
|
|
62
|
-
const interval = results.length > 1 ?
|
|
63
|
-
(new Date(results[1].timestamp).getTime() - new Date(results[0].timestamp).getTime()) / 1000 : 3600;
|
|
64
|
-
const dates = results.map((r, idx) => toEpochSeconds(r.timestamp || Date.now(), idx));
|
|
65
|
-
const prices = results.map((r) => r.price);
|
|
66
|
-
const hurstArr = results.map((r) => r.hurst ?? null);
|
|
67
|
-
const peArr = results.map((r) => r.pe ?? null);
|
|
68
|
-
const hurstSegments = results.map((r) => r.hurstSegment ?? null);
|
|
69
|
-
const peSegments = results.map((r) => r.peSegment ?? null);
|
|
70
|
-
const amaSlopePct = results.map((r) => r.amaSlopePct ?? null);
|
|
71
|
-
const kalmanVelocityPctRaw = results.map((r) => r.velocityRawPct ?? r.velocityPct ?? null);
|
|
72
|
-
const kalmanDisplacementPct = results.map((r) => r.displacementRawPct ?? r.displacementPct ?? null);
|
|
73
|
-
const kalmanVelocityPct = buildKalmanVelocitySeries(results, {
|
|
74
|
-
kalmanSmoothPct: defaultKalmanSmoothPct,
|
|
75
|
-
kalmanDispScaleMult: defaultKalmanDispScaleMult,
|
|
76
|
-
kalmanDispThresholdMult: defaultKalmanDispThresholdMult,
|
|
77
|
-
kalmanSmoothSpanPct: defaultKalmanSmoothSpanPct,
|
|
78
|
-
});
|
|
79
|
-
const kalmanIsReady = results.map((r) => r.isReady ?? false);
|
|
80
|
-
const signals = results.map((r) => r.signal);
|
|
81
|
-
const amaLabel = data.amaKey || 'AMA3';
|
|
82
|
-
const ama3Prices = results.map((r) => r.ama3Price ?? null);
|
|
83
|
-
const amaErPeriod = data.amaConfig?.erPeriod ?? MARKET_ADAPTER.AMAS[MARKET_ADAPTER.DEFAULT_AMA_KEY].erPeriod;
|
|
84
|
-
const amaSlowPeriod = data.amaConfig?.slowPeriod ?? MARKET_ADAPTER.AMAS[MARKET_ADAPTER.DEFAULT_AMA_KEY].slowPeriod;
|
|
85
|
-
const amaFastPeriod = data.amaConfig?.fastPeriod ?? MARKET_ADAPTER.AMAS[MARKET_ADAPTER.DEFAULT_AMA_KEY].fastPeriod;
|
|
86
|
-
const amaErSmoothPeriod = data.amaConfig?.erSmoothPeriod ?? 0;
|
|
87
|
-
const amaWarmupBars = getAmaWarmupBars(amaErPeriod, amaSlowPeriod, lookbackBars, amaFastPeriod, amaErSmoothPeriod);
|
|
88
|
-
const amaSlopeReadyBars = Math.ceil(amaErPeriod) + lookbackBars;
|
|
89
|
-
const amaSeedSmaLine = new Array(results.length).fill(null);
|
|
90
|
-
const amaSeedWindowEnd = Math.min(results.length - 1, Math.ceil(amaErPeriod));
|
|
91
|
-
if (amaSeedWindowEnd >= 0) {
|
|
92
|
-
let seedSum = 0;
|
|
93
|
-
let seedCount = 0;
|
|
94
|
-
for (let i = 0; i <= amaSeedWindowEnd; i++) {
|
|
95
|
-
if (Number.isFinite(prices[i])) {
|
|
96
|
-
seedSum += prices[i];
|
|
97
|
-
seedCount++;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (seedCount > 0) {
|
|
101
|
-
const seedSma = seedSum / seedCount;
|
|
102
|
-
for (let i = 0; i <= amaSeedWindowEnd; i++) {
|
|
103
|
-
amaSeedSmaLine[i] = seedSma;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const lastDate = dates[dates.length - 1];
|
|
108
|
-
for (let i = 1; i <= 150; i++) {
|
|
109
|
-
dates.push(lastDate + (i * interval));
|
|
110
|
-
prices.push(null);
|
|
111
|
-
hurstArr.push(null);
|
|
112
|
-
peArr.push(null);
|
|
113
|
-
hurstSegments.push(null);
|
|
114
|
-
peSegments.push(null);
|
|
115
|
-
amaSlopePct.push(null);
|
|
116
|
-
kalmanVelocityPctRaw.push(null);
|
|
117
|
-
kalmanVelocityPct.push(null);
|
|
118
|
-
kalmanDisplacementPct.push(null);
|
|
119
|
-
kalmanIsReady.push(null);
|
|
120
|
-
signals.push(null);
|
|
121
|
-
ama3Prices.push(null);
|
|
122
|
-
amaSeedSmaLine.push(null);
|
|
123
|
-
}
|
|
124
|
-
const realBarCount = results.length;
|
|
125
|
-
function maxAbsPct(arr) {
|
|
126
|
-
let m = 0;
|
|
127
|
-
for (let i = 0; i < realBarCount; i++) {
|
|
128
|
-
if (arr[i] != null && Math.abs(arr[i]) > m)
|
|
129
|
-
m = Math.abs(arr[i]);
|
|
130
|
-
}
|
|
131
|
-
return m || 4;
|
|
132
|
-
}
|
|
133
|
-
const amaPctMax = Math.ceil(maxAbsPct(amaSlopePct) * 1.15) || 5;
|
|
134
|
-
const kalPctMax = Math.ceil(Math.max(maxAbsPct(kalmanVelocityPct), maxAbsPct(kalmanDisplacementPct)) * 1.15) || 5;
|
|
135
|
-
function buildPercentiles(arr, startIndex = 0) {
|
|
136
|
-
const safeStartIndex = Math.max(0, Math.min(realBarCount, Math.ceil(startIndex)));
|
|
137
|
-
const sorted = [];
|
|
138
|
-
for (let i = safeStartIndex; i < realBarCount; i++) {
|
|
139
|
-
if (arr[i] != null)
|
|
140
|
-
sorted.push(Math.abs(arr[i]));
|
|
141
|
-
}
|
|
142
|
-
sorted.sort((a, b) => a - b);
|
|
143
|
-
const pcts = [];
|
|
144
|
-
for (let p = 0; p <= 100; p++) {
|
|
145
|
-
const idx = Math.min(Math.floor(sorted.length * p / 100), sorted.length - 1);
|
|
146
|
-
pcts.push(sorted[idx] || 0);
|
|
147
|
-
}
|
|
148
|
-
return pcts;
|
|
149
|
-
}
|
|
150
|
-
const amaPercentiles = buildPercentiles(amaSlopePct, amaSlopeReadyBars);
|
|
151
|
-
const kalPercentiles = buildPercentiles(kalmanVelocityPct);
|
|
152
|
-
const maxDispPct = Math.ceil(maxAbsPct(kalmanDisplacementPct) * 1.15) || 5;
|
|
153
|
-
return `<!DOCTYPE html>
|
|
154
|
-
<html lang="en">
|
|
155
|
-
<head>
|
|
156
|
-
<meta charset="UTF-8">
|
|
157
|
-
<title>${escapeHtml(title)}</title>
|
|
158
|
-
<link rel="stylesheet" href="../uplot/uPlot.min.css">
|
|
159
|
-
<script src="../uplot/uPlot.iife.min.js"></script>
|
|
160
|
-
<style>
|
|
161
|
-
* { box-sizing: border-box; }
|
|
162
|
-
body { background: #0b0e14; color: #d1d5db; font-family: 'Segoe UI', sans-serif; margin: 0; padding: 0; overflow: hidden; }
|
|
163
|
-
#header { padding: 10px 20px; background: #161b22; border-bottom: 1px solid #30363d; display: flex; align-items: center; justify-content: space-between; height: 45px; z-index: 100; }
|
|
164
|
-
#panels { display: flex; flex-direction: column; height: calc(100vh - 45px); width: 100vw; }
|
|
165
|
-
#price-panel { flex: 0 0 34%; min-height: 0; position: relative; border-bottom: 1px solid #30363d; }
|
|
166
|
-
#ama-panel { flex: 0 0 14%; min-height: 0; position: relative; border-bottom: 1px solid #30363d; }
|
|
167
|
-
#kalman-panel { flex: 0 0 21%; min-height: 0; position: relative; border-bottom: 1px solid #30363d; }
|
|
168
|
-
#output-panel { flex: 1 1 0; min-height: 0; position: relative; }
|
|
169
|
-
.uplot { background: #0b0e14; }
|
|
170
|
-
.legend { position: absolute; top: 8px; left: 70px; font-size: 11px; pointer-events: none; z-index: 10; display: flex; flex-wrap: wrap; gap: 4px 8px; color: #8b949e; white-space: nowrap; align-items: center; max-width: calc(100% - 86px); }
|
|
171
|
-
.legend-item { display: flex; align-items: center; gap: 3px; }
|
|
172
|
-
.legend-val { font-family: monospace; display: inline-block; text-align: right; min-width: 45px; }
|
|
173
|
-
#l-price, #l-ama3 { min-width: 62px; }
|
|
174
|
-
#l-ama-slope, #l-kal-vel, #l-kal-disp { min-width: 54px; }
|
|
175
|
-
#l-signal, #l-signal-latched { min-width: 70px; text-align: left; }
|
|
176
|
-
#l-combined-raw, #l-combined-echo { min-width: 42px; }
|
|
177
|
-
#l-mult { min-width: 38px; }
|
|
178
|
-
#l-sell, #l-buy { min-width: 30px; }
|
|
179
|
-
.dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
|
|
180
|
-
.u-cursor-x { border-left: 1px dashed rgba(255,255,255,0.3) !important; }
|
|
181
|
-
.u-cursor-y { border-top: 1px dashed rgba(255,255,255,0.3) !important; display: none; }
|
|
182
|
-
.is-hovered .u-cursor-y { display: block; }
|
|
183
|
-
.ctrl { pointer-events: auto; display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; }
|
|
184
|
-
.ctrl label { color: #8b949e; font-size: 10px; min-width: 24px; text-align: right; margin-right: 2px; }
|
|
185
|
-
.ctrl.alpha label { min-width: 8px; }
|
|
186
|
-
.ctrl.ms label { min-width: 32px; }
|
|
187
|
-
.ctrl.clip label { min-width: 30px; }
|
|
188
|
-
.ctrl.off label { min-width: 24px; }
|
|
189
|
-
.ctrl.regime label { min-width: 24px; }
|
|
190
|
-
.ctrl input[type="range"] { width: 80px; height: 3px; }
|
|
191
|
-
.ctrl .val { font-weight: bold; font-size: 10px; min-width: 30px; display: inline-block; text-align: right; }
|
|
192
|
-
.group-sep { border-left: 1px solid #30363d; margin-left: 6px; padding-left: 4px; display: inline-flex; align-items: center; height: 16px; }
|
|
193
|
-
.group-label { font-size: 9px; color: #484f58; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 8px; font-weight: bold; }
|
|
194
|
-
.ctrl.alpha input[type="range"] { accent-color: #58a6ff; width: 80px; }
|
|
195
|
-
.ctrl.alpha .val { color: #58a6ff; }
|
|
196
|
-
.ctrl.dw label { min-width: 20px; }
|
|
197
|
-
.ctrl.dw input[type="range"] { accent-color: #a371f7; width: 80px; }
|
|
198
|
-
.ctrl.dw .val { color: #a371f7; }
|
|
199
|
-
.ctrl.kf label { min-width: 20px; }
|
|
200
|
-
.ctrl.kf input[type="range"] { accent-color: #79c0ff; width: 80px; }
|
|
201
|
-
.ctrl.kf .val { color: #79c0ff; }
|
|
202
|
-
.ctrl.kfd label { min-width: 20px; }
|
|
203
|
-
.ctrl.kfd input[type="range"] { accent-color: #58a6ff; width: 80px; }
|
|
204
|
-
.ctrl.kfd .val { color: #58a6ff; }
|
|
205
|
-
.ctrl.kdt label { min-width: 20px; }
|
|
206
|
-
.ctrl.kdt input[type="range"] { accent-color: #f78166; width: 80px; }
|
|
207
|
-
.ctrl.kdt .val { color: #f78166; }
|
|
208
|
-
.ctrl.kfs label { min-width: 20px; }
|
|
209
|
-
.ctrl.kfs input[type="range"] { accent-color: #ffab70; width: 80px; }
|
|
210
|
-
.ctrl.kfs .val { color: #ffab70; }
|
|
211
|
-
.ctrl.ms-ama label { min-width: 32px; }
|
|
212
|
-
.ctrl.ms-ama input[type="range"] { accent-color: #e3b341; width: 80px; }
|
|
213
|
-
.ctrl.ms-ama .val { color: #e3b341; }
|
|
214
|
-
.ctrl.ms-kal label { min-width: 32px; }
|
|
215
|
-
.ctrl.ms-kal input[type="range"] { accent-color: #f0883e; width: 80px; }
|
|
216
|
-
.ctrl.ms-kal .val { color: #f0883e; }
|
|
217
|
-
.ctrl.cf label { min-width: 20px; }
|
|
218
|
-
.ctrl.cf input[type="range"] { accent-color: #d2a8ff; width: 80px; }
|
|
219
|
-
.ctrl.cf .val { color: #d2a8ff; }
|
|
220
|
-
.ctrl.lb label { min-width: 20px; }
|
|
221
|
-
.ctrl.lb input[type="range"] { accent-color: #39d0d8; width: 80px; }
|
|
222
|
-
.ctrl.lb .val { color: #39d0d8; }
|
|
223
|
-
.ctrl.off input[type="range"] { accent-color: #3fb950; }
|
|
224
|
-
.ctrl.off .val { color: #3fb950; }
|
|
225
|
-
.ctrl.nz input[type="range"] { accent-color: #8b949e; }
|
|
226
|
-
.ctrl.nz .val { color: #8b949e; }
|
|
227
|
-
.copy-btn, .paste-btn { pointer-events: auto; margin-left: 6px; padding: 2px 10px; font-size: 10px; background: #21262d; color: #8b949e; border: 1px solid #30363d; border-radius: 4px; cursor: pointer; }
|
|
228
|
-
.copy-btn:hover, .paste-btn:hover { background: #30363d; color: #e6edf3; }
|
|
229
|
-
.copy-btn.copied { color: #3fb950; border-color: #3fb950; }
|
|
230
|
-
.paste-btn.pasted { color: #58a6ff; border-color: #58a6ff; }
|
|
231
|
-
.paste-btn.error { color: #f85149; border-color: #f85149; }
|
|
232
|
-
#paste-confirm { display: none; position: fixed; background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 14px 16px; z-index: 1000; box-shadow: 0 4px 24px rgba(0,0,0,0.7); min-width: 200px; }
|
|
233
|
-
#paste-confirm-title { font-size: 10px; color: #8b949e; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
|
|
234
|
-
#paste-confirm-vals { font-size: 11px; font-family: monospace; color: #e6edf3; line-height: 1.7; margin-bottom: 12px; }
|
|
235
|
-
#paste-confirm-vals span { color: #58a6ff; }
|
|
236
|
-
#paste-confirm-btns { display: flex; gap: 6px; justify-content: flex-end; }
|
|
237
|
-
#paste-confirm-btns button { padding: 3px 12px; font-size: 10px; border-radius: 4px; cursor: pointer; border: 1px solid #30363d; background: #21262d; color: #8b949e; }
|
|
238
|
-
#paste-confirm-apply { background: #1f4e23 !important; color: #3fb950 !important; border-color: #3fb950 !important; }
|
|
239
|
-
#paste-confirm-apply:hover { background: #2ea043 !important; color: #fff !important; }
|
|
240
|
-
|
|
241
|
-
.ctrl.clip input[type="range"] { accent-color: #da3633; }
|
|
242
|
-
.ctrl.clip .val { color: #da3633; }
|
|
243
|
-
.ctrl.regime input[type="range"] { accent-color: #d2a8ff; }
|
|
244
|
-
.ctrl.regime .val { color: #d2a8ff; }
|
|
245
|
-
.row-break { flex-basis: 100%; height: 0; }
|
|
246
|
-
|
|
247
|
-
.section-label { position: absolute; top: 8px; right: 12px; font-size: 9px; color: #30363d; text-transform: uppercase; letter-spacing: 1px; z-index: 10; pointer-events: none; }
|
|
248
|
-
</style>
|
|
249
|
-
</head>
|
|
250
|
-
<body>
|
|
251
|
-
<div id="header">
|
|
252
|
-
<div style="font-weight:bold;color:#fff;">${escapeHtml(title)}</div>
|
|
253
|
-
<div style="font-size:11px;color:#8b949e;text-transform:uppercase;">Log Price \u2192 AMA Slope \u2192 Kalman Composite \u2192 Dynamic Weight | Scroll \u00b7 Drag \u00b7 Ctrl+0</div>
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
<div id="panels">
|
|
257
|
-
<div id="price-panel">
|
|
258
|
-
<div class="section-label">PRICE (LOG)</div>
|
|
259
|
-
<div class="legend">
|
|
260
|
-
<div class="legend-item"><div class="dot" style="background:#58a6ff;"></div>Price: <span id="l-price" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
261
|
-
<div class="legend-item"><div class="dot" style="background:#e3b341;"></div>${amaLabel}: <span id="l-ama3" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
262
|
-
<div class="legend-item"><div class="dot" style="background:#8b949e;"></div>Seed SMA: <span id="l-seed-sma" class="legend-val">-</span></div>
|
|
263
|
-
</div>
|
|
264
|
-
<div id="price-chart"></div>
|
|
265
|
-
</div>
|
|
266
|
-
<div id="ama-panel">
|
|
267
|
-
<div class="section-label">AMA SLOPE INPUT</div>
|
|
268
|
-
<div class="legend">
|
|
269
|
-
<div class="legend-item"><div class="dot" style="background:#f0a000;"></div>Slope%: <span id="l-ama-slope" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
270
|
-
</div>
|
|
271
|
-
<div id="ama-chart"></div>
|
|
272
|
-
</div>
|
|
273
|
-
<div id="kalman-panel">
|
|
274
|
-
<div class="section-label">KALMAN COMPOSITE INPUT</div>
|
|
275
|
-
<div class="legend">
|
|
276
|
-
<div class="legend-item"><div class="dot" style="background:#d2a8ff;"></div>Vel%: <span id="l-kal-vel" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
277
|
-
<div class="legend-item"><div class="dot" style="background:#79c0ff;"></div>Disp%: <span id="l-kal-disp" class="legend-val">-</span></div>
|
|
278
|
-
<div class="legend-item">Raw: <span id="l-signal" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
279
|
-
<div class="legend-item">Echo: <span id="l-signal-echo" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
280
|
-
<div class="legend-item">Latched: <span id="l-signal-latched" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
281
|
-
</div>
|
|
282
|
-
<div id="kalman-chart"></div>
|
|
283
|
-
</div>
|
|
284
|
-
<div id="output-panel">
|
|
285
|
-
<div class="section-label">COMBINED WEIGHT OUTPUT</div>
|
|
286
|
-
<div class="legend" style="gap: 4px;">
|
|
287
|
-
<div class="legend-item"><div class="dot" style="background:linear-gradient(to bottom,#8b949e,#8b949e);"></div>Raw: <span id="l-combined-raw" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
288
|
-
<div class="legend-item"><div class="dot" style="background:linear-gradient(to bottom,#2ea043,#f85149);"></div>Echo: <span id="l-combined-echo" class="legend-val" style="font-weight:bold;">-</span></div>
|
|
289
|
-
<div class="legend-item">xMult: <span id="l-mult" class="legend-val" style="font-weight:bold;color:#d2a8ff;">-</span></div>
|
|
290
|
-
<div class="legend-item">S: <span id="l-sell" class="legend-val" style="color:#ff7b72;">-</span></div>
|
|
291
|
-
<div class="legend-item">B: <span id="l-buy" class="legend-val" style="color:#58a6ff;">-</span></div>
|
|
292
|
-
|
|
293
|
-
<div class="group-sep"></div>
|
|
294
|
-
<div class="ctrl alpha"><label for="alpha-slider">α</label><input type="range" id="alpha-slider" min="0" max="100" value="${Math.round(defaultAlpha * 100)}" title="Alpha Mix (AMA vs Kalman)"><span class="val" id="alpha-value">${defaultAlpha.toFixed(2)}</span></div>
|
|
295
|
-
<div class="ctrl dw"><label for="dw-slider">dw</label><input type="range" id="dw-slider" min="0" max="100" value="${Math.round(defaultDispWeight * 100)}" title="Displacement Weight"><span class="val" id="dw-value">${defaultDispWeight.toFixed(2)}</span></div>
|
|
296
|
-
|
|
297
|
-
<div class="group-sep"></div>
|
|
298
|
-
<div class="ctrl nz"><label for="nz-slider">nz%</label><input type="range" id="nz-slider" min="0" max="100" value="${Math.round(defaultNeutralZone * 100)}" title="Neutral Zone %"><span class="val" id="nz-value">${defaultNeutralZone.toFixed(2)}</span></div>
|
|
299
|
-
<div class="ctrl lb"><label for="lb-slider">lb</label><input type="range" id="lb-slider" min="0" max="1000" value="${lbInitSlider}" title="Lookback Bars (1-32)"><span class="val" id="lb-value">${lookbackBars}</span></div>
|
|
300
|
-
<div class="ctrl ms-ama"><label for="ama-ms-slider">amaS%</label><input type="range" id="ama-ms-slider" min="0" max="1000" value="${amaMsInitSlider}" title="AMA Max Slope % per bar (0.04-0.12)"><span class="val" id="ama-ms-value">${defaultAmaMaxSlopePct.toFixed(4)}</span></div>
|
|
301
|
-
<div class="ctrl clip"><label for="clip-slider">clip%</label><input type="range" id="clip-slider" min="0" max="55" value="${Math.min(defaultClipPct, 55)}" title="Outlier Clip %"><span class="val" id="clip-value">${Math.min(defaultClipPct, 55)}%</span></div>
|
|
302
|
-
|
|
303
|
-
<div class="group-sep"></div>
|
|
304
|
-
<div class="ctrl th"><label for="th-slider">th%</label><input type="range" id="th-slider" min="0" max="50" value="${Math.round(defaultMinOutputThreshold * 100)}" title="Minimum pre-gain blended output required before the signal is allowed through (0.00-0.50)"><span class="val" id="th-value">${defaultMinOutputThreshold.toFixed(2)}</span></div>
|
|
305
|
-
|
|
306
|
-
<div class="group-sep"></div>
|
|
307
|
-
<div class="row-break"></div>
|
|
308
|
-
<div class="ctrl ms-kal"><label for="kal-ms-slider">kalS%</label><input type="range" id="kal-ms-slider" min="0" max="1000" value="${kalMsInitSlider}" title="Kalman Max Slope % (0.15-1.5)"><span class="val" id="kal-ms-value">${clampedKalMs.toFixed(2)}</span></div>
|
|
309
|
-
<div class="ctrl kf"><label for="kf-slider">kf</label><input type="range" id="kf-slider" min="0" max="200" value="${defaultKalmanSmoothPct}" title="Kalman smoothing blend (0 = raw, 100 = current adaptive smoothing, 200 = stronger smoothing)"><span class="val" id="kf-value">${defaultKalmanSmoothPct}%</span></div>
|
|
310
|
-
<div class="ctrl kfd"><label for="kfd-slider">kfd</label><input type="range" id="kfd-slider" min="100" max="300" value="${Math.round(defaultKalmanDispScaleMult * 100)}" title="Kalman displacement scale multiplier (1x to 3x)"><span class="val" id="kfd-value">${defaultKalmanDispScaleMult.toFixed(2)}x</span></div>
|
|
311
|
-
<div class="ctrl dsp"><label for="dsp-slider">dsp</label><input type="range" id="dsp-slider" min="25" max="400" value="${Math.round(defaultDispScaleMinPct * 100)}" title="Minimum displacement scale floor (0.25x to 4.0x)"><span class="val" id="dsp-value">${defaultDispScaleMinPct.toFixed(2)}x</span></div>
|
|
312
|
-
<div class="ctrl kdt"><label for="kdt-slider">kdt</label><input type="range" id="kdt-slider" min="25" max="300" value="${Math.round(defaultKalmanDispThresholdMult * 100)}" title="Kalman displacement threshold multiplier (0.25x to 3x)"><span class="val" id="kdt-value">${defaultKalmanDispThresholdMult.toFixed(2)}x</span></div>
|
|
313
|
-
<div class="ctrl kfs"><label for="kfs-slider">kfs</label><input type="range" id="kfs-slider" min="20" max="200" value="${defaultKalmanSmoothSpanPct}" title="Adaptive EMA span ratio (20% span / 200% span; floor fixed at 0)"><span class="val" id="kfs-value">${defaultKalmanSmoothSpanPct}%</span></div>
|
|
314
|
-
<div class="ctrl cf"><label for="cf-slider">cf</label><input type="range" id="cf-slider" min="0" max="5" value="${defaultSignalConfirmBars}" title="Signal confirmation bars (0 disables latching; otherwise flips after N opposite echo bars)"><span class="val" id="cf-value">${defaultSignalConfirmBars}</span></div>
|
|
315
|
-
<div class="ctrl off"><label for="gain-slider">gain</label><input type="range" id="gain-slider" min="0" max="1000" value="${gainInitSlider}" title="Output Gain (0.5-2.0)"><span class="val" id="gain-value">${clampedGain.toFixed(3)}</span></div>
|
|
316
|
-
<div class="ctrl regime"><label for="regime-slider">regi</label><input type="range" id="regime-slider" min="0" max="200" value="${regimeInitSlider}" title="Regime Sensitivity"><span class="val" id="regime-value">${defaultRegimeSensitivity.toFixed(2)}</span></div>
|
|
317
|
-
<button class="copy-btn" id="copy-params-btn">copy</button>
|
|
318
|
-
<button class="paste-btn" id="paste-params-btn">paste</button>
|
|
319
|
-
</div>
|
|
320
|
-
<div id="output-chart"></div>
|
|
321
|
-
</div>
|
|
322
|
-
</div>
|
|
323
|
-
|
|
324
|
-
<div id="paste-confirm">
|
|
325
|
-
<div id="paste-confirm-title">Confirm paste parameters</div>
|
|
326
|
-
<div id="paste-confirm-vals"></div>
|
|
327
|
-
<div id="paste-confirm-btns">
|
|
328
|
-
<button id="paste-confirm-cancel">Cancel</button>
|
|
329
|
-
<button id="paste-confirm-apply">Apply</button>
|
|
330
|
-
</div>
|
|
331
|
-
</div>
|
|
332
|
-
|
|
333
|
-
<script id="payload" type="application/json">${serializeJsonForScript({ dates, prices, hurstArr, peArr, hurstSegments, peSegments, ama3Prices, amaSeedSmaLine, amaSlopePct, kalmanVelocityPctRaw, kalmanVelocityPct, kalmanDisplacementPct, kalmanIsReady, signals, alpha: defaultAlpha, gain: defaultGain, kalmanSmoothPct: defaultKalmanSmoothPct, kalmanDispScaleMult: defaultKalmanDispScaleMult, kalmanDispThresholdMult: defaultKalmanDispThresholdMult, kalmanSmoothSpanPct: defaultKalmanSmoothSpanPct, signalConfirmBars: defaultSignalConfirmBars, neutralZonePct: defaultNeutralZone, dispWeight: defaultDispWeight, amaMaxSlopePct: defaultAmaMaxSlopePct, kalmanMaxSlopePct: defaultKalmanMaxSlopePct, maxDispPct, clipPct: defaultClipPct, minOutputThreshold: defaultMinOutputThreshold, outputClamp: defaultOutputClamp, regimeSensitivity: defaultRegimeSensitivity, absoluteThreshold: defaultAbsoluteThreshold, lookbackBars, amaErPeriod, amaSlowPeriod, amaWarmupBars, amaSlopeReadyBars, realBarCount, amaPctMax, kalPctMax, amaPercentiles, kalPercentiles, amaSlopeLogMin: AMA_MS_LOG_MIN_N, amaSlopeLogMax: AMA_MS_LOG_MAX_N, kalSlopeLogMin: KAL_MS_LOG_MIN_N, kalSlopeLogMax: KAL_MS_LOG_MAX_N, lbLogMin: LB_LOG_MIN_N, lbLogMax: LB_LOG_MAX_N, gainLogMin: GAIN_LOG_MIN_N, gainLogMax: GAIN_LOG_MAX_N, dispScaleMinPct: defaultDispScaleMinPct, weightMin: MARKET_ADAPTER.DYNAMIC_WEIGHT_MIN_WEIGHT, weightMax: MARKET_ADAPTER.DYNAMIC_WEIGHT_MAX_WEIGHT, marketAdapter: ma, amaWeightConfig, hNodes: [0.5 + MARKET_ADAPTER.HURST_ZONE_BAND, 0.5, 0.5 - MARKET_ADAPTER.HURST_ZONE_BAND], pNodes: MARKET_ADAPTER.PE_NODES, regimeTable: MARKET_ADAPTER.REGIME_TABLE })}</script>
|
|
334
|
-
|
|
335
|
-
<script>
|
|
336
|
-
const data = JSON.parse(document.getElementById('payload').textContent);
|
|
337
|
-
const SYNC_KEY = "dyn-wt-res-v4";
|
|
338
|
-
const Y_AXIS_SIZE = 58;
|
|
339
|
-
const ma = data.marketAdapter || {};
|
|
340
|
-
const amaWeightConfig = data.amaWeightConfig || {};
|
|
341
|
-
|
|
342
|
-
const ABSOLUTE_THRESHOLD = data.absoluteThreshold ?? ${JSON.stringify(defaultAbsoluteThreshold)};
|
|
343
|
-
const WEIGHT_MIN = data.weightMin ?? ${JSON.stringify(MARKET_ADAPTER.DYNAMIC_WEIGHT_MIN_WEIGHT)};
|
|
344
|
-
const WEIGHT_MAX = data.weightMax ?? ${JSON.stringify(MARKET_ADAPTER.DYNAMIC_WEIGHT_MAX_WEIGHT)};
|
|
345
|
-
const OUTPUT_CLAMP = data.outputClamp ?? ${JSON.stringify(defaultOutputClamp)};
|
|
346
|
-
const weightDistribution = ${serializeJsonForScript(DEFAULT_CONFIG.weightDistribution)};
|
|
347
|
-
const STATIC_SELL = Number.isFinite(weightDistribution.sell) ? weightDistribution.sell : ${JSON.stringify(DEFAULT_CONFIG.weightDistribution.sell)};
|
|
348
|
-
const STATIC_BUY = Number.isFinite(weightDistribution.buy) ? weightDistribution.buy : ${JSON.stringify(DEFAULT_CONFIG.weightDistribution.buy)};
|
|
349
|
-
|
|
350
|
-
let currentAlpha = data.alpha ?? ${JSON.stringify(defaultAlpha)};
|
|
351
|
-
let currentGain = data.gain ?? ${JSON.stringify(defaultGain)};
|
|
352
|
-
let currentMinOutputThreshold = Math.min(Math.max(data.minOutputThreshold ?? ${JSON.stringify(defaultMinOutputThreshold)}, 0), 0.5);
|
|
353
|
-
let currentKalmanSmoothPct = data.kalmanSmoothPct ?? ${JSON.stringify(defaultKalmanSmoothPct)};
|
|
354
|
-
let currentKalmanDispScaleMult = data.kalmanDispScaleMult ?? ${JSON.stringify(defaultKalmanDispScaleMult)};
|
|
355
|
-
let currentKalmanDispThresholdMult = data.kalmanDispThresholdMult ?? ${JSON.stringify(defaultKalmanDispThresholdMult)};
|
|
356
|
-
let currentKalmanSmoothSpanPct = data.kalmanSmoothSpanPct ?? ${JSON.stringify(defaultKalmanSmoothSpanPct)};
|
|
357
|
-
let currentDispScaleMinPct = data.dispScaleMinPct ?? ${JSON.stringify(defaultDispScaleMinPct)};
|
|
358
|
-
let currentSignalConfirmBars = data.signalConfirmBars ?? ${JSON.stringify(defaultSignalConfirmBars)};
|
|
359
|
-
let currentNz = data.neutralZonePct ?? ${JSON.stringify(defaultNeutralZone)};
|
|
360
|
-
let currentDw = data.dispWeight ?? ${JSON.stringify(defaultDispWeight)};
|
|
361
|
-
let currentAmaMaxSlopePct = data.amaMaxSlopePct ?? ${JSON.stringify(defaultAmaMaxSlopePct)};
|
|
362
|
-
let currentKalmanMaxSlopePct = data.kalmanMaxSlopePct ?? ${JSON.stringify(defaultKalmanMaxSlopePct)};
|
|
363
|
-
const AMA_MS_LOG_MIN = data.amaSlopeLogMin;
|
|
364
|
-
const AMA_MS_LOG_MAX = data.amaSlopeLogMax;
|
|
365
|
-
const KAL_MS_LOG_MIN = data.kalSlopeLogMin;
|
|
366
|
-
const KAL_MS_LOG_MAX = data.kalSlopeLogMax;
|
|
367
|
-
const amaMsSliderToVal = (pos) => Math.exp(AMA_MS_LOG_MIN + (pos / 1000) * (AMA_MS_LOG_MAX - AMA_MS_LOG_MIN));
|
|
368
|
-
const kalMsSliderToVal = (pos) => Math.exp(KAL_MS_LOG_MIN + (pos / 1000) * (KAL_MS_LOG_MAX - KAL_MS_LOG_MIN));
|
|
369
|
-
|
|
370
|
-
let currentLookbackBars = data.lookbackBars ?? ${JSON.stringify(lookbackBars)};
|
|
371
|
-
const LB_LOG_MIN = data.lbLogMin;
|
|
372
|
-
const LB_LOG_MAX = data.lbLogMax;
|
|
373
|
-
const lbSliderToVal = (pos) => Math.round(Math.exp(LB_LOG_MIN + (pos / 1000) * (LB_LOG_MAX - LB_LOG_MIN)));
|
|
374
|
-
const lbValToSlider = (val) => Math.round((Math.log(Math.max(1, val)) - LB_LOG_MIN) / (LB_LOG_MAX - LB_LOG_MIN) * 1000);
|
|
375
|
-
|
|
376
|
-
const GAIN_LOG_MIN = data.gainLogMin;
|
|
377
|
-
const GAIN_LOG_MAX = data.gainLogMax;
|
|
378
|
-
const gainSliderToVal = (pos) => Math.exp(GAIN_LOG_MIN + (pos / 1000) * (GAIN_LOG_MAX - GAIN_LOG_MIN));
|
|
379
|
-
const gainValToSlider = (val) => Math.round((Math.log(Math.max(Math.exp(GAIN_LOG_MIN), val)) - GAIN_LOG_MIN) / (GAIN_LOG_MAX - GAIN_LOG_MIN) * 1000);
|
|
380
|
-
|
|
381
|
-
let currentClipPct = data.clipPct ?? ${JSON.stringify(defaultClipPct)};
|
|
382
|
-
const maxAmaSlope = data.amaPercentiles[data.amaPercentiles.length - 1];
|
|
383
|
-
let currentAmaClipThreshold = currentClipPct === 0 ? maxAmaSlope : data.amaPercentiles[100 - currentClipPct];
|
|
384
|
-
let currentKalClipThreshold = currentClipPct === 0 ? Infinity : data.kalPercentiles[100 - currentClipPct];
|
|
385
|
-
|
|
386
|
-
// Regime table and axis nodes from payload — sourced from MARKET_ADAPTER in constants.ts
|
|
387
|
-
const REGIME_TABLE = data.regimeTable;
|
|
388
|
-
const H_NODES = data.hNodes; // [0.5+band, 0.5, 0.5-band]
|
|
389
|
-
const P_NODES = data.pNodes; // PE_NODES
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Bilinear interpolation for smooth regime multiplier (mirrors regime_gate.ts)
|
|
393
|
-
*/
|
|
394
|
-
function getRegimeMultiplier(H, PE) {
|
|
395
|
-
if (H == null || PE == null) return 1.0;
|
|
396
|
-
|
|
397
|
-
// Clamp inputs to grid range
|
|
398
|
-
const h = Math.max(H_NODES[2], Math.min(H_NODES[0], H));
|
|
399
|
-
const p = Math.max(P_NODES[0], Math.min(P_NODES[2], PE));
|
|
400
|
-
|
|
401
|
-
// Find H segment (H_NODES decreasing)
|
|
402
|
-
let i = h > H_NODES[1] ? 0 : 1;
|
|
403
|
-
let h0 = H_NODES[i], h1 = H_NODES[i+1];
|
|
404
|
-
let th = (h - h1) / (h0 - h1); // 0 at h1, 1 at h0
|
|
405
|
-
|
|
406
|
-
// Find PE segment (P_NODES increasing)
|
|
407
|
-
let j = p < P_NODES[1] ? 0 : 1;
|
|
408
|
-
let p0 = P_NODES[j], p1 = P_NODES[j+1];
|
|
409
|
-
let tp = (p - p0) / (p1 - p0); // 0 at p0, 1 at p1
|
|
410
|
-
|
|
411
|
-
// 4-point lookup
|
|
412
|
-
const v00 = REGIME_TABLE[i][j]; // h0, p0
|
|
413
|
-
const v01 = REGIME_TABLE[i][j+1]; // h0, p1
|
|
414
|
-
const v10 = REGIME_TABLE[i+1][j]; // h1, p0
|
|
415
|
-
const v11 = REGIME_TABLE[i+1][j+1]; // h1, p1
|
|
416
|
-
|
|
417
|
-
// Bilinear interpolation
|
|
418
|
-
const row0 = v00 * (1 - tp) + v01 * tp;
|
|
419
|
-
const row1 = v10 * (1 - tp) + v11 * tp;
|
|
420
|
-
return row0 * th + row1 * (1 - th);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
let currentRegimeSensitivity = data.regimeSensitivity ?? ma.regimeSensitivity;
|
|
424
|
-
|
|
425
|
-
const currentKalmanVelocityPct = new Array(data.dates.length).fill(null);
|
|
426
|
-
const currentKalmanAdaptivePct = new Array(data.dates.length).fill(null);
|
|
427
|
-
const currentLatchedSignals = new Array(data.dates.length).fill(null);
|
|
428
|
-
const dynamicAmaOff = new Array(data.dates.length).fill(null);
|
|
429
|
-
const dynamicAmaSlopePct = new Array(data.dates.length).fill(null);
|
|
430
|
-
const dynamicKalOff = new Array(data.dates.length).fill(null);
|
|
431
|
-
const combinedOff = new Array(data.dates.length).fill(null);
|
|
432
|
-
const combinedSell = new Array(data.dates.length).fill(null);
|
|
433
|
-
const combinedBuy = new Array(data.dates.length).fill(null);
|
|
434
|
-
const echoCombinedOff = new Array(data.dates.length).fill(null);
|
|
435
|
-
const echoCombinedSell = new Array(data.dates.length).fill(null);
|
|
436
|
-
const echoCombinedBuy = new Array(data.dates.length).fill(null);
|
|
437
|
-
const currentMults = new Array(data.dates.length).fill(null);
|
|
438
|
-
let currentOutputAxisMax = 0.5;
|
|
439
|
-
|
|
440
|
-
function recalcKalmanVelocity() {
|
|
441
|
-
const blend = Math.max(0, Math.min(200, currentKalmanSmoothPct)) / 100;
|
|
442
|
-
const rawSeries = data.kalmanVelocityPctRaw || data.kalmanVelocityPct;
|
|
443
|
-
const dispSeries = data.kalmanDisplacementPct;
|
|
444
|
-
const dispScale = Math.max(1.0, Math.min(3.0, currentKalmanDispScaleMult));
|
|
445
|
-
const dispThreshold = Math.max(0.25, Math.min(3.0, currentKalmanDispThresholdMult));
|
|
446
|
-
const smoothingBudget = 0.60;
|
|
447
|
-
const smoothingFloor = 0;
|
|
448
|
-
const smoothingSpan = smoothingBudget * Math.max(20, Math.min(200, currentKalmanSmoothSpanPct)) / 100;
|
|
449
|
-
let prevAdaptive = null;
|
|
450
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
451
|
-
const raw = rawSeries[i];
|
|
452
|
-
const dp = dispSeries[i];
|
|
453
|
-
if (raw == null || dp == null) {
|
|
454
|
-
currentKalmanVelocityPct[i] = null;
|
|
455
|
-
currentKalmanAdaptivePct[i] = null;
|
|
456
|
-
prevAdaptive = null;
|
|
457
|
-
} else {
|
|
458
|
-
const trendConfidence = Math.max(0, Math.min(1, Math.abs(dp) / (dispScale * dispThreshold)));
|
|
459
|
-
const smoothingAlpha = Math.min(smoothingBudget, smoothingFloor + (smoothingSpan * trendConfidence));
|
|
460
|
-
const adaptive = prevAdaptive == null ? raw : (smoothingAlpha * raw) + ((1 - smoothingAlpha) * prevAdaptive);
|
|
461
|
-
currentKalmanAdaptivePct[i] = adaptive;
|
|
462
|
-
currentKalmanVelocityPct[i] = blend === 0 ? raw : (raw + ((adaptive - raw) * blend));
|
|
463
|
-
prevAdaptive = adaptive;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function recalcKalmanClipThreshold() {
|
|
469
|
-
if (currentClipPct === 0) {
|
|
470
|
-
currentKalClipThreshold = Infinity;
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
const magnitudes = [];
|
|
475
|
-
for (let i = 0; i < data.realBarCount; i++) {
|
|
476
|
-
const value = currentKalmanVelocityPct[i];
|
|
477
|
-
if (value != null) magnitudes.push(Math.abs(value));
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (magnitudes.length === 0) {
|
|
481
|
-
currentKalClipThreshold = Infinity;
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
magnitudes.sort((a, b) => a - b);
|
|
486
|
-
const idx = Math.min(
|
|
487
|
-
Math.floor((100 - currentClipPct) / 100 * magnitudes.length),
|
|
488
|
-
magnitudes.length - 1
|
|
489
|
-
);
|
|
490
|
-
currentKalClipThreshold = magnitudes[idx];
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
function signalDirectionForIndex(i) {
|
|
494
|
-
const sig = data.signals[i];
|
|
495
|
-
if (!sig) return 0;
|
|
496
|
-
if (sig.includes('BULL')) return 1;
|
|
497
|
-
if (sig.includes('BEAR')) return -1;
|
|
498
|
-
return 0;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
function directionToSignal(dir) {
|
|
502
|
-
if (dir > 0) return 'BULLISH_DISPLACEMENT';
|
|
503
|
-
if (dir < 0) return 'BEARISH_DISPLACEMENT';
|
|
504
|
-
return 'NEUTRAL';
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function recalcLatchedSignals() {
|
|
508
|
-
const confirmBars = Math.max(0, Math.min(5, currentSignalConfirmBars));
|
|
509
|
-
if (confirmBars === 0) {
|
|
510
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
511
|
-
currentLatchedSignals[i] = data.signals[i] || null;
|
|
512
|
-
}
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
let latchedDir = 0;
|
|
516
|
-
let pendingDir = 0;
|
|
517
|
-
let pendingCount = 0;
|
|
518
|
-
|
|
519
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
520
|
-
const raw = data.signals[i];
|
|
521
|
-
const echoDir = signalDirectionForIndex(i);
|
|
522
|
-
|
|
523
|
-
if (raw == null) {
|
|
524
|
-
currentLatchedSignals[i] = null;
|
|
525
|
-
pendingDir = 0;
|
|
526
|
-
pendingCount = 0;
|
|
527
|
-
continue;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (echoDir === 0) {
|
|
531
|
-
currentLatchedSignals[i] = directionToSignal(latchedDir);
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
if (latchedDir === 0) {
|
|
536
|
-
latchedDir = echoDir;
|
|
537
|
-
pendingDir = 0;
|
|
538
|
-
pendingCount = 0;
|
|
539
|
-
currentLatchedSignals[i] = directionToSignal(latchedDir);
|
|
540
|
-
continue;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (echoDir === latchedDir) {
|
|
544
|
-
pendingDir = 0;
|
|
545
|
-
pendingCount = 0;
|
|
546
|
-
currentLatchedSignals[i] = directionToSignal(latchedDir);
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (pendingDir !== echoDir) {
|
|
551
|
-
pendingDir = echoDir;
|
|
552
|
-
pendingCount = 1;
|
|
553
|
-
} else {
|
|
554
|
-
pendingCount++;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (pendingCount >= confirmBars) {
|
|
558
|
-
latchedDir = echoDir;
|
|
559
|
-
pendingDir = 0;
|
|
560
|
-
pendingCount = 0;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
currentLatchedSignals[i] = directionToSignal(latchedDir);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function computeSlopeAtIndex(idx, lb) {
|
|
568
|
-
if (idx < lb || !data.ama3Prices[idx] || !data.ama3Prices[idx - lb]) return 0;
|
|
569
|
-
const current = data.ama3Prices[idx];
|
|
570
|
-
const past = data.ama3Prices[idx - lb];
|
|
571
|
-
if (past <= 0) return 0;
|
|
572
|
-
return ((current - past) / past * 100) / Math.max(lb, 1);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function recalcInputs() {
|
|
576
|
-
recalcKalmanVelocity();
|
|
577
|
-
recalcKalmanClipThreshold();
|
|
578
|
-
recalcLatchedSignals();
|
|
579
|
-
const nz = currentNz;
|
|
580
|
-
const amaMs = currentAmaMaxSlopePct;
|
|
581
|
-
const kalMs = currentKalmanMaxSlopePct;
|
|
582
|
-
const mo = OUTPUT_CLAMP;
|
|
583
|
-
const dw = currentDw;
|
|
584
|
-
const lb = currentLookbackBars;
|
|
585
|
-
const amaErWarmup = Math.max(0, Number.isFinite(data.amaErPeriod) ? Math.ceil(data.amaErPeriod) : ${JSON.stringify(MARKET_ADAPTER.AMAS[MARKET_ADAPTER.DEFAULT_AMA_KEY].erPeriod)});
|
|
586
|
-
const amaReadyBar = Math.max(lb, amaErWarmup + lb);
|
|
587
|
-
const acl = currentAmaClipThreshold;
|
|
588
|
-
const kcl = currentKalClipThreshold;
|
|
589
|
-
|
|
590
|
-
// Recompute clip threshold based on current lookback
|
|
591
|
-
let dynamicClipThreshold = Infinity;
|
|
592
|
-
if (currentClipPct > 0) {
|
|
593
|
-
const slopes = [];
|
|
594
|
-
for (let i = amaReadyBar; i < data.realBarCount; i++) {
|
|
595
|
-
const s = computeSlopeAtIndex(i, lb);
|
|
596
|
-
if (s !== 0) slopes.push(Math.abs(s));
|
|
597
|
-
}
|
|
598
|
-
if (slopes.length > 0) {
|
|
599
|
-
slopes.sort((a, b) => a - b);
|
|
600
|
-
const idx = Math.min(Math.floor((100 - currentClipPct) / 100 * slopes.length), slopes.length - 1);
|
|
601
|
-
dynamicClipThreshold = slopes[idx];
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
for (let i = 0; i < data.realBarCount; i++) {
|
|
606
|
-
// AMA: compute slope dynamically with current lookback, then clip and convert to offset
|
|
607
|
-
const sp = computeSlopeAtIndex(i, lb);
|
|
608
|
-
dynamicAmaSlopePct[i] = i < amaReadyBar ? null : sp;
|
|
609
|
-
const effectiveAcl = currentClipPct > 0 ? dynamicClipThreshold : acl;
|
|
610
|
-
const clippedA = Math.max(-effectiveAcl, Math.min(effectiveAcl, sp));
|
|
611
|
-
if (Math.abs(clippedA) < nz || i < amaReadyBar) { dynamicAmaOff[i] = 0; }
|
|
612
|
-
else { dynamicAmaOff[i] = Math.max(-mo, Math.min(mo, (clippedA / amaMs) * mo)); }
|
|
613
|
-
|
|
614
|
-
// Kalman: use pre-computed values from payload
|
|
615
|
-
const vp = currentKalmanVelocityPct[i];
|
|
616
|
-
const dp = data.kalmanDisplacementPct[i];
|
|
617
|
-
const kr = data.kalmanIsReady[i];
|
|
618
|
-
|
|
619
|
-
if (!kr || vp === null || dp === null) { dynamicKalOff[i] = null; }
|
|
620
|
-
else {
|
|
621
|
-
const clippedV = Math.max(-kcl, Math.min(kcl, vp));
|
|
622
|
-
if (Math.abs(clippedV) < nz) { dynamicKalOff[i] = 0; }
|
|
623
|
-
else {
|
|
624
|
-
const dispScale = currentDispScaleMinPct;
|
|
625
|
-
const dispConf = Math.min(Math.abs(dp) / dispScale, 1.0);
|
|
626
|
-
const momAlign = Math.max(0, (clippedV * dp) / (Math.abs(clippedV) * Math.abs(dp) + 1e-10));
|
|
627
|
-
const composite = clippedV * (1 - dw + dw * dispConf * momAlign);
|
|
628
|
-
dynamicKalOff[i] = Math.max(-mo, Math.min(mo, (composite / kalMs) * mo));
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
for (let i = data.realBarCount; i < data.dates.length; i++) {
|
|
633
|
-
dynamicAmaOff[i] = null;
|
|
634
|
-
dynamicAmaSlopePct[i] = null;
|
|
635
|
-
dynamicKalOff[i] = null;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
function recalcWeights() {
|
|
640
|
-
// Normalize each channel by the configured clamp so alpha remains a pure ratio knob.
|
|
641
|
-
// Gain then scales the blended output linearly after the dead-band decision.
|
|
642
|
-
currentOutputAxisMax = Math.max(0.5, OUTPUT_CLAMP);
|
|
643
|
-
const channelNorm = Math.max(Math.abs(OUTPUT_CLAMP), 1e-9);
|
|
644
|
-
const outputThreshold = currentMinOutputThreshold;
|
|
645
|
-
|
|
646
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
647
|
-
const aOff = dynamicAmaOff[i];
|
|
648
|
-
const kOff = dynamicKalOff[i];
|
|
649
|
-
if (aOff === null || kOff === null) {
|
|
650
|
-
combinedOff[i] = null; combinedSell[i] = null; combinedBuy[i] = null; currentMults[i] = null;
|
|
651
|
-
} else {
|
|
652
|
-
const blendedOff = (currentAlpha * (aOff / channelNorm) + (1 - currentAlpha) * (kOff / channelNorm));
|
|
653
|
-
const baseMult = getRegimeMultiplier(data.hurstArr[i], data.peArr[i]);
|
|
654
|
-
// Use power for sensitivity: pushes away from 1.0 in both directions without flipping sign
|
|
655
|
-
const rawMult = Math.pow(baseMult, currentRegimeSensitivity);
|
|
656
|
-
// Dead-band: only apply regime multiplier when |mult - 1.0| >= absoluteThreshold
|
|
657
|
-
// Clamp to 1.0 max: regime only dampens, never amplifies
|
|
658
|
-
const finalMult = Math.abs(rawMult - 1.0) >= ABSOLUTE_THRESHOLD ? Math.min(rawMult, 1.0) : 1.0;
|
|
659
|
-
currentMults[i] = finalMult;
|
|
660
|
-
const gatedOff = Math.abs(blendedOff * finalMult) < outputThreshold ? 0 : (blendedOff * finalMult);
|
|
661
|
-
const off = gatedOff * currentGain;
|
|
662
|
-
combinedOff[i] = Math.round(off * 1000) / 1000;
|
|
663
|
-
combinedSell[i] = Math.max(WEIGHT_MIN, Math.min(WEIGHT_MAX, Math.round((STATIC_SELL - off) * 100) / 100));
|
|
664
|
-
combinedBuy[i] = Math.max(WEIGHT_MIN, Math.min(WEIGHT_MAX, Math.round((STATIC_BUY + off) * 100) / 100));
|
|
665
|
-
currentOutputAxisMax = Math.max(currentOutputAxisMax, Math.abs(off));
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
const confirmBars = Math.max(0, Math.min(5, currentSignalConfirmBars));
|
|
669
|
-
let latchedSign = 0;
|
|
670
|
-
let pendingSign = 0;
|
|
671
|
-
let pendingCount = 0;
|
|
672
|
-
let latchedOff = 0;
|
|
673
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
674
|
-
const raw = combinedOff[i];
|
|
675
|
-
if (raw == null) {
|
|
676
|
-
echoCombinedOff[i] = null;
|
|
677
|
-
echoCombinedSell[i] = null;
|
|
678
|
-
echoCombinedBuy[i] = null;
|
|
679
|
-
latchedSign = 0;
|
|
680
|
-
pendingSign = 0;
|
|
681
|
-
pendingCount = 0;
|
|
682
|
-
latchedOff = 0;
|
|
683
|
-
continue;
|
|
684
|
-
}
|
|
685
|
-
if (confirmBars === 0) {
|
|
686
|
-
echoCombinedOff[i] = raw;
|
|
687
|
-
echoCombinedSell[i] = combinedSell[i];
|
|
688
|
-
echoCombinedBuy[i] = combinedBuy[i];
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
|
-
const sign = raw > 0 ? 1 : raw < 0 ? -1 : 0;
|
|
692
|
-
if (sign === latchedSign) {
|
|
693
|
-
pendingSign = 0;
|
|
694
|
-
pendingCount = 0;
|
|
695
|
-
latchedOff = raw;
|
|
696
|
-
} else {
|
|
697
|
-
if (pendingSign !== sign) {
|
|
698
|
-
pendingSign = sign;
|
|
699
|
-
pendingCount = 1;
|
|
700
|
-
} else {
|
|
701
|
-
pendingCount++;
|
|
702
|
-
}
|
|
703
|
-
if (pendingCount >= confirmBars) {
|
|
704
|
-
latchedSign = sign;
|
|
705
|
-
pendingSign = 0;
|
|
706
|
-
pendingCount = 0;
|
|
707
|
-
latchedOff = raw;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
echoCombinedOff[i] = latchedOff;
|
|
711
|
-
echoCombinedSell[i] = Math.max(WEIGHT_MIN, Math.min(WEIGHT_MAX, Math.round((STATIC_SELL - latchedOff) * 100) / 100));
|
|
712
|
-
echoCombinedBuy[i] = Math.max(WEIGHT_MIN, Math.min(WEIGHT_MAX, Math.round((STATIC_BUY + latchedOff) * 100) / 100));
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
716
|
-
if (combinedOff[i] !== null) currentOutputAxisMax = Math.max(currentOutputAxisMax, Math.abs(combinedOff[i]));
|
|
717
|
-
if (echoCombinedOff[i] !== null) currentOutputAxisMax = Math.max(currentOutputAxisMax, Math.abs(echoCombinedOff[i]));
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
recalcInputs();
|
|
721
|
-
recalcWeights();
|
|
722
|
-
|
|
723
|
-
const xMin = data.dates[0];
|
|
724
|
-
const xMax = data.dates[data.dates.length - 1];
|
|
725
|
-
let pendingRange = null;
|
|
726
|
-
let pendingRangeRaf = 0;
|
|
727
|
-
let priceChart, amaChart, kalmanChart, outputChart;
|
|
728
|
-
let charts;
|
|
729
|
-
|
|
730
|
-
${UPLOT_SHARED_SCRIPT}
|
|
731
|
-
|
|
732
|
-
function refreshChartsPreservingZoom() {
|
|
733
|
-
const xs = outputChart?.scales?.x;
|
|
734
|
-
const savedX = xs ? {
|
|
735
|
-
min: Number.isFinite(xs.min) ? xs.min : xMin,
|
|
736
|
-
max: Number.isFinite(xs.max) ? xs.max : xMax,
|
|
737
|
-
} : null;
|
|
738
|
-
|
|
739
|
-
amaChart.setData([data.dates, dynamicAmaSlopePct], false);
|
|
740
|
-
kalmanChart.setData([data.dates, currentKalmanVelocityPct, data.kalmanDisplacementPct], false);
|
|
741
|
-
outputChart.setData([data.dates, combinedOff, echoCombinedOff], false);
|
|
742
|
-
|
|
743
|
-
if (savedX) {
|
|
744
|
-
charts.forEach(c => c.batch(() => c.setScale('x', savedX)));
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
let lastLiveIdx = data.realBarCount - 1;
|
|
749
|
-
|
|
750
|
-
function updateLegend(idx) {
|
|
751
|
-
if (idx == null) return;
|
|
752
|
-
lastLiveIdx = idx;
|
|
753
|
-
|
|
754
|
-
const price = data.prices[idx];
|
|
755
|
-
const priceEl = document.getElementById('l-price');
|
|
756
|
-
if (price == null) { priceEl.textContent = '-'; priceEl.style.color = '#8b949e'; }
|
|
757
|
-
else { priceEl.textContent = price.toFixed(4); priceEl.style.color = '#58a6ff'; }
|
|
758
|
-
|
|
759
|
-
const ama3 = data.ama3Prices[idx];
|
|
760
|
-
const ama3El = document.getElementById('l-ama3');
|
|
761
|
-
if (ama3 == null) { ama3El.textContent = '-'; ama3El.style.color = '#8b949e'; }
|
|
762
|
-
else { ama3El.textContent = ama3.toFixed(4); ama3El.style.color = '#e3b341'; }
|
|
763
|
-
|
|
764
|
-
const seedSma = data.amaSeedSmaLine[idx];
|
|
765
|
-
const seedSmaEl = document.getElementById('l-seed-sma');
|
|
766
|
-
if (seedSma == null) { seedSmaEl.textContent = '-'; seedSmaEl.style.color = '#8b949e'; }
|
|
767
|
-
else { seedSmaEl.textContent = seedSma.toFixed(4); seedSmaEl.style.color = '#8b949e'; }
|
|
768
|
-
|
|
769
|
-
const sp = dynamicAmaSlopePct[idx];
|
|
770
|
-
const spEl = document.getElementById('l-ama-slope');
|
|
771
|
-
if (sp == null) { spEl.textContent = '-'; spEl.style.color = '#8b949e'; }
|
|
772
|
-
else { spEl.textContent = (sp >= 0 ? '+' : '') + sp.toFixed(3) + '%'; spEl.style.color = sp > 0.01 ? '#2ea043' : sp < -0.01 ? '#f85149' : '#8b949e'; }
|
|
773
|
-
|
|
774
|
-
const vp = currentKalmanVelocityPct[idx];
|
|
775
|
-
const vpEl = document.getElementById('l-kal-vel');
|
|
776
|
-
if (vp == null) { vpEl.textContent = '-'; vpEl.style.color = '#8b949e'; }
|
|
777
|
-
else { vpEl.textContent = (vp >= 0 ? '+' : '') + vp.toFixed(3) + '%'; vpEl.style.color = vp > 0.01 ? '#2ea043' : vp < -0.01 ? '#f85149' : '#8b949e'; }
|
|
778
|
-
|
|
779
|
-
const dp = data.kalmanDisplacementPct[idx];
|
|
780
|
-
const dpEl = document.getElementById('l-kal-disp');
|
|
781
|
-
if (dp == null) { dpEl.textContent = '-'; dpEl.style.color = '#8b949e'; }
|
|
782
|
-
else { dpEl.textContent = (dp >= 0 ? '+' : '') + dp.toFixed(2) + '%'; dpEl.style.color = dp > 0.3 ? '#2ea043' : dp < -0.3 ? '#f85149' : '#8b949e'; }
|
|
783
|
-
|
|
784
|
-
const sig = data.signals[idx];
|
|
785
|
-
const echoSig = directionToSignal(signalDirectionForIndex(idx));
|
|
786
|
-
const latchedSig = currentLatchedSignals[idx];
|
|
787
|
-
const sigEl = document.getElementById('l-signal');
|
|
788
|
-
if (!sig) { sigEl.textContent = '-'; sigEl.style.color = '#8b949e'; }
|
|
789
|
-
else if (sig.includes('BULL')) { sigEl.textContent = '\u25b2 BULL'; sigEl.style.color = '#2ea043'; }
|
|
790
|
-
else if (sig.includes('BEAR')) { sigEl.textContent = '\u25bc BEAR'; sigEl.style.color = '#f85149'; }
|
|
791
|
-
else if (sig === 'EQUILIBRIUM') { sigEl.textContent = '\u2248 EQ'; sigEl.style.color = '#58a6ff'; }
|
|
792
|
-
else { sigEl.textContent = '\u25cb NEU'; sigEl.style.color = '#8b949e'; }
|
|
793
|
-
const echoEl = document.getElementById('l-signal-echo');
|
|
794
|
-
if (!echoSig) { echoEl.textContent = '-'; echoEl.style.color = '#8b949e'; }
|
|
795
|
-
else if (echoSig.includes('BULL')) { echoEl.textContent = '\u25b2 BULL'; echoEl.style.color = '#3fb950'; }
|
|
796
|
-
else if (echoSig.includes('BEAR')) { echoEl.textContent = '\u25bc BEAR'; echoEl.style.color = '#ff7b72'; }
|
|
797
|
-
else { echoEl.textContent = '\u25cb NEU'; echoEl.style.color = '#8b949e'; }
|
|
798
|
-
const latchedEl = document.getElementById('l-signal-latched');
|
|
799
|
-
if (!latchedSig) { latchedEl.textContent = '-'; latchedEl.style.color = '#8b949e'; }
|
|
800
|
-
else if (latchedSig.includes('BULL')) { latchedEl.textContent = '\u25b2 BULL'; latchedEl.style.color = '#3fb950'; }
|
|
801
|
-
else if (latchedSig.includes('BEAR')) { latchedEl.textContent = '\u25bc BEAR'; latchedEl.style.color = '#ff7b72'; }
|
|
802
|
-
else if (latchedSig === 'EQUILIBRIUM') { latchedEl.textContent = '\u2248 EQ'; latchedEl.style.color = '#79c0ff'; }
|
|
803
|
-
else { latchedEl.textContent = '\u25cb NEU'; latchedEl.style.color = '#8b949e'; }
|
|
804
|
-
|
|
805
|
-
const cRaw = combinedOff[idx];
|
|
806
|
-
const cRawEl = document.getElementById('l-combined-raw');
|
|
807
|
-
if (cRaw == null) { cRawEl.textContent = '-'; cRawEl.style.color = '#8b949e'; }
|
|
808
|
-
else { cRawEl.textContent = (cRaw >= 0 ? '+' : '') + cRaw.toFixed(3); cRawEl.style.color = cRaw > 0.01 ? '#8b949e' : cRaw < -0.01 ? '#8b949e' : '#8b949e'; }
|
|
809
|
-
|
|
810
|
-
const cEcho = echoCombinedOff[idx];
|
|
811
|
-
const cEchoEl = document.getElementById('l-combined-echo');
|
|
812
|
-
if (cEcho == null) { cEchoEl.textContent = '-'; cEchoEl.style.color = '#8b949e'; }
|
|
813
|
-
else { cEchoEl.textContent = (cEcho >= 0 ? '+' : '') + cEcho.toFixed(3); cEchoEl.style.color = cEcho > 0.01 ? '#2ea043' : cEcho < -0.01 ? '#f85149' : '#8b949e'; }
|
|
814
|
-
|
|
815
|
-
const mult = currentMults[idx];
|
|
816
|
-
const multEl = document.getElementById('l-mult');
|
|
817
|
-
if (mult == null) { multEl.textContent = '-'; }
|
|
818
|
-
else { multEl.textContent = 'x' + mult.toFixed(2); multEl.style.color = mult > 1.05 ? '#3fb950' : mult < 0.95 ? '#f85149' : '#d2a8ff'; }
|
|
819
|
-
|
|
820
|
-
document.getElementById('l-sell').textContent = echoCombinedSell[idx] != null ? echoCombinedSell[idx].toFixed(2) : '-';
|
|
821
|
-
document.getElementById('l-buy').textContent = echoCombinedBuy[idx] != null ? echoCombinedBuy[idx].toFixed(2) : '-';
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
function makeSignalBgHook(scaleKey) {
|
|
825
|
-
return u => {
|
|
826
|
-
const { ctx, bbox } = u;
|
|
827
|
-
ctx.save();
|
|
828
|
-
ctx.beginPath(); ctx.rect(bbox.left, bbox.top, bbox.width, bbox.height); ctx.clip();
|
|
829
|
-
ctx.globalCompositeOperation = 'destination-over';
|
|
830
|
-
let i = 0;
|
|
831
|
-
while (i < data.signals.length) {
|
|
832
|
-
const s = currentLatchedSignals[i] || data.signals[i];
|
|
833
|
-
if (!s || i >= data.realBarCount) { i++; continue; }
|
|
834
|
-
const isBull = s.includes('BULL');
|
|
835
|
-
const isBear = s.includes('BEAR');
|
|
836
|
-
let j = i + 1;
|
|
837
|
-
while (j < data.realBarCount) {
|
|
838
|
-
const sj = currentLatchedSignals[j] || data.signals[j];
|
|
839
|
-
if (sj !== s) break;
|
|
840
|
-
j++;
|
|
841
|
-
}
|
|
842
|
-
const x0 = u.valToPos(data.dates[i], 'x', true);
|
|
843
|
-
const x1 = j < data.realBarCount ? u.valToPos(data.dates[j], 'x', true) : bbox.left + bbox.width;
|
|
844
|
-
if (isBull) { ctx.fillStyle = 'rgba(46,160,67,0.06)'; ctx.fillRect(x0, bbox.top, x1 - x0, bbox.height); }
|
|
845
|
-
else if (isBear) { ctx.fillStyle = 'rgba(248,81,73,0.06)'; ctx.fillRect(x0, bbox.top, x1 - x0, bbox.height); }
|
|
846
|
-
i = j;
|
|
847
|
-
}
|
|
848
|
-
// Neutral zone band
|
|
849
|
-
if (scaleKey) {
|
|
850
|
-
const nzY = u.valToPos(currentNz, scaleKey, true);
|
|
851
|
-
const nzYNeg = u.valToPos(-currentNz, scaleKey, true);
|
|
852
|
-
ctx.globalCompositeOperation = 'source-over';
|
|
853
|
-
ctx.fillStyle = 'rgba(139,148,158,0.06)';
|
|
854
|
-
ctx.fillRect(bbox.left, Math.min(nzY, nzYNeg), bbox.width, Math.abs(nzYNeg - nzY));
|
|
855
|
-
}
|
|
856
|
-
ctx.restore();
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
function makePctFillHook(values, scaleKey, posColor, negColor, strokeStyle = 'rgba(255,255,255,0.35)') {
|
|
861
|
-
return u => {
|
|
862
|
-
const { ctx, bbox } = u;
|
|
863
|
-
ctx.save();
|
|
864
|
-
ctx.beginPath(); ctx.rect(bbox.left, bbox.top, bbox.width, bbox.height); ctx.clip();
|
|
865
|
-
const zeroY = u.valToPos(0, scaleKey, true);
|
|
866
|
-
const path = new Path2D();
|
|
867
|
-
let inSeg = false, lastX = 0;
|
|
868
|
-
for (let i = 0; i < values.length; i++) {
|
|
869
|
-
const v = values[i];
|
|
870
|
-
if (v === null) { if (inSeg) { path.lineTo(lastX, zeroY); inSeg = false; } continue; }
|
|
871
|
-
const x = u.valToPos(data.dates[i], 'x', true);
|
|
872
|
-
const y = u.valToPos(v, scaleKey, true);
|
|
873
|
-
if (!inSeg) { path.moveTo(x, zeroY); path.lineTo(x, y); inSeg = true; }
|
|
874
|
-
else path.lineTo(x, y);
|
|
875
|
-
lastX = x;
|
|
876
|
-
}
|
|
877
|
-
if (inSeg) path.lineTo(lastX, zeroY);
|
|
878
|
-
ctx.save();
|
|
879
|
-
ctx.beginPath(); ctx.rect(bbox.left, bbox.top, bbox.width, zeroY - bbox.top); ctx.clip();
|
|
880
|
-
ctx.fillStyle = posColor; ctx.fill(path);
|
|
881
|
-
ctx.restore();
|
|
882
|
-
ctx.save();
|
|
883
|
-
ctx.beginPath(); ctx.rect(bbox.left, zeroY, bbox.width, bbox.top + bbox.height - zeroY); ctx.clip();
|
|
884
|
-
ctx.fillStyle = negColor; ctx.fill(path);
|
|
885
|
-
ctx.restore();
|
|
886
|
-
if (strokeStyle) {
|
|
887
|
-
ctx.strokeStyle = strokeStyle; ctx.lineWidth = 1; ctx.stroke(path);
|
|
888
|
-
ctx.strokeStyle = 'rgba(255,255,255,0.15)'; ctx.lineWidth = 1;
|
|
889
|
-
ctx.beginPath(); ctx.moveTo(bbox.left, zeroY); ctx.lineTo(bbox.left + bbox.width, zeroY); ctx.stroke();
|
|
890
|
-
}
|
|
891
|
-
ctx.restore();
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function makeClampLineHook(scaleKey, clampValue, label = 'clamp') {
|
|
896
|
-
return u => {
|
|
897
|
-
const { ctx, bbox } = u;
|
|
898
|
-
ctx.save();
|
|
899
|
-
ctx.beginPath(); ctx.rect(bbox.left, bbox.top, bbox.width, bbox.height); ctx.clip();
|
|
900
|
-
|
|
901
|
-
const y = u.valToPos(clampValue, scaleKey, true);
|
|
902
|
-
ctx.strokeStyle = '#a371f7';
|
|
903
|
-
ctx.shadowColor = 'rgba(163,113,247,0.65)';
|
|
904
|
-
ctx.shadowBlur = 5;
|
|
905
|
-
ctx.lineWidth = 1.5;
|
|
906
|
-
ctx.setLineDash([5, 4]);
|
|
907
|
-
ctx.beginPath();
|
|
908
|
-
ctx.moveTo(bbox.left, y);
|
|
909
|
-
ctx.lineTo(bbox.left + bbox.width, y);
|
|
910
|
-
ctx.stroke();
|
|
911
|
-
ctx.setLineDash([]);
|
|
912
|
-
ctx.shadowBlur = 0;
|
|
913
|
-
ctx.shadowColor = 'transparent';
|
|
914
|
-
|
|
915
|
-
if (label) {
|
|
916
|
-
ctx.font = 'bold 10px Segoe UI, sans-serif';
|
|
917
|
-
ctx.textBaseline = 'middle';
|
|
918
|
-
const textW = ctx.measureText(label).width + 8;
|
|
919
|
-
const textX = Math.max(bbox.left + 4, bbox.left + bbox.width - textW - 2);
|
|
920
|
-
const textY = y - 8;
|
|
921
|
-
ctx.fillStyle = 'rgba(11,14,20,0.82)';
|
|
922
|
-
ctx.fillRect(textX - 4, textY - 7, textW, 14);
|
|
923
|
-
ctx.fillStyle = '#a371f7';
|
|
924
|
-
ctx.fillText(label, textX, textY);
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
ctx.restore();
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
function makeClampPairHooks(scaleKey, clampValue) {
|
|
932
|
-
return [
|
|
933
|
-
makeClampLineHook(scaleKey, clampValue, 'clamp ' + clampValue.toFixed(2)),
|
|
934
|
-
makeClampLineHook(scaleKey, -clampValue, 'clamp -' + clampValue.toFixed(2)),
|
|
935
|
-
];
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
const cursorCfg = {
|
|
939
|
-
show: true, x: true, y: true, points: { show: false },
|
|
940
|
-
drag: { x: false, y: false, setScale: false },
|
|
941
|
-
sync: { key: SYNC_KEY, setSeries: false, scales: ['x', null] },
|
|
942
|
-
focus: { prox: -1 },
|
|
943
|
-
};
|
|
944
|
-
|
|
945
|
-
const TIME_MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
946
|
-
|
|
947
|
-
function pad2(n) {
|
|
948
|
-
return String(n).padStart(2, '0');
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
function formatTimeLabel(tsSec, spanSec) {
|
|
952
|
-
const d = new Date(tsSec * 1000);
|
|
953
|
-
if (!Number.isFinite(spanSec)) spanSec = 0;
|
|
954
|
-
|
|
955
|
-
if (spanSec >= 365 * 24 * 3600 * 2) {
|
|
956
|
-
return String(d.getUTCFullYear());
|
|
957
|
-
}
|
|
958
|
-
if (spanSec >= 90 * 24 * 3600) {
|
|
959
|
-
return TIME_MONTHS[d.getUTCMonth()] + ' ' + d.getUTCFullYear();
|
|
960
|
-
}
|
|
961
|
-
if (spanSec >= 14 * 24 * 3600) {
|
|
962
|
-
return TIME_MONTHS[d.getUTCMonth()] + ' ' + d.getUTCDate();
|
|
963
|
-
}
|
|
964
|
-
return TIME_MONTHS[d.getUTCMonth()] + ' ' + d.getUTCDate() + ' ' + pad2(d.getUTCHours()) + ':' + pad2(d.getUTCMinutes());
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
function makeTimeAxis(showLabels = false) {
|
|
968
|
-
return {
|
|
969
|
-
show: true,
|
|
970
|
-
stroke: '#30363d',
|
|
971
|
-
grid: { stroke: '#1c2128' },
|
|
972
|
-
ticks: { stroke: '#30363d', width: 1 },
|
|
973
|
-
size: showLabels ? 24 : 0,
|
|
974
|
-
font: '11px Segoe UI, sans-serif',
|
|
975
|
-
values: showLabels ? (u, vals) => {
|
|
976
|
-
const xScale = u.scales.x || {};
|
|
977
|
-
const spanSec = Number.isFinite(xScale.min) && Number.isFinite(xScale.max)
|
|
978
|
-
? Math.max(0, xScale.max - xScale.min)
|
|
979
|
-
: (xMax - xMin);
|
|
980
|
-
return vals.map((ts) => formatTimeLabel(ts, spanSec));
|
|
981
|
-
} : () => [],
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
function init() {
|
|
986
|
-
// Force all sliders to match JS state — overrides browser form-restore memory
|
|
987
|
-
document.getElementById('alpha-slider').value = Math.round(currentAlpha * 100);
|
|
988
|
-
document.getElementById('ama-ms-slider').value = Math.round((Math.log(currentAmaMaxSlopePct) - AMA_MS_LOG_MIN) / (AMA_MS_LOG_MAX - AMA_MS_LOG_MIN) * 1000);
|
|
989
|
-
document.getElementById('kal-ms-slider').value = Math.round((Math.log(currentKalmanMaxSlopePct) - KAL_MS_LOG_MIN) / (KAL_MS_LOG_MAX - KAL_MS_LOG_MIN) * 1000);
|
|
990
|
-
document.getElementById('th-slider').value = Math.round(currentMinOutputThreshold * 100);
|
|
991
|
-
document.getElementById('th-value').textContent = currentMinOutputThreshold.toFixed(2);
|
|
992
|
-
document.getElementById('gain-slider').value = gainValToSlider(currentGain);
|
|
993
|
-
document.getElementById('kf-slider').value = currentKalmanSmoothPct;
|
|
994
|
-
document.getElementById('kfd-slider').value = Math.round(currentKalmanDispScaleMult * 100);
|
|
995
|
-
document.getElementById('dsp-slider').value = Math.round(currentDispScaleMinPct * 100);
|
|
996
|
-
document.getElementById('kdt-slider').value = Math.round(currentKalmanDispThresholdMult * 100);
|
|
997
|
-
document.getElementById('kfs-slider').value = currentKalmanSmoothSpanPct;
|
|
998
|
-
document.getElementById('cf-slider').value = currentSignalConfirmBars;
|
|
999
|
-
document.getElementById('clip-slider').value = currentClipPct;
|
|
1000
|
-
document.getElementById('nz-slider').value = Math.round(currentNz * 100);
|
|
1001
|
-
document.getElementById('lb-slider').value = lbValToSlider(currentLookbackBars);
|
|
1002
|
-
|
|
1003
|
-
const priceEl = document.getElementById('price-panel');
|
|
1004
|
-
const amaEl = document.getElementById('ama-panel');
|
|
1005
|
-
const kalmanEl = document.getElementById('kalman-panel');
|
|
1006
|
-
const outputEl = document.getElementById('output-panel');
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
priceChart = new uPlot({
|
|
1010
|
-
width: priceEl.offsetWidth, height: priceEl.offsetHeight,
|
|
1011
|
-
padding: [4, 8, 0, 4], select: { show: false }, legend: { show: false },
|
|
1012
|
-
scales: {
|
|
1013
|
-
x: { time: true },
|
|
1014
|
-
y: { auto: true, distr: 3, log: 10, range: (u, min, max) => [min * 0.9, max * 1.1] }
|
|
1015
|
-
},
|
|
1016
|
-
series: [
|
|
1017
|
-
{ label: 'Time' },
|
|
1018
|
-
{ label: 'Price', stroke: '#58a6ff', width: 1.5, scale: 'y', points: { show: false } },
|
|
1019
|
-
{ label: '${amaLabel}', stroke: '#e3b341', width: 1.5, scale: 'y', points: { show: false } },
|
|
1020
|
-
{ label: 'Seed SMA', stroke: '#8b949e', width: 1.5, dash: [4, 4], scale: 'y', points: { show: false } },
|
|
1021
|
-
],
|
|
1022
|
-
axes: [
|
|
1023
|
-
makeTimeAxis(false),
|
|
1024
|
-
{ scale: 'y', stroke: '#30363d', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
1025
|
-
values: (u, v) => v.map(x => x != null ? x.toFixed(4) : ''), }
|
|
1026
|
-
],
|
|
1027
|
-
cursor: cursorCfg,
|
|
1028
|
-
hooks: { draw: [makeSignalBgHook('y')] }
|
|
1029
|
-
}, [data.dates, data.prices, data.ama3Prices, data.amaSeedSmaLine], document.getElementById('price-chart'));
|
|
1030
|
-
|
|
1031
|
-
amaChart = new uPlot({
|
|
1032
|
-
width: amaEl.offsetWidth, height: amaEl.offsetHeight,
|
|
1033
|
-
padding: [4, 8, 0, 4], select: { show: false }, legend: { show: false },
|
|
1034
|
-
scales: { x: { time: true }, p: { auto: true } },
|
|
1035
|
-
series: [
|
|
1036
|
-
{ label: 'Time' },
|
|
1037
|
-
{ label: 'Slope%', stroke: '#f0a000', width: 2, scale: 'p', points: { show: false } },
|
|
1038
|
-
],
|
|
1039
|
-
axes: [
|
|
1040
|
-
makeTimeAxis(false),
|
|
1041
|
-
{ scale: 'p', stroke: '#30363d', grid: { stroke: '#1c2128', dash: [4, 4] }, ticks: { stroke: '#30303d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
1042
|
-
values: (u, v) => v.map(x => x != null ? (x >= 0 ? '+' : '') + x.toFixed(1) + '%' : '') }
|
|
1043
|
-
],
|
|
1044
|
-
cursor: cursorCfg,
|
|
1045
|
-
hooks: { draw: [makePctFillHook(dynamicAmaSlopePct, 'p', 'rgba(46,160,67,0.20)', 'rgba(248,81,73,0.20)'), makeSignalBgHook('p')] }
|
|
1046
|
-
}, [data.dates, dynamicAmaSlopePct], document.getElementById('ama-chart'));
|
|
1047
|
-
|
|
1048
|
-
kalmanChart = new uPlot({
|
|
1049
|
-
width: kalmanEl.offsetWidth, height: kalmanEl.offsetHeight,
|
|
1050
|
-
padding: [4, 8, 0, 4], select: { show: false }, legend: { show: false },
|
|
1051
|
-
scales: { x: { time: true }, v: { auto: true } },
|
|
1052
|
-
series: [
|
|
1053
|
-
{ label: 'Time' },
|
|
1054
|
-
{ label: 'Vel%', stroke: '#d2a8ff', width: 2, scale: 'v', points: { show: false } },
|
|
1055
|
-
{ label: 'Disp%', stroke: '#79c0ff', width: 1.5, dash: [6, 3], scale: 'v', points: { show: false } },
|
|
1056
|
-
],
|
|
1057
|
-
axes: [
|
|
1058
|
-
makeTimeAxis(false),
|
|
1059
|
-
{ scale: 'v', stroke: '#30363d', grid: { stroke: '#1c2128', dash: [4, 4] }, ticks: { stroke: '#30303d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
1060
|
-
values: (u, v) => v.map(x => x != null ? (x >= 0 ? '+' : '') + x.toFixed(1) + '%' : '') }
|
|
1061
|
-
],
|
|
1062
|
-
cursor: cursorCfg,
|
|
1063
|
-
hooks: { draw: [
|
|
1064
|
-
makePctFillHook(currentKalmanVelocityPct, 'v', 'rgba(210,168,255,0.18)', 'rgba(210,168,255,0.18)'),
|
|
1065
|
-
makeSignalBgHook('v')
|
|
1066
|
-
] }
|
|
1067
|
-
}, [data.dates, currentKalmanVelocityPct, data.kalmanDisplacementPct], document.getElementById('kalman-chart'));
|
|
1068
|
-
|
|
1069
|
-
outputChart = new uPlot({
|
|
1070
|
-
width: outputEl.offsetWidth, height: outputEl.offsetHeight,
|
|
1071
|
-
padding: [20, 8, 0, 4], select: { show: false }, legend: { show: false },
|
|
1072
|
-
scales: { x: { time: true }, ow: { auto: true, range: (u, min, max) => {
|
|
1073
|
-
const m = 0.5;
|
|
1074
|
-
const pad = (max - min) * 0.1 || 0.02;
|
|
1075
|
-
return [Math.min(min - pad, -m), Math.max(max + pad, m)];
|
|
1076
|
-
}}},
|
|
1077
|
-
series: [
|
|
1078
|
-
{ label: 'Time' },
|
|
1079
|
-
{ label: 'RawOff', stroke: 'transparent', width: 0, scale: 'ow', points: { show: false } },
|
|
1080
|
-
{ label: 'EchoOff', stroke: 'transparent', width: 0, scale: 'ow', points: { show: false } }
|
|
1081
|
-
],
|
|
1082
|
-
axes: [
|
|
1083
|
-
makeTimeAxis(true),
|
|
1084
|
-
{ scale: 'ow', stroke: '#30363d', grid: { stroke: '#1c2128', dash: [4, 4] }, ticks: { stroke: '#30303d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
1085
|
-
values: (u, v) => v.map(x => x != null ? (x >= 0 ? '+' : '') + x.toFixed(2) : ''),
|
|
1086
|
-
splits: () => { const m = Math.max(0.5, currentOutputAxisMax || 0.5); return [-m, -m/2, 0, m/2, m]; } }
|
|
1087
|
-
],
|
|
1088
|
-
cursor: cursorCfg,
|
|
1089
|
-
hooks: { draw: [
|
|
1090
|
-
makePctFillHook(combinedOff, 'ow', 'rgba(108,117,125,0.08)', 'rgba(108,117,125,0.06)', null),
|
|
1091
|
-
makePctFillHook(echoCombinedOff, 'ow', 'rgba(46,160,67,0.18)', 'rgba(248,81,73,0.18)', null),
|
|
1092
|
-
...makeClampPairHooks('ow', OUTPUT_CLAMP)
|
|
1093
|
-
] }
|
|
1094
|
-
}, [data.dates, combinedOff, echoCombinedOff], document.getElementById('output-chart'));
|
|
1095
|
-
|
|
1096
|
-
charts = [priceChart, amaChart, kalmanChart, outputChart];
|
|
1097
|
-
let leavePending = null;
|
|
1098
|
-
charts.forEach(chart => {
|
|
1099
|
-
chart.over.addEventListener('mousemove', () => {
|
|
1100
|
-
if (leavePending !== null) { clearTimeout(leavePending); leavePending = null; }
|
|
1101
|
-
const idx = chart.cursor.idx;
|
|
1102
|
-
if (idx != null) updateLegend(idx);
|
|
1103
|
-
});
|
|
1104
|
-
chart.over.addEventListener('mouseleave', () => {
|
|
1105
|
-
leavePending = setTimeout(() => { leavePending = null; updateLegend(lastLiveIdx); }, 60);
|
|
1106
|
-
});
|
|
1107
|
-
chart.root.addEventListener('mouseenter', () => chart.root.classList.add('is-hovered'));
|
|
1108
|
-
chart.root.addEventListener('mouseleave', () => chart.root.classList.remove('is-hovered'));
|
|
1109
|
-
bindWheelZoom(chart);
|
|
1110
|
-
bindPan(chart);
|
|
1111
|
-
});
|
|
1112
|
-
|
|
1113
|
-
function onSliderChange() {
|
|
1114
|
-
recalcInputs();
|
|
1115
|
-
recalcWeights();
|
|
1116
|
-
refreshChartsPreservingZoom();
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
document.getElementById('alpha-slider').addEventListener('input', (e) => {
|
|
1120
|
-
currentAlpha = parseInt(e.target.value, 10) / 100;
|
|
1121
|
-
document.getElementById('alpha-value').textContent = currentAlpha.toFixed(2);
|
|
1122
|
-
recalcWeights();
|
|
1123
|
-
refreshChartsPreservingZoom();
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
document.getElementById('dw-slider').addEventListener('input', (e) => {
|
|
1127
|
-
currentDw = parseInt(e.target.value, 10) / 100;
|
|
1128
|
-
document.getElementById('dw-value').textContent = currentDw.toFixed(2);
|
|
1129
|
-
onSliderChange();
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
|
-
document.getElementById('ama-ms-slider').addEventListener('input', (e) => {
|
|
1133
|
-
currentAmaMaxSlopePct = amaMsSliderToVal(parseInt(e.target.value, 10));
|
|
1134
|
-
document.getElementById('ama-ms-value').textContent = currentAmaMaxSlopePct.toFixed(4);
|
|
1135
|
-
onSliderChange();
|
|
1136
|
-
});
|
|
1137
|
-
|
|
1138
|
-
document.getElementById('kal-ms-slider').addEventListener('input', (e) => {
|
|
1139
|
-
currentKalmanMaxSlopePct = kalMsSliderToVal(parseInt(e.target.value, 10));
|
|
1140
|
-
document.getElementById('kal-ms-value').textContent = currentKalmanMaxSlopePct.toFixed(2);
|
|
1141
|
-
onSliderChange();
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
|
-
document.getElementById('gain-slider').addEventListener('input', (e) => {
|
|
1145
|
-
currentGain = gainSliderToVal(parseInt(e.target.value, 10));
|
|
1146
|
-
document.getElementById('gain-value').textContent = currentGain.toFixed(3);
|
|
1147
|
-
onSliderChange();
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
document.getElementById('th-slider').addEventListener('input', (e) => {
|
|
1151
|
-
currentMinOutputThreshold = Math.min(Math.max(parseInt(e.target.value, 10) / 100, 0), 0.5);
|
|
1152
|
-
document.getElementById('th-value').textContent = currentMinOutputThreshold.toFixed(2);
|
|
1153
|
-
recalcWeights();
|
|
1154
|
-
refreshChartsPreservingZoom();
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
document.getElementById('kf-slider').addEventListener('input', (e) => {
|
|
1158
|
-
currentKalmanSmoothPct = parseInt(e.target.value, 10);
|
|
1159
|
-
document.getElementById('kf-value').textContent = currentKalmanSmoothPct + '%';
|
|
1160
|
-
onSliderChange();
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
document.getElementById('kfd-slider').addEventListener('input', (e) => {
|
|
1164
|
-
currentKalmanDispScaleMult = parseInt(e.target.value, 10) / 100;
|
|
1165
|
-
document.getElementById('kfd-value').textContent = currentKalmanDispScaleMult.toFixed(2) + 'x';
|
|
1166
|
-
onSliderChange();
|
|
1167
|
-
});
|
|
1168
|
-
|
|
1169
|
-
document.getElementById('dsp-slider').addEventListener('input', (e) => {
|
|
1170
|
-
currentDispScaleMinPct = parseInt(e.target.value, 10) / 100;
|
|
1171
|
-
document.getElementById('dsp-value').textContent = currentDispScaleMinPct.toFixed(2) + 'x';
|
|
1172
|
-
onSliderChange();
|
|
1173
|
-
});
|
|
1174
|
-
|
|
1175
|
-
document.getElementById('kdt-slider').addEventListener('input', (e) => {
|
|
1176
|
-
currentKalmanDispThresholdMult = parseInt(e.target.value, 10) / 100;
|
|
1177
|
-
document.getElementById('kdt-value').textContent = currentKalmanDispThresholdMult.toFixed(2) + 'x';
|
|
1178
|
-
onSliderChange();
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
document.getElementById('kfs-slider').addEventListener('input', (e) => {
|
|
1182
|
-
currentKalmanSmoothSpanPct = parseInt(e.target.value, 10);
|
|
1183
|
-
document.getElementById('kfs-value').textContent = currentKalmanSmoothSpanPct + '%';
|
|
1184
|
-
onSliderChange();
|
|
1185
|
-
});
|
|
1186
|
-
|
|
1187
|
-
document.getElementById('cf-slider').addEventListener('input', (e) => {
|
|
1188
|
-
currentSignalConfirmBars = parseInt(e.target.value, 10);
|
|
1189
|
-
document.getElementById('cf-value').textContent = currentSignalConfirmBars;
|
|
1190
|
-
onSliderChange();
|
|
1191
|
-
});
|
|
1192
|
-
|
|
1193
|
-
document.getElementById('clip-slider').addEventListener('input', (e) => {
|
|
1194
|
-
currentClipPct = parseInt(e.target.value, 10);
|
|
1195
|
-
if (currentClipPct === 0) {
|
|
1196
|
-
currentAmaClipThreshold = data.amaPercentiles[data.amaPercentiles.length - 1];
|
|
1197
|
-
currentKalClipThreshold = Infinity;
|
|
1198
|
-
} else {
|
|
1199
|
-
currentAmaClipThreshold = data.amaPercentiles[100 - currentClipPct];
|
|
1200
|
-
recalcKalmanClipThreshold();
|
|
1201
|
-
}
|
|
1202
|
-
document.getElementById('clip-value').textContent = currentClipPct + '%';
|
|
1203
|
-
onSliderChange();
|
|
1204
|
-
});
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
document.getElementById('nz-slider').addEventListener('input', (e) => {
|
|
1208
|
-
currentNz = parseInt(e.target.value, 10) / 100;
|
|
1209
|
-
document.getElementById('nz-value').textContent = currentNz.toFixed(2);
|
|
1210
|
-
onSliderChange();
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
|
-
document.getElementById('lb-slider').addEventListener('input', (e) => {
|
|
1214
|
-
currentLookbackBars = lbSliderToVal(parseInt(e.target.value, 10));
|
|
1215
|
-
document.getElementById('lb-value').textContent = currentLookbackBars;
|
|
1216
|
-
onSliderChange();
|
|
1217
|
-
});
|
|
1218
|
-
|
|
1219
|
-
document.getElementById('regime-slider').addEventListener('input', (e) => {
|
|
1220
|
-
currentRegimeSensitivity = parseInt(e.target.value, 10) / 100;
|
|
1221
|
-
document.getElementById('regime-value').textContent = currentRegimeSensitivity.toFixed(2);
|
|
1222
|
-
recalcWeights();
|
|
1223
|
-
refreshChartsPreservingZoom();
|
|
1224
|
-
});
|
|
1225
|
-
|
|
1226
|
-
function applyParams(p, btn) {
|
|
1227
|
-
if (typeof p !== 'object' || p === null) throw new Error('not an object');
|
|
1228
|
-
if (p.alpha != null) {
|
|
1229
|
-
currentAlpha = Math.max(0, Math.min(1, p.alpha));
|
|
1230
|
-
document.getElementById('alpha-slider').value = Math.round(currentAlpha * 100);
|
|
1231
|
-
document.getElementById('alpha-value').textContent = currentAlpha.toFixed(2);
|
|
1232
|
-
}
|
|
1233
|
-
if (p.dispWeight != null) {
|
|
1234
|
-
currentDw = Math.max(0, Math.min(1, p.dispWeight));
|
|
1235
|
-
document.getElementById('dw-slider').value = Math.round(currentDw * 100);
|
|
1236
|
-
document.getElementById('dw-value').textContent = currentDw.toFixed(2);
|
|
1237
|
-
}
|
|
1238
|
-
if (p.amaMaxSlopePct != null) {
|
|
1239
|
-
currentAmaMaxSlopePct = Math.max(0.01, Math.min(0.5, p.amaMaxSlopePct));
|
|
1240
|
-
document.getElementById('ama-ms-slider').value = Math.round((Math.log(currentAmaMaxSlopePct) - AMA_MS_LOG_MIN) / (AMA_MS_LOG_MAX - AMA_MS_LOG_MIN) * 1000);
|
|
1241
|
-
document.getElementById('ama-ms-value').textContent = currentAmaMaxSlopePct.toFixed(4);
|
|
1242
|
-
}
|
|
1243
|
-
if (p.kalmanMaxSlopePct != null) {
|
|
1244
|
-
currentKalmanMaxSlopePct = Math.max(0.15, Math.min(1.5, p.kalmanMaxSlopePct));
|
|
1245
|
-
document.getElementById('kal-ms-slider').value = Math.round((Math.log(currentKalmanMaxSlopePct) - KAL_MS_LOG_MIN) / (KAL_MS_LOG_MAX - KAL_MS_LOG_MIN) * 1000);
|
|
1246
|
-
document.getElementById('kal-ms-value').textContent = currentKalmanMaxSlopePct.toFixed(2);
|
|
1247
|
-
}
|
|
1248
|
-
if (p.gain != null) {
|
|
1249
|
-
currentGain = Math.max(0.5, Math.min(2.0, p.gain));
|
|
1250
|
-
document.getElementById('gain-slider').value = gainValToSlider(currentGain);
|
|
1251
|
-
document.getElementById('gain-value').textContent = currentGain.toFixed(3);
|
|
1252
|
-
}
|
|
1253
|
-
if (p.minOutputThreshold != null) {
|
|
1254
|
-
currentMinOutputThreshold = Math.max(0, Math.min(0.5, p.minOutputThreshold));
|
|
1255
|
-
document.getElementById('th-slider').value = Math.round(currentMinOutputThreshold * 100);
|
|
1256
|
-
document.getElementById('th-value').textContent = currentMinOutputThreshold.toFixed(2);
|
|
1257
|
-
}
|
|
1258
|
-
if (p.kalmanSmoothPct != null) {
|
|
1259
|
-
currentKalmanSmoothPct = Math.max(0, Math.min(200, Math.round(p.kalmanSmoothPct)));
|
|
1260
|
-
document.getElementById('kf-slider').value = currentKalmanSmoothPct;
|
|
1261
|
-
document.getElementById('kf-value').textContent = currentKalmanSmoothPct + '%';
|
|
1262
|
-
}
|
|
1263
|
-
if (p.kalmanDispScaleMult != null) {
|
|
1264
|
-
currentKalmanDispScaleMult = Math.max(1.0, Math.min(3.0, p.kalmanDispScaleMult));
|
|
1265
|
-
document.getElementById('kfd-slider').value = Math.round(currentKalmanDispScaleMult * 100);
|
|
1266
|
-
document.getElementById('kfd-value').textContent = currentKalmanDispScaleMult.toFixed(2) + 'x';
|
|
1267
|
-
}
|
|
1268
|
-
if (p.dispScaleMinPct != null) {
|
|
1269
|
-
currentDispScaleMinPct = Math.max(0.25, Math.min(4.0, p.dispScaleMinPct));
|
|
1270
|
-
document.getElementById('dsp-slider').value = Math.round(currentDispScaleMinPct * 100);
|
|
1271
|
-
document.getElementById('dsp-value').textContent = currentDispScaleMinPct.toFixed(2) + 'x';
|
|
1272
|
-
}
|
|
1273
|
-
if (p.kalmanDispThresholdMult != null) {
|
|
1274
|
-
currentKalmanDispThresholdMult = Math.max(0.25, Math.min(3.0, p.kalmanDispThresholdMult));
|
|
1275
|
-
document.getElementById('kdt-slider').value = Math.round(currentKalmanDispThresholdMult * 100);
|
|
1276
|
-
document.getElementById('kdt-value').textContent = currentKalmanDispThresholdMult.toFixed(2) + 'x';
|
|
1277
|
-
}
|
|
1278
|
-
if (p.kalmanSmoothSpanPct != null) {
|
|
1279
|
-
currentKalmanSmoothSpanPct = Math.max(20, Math.min(200, Math.round(p.kalmanSmoothSpanPct)));
|
|
1280
|
-
document.getElementById('kfs-slider').value = currentKalmanSmoothSpanPct;
|
|
1281
|
-
document.getElementById('kfs-value').textContent = currentKalmanSmoothSpanPct + '%';
|
|
1282
|
-
}
|
|
1283
|
-
if (p.signalConfirmBars != null) {
|
|
1284
|
-
currentSignalConfirmBars = Math.max(0, Math.min(5, Math.round(p.signalConfirmBars)));
|
|
1285
|
-
document.getElementById('cf-slider').value = currentSignalConfirmBars;
|
|
1286
|
-
document.getElementById('cf-value').textContent = currentSignalConfirmBars;
|
|
1287
|
-
}
|
|
1288
|
-
if (p.clipPct != null) {
|
|
1289
|
-
currentClipPct = Math.max(0, Math.min(55, Math.round(p.clipPct)));
|
|
1290
|
-
document.getElementById('clip-slider').value = currentClipPct;
|
|
1291
|
-
document.getElementById('clip-value').textContent = currentClipPct + '%';
|
|
1292
|
-
if (currentClipPct === 0) {
|
|
1293
|
-
currentAmaClipThreshold = data.amaPercentiles[data.amaPercentiles.length - 1];
|
|
1294
|
-
currentKalClipThreshold = Infinity;
|
|
1295
|
-
} else {
|
|
1296
|
-
currentAmaClipThreshold = data.amaPercentiles[100 - currentClipPct];
|
|
1297
|
-
recalcKalmanClipThreshold();
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
if (p.neutralZonePct != null) {
|
|
1301
|
-
currentNz = Math.max(0, Math.min(1, p.neutralZonePct));
|
|
1302
|
-
document.getElementById('nz-slider').value = Math.round(currentNz * 100);
|
|
1303
|
-
document.getElementById('nz-value').textContent = currentNz.toFixed(2);
|
|
1304
|
-
}
|
|
1305
|
-
if (p.regimeSensitivity != null) {
|
|
1306
|
-
currentRegimeSensitivity = Math.max(0, Math.min(2, p.regimeSensitivity));
|
|
1307
|
-
document.getElementById('regime-slider').value = Math.round(currentRegimeSensitivity * 100);
|
|
1308
|
-
document.getElementById('regime-value').textContent = currentRegimeSensitivity.toFixed(2);
|
|
1309
|
-
}
|
|
1310
|
-
if (p.lookbackBars != null) {
|
|
1311
|
-
currentLookbackBars = Math.max(1, Math.min(32, Math.round(p.lookbackBars)));
|
|
1312
|
-
document.getElementById('lb-slider').value = lbValToSlider(currentLookbackBars);
|
|
1313
|
-
document.getElementById('lb-value').textContent = currentLookbackBars;
|
|
1314
|
-
}
|
|
1315
|
-
recalcInputs();
|
|
1316
|
-
recalcWeights();
|
|
1317
|
-
refreshChartsPreservingZoom();
|
|
1318
|
-
if (btn) { btn.textContent = 'pasted!'; btn.classList.add('pasted'); setTimeout(() => { btn.textContent = 'paste'; btn.classList.remove('pasted'); }, 1500); }
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
let _confirmPending = null;
|
|
1322
|
-
function showConfirm(p, btn) {
|
|
1323
|
-
_confirmPending = { p, btn };
|
|
1324
|
-
const labels = {
|
|
1325
|
-
alpha: 'alpha',
|
|
1326
|
-
amaMaxSlopePct: 'amaS%',
|
|
1327
|
-
kalmanMaxSlopePct: 'kalS%',
|
|
1328
|
-
minOutputThreshold: 'th%',
|
|
1329
|
-
gain: 'gain',
|
|
1330
|
-
kalmanSmoothPct: 'kf',
|
|
1331
|
-
kalmanDispScaleMult: 'kfd',
|
|
1332
|
-
dispScaleMinPct: 'dsp',
|
|
1333
|
-
kalmanDispThresholdMult: 'kdt',
|
|
1334
|
-
kalmanSmoothSpanPct: 'kfs',
|
|
1335
|
-
signalConfirmBars: 'cf',
|
|
1336
|
-
clipPct: 'clip%',
|
|
1337
|
-
neutralZonePct: 'nz%',
|
|
1338
|
-
regimeSensitivity: 'regime',
|
|
1339
|
-
dispWeight: 'dw',
|
|
1340
|
-
lookbackBars: 'lb',
|
|
1341
|
-
};
|
|
1342
|
-
document.getElementById('paste-confirm-vals').innerHTML = Object.entries(labels)
|
|
1343
|
-
.filter(([k]) => p[k] != null)
|
|
1344
|
-
.map(([k, label]) => label + ': <span>' + p[k] + '</span>')
|
|
1345
|
-
.join('<br>');
|
|
1346
|
-
const popup = document.getElementById('paste-confirm');
|
|
1347
|
-
popup.style.display = 'block';
|
|
1348
|
-
const r = btn.getBoundingClientRect();
|
|
1349
|
-
const pw = popup.offsetWidth, ph = popup.offsetHeight;
|
|
1350
|
-
let top = r.top - ph - 6;
|
|
1351
|
-
let left = r.right - pw;
|
|
1352
|
-
if (top < 4) top = r.bottom + 6;
|
|
1353
|
-
if (left < 4) left = 4;
|
|
1354
|
-
popup.style.top = top + 'px';
|
|
1355
|
-
popup.style.left = left + 'px';
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
document.getElementById('paste-confirm-apply').addEventListener('click', () => {
|
|
1359
|
-
document.getElementById('paste-confirm').style.display = 'none';
|
|
1360
|
-
if (_confirmPending) { applyParams(_confirmPending.p, _confirmPending.btn); _confirmPending = null; }
|
|
1361
|
-
});
|
|
1362
|
-
document.getElementById('paste-confirm-cancel').addEventListener('click', () => {
|
|
1363
|
-
document.getElementById('paste-confirm').style.display = 'none';
|
|
1364
|
-
_confirmPending = null;
|
|
1365
|
-
});
|
|
1366
|
-
document.addEventListener('keydown', (e) => {
|
|
1367
|
-
if (e.key === 'Escape' && document.getElementById('paste-confirm').style.display !== 'none') {
|
|
1368
|
-
document.getElementById('paste-confirm').style.display = 'none';
|
|
1369
|
-
_confirmPending = null;
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
|
|
1373
|
-
const LS_KEY = 'dw_research_params';
|
|
1374
|
-
|
|
1375
|
-
document.getElementById('copy-params-btn').addEventListener('click', () => {
|
|
1376
|
-
const btn = document.getElementById('copy-params-btn');
|
|
1377
|
-
const params = {
|
|
1378
|
-
alpha: +currentAlpha.toFixed(2),
|
|
1379
|
-
amaMaxSlopePct: +currentAmaMaxSlopePct.toFixed(4),
|
|
1380
|
-
kalmanMaxSlopePct: +currentKalmanMaxSlopePct.toFixed(2),
|
|
1381
|
-
minOutputThreshold: +currentMinOutputThreshold.toFixed(2),
|
|
1382
|
-
gain: +currentGain.toFixed(3),
|
|
1383
|
-
kalmanSmoothPct: currentKalmanSmoothPct,
|
|
1384
|
-
kalmanDispScaleMult: +currentKalmanDispScaleMult.toFixed(2),
|
|
1385
|
-
dispScaleMinPct: +currentDispScaleMinPct.toFixed(2),
|
|
1386
|
-
kalmanDispThresholdMult: +currentKalmanDispThresholdMult.toFixed(2),
|
|
1387
|
-
kalmanSmoothSpanPct: currentKalmanSmoothSpanPct,
|
|
1388
|
-
signalConfirmBars: currentSignalConfirmBars,
|
|
1389
|
-
clipPct: currentClipPct,
|
|
1390
|
-
neutralZonePct: +currentNz.toFixed(3),
|
|
1391
|
-
regimeSensitivity: +currentRegimeSensitivity.toFixed(2),
|
|
1392
|
-
dispWeight: +currentDw.toFixed(2),
|
|
1393
|
-
lookbackBars: currentLookbackBars,
|
|
1394
|
-
};
|
|
1395
|
-
const json = JSON.stringify(params, null, 2);
|
|
1396
|
-
localStorage.setItem(LS_KEY, json);
|
|
1397
|
-
navigator.clipboard.writeText(json).catch(() => {});
|
|
1398
|
-
btn.textContent = 'copied!';
|
|
1399
|
-
btn.classList.add('copied');
|
|
1400
|
-
setTimeout(() => { btn.textContent = 'copy'; btn.classList.remove('copied'); }, 1500);
|
|
1401
|
-
});
|
|
1402
|
-
|
|
1403
|
-
document.getElementById('paste-params-btn').addEventListener('click', () => {
|
|
1404
|
-
const btn = document.getElementById('paste-params-btn');
|
|
1405
|
-
const tryParse = (text) => {
|
|
1406
|
-
try { showConfirm(JSON.parse(text), btn); }
|
|
1407
|
-
catch { btn.textContent = 'error'; btn.classList.add('error'); setTimeout(() => { btn.textContent = 'paste'; btn.classList.remove('error'); }, 1500); }
|
|
1408
|
-
};
|
|
1409
|
-
// Use localStorage first (same-tab copy/paste), fallback to Ctrl+V
|
|
1410
|
-
const stored = localStorage.getItem(LS_KEY);
|
|
1411
|
-
if (stored) {
|
|
1412
|
-
try { showConfirm(JSON.parse(stored), btn); return; } catch {}
|
|
1413
|
-
}
|
|
1414
|
-
// No localStorage data - use Ctrl+V method
|
|
1415
|
-
btn.textContent = 'Ctrl+V…';
|
|
1416
|
-
btn.classList.add('pasted');
|
|
1417
|
-
const ta = document.createElement('textarea');
|
|
1418
|
-
ta.style.cssText = 'position:fixed;opacity:0;top:0;left:0;width:1px;height:1px;font-size:16px;';
|
|
1419
|
-
document.body.appendChild(ta);
|
|
1420
|
-
ta.focus();
|
|
1421
|
-
const cleanup = () => { document.body.removeChild(ta); btn.textContent = 'paste'; btn.classList.remove('pasted'); };
|
|
1422
|
-
ta.addEventListener('paste', (e) => {
|
|
1423
|
-
const text = (e.clipboardData || window.clipboardData).getData('text');
|
|
1424
|
-
cleanup();
|
|
1425
|
-
tryParse(text);
|
|
1426
|
-
}, { once: true });
|
|
1427
|
-
ta.addEventListener('keydown', (e) => { if (e.key === 'Escape') cleanup(); });
|
|
1428
|
-
setTimeout(cleanup, 10000);
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
function sizeCharts() {
|
|
1433
|
-
if (!priceChart || !amaChart || !kalmanChart || !outputChart) return;
|
|
1434
|
-
[[priceChart, 'price-panel'], [amaChart, 'ama-panel'], [kalmanChart, 'kalman-panel'], [outputChart, 'output-panel']].forEach(([chart, id]) => {
|
|
1435
|
-
const el = document.getElementById(id);
|
|
1436
|
-
chart.setSize({ width: el.offsetWidth, height: el.offsetHeight });
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
window.addEventListener('resize', sizeCharts);
|
|
1441
|
-
window.addEventListener('keydown', (e) => { if ((e.ctrlKey || e.metaKey) && e.key === '0') syncXRange(xMin, xMax); });
|
|
1442
|
-
|
|
1443
|
-
init();
|
|
1444
|
-
requestAnimationFrame(() => { sizeCharts(); updateLegend(lastLiveIdx); });
|
|
1445
|
-
</script>
|
|
1446
|
-
</body>
|
|
1447
|
-
</html>`;
|
|
1448
|
-
}
|
|
1449
|
-
module.exports = { generateHTML };
|
|
1450
|
-
//# sourceMappingURL=dynamic_weight_chart_generator.js.map
|