dexbot 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/chart_utils.d.ts +11 -9
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +21 -16
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +4 -13
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +16 -18
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +3 -7
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +38 -34
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +1 -4
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +10 -7
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +6 -6
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +23 -15
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +12 -13
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +16 -16
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +1 -4
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +10 -7
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +6 -13
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts.map +1 -1
- package/dist/credential-daemon.js +74 -35
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +16 -15
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.d.ts +1 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +8 -20
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.d.ts +2 -10
- package/dist/market_adapter/candle_utils.d.ts.map +1 -1
- package/dist/market_adapter/candle_utils.js +7 -8
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +12 -7
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +4 -5
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.d.ts +4 -9
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +9 -9
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.d.ts +16 -20
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +16 -15
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.d.ts +8 -11
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +13 -11
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts +5 -12
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +12 -21
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +75 -53
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +102 -98
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.d.ts +21 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +10 -10
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +7 -11
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +23 -30
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +5 -4
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +5 -3
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +4 -7
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +5 -4
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +11 -19
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +22 -22
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/index.d.ts +24 -2
- package/dist/market_adapter/index.d.ts.map +1 -1
- package/dist/market_adapter/index.js +82 -56
- package/dist/market_adapter/index.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +26 -37
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +4 -12
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +100 -66
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts +4 -9
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +17 -18
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/interval_utils.d.ts +1 -4
- package/dist/market_adapter/interval_utils.d.ts.map +1 -1
- package/dist/market_adapter/interval_utils.js +2 -3
- package/dist/market_adapter/interval_utils.js.map +1 -1
- package/dist/market_adapter/log_format.d.ts +1 -9
- package/dist/market_adapter/log_format.d.ts.map +1 -1
- package/dist/market_adapter/log_format.js +7 -8
- package/dist/market_adapter/log_format.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.d.ts +1 -4
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +22 -20
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +13 -24
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +58 -56
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +4 -17
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +36 -36
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +51 -72
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +227 -192
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/merge_lp_data.js +17 -16
- package/dist/market_adapter/merge_lp_data.js.map +1 -1
- package/dist/market_adapter/test_helpers.d.ts +9 -13
- package/dist/market_adapter/test_helpers.d.ts.map +1 -1
- package/dist/market_adapter/test_helpers.js +14 -14
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.d.ts +6 -14
- package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +16 -15
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.d.ts +2 -5
- package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +5 -5
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts +19 -21
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +15 -16
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.d.ts +1 -4
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +10 -10
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +1 -6
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +14 -14
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.d.ts +1 -7
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +21 -25
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.d.ts +12 -12
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
- package/dist/market_adapter/utils/native_history.js +15 -15
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/market_adapter/utils/paths.d.ts +2 -4
- package/dist/market_adapter/utils/paths.d.ts.map +1 -1
- package/dist/market_adapter/utils/paths.js +6 -5
- package/dist/market_adapter/utils/paths.js.map +1 -1
- package/dist/modules/account_bots.d.ts +7 -8
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +92 -114
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +5 -9
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +69 -32
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.d.ts +32 -1
- package/dist/modules/authority_resolver.d.ts.map +1 -1
- package/dist/modules/authority_resolver.js +18 -12
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.d.ts +3 -8
- package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +21 -16
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +21 -29
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +72 -38
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts +9 -36
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.js +40 -83
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +14 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -3
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts +10 -2
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +68 -31
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts +1 -4
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +6 -3
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.d.ts +3 -6
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +11 -9
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +53 -55
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +28 -27
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts +5 -9
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +46 -12
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts +102 -100
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +473 -471
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts +2 -7
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +8 -3
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.d.ts +26 -41
- package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +76 -42
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.d.ts +1 -5
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +49 -11
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts +1 -4
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +47 -84
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.d.ts +1 -8
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
- package/dist/modules/bitshares-native/transport.js +22 -15
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts +3 -8
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +61 -23
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts +1 -8
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +21 -17
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +12 -23
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +109 -56
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts +1 -13
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +34 -34
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts +3 -9
- package/dist/modules/bots_file_lock.d.ts.map +1 -1
- package/dist/modules/bots_file_lock.js +8 -9
- package/dist/modules/bots_file_lock.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +7 -39
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +126 -90
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +46 -52
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +152 -104
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts +50 -57
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +28 -24
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +492 -492
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +79 -39
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.d.ts +1 -13
- package/dist/modules/cr_planner.d.ts.map +1 -1
- package/dist/modules/cr_planner.js +28 -28
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +18 -33
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +114 -87
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +11 -21
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +40 -40
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credential_session_cache.d.ts +8 -8
- package/dist/modules/credential_session_cache.d.ts.map +1 -1
- package/dist/modules/credential_session_cache.js +41 -8
- package/dist/modules/credential_session_cache.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts +51 -316
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +257 -183
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/browser_provider.js +6 -6
- package/dist/modules/crypto/browser_provider.js.map +1 -1
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +2 -0
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/sync.js +3 -3
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +124 -73
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +198 -3577
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +322 -0
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_cow_runtime.js +1836 -0
- package/dist/modules/dexbot_cow_runtime.js.map +1 -0
- package/dist/modules/dexbot_credential_client.d.ts +5 -11
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
- package/dist/modules/dexbot_credential_client.js +32 -30
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +47 -15
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +565 -22
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +79 -10
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +294 -55
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +26 -0
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_startup_runtime.js +575 -0
- package/dist/modules/dexbot_startup_runtime.js.map +1 -0
- package/dist/modules/dexbot_state_recovery.d.ts +115 -0
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -0
- package/dist/modules/dexbot_state_recovery.js +431 -0
- package/dist/modules/dexbot_state_recovery.js.map +1 -0
- package/dist/modules/fund_registry.d.ts +1 -13
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +23 -22
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.d.ts +3 -7
- package/dist/modules/general_settings.d.ts.map +1 -1
- package/dist/modules/general_settings.js +15 -15
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts +1 -6
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +19 -16
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +53 -20
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +23 -66
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +115 -107
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.d.ts +2 -5
- package/dist/modules/launcher/child_env.d.ts.map +1 -1
- package/dist/modules/launcher/child_env.js +4 -4
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts +4 -8
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.js +30 -26
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
- package/dist/modules/launcher/credential_daemon.d.ts +8 -15
- package/dist/modules/launcher/credential_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/credential_daemon.js +72 -41
- package/dist/modules/launcher/credential_daemon.js.map +1 -1
- package/dist/modules/launcher/credential_secret.d.ts +1 -4
- package/dist/modules/launcher/credential_secret.d.ts.map +1 -1
- package/dist/modules/launcher/credential_secret.js +36 -4
- package/dist/modules/launcher/credential_secret.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +32 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +25 -28
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/headless_password.d.ts +1 -4
- package/dist/modules/launcher/headless_password.d.ts.map +1 -1
- package/dist/modules/launcher/headless_password.js +11 -11
- package/dist/modules/launcher/headless_password.js.map +1 -1
- package/dist/modules/launcher/launch_modes.d.ts +15 -14
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
- package/dist/modules/launcher/launch_modes.js +8 -8
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +10 -19
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +33 -34
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts +10 -17
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +42 -39
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +28 -57
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +135 -108
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts +5 -10
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +14 -14
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +17 -37
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +35 -34
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.d.ts +1 -4
- package/dist/modules/launcher/supervisor_control.d.ts.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +9 -4
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/logger.d.ts +3 -1
- package/dist/modules/logger.d.ts.map +1 -1
- package/dist/modules/logger.js +38 -28
- package/dist/modules/logger.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +2 -10
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +18 -16
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_health_cache.d.ts +2 -12
- package/dist/modules/node_health_cache.d.ts.map +1 -1
- package/dist/modules/node_health_cache.js +24 -24
- package/dist/modules/node_health_cache.js.map +1 -1
- package/dist/modules/node_manager.d.ts +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +44 -38
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.d.ts +12 -12
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +111 -76
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +1 -2
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +4 -4
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.d.ts +8 -14
- package/dist/modules/order/export.d.ts.map +1 -1
- package/dist/modules/order/export.js +77 -42
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +17 -22
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +25 -31
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +18 -104
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +246 -188
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts +8 -8
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile.js +24 -24
- package/dist/modules/order/grid_reconcile.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts +224 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +145 -72
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/index.d.ts +1 -1
- package/dist/modules/order/index.d.ts.map +1 -1
- package/dist/modules/order/index.js +42 -7
- package/dist/modules/order/index.js.map +1 -1
- package/dist/modules/order/logger.d.ts +6 -16
- package/dist/modules/order/logger.d.ts.map +1 -1
- package/dist/modules/order/logger.js +76 -53
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +4 -4
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +3 -1
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +160 -37
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +166 -128
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.d.ts +6 -10
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
- package/dist/modules/order/processed_fill_store.js +10 -9
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.d.ts +3 -3
- package/dist/modules/order/strategy.d.ts.map +1 -1
- package/dist/modules/order/strategy.js +29 -27
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts +9 -19
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +176 -126
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +55 -85
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +155 -88
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +27 -72
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +144 -105
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +74 -44
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +188 -149
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +21 -43
- package/dist/modules/order/utils/validate.d.ts.map +1 -1
- package/dist/modules/order/utils/validate.js +140 -110
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/working_grid.d.ts +1 -4
- package/dist/modules/order/working_grid.d.ts.map +1 -1
- package/dist/modules/order/working_grid.js +9 -7
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/path_api.js +2 -2
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts +51 -55
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +72 -52
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.d.ts +1 -1
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +7 -7
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime.d.ts +1 -1
- package/dist/modules/runtime.d.ts.map +1 -1
- package/dist/modules/runtime.js +4 -4
- package/dist/modules/runtime.js.map +1 -1
- package/dist/modules/runtime_settings.d.ts +1 -0
- package/dist/modules/runtime_settings.d.ts.map +1 -1
- package/dist/modules/runtime_settings.js +15 -10
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +1 -4
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +2 -1
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/storage/browser_adapter.d.ts +7 -3
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
- package/dist/modules/storage/browser_adapter.js +2 -0
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +2 -2
- package/dist/modules/storage/index.d.ts.map +1 -1
- package/dist/modules/storage/index.js +2 -5
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/modules/storage/node_adapter.d.ts +3 -3
- package/dist/modules/storage/node_adapter.d.ts.map +1 -1
- package/dist/modules/storage/node_adapter.js +9 -7
- package/dist/modules/storage/node_adapter.js.map +1 -1
- package/dist/modules/storage/types.d.ts +13 -10
- package/dist/modules/storage/types.d.ts.map +1 -1
- package/dist/modules/types.d.ts +0 -2
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/utils/base58check.d.ts +1 -9
- package/dist/modules/utils/base58check.d.ts.map +1 -1
- package/dist/modules/utils/base58check.js +14 -16
- package/dist/modules/utils/base58check.js.map +1 -1
- package/dist/modules/utils/build_dir.d.ts +2 -5
- package/dist/modules/utils/build_dir.d.ts.map +1 -1
- package/dist/modules/utils/build_dir.js +6 -3
- package/dist/modules/utils/build_dir.js.map +1 -1
- package/dist/modules/utils/errors.d.ts +2 -0
- package/dist/modules/utils/errors.d.ts.map +1 -0
- package/dist/modules/utils/errors.js +12 -0
- package/dist/modules/utils/errors.js.map +1 -0
- package/dist/modules/utils/fs_utils.d.ts +1 -8
- package/dist/modules/utils/fs_utils.d.ts.map +1 -1
- package/dist/modules/utils/fs_utils.js +8 -3
- package/dist/modules/utils/fs_utils.js.map +1 -1
- package/dist/modules/utils/math_utils.d.ts +2 -6
- package/dist/modules/utils/math_utils.d.ts.map +1 -1
- package/dist/modules/utils/math_utils.js +6 -2
- package/dist/modules/utils/math_utils.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts +1 -11
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +25 -27
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts +7 -6
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +132 -106
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.d.ts.map +1 -1
- package/dist/scripts/analyze-git.js +15 -11
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts +146 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +81 -105
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +9 -8
- package/dist/scripts/diagnose-pool-history.js.map +1 -1
- package/dist/scripts/divergence-calc.d.ts.map +1 -1
- package/dist/scripts/divergence-calc.js +11 -8
- package/dist/scripts/divergence-calc.js.map +1 -1
- package/dist/scripts/fix-err-message.d.ts +3 -0
- package/dist/scripts/fix-err-message.d.ts.map +1 -0
- package/dist/scripts/fix-err-message.js +198 -0
- package/dist/scripts/fix-err-message.js.map +1 -0
- package/dist/scripts/generate_lp_chart.d.ts +2 -9
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
- package/dist/scripts/generate_lp_chart.js +14 -10
- package/dist/scripts/generate_lp_chart.js.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.js +4 -4
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +17 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +23 -20
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/dist/scripts/migrate_bot_keys.d.ts +1 -4
- package/dist/scripts/migrate_bot_keys.d.ts.map +1 -1
- package/dist/scripts/migrate_bot_keys.js +48 -124
- package/dist/scripts/migrate_bot_keys.js.map +1 -1
- package/dist/scripts/native_release_gates.d.ts.map +1 -1
- package/dist/scripts/native_release_gates.js +18 -14
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.js +1 -1
- package/dist/scripts/print_grid.js.map +1 -1
- package/dist/scripts/run-tests.js +1 -0
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts +1 -11
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +21 -19
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
- package/dist/scripts/test-credit-renewal.js +2 -1
- package/dist/scripts/test-credit-renewal.js.map +1 -1
- package/dist/scripts/update.d.ts.map +1 -1
- package/dist/scripts/update.js +85 -79
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/validate_bots.js +2 -2
- package/dist/scripts/validate_bots.js.map +1 -1
- package/dist/scripts/verify-browser-bundle.js +25 -1
- package/dist/scripts/verify-browser-bundle.js.map +1 -1
- package/dist/unlock.d.ts +4 -17
- package/dist/unlock.d.ts.map +1 -1
- package/dist/unlock.js +141 -108
- package/dist/unlock.js.map +1 -1
- package/package.json +7 -2
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +0 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +0 -149
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +0 -3
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +0 -387
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +0 -3
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -200
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +0 -3
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +0 -212
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +0 -31
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +0 -249
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +0 -2
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +0 -782
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_derivatives.d.ts +0 -95
- package/dist/analysis/analyze_derivatives.d.ts.map +0 -1
- package/dist/analysis/analyze_derivatives.js +0 -295
- package/dist/analysis/analyze_derivatives.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts +0 -14
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js +0 -207
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts +0 -13
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js +0 -123
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts +0 -20
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js +0 -139
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts +0 -19
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js +0 -413
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts +0 -3
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js +0 -159
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts +0 -3
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js +0 -367
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts +0 -22
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js +0 -172
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +0 -99
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +0 -804
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +0 -2
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +0 -347
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts +0 -15
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js +0 -48
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts +0 -22
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js +0 -162
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +0 -3
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js +0 -498
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +0 -546
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +0 -427
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/derivative_chart_generator.d.ts +0 -18
- package/dist/analysis/derivative_chart_generator.d.ts.map +0 -1
- package/dist/analysis/derivative_chart_generator.js +0 -896
- package/dist/analysis/derivative_chart_generator.js.map +0 -1
- package/dist/analysis/price_sources.d.ts +0 -34
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js +0 -103
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts +0 -115
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js +0 -1247
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +0 -36
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +0 -172
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +0 -250
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/derivative_analyzer.js +0 -903
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +0 -1450
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +0 -408
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +0 -345
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -130
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -38
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +0 -6
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +0 -732
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
|
@@ -1,732 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { MARKET_ADAPTER } = require('../../modules/constants');
|
|
3
|
-
const { escapeHtml, serializeJsonForScript, toEpochSeconds, UPLOT_SHARED_SCRIPT } = require('../chart_utils');
|
|
4
|
-
const { roundTo } = require('../../modules/utils/math_utils');
|
|
5
|
-
function generateHTML(data, title = 'ATR Volatility Research') {
|
|
6
|
-
const results = data.allResults || [];
|
|
7
|
-
if (results.length === 0)
|
|
8
|
-
throw new Error('No analysis results in input');
|
|
9
|
-
const volatilityCfg = data.volatilityConfig || {};
|
|
10
|
-
const defaultThreshold = data.volatilityThreshold ?? volatilityCfg.volatilityThreshold
|
|
11
|
-
?? MARKET_ADAPTER.DYNAMIC_WEIGHT_SYMMETRIC_SHIFT_THRESHOLD;
|
|
12
|
-
const defaultAtrPeriod = data.atrPeriod ?? volatilityCfg.atrPeriod ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_ATR_PERIOD_DEFAULT;
|
|
13
|
-
const defaultExponent = data.volatilityExponent ?? volatilityCfg.volatilityExponent ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_VOLATILITY_EXPONENT;
|
|
14
|
-
const defaultScaleX = data.volatilityScaleX ?? volatilityCfg.volatilityScaleX ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_VOLATILITY_SCALE_X_DEFAULT;
|
|
15
|
-
const defaultClamp = data.volatilityClamp ?? volatilityCfg.volatilityClamp ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_SYMMETRIC_SHIFT_CLAMP;
|
|
16
|
-
const defaultMinWeight = data.minWeight ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_MIN_WEIGHT;
|
|
17
|
-
const defaultMaxWeight = data.maxWeight ?? MARKET_ADAPTER.DYNAMIC_WEIGHT_MAX_WEIGHT;
|
|
18
|
-
const interval = results.length > 1
|
|
19
|
-
? (new Date(results[1].timestamp).getTime() - new Date(results[0].timestamp).getTime()) / 1000
|
|
20
|
-
: 3600;
|
|
21
|
-
const dates = results.map((r, i) => toEpochSeconds(r.timestamp || Date.now(), i));
|
|
22
|
-
const prices = results.map((r) => r.price);
|
|
23
|
-
const ama3Prices = results.map((r) => r.ama3Price ?? null);
|
|
24
|
-
const baseVarianceSeries = results.map((r) => r.weightVariance ?? null);
|
|
25
|
-
const candleRows = Array.isArray(data.candles) ? data.candles : [];
|
|
26
|
-
const realBarCount = results.length;
|
|
27
|
-
const lastDate = dates[dates.length - 1];
|
|
28
|
-
for (let i = 1; i <= 120; i++) {
|
|
29
|
-
dates.push(lastDate + (i * interval));
|
|
30
|
-
prices.push(null);
|
|
31
|
-
ama3Prices.push(null);
|
|
32
|
-
baseVarianceSeries.push(null);
|
|
33
|
-
}
|
|
34
|
-
const payload = {
|
|
35
|
-
dates,
|
|
36
|
-
prices,
|
|
37
|
-
ama3Prices,
|
|
38
|
-
candles: candleRows,
|
|
39
|
-
atrPeriod: defaultAtrPeriod,
|
|
40
|
-
varianceSeries: baseVarianceSeries,
|
|
41
|
-
realBarCount,
|
|
42
|
-
volatilityThreshold: defaultThreshold,
|
|
43
|
-
volatilityExponent: defaultExponent,
|
|
44
|
-
volatilityScaleX: defaultScaleX,
|
|
45
|
-
volatilityClamp: defaultClamp,
|
|
46
|
-
minWeight: defaultMinWeight,
|
|
47
|
-
maxWeight: defaultMaxWeight,
|
|
48
|
-
marketAdapter: MARKET_ADAPTER,
|
|
49
|
-
};
|
|
50
|
-
return `<!DOCTYPE html>
|
|
51
|
-
<html lang="en">
|
|
52
|
-
<head>
|
|
53
|
-
<meta charset="UTF-8">
|
|
54
|
-
<meta name="color-scheme" content="dark">
|
|
55
|
-
<meta name="darkreader-lock">
|
|
56
|
-
<title>${escapeHtml(title)}</title>
|
|
57
|
-
<link rel="stylesheet" href="../uplot/uPlot.min.css">
|
|
58
|
-
<script src="../uplot/uPlot.iife.min.js"></script>
|
|
59
|
-
<style>
|
|
60
|
-
* { box-sizing: border-box; }
|
|
61
|
-
:root { color-scheme: dark; }
|
|
62
|
-
body { background: #0b0e14; color: #d1d5db; font-family: 'Segoe UI', sans-serif; margin: 0; padding: 0; overflow: hidden; }
|
|
63
|
-
#header { padding: 10px 18px; background: #161b22; border-bottom: 1px solid #30363d; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 48px; }
|
|
64
|
-
#header-left { font-weight: bold; color: #fff; }
|
|
65
|
-
#hint { font-size: 11px; color: #8b949e; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
|
|
66
|
-
#panels { display: flex; flex-direction: column; height: calc(100vh - 48px); width: 100vw; }
|
|
67
|
-
#price-panel { flex: 0 0 33%; min-height: 0; position: relative; border-bottom: 1px solid #30363d; }
|
|
68
|
-
#variance-panel { flex: 0 0 27%; min-height: 0; position: relative; border-bottom: 1px solid #30363d; }
|
|
69
|
-
#variance-panel .legend { top: 10px; }
|
|
70
|
-
#variance-chart { margin-top: 0; height: 100%; }
|
|
71
|
-
#shift-panel { flex: 0 0 40%; min-height: 0; position: relative; }
|
|
72
|
-
#shift-panel .legend { top: 18px; }
|
|
73
|
-
#shift-chart { margin-top: 0; height: calc(100% - 30px); }
|
|
74
|
-
.uplot { background: #0b0e14; }
|
|
75
|
-
.legend { position: absolute; top: 8px; left: 12px; right: 12px; font-size: 11px; pointer-events: none; z-index: 10; display: flex; gap: 12px; color: #adbac7; white-space: nowrap; align-items: center; flex-wrap: wrap; }
|
|
76
|
-
.legend-item { display: flex; align-items: center; gap: 5px; }
|
|
77
|
-
.legend-val { font-family: monospace; font-weight: bold; }
|
|
78
|
-
.dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
|
|
79
|
-
.u-cursor-x { border-left: 1px dashed rgba(255,255,255,0.3) !important; }
|
|
80
|
-
.u-cursor-y { border-top: 1px dashed rgba(255,255,255,0.3) !important; display: none; }
|
|
81
|
-
.is-hovered .u-cursor-y { display: block; }
|
|
82
|
-
.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; }
|
|
83
|
-
.ctrl { pointer-events: auto; display: inline-flex; align-items: center; gap: 3px; margin-left: 0; }
|
|
84
|
-
.ctrl label { color: #8b949e; font-size: 11px; min-width: 34px; text-align: right; }
|
|
85
|
-
.ctrl input[type="range"] { width: 138px; height: 3px; margin-right: 0; }
|
|
86
|
-
.ctrl .val { font-weight: bold; font-size: 11px; min-width: 36px; display: inline-block; text-align: right; margin-left: 0; }
|
|
87
|
-
.ctrl.thr label { min-width: 26px; }
|
|
88
|
-
.ctrl.atr label { min-width: 28px; }
|
|
89
|
-
.ctrl.exp label { min-width: 24px; }
|
|
90
|
-
.ctrl.scale label { min-width: 38px; }
|
|
91
|
-
.ctrl.clamp label { min-width: 36px; }
|
|
92
|
-
.ctrl.thr input[type="range"] { accent-color: #8b949e; }
|
|
93
|
-
.ctrl.thr .val { color: #8b949e; }
|
|
94
|
-
.ctrl.atr input[type="range"] { accent-color: #3fb950; }
|
|
95
|
-
.ctrl.atr .val { color: #3fb950; }
|
|
96
|
-
.ctrl.atr input[type="range"] { margin-right: -6px; }
|
|
97
|
-
.ctrl.exp input[type="range"] { accent-color: #58a6ff; }
|
|
98
|
-
.ctrl.exp .val { color: #58a6ff; }
|
|
99
|
-
.ctrl.thr input[type="range"],
|
|
100
|
-
.ctrl.atr input[type="range"],
|
|
101
|
-
.ctrl.exp input[type="range"],
|
|
102
|
-
.ctrl.scale input[type="range"],
|
|
103
|
-
.ctrl.clamp input[type="range"] { width: 138px; }
|
|
104
|
-
.ctrl.scale input[type="range"] { accent-color: #f0883e; }
|
|
105
|
-
.ctrl.scale input[type="range"] { margin-right: 8px; }
|
|
106
|
-
.ctrl.scale .val { color: #f0883e; }
|
|
107
|
-
.ctrl.clamp input[type="range"] { accent-color: #a371f7; }
|
|
108
|
-
.ctrl.clamp .val { color: #a371f7; }
|
|
109
|
-
.group-sep { border-left: 1px solid #30363d; margin-left: 2px; padding-left: 2px; display: inline-flex; align-items: center; height: 18px; }
|
|
110
|
-
.signal-summary { margin-left: 8px; min-width: 313px; max-width: 450px; flex: 0 0 338px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; justify-content: center; }
|
|
111
|
-
.signal-bar { display: flex; width: 100%; height: 15px; overflow: hidden; border-radius: 999px; background: #10151d; border: 1px solid #30363d; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 0 10px rgba(88,166,255,0.08); }
|
|
112
|
-
.signal-seg { position: relative; height: 100%; min-width: 1px; transition: width 0.18s ease; box-shadow: inset 0 0 8px rgba(255,255,255,0.14), 0 0 8px currentColor; }
|
|
113
|
-
.signal-seg:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.34); }
|
|
114
|
-
.signal-seg.below { color: #58a6ff; background: linear-gradient(90deg, #3b82f6 0%, #7dd3fc 100%); box-shadow: inset 0 0 4px rgba(255,255,255,0.14); }
|
|
115
|
-
.signal-seg.mid { color: #ffd24a; background: linear-gradient(90deg, #ffe066 0%, #fff3a0 100%); box-shadow: inset 0 0 4px rgba(255,255,255,0.18); }
|
|
116
|
-
.signal-seg.over { color: #f85149; background: linear-gradient(90deg, #ff4d4d 0%, #ff8a8a 100%); box-shadow: inset 0 0 4px rgba(255,255,255,0.12); }
|
|
117
|
-
.signal-labels { position: relative; width: 100%; height: 12px; font-size: 10px; color: #8b949e; white-space: nowrap; }
|
|
118
|
-
.signal-labels span { position: absolute; top: 0; transform: translateY(0); pointer-events: none; }
|
|
119
|
-
.signal-labels span:nth-child(1) { left: 2px; color: #58a6ff; }
|
|
120
|
-
.signal-labels span:nth-child(2) { left: 50%; transform: translate(-50%, 0); color: #ffd24a; }
|
|
121
|
-
.signal-labels span:nth-child(3) { right: 2px; color: #f85149; }
|
|
122
|
-
</style>
|
|
123
|
-
</head>
|
|
124
|
-
<body>
|
|
125
|
-
<div id="header">
|
|
126
|
-
<div id="header-left">${escapeHtml(title)}</div>
|
|
127
|
-
<div id="hint">Log price only · weight variance · symmetric shift · wheel zoom · drag pan · Ctrl+0 reset</div>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div id="panels">
|
|
131
|
-
<div id="price-panel">
|
|
132
|
-
<div class="section-label">PRICE (LOG)</div>
|
|
133
|
-
<div class="legend">
|
|
134
|
-
<div class="legend-item"><div class="dot" style="background:#58a6ff;"></div>Price: <span id="l-price" class="legend-val" style="color:#58a6ff;">-</span></div>
|
|
135
|
-
<div class="legend-item"><div class="dot" style="background:#e3b341;"></div>AMA3: <span id="l-ama3" class="legend-val" style="color:#e3b341;">-</span></div>
|
|
136
|
-
</div>
|
|
137
|
-
<div id="price-chart"></div>
|
|
138
|
-
</div>
|
|
139
|
-
<div id="variance-panel">
|
|
140
|
-
<div class="section-label">WEIGHT VARIANCE</div>
|
|
141
|
-
<div class="legend">
|
|
142
|
-
<div class="legend-item"><div class="dot" style="background:#d2a8ff;"></div>Weight variance: <span id="l-var" class="legend-val" style="color:#d2a8ff;">-</span></div>
|
|
143
|
-
</div>
|
|
144
|
-
<div id="variance-chart"></div>
|
|
145
|
-
</div>
|
|
146
|
-
<div id="shift-panel">
|
|
147
|
-
<div class="section-label">SYMMETRIC SHIFT</div>
|
|
148
|
-
<div class="legend" style="gap: 10px;">
|
|
149
|
-
<div class="legend-item"><div class="dot" style="background:#f85149;"></div>Δ: <span id="l-delta" class="legend-val" style="color:#f85149;">-</span></div>
|
|
150
|
-
<div class="legend-item">Weff: <span id="l-weff" class="legend-val" style="color:#3fb950;">-</span></div>
|
|
151
|
-
<div class="group-sep"></div>
|
|
152
|
-
<div class="ctrl thr"><label for="threshold-slider">thr</label><input type="range" id="threshold-slider" min="0" max="500" step="1" value="${Math.round(defaultThreshold * 1000)}"><span class="val" id="threshold-value">${defaultThreshold.toFixed(3)}</span></div>
|
|
153
|
-
<div class="ctrl atr"><label for="atr-slider">atr</label><input type="range" id="atr-slider" min="3" max="30" step="1" value="${Math.round(defaultAtrPeriod)}"><span class="val" id="atr-value">${Math.round(defaultAtrPeriod)}</span></div>
|
|
154
|
-
<div class="ctrl clamp"><label for="clamp-slider">clamp</label><input type="range" id="clamp-slider" min="100" max="1000" step="1" value="${Math.round(defaultClamp * 1000)}"><span class="val" id="clamp-value">${defaultClamp.toFixed(3)}</span></div>
|
|
155
|
-
<div class="ctrl exp"><label for="exponent-slider">exp</label><input type="range" id="exponent-slider" min="500" max="1000" step="1" value="${Math.round(defaultExponent * 1000)}"><span class="val" id="exponent-value">${defaultExponent.toFixed(3)}</span></div>
|
|
156
|
-
<div class="ctrl scale"><label for="scale-slider">scaleX</label><input type="range" id="scale-slider" min="100" max="10000" step="1" value="${Math.round(defaultScaleX * 100)}"><span class="val" id="scale-value">${defaultScaleX.toFixed(2)}x</span></div>
|
|
157
|
-
<div class="signal-summary">
|
|
158
|
-
<div class="signal-bar" id="signal-bar" title="Signal distribution">
|
|
159
|
-
<div id="signal-below" class="signal-seg below" style="width:0%"></div>
|
|
160
|
-
<div id="signal-mid" class="signal-seg mid" style="width:0%"></div>
|
|
161
|
-
<div id="signal-over" class="signal-seg over" style="width:0%"></div>
|
|
162
|
-
</div>
|
|
163
|
-
<div class="signal-labels">
|
|
164
|
-
<span id="signal-below-label">below 0%</span>
|
|
165
|
-
<span id="signal-mid-label">in 0%</span>
|
|
166
|
-
<span id="signal-over-label">over 0%</span>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
<div id="shift-chart"></div>
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<script id="payload" type="application/json">${serializeJsonForScript(payload)}</script>
|
|
175
|
-
<script>
|
|
176
|
-
(function () {
|
|
177
|
-
const data = JSON.parse(document.getElementById('payload').textContent);
|
|
178
|
-
const SYNC_KEY = 'volatility-det-v1';
|
|
179
|
-
const Y_AXIS_SIZE = 58;
|
|
180
|
-
const MARKET_ADAPTER = data.marketAdapter || {};
|
|
181
|
-
const MIN_WEIGHT = data.minWeight ?? ${JSON.stringify(defaultMinWeight)};
|
|
182
|
-
const MAX_WEIGHT = data.maxWeight ?? ${JSON.stringify(defaultMaxWeight)};
|
|
183
|
-
const BASELINE_WEIGHT = 0.5;
|
|
184
|
-
const EXP_LOG_MIN = Math.log(0.5);
|
|
185
|
-
const EXP_LOG_MAX = Math.log(1.0);
|
|
186
|
-
const SCALE_LOG_MIN = Math.log(1.0);
|
|
187
|
-
const SCALE_LOG_MAX = Math.log(100.0);
|
|
188
|
-
const candleRows = Array.isArray(data.candles) ? data.candles : [];
|
|
189
|
-
const baseVarianceSeries = Array.isArray(data.varianceSeries) ? data.varianceSeries : [];
|
|
190
|
-
|
|
191
|
-
function getCandleClose(c) { return Array.isArray(c) ? c[4] : c?.close; }
|
|
192
|
-
function getCandleHigh(c) { return Array.isArray(c) ? c[2] : c?.high; }
|
|
193
|
-
function getCandleLow(c) { return Array.isArray(c) ? c[3] : c?.low; }
|
|
194
|
-
|
|
195
|
-
let currentAtrPeriod = Math.max(3, Math.min(30, Math.round(data.atrPeriod ?? ${JSON.stringify(defaultAtrPeriod)})));
|
|
196
|
-
let currentThreshold = data.volatilityThreshold;
|
|
197
|
-
let currentExponent = data.volatilityExponent;
|
|
198
|
-
let currentScaleX = data.volatilityScaleX;
|
|
199
|
-
let currentClamp = Math.max(0.1, data.volatilityClamp ?? ${JSON.stringify(defaultClamp)});
|
|
200
|
-
|
|
201
|
-
const xMin = data.dates[0];
|
|
202
|
-
const xMax = data.dates[data.dates.length - 1];
|
|
203
|
-
let pendingRange = null;
|
|
204
|
-
let pendingRangeRaf = 0;
|
|
205
|
-
let priceChart, varianceChart, shiftChart;
|
|
206
|
-
let charts;
|
|
207
|
-
|
|
208
|
-
${UPLOT_SHARED_SCRIPT}
|
|
209
|
-
|
|
210
|
-
function clamp(v, lo, hi) {
|
|
211
|
-
return Math.max(lo, Math.min(hi, v));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function fmtNum(v, digits = 4) {
|
|
215
|
-
if (v == null || !Number.isFinite(v)) return '-';
|
|
216
|
-
const abs = Math.abs(v);
|
|
217
|
-
if (abs >= 1000) return v.toFixed(2);
|
|
218
|
-
if (abs >= 1) return v.toFixed(Math.min(4, digits));
|
|
219
|
-
return v.toPrecision(Math.min(6, digits + 2));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function fmtSigned(v, digits = 3) {
|
|
223
|
-
if (v == null || !Number.isFinite(v)) return '-';
|
|
224
|
-
const s = v >= 0 ? '+' : '';
|
|
225
|
-
return s + v.toFixed(digits);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function fmtDate(ts) {
|
|
229
|
-
if (ts == null) return '-';
|
|
230
|
-
const d = new Date(ts * 1000);
|
|
231
|
-
return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: '2-digit' })
|
|
232
|
-
+ ' ' + d.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function expSliderToVal(pos) {
|
|
236
|
-
return Math.exp(EXP_LOG_MIN + (pos / 1000) * (EXP_LOG_MAX - EXP_LOG_MIN));
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function expValToSlider(val) {
|
|
240
|
-
const clamped = Math.max(Math.exp(EXP_LOG_MIN), Math.min(Math.exp(EXP_LOG_MAX), val));
|
|
241
|
-
return Math.round((Math.log(clamped) - EXP_LOG_MIN) / (EXP_LOG_MAX - EXP_LOG_MIN) * 1000);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function scaleSliderToVal(pos) {
|
|
245
|
-
return Math.exp(SCALE_LOG_MIN + (pos / 1000) * (SCALE_LOG_MAX - SCALE_LOG_MIN));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function scaleValToSlider(val) {
|
|
249
|
-
const clamped = Math.max(Math.exp(SCALE_LOG_MIN), Math.min(Math.exp(SCALE_LOG_MAX), val));
|
|
250
|
-
return Math.round((Math.log(clamped) - SCALE_LOG_MIN) / (SCALE_LOG_MAX - SCALE_LOG_MIN) * 1000);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function clampValToSlider(val) {
|
|
254
|
-
const clamped = Math.max(0.1, Math.min(1.0, val));
|
|
255
|
-
return Math.round(clamped * 1000);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function clampSliderToVal(pos) {
|
|
259
|
-
return Math.max(0.1, Math.min(1.0, pos / 1000));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/* Sync with analysis/math_utils.ts computeATR() — keep in sync when changing ATR logic */
|
|
263
|
-
function computeATRSeries(candles, period = 14) {
|
|
264
|
-
const atrs = [];
|
|
265
|
-
if (!Array.isArray(candles) || candles.length === 0) return atrs;
|
|
266
|
-
|
|
267
|
-
const safePeriod = Math.max(1, Math.round(period));
|
|
268
|
-
let prevClose = Number(getCandleClose(candles[0]) ?? 0);
|
|
269
|
-
let atrVal = 0;
|
|
270
|
-
|
|
271
|
-
for (let i = 0; i < candles.length; i++) {
|
|
272
|
-
const c = candles[i];
|
|
273
|
-
const high = Number(getCandleHigh(c) ?? 0);
|
|
274
|
-
const low = Number(getCandleLow(c) ?? 0);
|
|
275
|
-
const close = Number(getCandleClose(c) ?? 0);
|
|
276
|
-
if (i === 0) {
|
|
277
|
-
atrs.push(0);
|
|
278
|
-
prevClose = close;
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
const tr = Math.max(high - low, Math.abs(high - prevClose), Math.abs(low - prevClose));
|
|
282
|
-
if (i <= safePeriod) {
|
|
283
|
-
atrVal = atrVal === 0 ? tr : (atrVal * (i - 1) + tr) / i;
|
|
284
|
-
} else {
|
|
285
|
-
atrVal = (atrVal * (safePeriod - 1) + tr) / safePeriod;
|
|
286
|
-
}
|
|
287
|
-
atrs.push(atrVal);
|
|
288
|
-
prevClose = close;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return atrs;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function rebuildVarianceSeries() {
|
|
295
|
-
if (!candleRows.length) return baseVarianceSeries.slice();
|
|
296
|
-
|
|
297
|
-
const atrSeries = computeATRSeries(candleRows, currentAtrPeriod);
|
|
298
|
-
const next = new Array(data.dates.length).fill(null);
|
|
299
|
-
for (let i = 0; i < data.realBarCount; i++) {
|
|
300
|
-
const amaPrice = data.ama3Prices[i];
|
|
301
|
-
const atr = atrSeries[i] ?? 0;
|
|
302
|
-
next[i] = amaPrice > 0 ? atr / amaPrice : 0;
|
|
303
|
-
}
|
|
304
|
-
return next;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function toPlotLog(values) {
|
|
308
|
-
return values.map((v) => (v != null && v > 0 ? v : null));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
let varianceSeries = rebuildVarianceSeries();
|
|
312
|
-
const variancePlot = toPlotLog(varianceSeries);
|
|
313
|
-
|
|
314
|
-
let rawDeltaArr = new Array(data.dates.length).fill(null);
|
|
315
|
-
let deltaArr = new Array(data.dates.length).fill(null);
|
|
316
|
-
let weffArr = new Array(data.dates.length).fill(null);
|
|
317
|
-
let signalSummary = { below: 0, mid: 0, over: 0, total: 0 };
|
|
318
|
-
|
|
319
|
-
function calcShift(weightVariance) {
|
|
320
|
-
const safeVariance = Number.isFinite(weightVariance) && weightVariance > 0 ? weightVariance : 0;
|
|
321
|
-
const effectiveExponent = Math.max(Math.exp(EXP_LOG_MIN), Math.min(Math.exp(EXP_LOG_MAX), currentExponent));
|
|
322
|
-
const effectiveScaleX = Math.max(Math.exp(SCALE_LOG_MIN), Math.min(Math.exp(SCALE_LOG_MAX), currentScaleX));
|
|
323
|
-
const effectiveClamp = Number.isFinite(currentClamp) && currentClamp >= 0.1 ? currentClamp : ${JSON.stringify(defaultClamp)};
|
|
324
|
-
const raw = -Math.pow(safeVariance, effectiveExponent) * effectiveScaleX;
|
|
325
|
-
const rawAbs = Math.abs(raw);
|
|
326
|
-
const clampedRaw = clamp(raw, -effectiveClamp, 0);
|
|
327
|
-
const delta = Math.abs(clampedRaw) < currentThreshold ? 0 : clampedRaw;
|
|
328
|
-
const weff = clamp(BASELINE_WEIGHT + delta, MIN_WEIGHT, MAX_WEIGHT);
|
|
329
|
-
return { raw: clampedRaw, rawAbs, delta, weff, sellW: weff, buyW: weff };
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function recalcShift() {
|
|
333
|
-
varianceSeries = rebuildVarianceSeries();
|
|
334
|
-
const effectiveClamp = Number.isFinite(currentClamp) && currentClamp >= 0.1 ? currentClamp : ${JSON.stringify(defaultClamp)};
|
|
335
|
-
let below = 0;
|
|
336
|
-
let mid = 0;
|
|
337
|
-
let over = 0;
|
|
338
|
-
let total = 0;
|
|
339
|
-
for (let i = 0; i < data.dates.length; i++) {
|
|
340
|
-
if (i >= data.realBarCount) {
|
|
341
|
-
rawDeltaArr[i] = null;
|
|
342
|
-
deltaArr[i] = null;
|
|
343
|
-
weffArr[i] = null;
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
const r = calcShift(varianceSeries[i]);
|
|
347
|
-
rawDeltaArr[i] = r.raw;
|
|
348
|
-
deltaArr[i] = r.delta;
|
|
349
|
-
weffArr[i] = r.weff;
|
|
350
|
-
if (Number.isFinite(r.rawAbs)) {
|
|
351
|
-
total++;
|
|
352
|
-
if (r.rawAbs >= effectiveClamp) over++;
|
|
353
|
-
else if (r.rawAbs < currentThreshold) below++;
|
|
354
|
-
else mid++;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
signalSummary = { below, mid, over, total };
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function updateSignalSummary() {
|
|
361
|
-
const total = signalSummary.total || 0;
|
|
362
|
-
const belowPct = total > 0 ? (signalSummary.below / total) * 100 : 0;
|
|
363
|
-
const midPct = total > 0 ? (signalSummary.mid / total) * 100 : 0;
|
|
364
|
-
const overPct = total > 0 ? (signalSummary.over / total) * 100 : 0;
|
|
365
|
-
|
|
366
|
-
const belowEl = document.getElementById('signal-below');
|
|
367
|
-
const midEl = document.getElementById('signal-mid');
|
|
368
|
-
const overEl = document.getElementById('signal-over');
|
|
369
|
-
belowEl.style.width = belowPct + '%';
|
|
370
|
-
midEl.style.width = midPct + '%';
|
|
371
|
-
overEl.style.width = overPct + '%';
|
|
372
|
-
belowEl.title = 'below: ' + signalSummary.below + '/' + total + ' (' + belowPct.toFixed(1) + '%)';
|
|
373
|
-
midEl.title = 'in: ' + signalSummary.mid + '/' + total + ' (' + midPct.toFixed(1) + '%)';
|
|
374
|
-
overEl.title = 'over: ' + signalSummary.over + '/' + total + ' (' + overPct.toFixed(1) + '%)';
|
|
375
|
-
|
|
376
|
-
const title = 'below: ' + signalSummary.below + '/' + total + ' (' + belowPct.toFixed(1) + '%) | in: ' + signalSummary.mid + '/' + total + ' (' + midPct.toFixed(1) + '%) | over: ' + signalSummary.over + '/' + total + ' (' + overPct.toFixed(1) + '%)';
|
|
377
|
-
document.getElementById('signal-bar').title = title;
|
|
378
|
-
document.getElementById('signal-below-label').textContent = 'below ' + belowPct.toFixed(1) + '%';
|
|
379
|
-
document.getElementById('signal-mid-label').textContent = 'in ' + midPct.toFixed(1) + '%';
|
|
380
|
-
document.getElementById('signal-over-label').textContent = 'over ' + overPct.toFixed(1) + '%';
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function rangeFrom(values, fallbackMin, fallbackMax, padFrac = 0.12) {
|
|
384
|
-
let min = Infinity;
|
|
385
|
-
let max = -Infinity;
|
|
386
|
-
for (let i = 0; i < values.length; i++) {
|
|
387
|
-
const v = values[i];
|
|
388
|
-
if (v == null || !Number.isFinite(v)) continue;
|
|
389
|
-
if (v < min) min = v;
|
|
390
|
-
if (v > max) max = v;
|
|
391
|
-
}
|
|
392
|
-
if (!Number.isFinite(min) || !Number.isFinite(max)) return [fallbackMin, fallbackMax];
|
|
393
|
-
if (min === max) {
|
|
394
|
-
const pad = Math.max(Math.abs(min) * padFrac, 0.02);
|
|
395
|
-
return [min - pad, max + pad];
|
|
396
|
-
}
|
|
397
|
-
const span = max - min;
|
|
398
|
-
const pad = span * padFrac;
|
|
399
|
-
return [min - pad, max + pad];
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function buildRawDeltaSplits(u) {
|
|
403
|
-
const scale = u.scales.d || {};
|
|
404
|
-
const r = rangeFrom(rawDeltaArr, -0.5, 0.04);
|
|
405
|
-
const min = Number.isFinite(scale.min) ? scale.min : r[0];
|
|
406
|
-
const max = Number.isFinite(scale.max) ? scale.max : r[1];
|
|
407
|
-
const lo = Math.min(min, max);
|
|
408
|
-
const hi = Math.max(min, max);
|
|
409
|
-
const step = 0.05;
|
|
410
|
-
const start = Math.floor(lo / step) * step;
|
|
411
|
-
const end = Math.ceil(hi / step) * step;
|
|
412
|
-
const splits = [];
|
|
413
|
-
for (let v = start; v <= end + 1e-9; v += step) {
|
|
414
|
-
const rounded = roundTo(v, 100);
|
|
415
|
-
if (!splits.includes(rounded)) splits.push(rounded);
|
|
416
|
-
}
|
|
417
|
-
if (!splits.includes(0)) splits.push(0);
|
|
418
|
-
if (!splits.includes(-currentThreshold)) splits.push(-currentThreshold);
|
|
419
|
-
return splits.sort((a, b) => a - b);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function makeDeltaHook(values, scaleKey, thresholdGetter) {
|
|
423
|
-
return (u) => {
|
|
424
|
-
const { ctx, bbox } = u;
|
|
425
|
-
ctx.save();
|
|
426
|
-
ctx.beginPath();
|
|
427
|
-
ctx.rect(bbox.left, bbox.top, bbox.width, bbox.height);
|
|
428
|
-
ctx.clip();
|
|
429
|
-
|
|
430
|
-
const zeroY = u.valToPos(0, scaleKey, true);
|
|
431
|
-
const thresholdY = u.valToPos(-thresholdGetter(), scaleKey, true);
|
|
432
|
-
|
|
433
|
-
ctx.strokeStyle = '#ffd24a';
|
|
434
|
-
ctx.shadowColor = 'rgba(255,210,74,0.85)';
|
|
435
|
-
ctx.shadowBlur = 6;
|
|
436
|
-
ctx.lineWidth = 2.5;
|
|
437
|
-
ctx.setLineDash([4, 3]);
|
|
438
|
-
ctx.beginPath();
|
|
439
|
-
ctx.moveTo(bbox.left, thresholdY);
|
|
440
|
-
ctx.lineTo(bbox.left + bbox.width, thresholdY);
|
|
441
|
-
ctx.stroke();
|
|
442
|
-
ctx.shadowBlur = 0;
|
|
443
|
-
ctx.shadowColor = 'transparent';
|
|
444
|
-
ctx.font = 'bold 10px Segoe UI, sans-serif';
|
|
445
|
-
ctx.textBaseline = 'middle';
|
|
446
|
-
const label = 'threshold';
|
|
447
|
-
const labelX = Math.max(bbox.left + 4, bbox.left + bbox.width - 60);
|
|
448
|
-
const labelY = thresholdY - 8;
|
|
449
|
-
const labelW = ctx.measureText(label).width + 8;
|
|
450
|
-
ctx.fillStyle = 'rgba(11,14,20,0.82)';
|
|
451
|
-
ctx.fillRect(labelX - 4, labelY - 7, labelW, 14);
|
|
452
|
-
ctx.fillStyle = '#ffd24a';
|
|
453
|
-
ctx.fillText(label, labelX, labelY);
|
|
454
|
-
|
|
455
|
-
const clampY = u.valToPos(-currentClamp, scaleKey, true);
|
|
456
|
-
ctx.strokeStyle = '#a371f7';
|
|
457
|
-
ctx.shadowColor = 'rgba(163,113,247,0.85)';
|
|
458
|
-
ctx.shadowBlur = 6;
|
|
459
|
-
ctx.lineWidth = 2;
|
|
460
|
-
ctx.setLineDash([4, 3]);
|
|
461
|
-
ctx.beginPath();
|
|
462
|
-
ctx.moveTo(bbox.left, clampY);
|
|
463
|
-
ctx.lineTo(bbox.left + bbox.width, clampY);
|
|
464
|
-
ctx.stroke();
|
|
465
|
-
ctx.shadowBlur = 0;
|
|
466
|
-
ctx.shadowColor = 'transparent';
|
|
467
|
-
ctx.font = 'bold 10px Segoe UI, sans-serif';
|
|
468
|
-
ctx.textBaseline = 'middle';
|
|
469
|
-
const clampLabel = 'clamp';
|
|
470
|
-
const clampLabelX = Math.max(bbox.left + 4, bbox.left + bbox.width - 52);
|
|
471
|
-
const clampLabelY = clampY - 8;
|
|
472
|
-
const clampLabelW = ctx.measureText(clampLabel).width + 8;
|
|
473
|
-
ctx.fillStyle = 'rgba(11,14,20,0.82)';
|
|
474
|
-
ctx.fillRect(clampLabelX - 4, clampLabelY - 7, clampLabelW, 14);
|
|
475
|
-
ctx.fillStyle = '#a371f7';
|
|
476
|
-
ctx.fillText(clampLabel, clampLabelX, clampLabelY);
|
|
477
|
-
|
|
478
|
-
ctx.strokeStyle = 'rgba(139,148,158,0.4)';
|
|
479
|
-
ctx.setLineDash([4, 4]);
|
|
480
|
-
ctx.beginPath();
|
|
481
|
-
ctx.moveTo(bbox.left, zeroY);
|
|
482
|
-
ctx.lineTo(bbox.left + bbox.width, zeroY);
|
|
483
|
-
ctx.stroke();
|
|
484
|
-
ctx.setLineDash([]);
|
|
485
|
-
|
|
486
|
-
const path = new Path2D();
|
|
487
|
-
let started = false;
|
|
488
|
-
let lastX = 0;
|
|
489
|
-
for (let i = 0; i < values.length; i++) {
|
|
490
|
-
const v = values[i];
|
|
491
|
-
if (v == null) { if (started) { path.lineTo(lastX, zeroY); started = false; } continue; }
|
|
492
|
-
const x = u.valToPos(data.dates[i], 'x', true);
|
|
493
|
-
const y = u.valToPos(v, scaleKey, true);
|
|
494
|
-
if (!started) {
|
|
495
|
-
path.moveTo(x, zeroY);
|
|
496
|
-
path.lineTo(x, y);
|
|
497
|
-
started = true;
|
|
498
|
-
} else {
|
|
499
|
-
path.lineTo(x, y);
|
|
500
|
-
}
|
|
501
|
-
lastX = x;
|
|
502
|
-
}
|
|
503
|
-
if (started) path.lineTo(lastX, zeroY);
|
|
504
|
-
|
|
505
|
-
ctx.save();
|
|
506
|
-
ctx.beginPath();
|
|
507
|
-
ctx.rect(bbox.left, zeroY, bbox.width, bbox.top + bbox.height - zeroY);
|
|
508
|
-
ctx.clip();
|
|
509
|
-
ctx.fillStyle = 'rgba(248,81,73,0.16)';
|
|
510
|
-
ctx.fill(path);
|
|
511
|
-
ctx.restore();
|
|
512
|
-
|
|
513
|
-
ctx.strokeStyle = 'rgba(248,81,73,0.9)';
|
|
514
|
-
ctx.lineWidth = 1.7;
|
|
515
|
-
ctx.stroke(path);
|
|
516
|
-
ctx.restore();
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
const cursorCfg = {
|
|
521
|
-
show: true,
|
|
522
|
-
x: true,
|
|
523
|
-
y: true,
|
|
524
|
-
points: { show: false },
|
|
525
|
-
drag: { x: false, y: false, setScale: false },
|
|
526
|
-
sync: { key: SYNC_KEY, setSeries: false, scales: ['x', null] },
|
|
527
|
-
focus: { prox: -1 },
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
function updateLegend(idx) {
|
|
531
|
-
if (idx == null || idx >= data.realBarCount) return;
|
|
532
|
-
document.getElementById('l-price').textContent = fmtNum(data.prices[idx], 6);
|
|
533
|
-
document.getElementById('l-ama3').textContent = fmtNum(data.ama3Prices[idx], 6);
|
|
534
|
-
const variance = varianceSeries[idx];
|
|
535
|
-
document.getElementById('l-var').textContent = variance == null ? '-' : fmtNum(variance, 6) + ' (' + fmtNum(variance * 100, 4) + '%)';
|
|
536
|
-
document.getElementById('l-delta').textContent = fmtSigned(deltaArr[idx], 3);
|
|
537
|
-
document.getElementById('l-weff').textContent = fmtNum(weffArr[idx], 3);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function init() {
|
|
541
|
-
currentAtrPeriod = Math.max(3, Math.min(30, Math.round(currentAtrPeriod)));
|
|
542
|
-
currentExponent = Math.max(Math.exp(EXP_LOG_MIN), Math.min(Math.exp(EXP_LOG_MAX), currentExponent));
|
|
543
|
-
currentScaleX = Math.max(Math.exp(SCALE_LOG_MIN), Math.min(Math.exp(SCALE_LOG_MAX), currentScaleX));
|
|
544
|
-
currentClamp = Math.max(0.1, Math.min(1.0, currentClamp));
|
|
545
|
-
document.getElementById('atr-slider').value = currentAtrPeriod;
|
|
546
|
-
document.getElementById('atr-value').textContent = String(currentAtrPeriod);
|
|
547
|
-
document.getElementById('threshold-slider').value = Math.round(currentThreshold * 1000);
|
|
548
|
-
document.getElementById('exponent-slider').value = expValToSlider(currentExponent);
|
|
549
|
-
document.getElementById('scale-slider').value = scaleValToSlider(currentScaleX);
|
|
550
|
-
document.getElementById('clamp-slider').value = clampValToSlider(currentClamp);
|
|
551
|
-
document.getElementById('exponent-value').textContent = currentExponent.toFixed(3);
|
|
552
|
-
document.getElementById('scale-value').textContent = currentScaleX.toFixed(2) + 'x';
|
|
553
|
-
document.getElementById('clamp-value').textContent = currentClamp.toFixed(3);
|
|
554
|
-
|
|
555
|
-
const priceEl = document.getElementById('price-panel');
|
|
556
|
-
const varianceEl = document.getElementById('variance-panel');
|
|
557
|
-
const shiftEl = document.getElementById('shift-panel');
|
|
558
|
-
|
|
559
|
-
recalcShift();
|
|
560
|
-
updateSignalSummary();
|
|
561
|
-
|
|
562
|
-
priceChart = new uPlot({
|
|
563
|
-
width: priceEl.offsetWidth,
|
|
564
|
-
height: priceEl.offsetHeight,
|
|
565
|
-
padding: [4, 8, 2, 4],
|
|
566
|
-
select: { show: false },
|
|
567
|
-
legend: { show: false },
|
|
568
|
-
scales: {
|
|
569
|
-
x: { time: true },
|
|
570
|
-
y: { auto: true, distr: 3, log: 10, range: (u, min, max) => [min * 0.95, max * 1.05] },
|
|
571
|
-
},
|
|
572
|
-
series: [
|
|
573
|
-
{ label: 'Time' },
|
|
574
|
-
{ label: 'Price', stroke: '#58a6ff', width: 1.5, scale: 'y', points: { show: false } },
|
|
575
|
-
{ label: 'AMA3', stroke: '#e3b341', width: 1.5, scale: 'y', points: { show: false } },
|
|
576
|
-
],
|
|
577
|
-
axes: [
|
|
578
|
-
{ show: false, stroke: '#545d68', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: 28, font: '11px Segoe UI, sans-serif' },
|
|
579
|
-
{ scale: 'y', stroke: '#545d68', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
580
|
-
values: (u, v) => v.map(x => x != null ? fmtNum(x, 6) : '') },
|
|
581
|
-
],
|
|
582
|
-
cursor: cursorCfg,
|
|
583
|
-
}, [data.dates, data.prices, data.ama3Prices], document.getElementById('price-chart'));
|
|
584
|
-
|
|
585
|
-
varianceChart = new uPlot({
|
|
586
|
-
width: varianceEl.offsetWidth,
|
|
587
|
-
height: varianceEl.offsetHeight,
|
|
588
|
-
padding: [14, 8, 2, 4],
|
|
589
|
-
select: { show: false },
|
|
590
|
-
legend: { show: false },
|
|
591
|
-
scales: {
|
|
592
|
-
x: { time: true },
|
|
593
|
-
v: { auto: true, range: (u, min, max) => [min * 0.95, max * 1.05] },
|
|
594
|
-
},
|
|
595
|
-
series: [
|
|
596
|
-
{ label: 'Time' },
|
|
597
|
-
{ label: 'Weight variance', stroke: '#d2a8ff', width: 1.5, scale: 'v', points: { show: false } },
|
|
598
|
-
],
|
|
599
|
-
axes: [
|
|
600
|
-
{ show: false, stroke: '#545d68', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: 28, font: '11px Segoe UI, sans-serif' },
|
|
601
|
-
{ scale: 'v', stroke: '#545d68', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
602
|
-
values: (u, v) => v.map(x => x != null ? fmtNum(x, 6) : '') },
|
|
603
|
-
],
|
|
604
|
-
cursor: cursorCfg,
|
|
605
|
-
}, [data.dates, variancePlot], document.getElementById('variance-chart'));
|
|
606
|
-
|
|
607
|
-
shiftChart = new uPlot({
|
|
608
|
-
width: shiftEl.offsetWidth,
|
|
609
|
-
height: shiftEl.offsetHeight,
|
|
610
|
-
padding: [26, 8, 4, 4],
|
|
611
|
-
select: { show: false },
|
|
612
|
-
legend: { show: false },
|
|
613
|
-
scales: {
|
|
614
|
-
x: { time: true },
|
|
615
|
-
d: { auto: true, range: () => rangeFrom(rawDeltaArr, -0.5, 0.04) },
|
|
616
|
-
},
|
|
617
|
-
series: [
|
|
618
|
-
{ label: 'Time' },
|
|
619
|
-
{ label: 'Raw Δ', stroke: '#8b949e', width: 1.2, dash: [5, 4], scale: 'd', points: { show: false } },
|
|
620
|
-
{ label: 'Δ', stroke: '#f85149', width: 1.7, scale: 'd', points: { show: false } },
|
|
621
|
-
],
|
|
622
|
-
axes: [
|
|
623
|
-
{ show: true, stroke: '#545d68', grid: { stroke: '#1c2128' }, ticks: { stroke: '#30363d', width: 1 }, size: 28, font: '11px Segoe UI, sans-serif' },
|
|
624
|
-
{ scale: 'd', stroke: '#545d68', grid: { stroke: '#1c2128', dash: [4, 4] }, ticks: { stroke: '#30363d', width: 1 }, size: Y_AXIS_SIZE, font: '11px Segoe UI, sans-serif',
|
|
625
|
-
values: (u, v) => v.map(x => x != null ? fmtSigned(x, 3) : ''),
|
|
626
|
-
splits: buildRawDeltaSplits },
|
|
627
|
-
],
|
|
628
|
-
cursor: cursorCfg,
|
|
629
|
-
hooks: {
|
|
630
|
-
draw: [makeDeltaHook(deltaArr, 'd', () => currentThreshold)],
|
|
631
|
-
},
|
|
632
|
-
}, [data.dates, rawDeltaArr, deltaArr], document.getElementById('shift-chart'));
|
|
633
|
-
|
|
634
|
-
charts = [priceChart, varianceChart, shiftChart];
|
|
635
|
-
let leavePending = null;
|
|
636
|
-
charts.forEach(chart => {
|
|
637
|
-
chart.over.addEventListener('mousemove', () => {
|
|
638
|
-
if (leavePending !== null) {
|
|
639
|
-
clearTimeout(leavePending);
|
|
640
|
-
leavePending = null;
|
|
641
|
-
}
|
|
642
|
-
updateLegend(chart.cursor.idx);
|
|
643
|
-
});
|
|
644
|
-
chart.over.addEventListener('mouseleave', () => {
|
|
645
|
-
leavePending = setTimeout(() => {
|
|
646
|
-
leavePending = null;
|
|
647
|
-
updateLegend(shiftChart.cursor.idx ?? data.realBarCount - 1);
|
|
648
|
-
}, 60);
|
|
649
|
-
});
|
|
650
|
-
chart.root.addEventListener('mouseenter', () => chart.root.classList.add('is-hovered'));
|
|
651
|
-
chart.root.addEventListener('mouseleave', () => chart.root.classList.remove('is-hovered'));
|
|
652
|
-
bindWheelZoom(chart);
|
|
653
|
-
bindPan(chart);
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
function refreshChartsPreservingZoom() {
|
|
657
|
-
const xs = shiftChart.scales.x;
|
|
658
|
-
const savedX = xs ? { min: Number.isFinite(xs.min) ? xs.min : xMin, max: Number.isFinite(xs.max) ? xs.max : xMax } : null;
|
|
659
|
-
varianceChart.setData([data.dates, toPlotLog(varianceSeries)], false);
|
|
660
|
-
shiftChart.setData([data.dates, rawDeltaArr, deltaArr], false);
|
|
661
|
-
if (savedX) {
|
|
662
|
-
[varianceChart, shiftChart].forEach((chart) => chart.batch(() => chart.setScale('x', savedX)));
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
function applyShiftFromSliders() {
|
|
667
|
-
recalcShift();
|
|
668
|
-
updateSignalSummary();
|
|
669
|
-
refreshChartsPreservingZoom();
|
|
670
|
-
updateLegend(shiftChart.cursor.idx ?? data.realBarCount - 1);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
document.getElementById('atr-slider').addEventListener('input', (e) => {
|
|
674
|
-
currentAtrPeriod = parseInt(e.target.value, 10);
|
|
675
|
-
document.getElementById('atr-value').textContent = String(currentAtrPeriod);
|
|
676
|
-
applyShiftFromSliders();
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
document.getElementById('threshold-slider').addEventListener('input', (e) => {
|
|
680
|
-
currentThreshold = parseInt(e.target.value, 10) / 1000;
|
|
681
|
-
document.getElementById('threshold-value').textContent = currentThreshold.toFixed(3);
|
|
682
|
-
applyShiftFromSliders();
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
document.getElementById('exponent-slider').addEventListener('input', (e) => {
|
|
686
|
-
currentExponent = expSliderToVal(parseInt(e.target.value, 10));
|
|
687
|
-
document.getElementById('exponent-value').textContent = currentExponent.toFixed(3);
|
|
688
|
-
applyShiftFromSliders();
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
document.getElementById('scale-slider').addEventListener('input', (e) => {
|
|
692
|
-
currentScaleX = scaleSliderToVal(parseInt(e.target.value, 10));
|
|
693
|
-
document.getElementById('scale-value').textContent = currentScaleX.toFixed(2) + 'x';
|
|
694
|
-
applyShiftFromSliders();
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
document.getElementById('clamp-slider').addEventListener('input', (e) => {
|
|
698
|
-
currentClamp = clampSliderToVal(parseInt(e.target.value, 10));
|
|
699
|
-
document.getElementById('clamp-value').textContent = currentClamp.toFixed(3);
|
|
700
|
-
applyShiftFromSliders();
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function sizeCharts() {
|
|
705
|
-
if (!priceChart || !varianceChart || !shiftChart) return;
|
|
706
|
-
[
|
|
707
|
-
[priceChart, 'price-panel'],
|
|
708
|
-
[varianceChart, 'variance-panel'],
|
|
709
|
-
[shiftChart, 'shift-panel'],
|
|
710
|
-
].forEach(([chart, id]) => {
|
|
711
|
-
const el = document.getElementById(id);
|
|
712
|
-
chart.setSize({ width: el.offsetWidth, height: el.offsetHeight });
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
window.addEventListener('resize', sizeCharts);
|
|
717
|
-
window.addEventListener('keydown', (e) => {
|
|
718
|
-
if ((e.ctrlKey || e.metaKey) && e.key === '0') syncXRange(xMin, xMax);
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
init();
|
|
722
|
-
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
723
|
-
sizeCharts();
|
|
724
|
-
updateLegend(data.realBarCount - 1);
|
|
725
|
-
}));
|
|
726
|
-
})();
|
|
727
|
-
</script>
|
|
728
|
-
</body>
|
|
729
|
-
</html>`;
|
|
730
|
-
}
|
|
731
|
-
module.exports = { generateHTML };
|
|
732
|
-
//# sourceMappingURL=volatility_chart_generator.js.map
|