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,896 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { escapeHtml, serializeJsonForScript, toEpochSeconds, UPLOT_SHARED_SCRIPT } = require('./chart_utils');
|
|
6
|
-
const { ensureDir, readJSON } = require('../modules/utils/fs_utils');
|
|
7
|
-
const { fixedTo } = require('../modules/utils/math_utils');
|
|
8
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
9
|
-
const cfg = {
|
|
10
|
-
inputFile: null,
|
|
11
|
-
outputFile: 'analysis/charts/derivative_chart.html',
|
|
12
|
-
title: 'Derivative Trend Analysis',
|
|
13
|
-
quiet: false,
|
|
14
|
-
};
|
|
15
|
-
for (let i = 0; i < argv.length; i++) {
|
|
16
|
-
const arg = argv[i];
|
|
17
|
-
if (arg === '--input')
|
|
18
|
-
cfg.inputFile = argv[++i];
|
|
19
|
-
else if (arg === '--output')
|
|
20
|
-
cfg.outputFile = argv[++i];
|
|
21
|
-
else if (arg === '--title')
|
|
22
|
-
cfg.title = argv[++i];
|
|
23
|
-
else if (arg === '--quiet')
|
|
24
|
-
cfg.quiet = true;
|
|
25
|
-
else if (arg === '--help' || arg === '-h') {
|
|
26
|
-
showHelp();
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (!cfg.inputFile) {
|
|
31
|
-
console.error('Error: --input required');
|
|
32
|
-
showHelp();
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
return cfg;
|
|
36
|
-
}
|
|
37
|
-
function showHelp() {
|
|
38
|
-
console.log(`
|
|
39
|
-
Derivative Chart Generator (uPlot)
|
|
40
|
-
Usage:
|
|
41
|
-
tsx analysis/derivative_chart_generator.ts --input <file.json> [options]
|
|
42
|
-
Options:
|
|
43
|
-
--output FILE Output HTML (default: analysis/charts/derivative_chart.html)
|
|
44
|
-
--title TEXT Chart title
|
|
45
|
-
--quiet Suppress output
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
48
|
-
function trendToNum(trend) {
|
|
49
|
-
if (trend === 'UP')
|
|
50
|
-
return 1;
|
|
51
|
-
if (trend === 'DOWN')
|
|
52
|
-
return -1;
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
function countTrend(arr) {
|
|
56
|
-
return arr.reduce((acc, v) => {
|
|
57
|
-
acc.total += 1;
|
|
58
|
-
if (v > 0)
|
|
59
|
-
acc.up += 1;
|
|
60
|
-
else if (v < 0)
|
|
61
|
-
acc.down += 1;
|
|
62
|
-
else
|
|
63
|
-
acc.neutral += 1;
|
|
64
|
-
return acc;
|
|
65
|
-
}, { total: 0, up: 0, down: 0, neutral: 0 });
|
|
66
|
-
}
|
|
67
|
-
function countStates(arr, positive, negative) {
|
|
68
|
-
return arr.reduce((acc, v) => {
|
|
69
|
-
acc.total += 1;
|
|
70
|
-
if (v === positive)
|
|
71
|
-
acc.positive += 1;
|
|
72
|
-
else if (v === negative)
|
|
73
|
-
acc.negative += 1;
|
|
74
|
-
else
|
|
75
|
-
acc.neutral += 1;
|
|
76
|
-
return acc;
|
|
77
|
-
}, { total: 0, positive: 0, negative: 0, neutral: 0 });
|
|
78
|
-
}
|
|
79
|
-
function generateHTML(data, title) {
|
|
80
|
-
const results = data.allResults || [];
|
|
81
|
-
if (results.length === 0)
|
|
82
|
-
throw new Error('No analysis results in input');
|
|
83
|
-
const source = data.config?.source || 'Unknown';
|
|
84
|
-
const smaPeriod = data.config?.slowSmaPeriod || 'N/A';
|
|
85
|
-
const fastSmaPeriod = data.config?.fastSmaPeriod || null;
|
|
86
|
-
const hasFastSma = fastSmaPeriod !== null && results.some((r) => r.fastSmaValue !== null && r.fastSmaValue !== undefined);
|
|
87
|
-
const macdFast = data.config?.macdFastPeriod ?? 12;
|
|
88
|
-
const macdSlow = data.config?.macdSlowPeriod ?? 26;
|
|
89
|
-
const macdSig = data.config?.macdSignalPeriod ?? 9;
|
|
90
|
-
const rsiPeriod = data.config?.rsiPeriod ?? 14;
|
|
91
|
-
const rsiOB = data.config?.rsiExtreme ?? 90;
|
|
92
|
-
const rsiOS = 100 - rsiOB;
|
|
93
|
-
const dates = results.map((r, idx) => toEpochSeconds(r.timestamp || Date.now(), idx));
|
|
94
|
-
const prices = results.map((r) => r.price);
|
|
95
|
-
const smaValues = results.map((r) => r.slowSma);
|
|
96
|
-
const fastSmaValues = results.map((r) => r.fastSmaValue);
|
|
97
|
-
const smaNum = results.map((r) => trendToNum(r.smaRawTrend));
|
|
98
|
-
const smaUp = smaNum.map((v) => (v > 0 ? 1 : 0));
|
|
99
|
-
const smaDown = smaNum.map((v) => (v < 0 ? -1 : 0));
|
|
100
|
-
const smaConf = results.map((r) => r.smaConfidence ?? 0);
|
|
101
|
-
const fastSmaNum = results.map((r) => trendToNum(r.fastSmaRawTrend));
|
|
102
|
-
const fastSmaUp = fastSmaNum.map((v) => (v > 0 ? 1 : 0));
|
|
103
|
-
const fastSmaDown = fastSmaNum.map((v) => (v < 0 ? -1 : 0));
|
|
104
|
-
const fastSmaConf = results.map((r) => r.fastSmaConfidence || 0);
|
|
105
|
-
const macdHistogram = results.map((r) => r.macdHistogram ?? null);
|
|
106
|
-
const macdLine = results.map((r) => r.macdLine ?? null);
|
|
107
|
-
const macdSignal = results.map((r) => r.macdSignal ?? null);
|
|
108
|
-
const macdHistUp = macdHistogram.map((v) => (v !== null && v > 0 ? v : null));
|
|
109
|
-
const macdHistDown = macdHistogram.map((v) => (v !== null && v < 0 ? v : null));
|
|
110
|
-
const rsiValues = results.map((r) => r.rsi ?? null);
|
|
111
|
-
const interpState = results.map((r) => r.interpretation || 'NEUTRAL');
|
|
112
|
-
const interpBars = results.map((r) => r.interpretationBars ?? 0);
|
|
113
|
-
const interpValues = interpState.map((s) => (s === 'BULL' ? 0.75
|
|
114
|
-
: s === 'BULL_WEAK' ? 0.35
|
|
115
|
-
: s === 'OVERBOUGHT' ? 0.95
|
|
116
|
-
: s === 'BEAR' ? -0.75
|
|
117
|
-
: s === 'BEAR_WEAK' ? -0.35
|
|
118
|
-
: s === 'OVERSOLD' ? -0.95
|
|
119
|
-
: 0));
|
|
120
|
-
const interpBull = interpState.map((s) => (s === 'BULL' ? 1 : 0));
|
|
121
|
-
const interpBullWeak = interpState.map((s) => (s === 'BULL_WEAK' ? 0.5 : 0));
|
|
122
|
-
const interpOB = interpState.map((s) => (s === 'OVERBOUGHT' ? 0.75 : 0));
|
|
123
|
-
const interpBear = interpState.map((s) => (s === 'BEAR' ? -1 : 0));
|
|
124
|
-
const interpBearWeak = interpState.map((s) => (s === 'BEAR_WEAK' ? -0.5 : 0));
|
|
125
|
-
const interpOS = interpState.map((s) => (s === 'OVERSOLD' ? -0.75 : 0));
|
|
126
|
-
const interpBullBlock = interpState.map((s) => (s === 'BULL' ? 1 : 0));
|
|
127
|
-
const interpBullWeakBlock = interpState.map((s) => (s === 'BULL_WEAK' ? 1 : 0));
|
|
128
|
-
const interpOBBlock = interpState.map((s) => (s === 'OVERBOUGHT' ? 1 : 0));
|
|
129
|
-
const interpBearBlock = interpState.map((s) => (s === 'BEAR' ? -1 : 0));
|
|
130
|
-
const interpBearWeakBlock = interpState.map((s) => (s === 'BEAR_WEAK' ? -1 : 0));
|
|
131
|
-
const interpOSBlock = interpState.map((s) => (s === 'OVERSOLD' ? -1 : 0));
|
|
132
|
-
const entryBias = results.map((r) => r.entryBias || 'NONE');
|
|
133
|
-
const entryLabelMap = {
|
|
134
|
-
NONE: 'No fresh entry',
|
|
135
|
-
EARLY_LONG: 'Early long entry',
|
|
136
|
-
CONFIRM_LONG: 'Confirmed long entry',
|
|
137
|
-
LATE_LONG: 'Late long entry',
|
|
138
|
-
EARLY_SHORT: 'Early short entry',
|
|
139
|
-
CONFIRM_SHORT: 'Confirmed short entry',
|
|
140
|
-
LATE_SHORT: 'Late short entry',
|
|
141
|
-
};
|
|
142
|
-
const entryBiasLabel = entryBias.map((v) => entryLabelMap[v] || v);
|
|
143
|
-
const signalPhase = results.map((r, i) => {
|
|
144
|
-
if (entryBias[i] !== 'NONE')
|
|
145
|
-
return entryLabelMap[entryBias[i]] || entryBias[i];
|
|
146
|
-
switch (interpState[i]) {
|
|
147
|
-
case 'BULL':
|
|
148
|
-
return 'Bull trend active';
|
|
149
|
-
case 'BULL_WEAK':
|
|
150
|
-
return 'Bull setup active';
|
|
151
|
-
case 'BEAR':
|
|
152
|
-
return 'Bear trend active';
|
|
153
|
-
case 'BEAR_WEAK':
|
|
154
|
-
return 'Bear setup active';
|
|
155
|
-
case 'OVERBOUGHT':
|
|
156
|
-
return 'Overbought exit pressure';
|
|
157
|
-
case 'OVERSOLD':
|
|
158
|
-
return 'Oversold exit pressure';
|
|
159
|
-
default:
|
|
160
|
-
return 'No active setup';
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
const bullWeakEntryMarkers = results.map((r) => (r.isBullWeakEntry ? 0.38 : null));
|
|
164
|
-
const bullConfirmationMarkers = results.map((r) => (r.isBullConfirmation ? 0.88 : null));
|
|
165
|
-
const lateBullMarkers = results.map((r) => (r.isLateBullWithoutWeak ? 0.88 : null));
|
|
166
|
-
const bearWeakEntryMarkers = results.map((r) => (r.isBearWeakEntry ? -0.38 : null));
|
|
167
|
-
const bearConfirmationMarkers = results.map((r) => (r.isBearConfirmation ? -0.88 : null));
|
|
168
|
-
const lateBearMarkers = results.map((r) => (r.isLateBearWithoutWeak ? -0.88 : null));
|
|
169
|
-
const priceSeries = prices.filter((v) => Number.isFinite(v));
|
|
170
|
-
const priceStart = priceSeries.length ? priceSeries[0] : null;
|
|
171
|
-
const priceEnd = priceSeries.length ? priceSeries[priceSeries.length - 1] : null;
|
|
172
|
-
const priceHigh = priceSeries.length ? Math.max(...priceSeries) : null;
|
|
173
|
-
const priceLow = priceSeries.length ? Math.min(...priceSeries) : null;
|
|
174
|
-
const priceChange = priceStart !== null && priceEnd !== null ? priceEnd - priceStart : null;
|
|
175
|
-
const priceChangePct = priceStart !== null && priceEnd !== null && priceStart !== 0
|
|
176
|
-
? ((priceEnd - priceStart) / priceStart) * 100
|
|
177
|
-
: null;
|
|
178
|
-
const smaTotals = countTrend(smaNum);
|
|
179
|
-
const fastSmaTotals = countTrend(fastSmaNum);
|
|
180
|
-
const macdTotals = countTrend(results.map((r) => (r.macdTrend === 'BULL' ? 1 : r.macdTrend === 'BEAR' ? -1 : 0)));
|
|
181
|
-
const rsiTotals = countStates(results.map((r) => r.rsiZone || 'NEUTRAL'), 'OVERBOUGHT', 'OVERSOLD');
|
|
182
|
-
const signalTotals = (() => {
|
|
183
|
-
let up = 0, down = 0, prev = null;
|
|
184
|
-
for (const state of interpState) {
|
|
185
|
-
const isBull = state === 'BULL' || state === 'BULL_WEAK';
|
|
186
|
-
const isBear = state === 'BEAR' || state === 'BEAR_WEAK';
|
|
187
|
-
if (isBull) {
|
|
188
|
-
if (state !== prev)
|
|
189
|
-
up += 1;
|
|
190
|
-
}
|
|
191
|
-
else if (isBear) {
|
|
192
|
-
if (state !== prev)
|
|
193
|
-
down += 1;
|
|
194
|
-
}
|
|
195
|
-
prev = state;
|
|
196
|
-
}
|
|
197
|
-
return { up, down };
|
|
198
|
-
})();
|
|
199
|
-
const candleCount = results.length;
|
|
200
|
-
const fmtPrice = (v) => (v === null ? 'n/a' : fixedTo(v, 6));
|
|
201
|
-
const fmtSignedPrice = (v) => (v === null ? 'n/a' : `${v >= 0 ? '+' : ''}${Math.round(Number(v))}`);
|
|
202
|
-
const fmtPct = (v) => (v === null ? 'n/a' : `${v >= 0 ? '+' : ''}${Math.round(Number(v))}%`);
|
|
203
|
-
const fmtShare = (count) => (candleCount > 0 ? `${Math.round((count / candleCount) * 100)}%` : 'n/a');
|
|
204
|
-
const headerParts = [];
|
|
205
|
-
if (smaPeriod !== 'N/A')
|
|
206
|
-
headerParts.push(`SMA(${smaPeriod})`);
|
|
207
|
-
if (hasFastSma)
|
|
208
|
-
headerParts.push(`fastSMA(${fastSmaPeriod})`);
|
|
209
|
-
headerParts.push(`MACD(${macdFast},${macdSlow},${macdSig})`);
|
|
210
|
-
headerParts.push(`RSI(${rsiPeriod})`);
|
|
211
|
-
const headerSub = headerParts.join(' · ');
|
|
212
|
-
const statsPanel = `
|
|
213
|
-
<div><span class="label">Candles</span> <span class="val">${results.length}</span></div>
|
|
214
|
-
<div style="margin-top:6px"><span class="label">── Price summary ──</span></div>
|
|
215
|
-
<div><span class="label">Start</span> <span class="val">${fmtPrice(priceStart)}</span></div>
|
|
216
|
-
<div><span class="label">End</span> <span class="val">${fmtPrice(priceEnd)}</span></div>
|
|
217
|
-
<div style="margin-top:4px"></div>
|
|
218
|
-
<div><span class="label">High</span> <span class="val">${fmtPrice(priceHigh)}</span></div>
|
|
219
|
-
<div><span class="label">Low</span> <span class="val">${fmtPrice(priceLow)}</span></div>
|
|
220
|
-
<div style="margin-top:4px"></div>
|
|
221
|
-
<div><span class="label">Abs change</span> <span class="val">${fmtSignedPrice(priceChange)}</span></div>
|
|
222
|
-
<div><span class="label">Rel change</span> <span class="val">${fmtPct(priceChangePct)}</span></div>
|
|
223
|
-
<div style="margin-top:6px"><span class="label">── Totals ──</span></div>
|
|
224
|
-
<div><span class="label">SMA(${smaPeriod})</span> <span class="val"><span class="pos">▲</span>${fmtShare(smaTotals.up)} <span class="neg">▼</span>${fmtShare(smaTotals.down)} <span class="muted">●</span>${fmtShare(smaTotals.neutral)}</span></div>
|
|
225
|
-
${hasFastSma ? `<div><span class="label">fastSMA(${fastSmaPeriod})</span> <span class="val"><span class="pos">▲</span>${fmtShare(fastSmaTotals.up)} <span class="neg">▼</span>${fmtShare(fastSmaTotals.down)} <span class="muted">●</span>${fmtShare(fastSmaTotals.neutral)}</span></div>` : ''}
|
|
226
|
-
<div style="margin-top:4px"></div>
|
|
227
|
-
<div><span class="label">MACD(${macdFast},${macdSlow},${macdSig})</span> <span class="val"><span class="pos">▲</span>${fmtShare(macdTotals.up)} <span class="neg">▼</span>${fmtShare(macdTotals.down)} <span class="muted">●</span>${fmtShare(macdTotals.neutral)}</span></div>
|
|
228
|
-
<div><span class="label">RSI(${rsiPeriod})</span> <span class="val"><span class="pos">▲</span>${fmtShare(rsiTotals.positive)} <span class="neg">▼</span>${fmtShare(rsiTotals.negative)} <span class="muted">●</span>${fmtShare(rsiTotals.neutral)}</span></div>
|
|
229
|
-
<div style="margin-top:4px"></div>
|
|
230
|
-
<div><span class="label">Signals</span> <span class="val"><span class="pos">▲</span>${signalTotals.up} <span class="neg">▼</span>${signalTotals.down}</span></div>
|
|
231
|
-
`;
|
|
232
|
-
const chartId = `deriv-uplot-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
233
|
-
return `<!DOCTYPE html>
|
|
234
|
-
<html lang="en">
|
|
235
|
-
<head>
|
|
236
|
-
<meta charset="UTF-8">
|
|
237
|
-
<meta name="darkreader-lock">
|
|
238
|
-
<meta name="color-scheme" content="dark">
|
|
239
|
-
<title>${escapeHtml(title)}</title>
|
|
240
|
-
<link rel="stylesheet" href="../uplot/uPlot.min.css">
|
|
241
|
-
<script src="../uplot/uPlot.iife.min.js"></script>
|
|
242
|
-
<style>
|
|
243
|
-
:root { color-scheme: dark; }
|
|
244
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
245
|
-
body {
|
|
246
|
-
background: #0e1117;
|
|
247
|
-
color: #e0e0e0;
|
|
248
|
-
font-family: 'Segoe UI', sans-serif;
|
|
249
|
-
overflow: hidden;
|
|
250
|
-
}
|
|
251
|
-
#header {
|
|
252
|
-
position: fixed;
|
|
253
|
-
top: 0;
|
|
254
|
-
left: 0;
|
|
255
|
-
right: 0;
|
|
256
|
-
z-index: 100;
|
|
257
|
-
background: rgba(14,17,23,0.92);
|
|
258
|
-
backdrop-filter: blur(4px);
|
|
259
|
-
border-bottom: 1px solid #2a2e3e;
|
|
260
|
-
padding: 8px 20px;
|
|
261
|
-
display: flex;
|
|
262
|
-
align-items: center;
|
|
263
|
-
gap: 18px;
|
|
264
|
-
}
|
|
265
|
-
#header h1 { font-size: 16px; font-weight: 600; color: #fff; white-space: nowrap; }
|
|
266
|
-
#header .sub { font-size: 11px; color: #888; white-space: nowrap; }
|
|
267
|
-
#stats {
|
|
268
|
-
position: fixed;
|
|
269
|
-
top: 160px;
|
|
270
|
-
right: 10px;
|
|
271
|
-
z-index: 100;
|
|
272
|
-
background: rgba(20,24,32,0.92);
|
|
273
|
-
backdrop-filter: blur(4px);
|
|
274
|
-
border: 1px solid #2a2e3e;
|
|
275
|
-
border-radius: 6px;
|
|
276
|
-
padding: 10px 14px;
|
|
277
|
-
font-size: 12px;
|
|
278
|
-
line-height: 1.85;
|
|
279
|
-
min-width: 230px;
|
|
280
|
-
}
|
|
281
|
-
#stats .label { color: #888; }
|
|
282
|
-
#stats .val { color: #e0e0e0; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
283
|
-
#stats .pos { color: #26a69a; }
|
|
284
|
-
#stats .neg { color: #ef5350; }
|
|
285
|
-
#stats .muted { color: #9ca3b8; }
|
|
286
|
-
#charts {
|
|
287
|
-
position: fixed;
|
|
288
|
-
top: 44px;
|
|
289
|
-
left: 0;
|
|
290
|
-
right: 276px;
|
|
291
|
-
bottom: 0;
|
|
292
|
-
padding-top: 0;
|
|
293
|
-
display: flex;
|
|
294
|
-
flex-direction: column;
|
|
295
|
-
gap: 0;
|
|
296
|
-
border-right: 1px solid #2a2e3e;
|
|
297
|
-
}
|
|
298
|
-
.chart {
|
|
299
|
-
width: 100%;
|
|
300
|
-
min-height: 0;
|
|
301
|
-
position: relative;
|
|
302
|
-
padding-top: 18px;
|
|
303
|
-
}
|
|
304
|
-
.chart::before {
|
|
305
|
-
content: attr(data-panel-title);
|
|
306
|
-
position: absolute;
|
|
307
|
-
top: 4px;
|
|
308
|
-
left: 10px;
|
|
309
|
-
z-index: 2;
|
|
310
|
-
pointer-events: none;
|
|
311
|
-
font-size: 10px;
|
|
312
|
-
letter-spacing: 0.08em;
|
|
313
|
-
text-transform: uppercase;
|
|
314
|
-
color: #8ea3be;
|
|
315
|
-
background: rgba(14,17,23,0.84);
|
|
316
|
-
border: 1px solid #263042;
|
|
317
|
-
border-radius: 999px;
|
|
318
|
-
padding: 2px 8px;
|
|
319
|
-
}
|
|
320
|
-
#price-chart { flex: 2.35; }
|
|
321
|
-
#deriv-chart { flex: 0.78; }
|
|
322
|
-
#interp-chart { flex: 1.22; }
|
|
323
|
-
#macd-chart { flex: 1.05; }
|
|
324
|
-
#rsi-chart { flex: 1.28; min-height: 0; }
|
|
325
|
-
.uplot { background: #0e1117; }
|
|
326
|
-
.u-cursor-y { display: none !important; border-top: 1px dashed rgba(255,255,255,0.35) !important; background: transparent !important; }
|
|
327
|
-
.uplot.is-hovered .u-cursor-y { display: block !important; }
|
|
328
|
-
.u-cursor-x { border-left: 1px dashed rgba(255,255,255,0.35) !important; background: transparent !important; }
|
|
329
|
-
.u-legend { display: none !important; }
|
|
330
|
-
#global-tooltip {
|
|
331
|
-
position: fixed;
|
|
332
|
-
z-index: 200;
|
|
333
|
-
pointer-events: none;
|
|
334
|
-
background: rgba(14,17,23,0.96);
|
|
335
|
-
border: 1px solid #2a2e3e;
|
|
336
|
-
border-radius: 6px;
|
|
337
|
-
padding: 8px 12px;
|
|
338
|
-
font-size: 11px;
|
|
339
|
-
line-height: 1.6;
|
|
340
|
-
color: #e0e0e0;
|
|
341
|
-
box-shadow: 0 4px 16px rgba(0,0,0,0.4);
|
|
342
|
-
display: none;
|
|
343
|
-
max-width: 260px;
|
|
344
|
-
white-space: nowrap;
|
|
345
|
-
}
|
|
346
|
-
#global-tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; }
|
|
347
|
-
#global-tooltip .tt-label { color: #888; }
|
|
348
|
-
#global-tooltip .tt-val { font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
349
|
-
#global-tooltip .tt-sep { border-top: 1px solid #263042; margin: 4px 0; }
|
|
350
|
-
#global-tooltip .tt-head { color: #fff; font-weight: 700; margin-bottom: 4px; }
|
|
351
|
-
</style>
|
|
352
|
-
</head>
|
|
353
|
-
<body>
|
|
354
|
-
<div id="global-tooltip"></div>
|
|
355
|
-
<div id="header">
|
|
356
|
-
<h1>📊 ${escapeHtml(title)}</h1>
|
|
357
|
-
<span class="sub">Source: ${escapeHtml(source)}</span>
|
|
358
|
-
<span class="sub">${headerSub}</span>
|
|
359
|
-
<button id="reset-zoom-btn" onclick="resetZoom()" title="Reset x-axis zoom on all panels" style="background:#1e2330;color:#ccc;border:1px solid #2a2e3e;border-radius:4px;padding:3px 10px;font-size:11px;cursor:pointer;white-space:nowrap;">↺ Reset Zoom</button>
|
|
360
|
-
<span class="sub" style="margin-left:auto">Generated: ${new Date().toLocaleString()}</span>
|
|
361
|
-
</div>
|
|
362
|
-
<div id="stats">${statsPanel}</div>
|
|
363
|
-
<div id="charts">
|
|
364
|
-
<div id="price-chart" class="chart" data-panel-title="Price / AMA"></div>
|
|
365
|
-
<div id="deriv-chart" class="chart" data-panel-title="Trend Blocks"></div>
|
|
366
|
-
<div id="interp-chart" class="chart" data-panel-title="Signal State"></div>
|
|
367
|
-
<div id="macd-chart" class="chart" data-panel-title="MACD"></div>
|
|
368
|
-
<div id="rsi-chart" class="chart" data-panel-title="RSI"></div>
|
|
369
|
-
</div>
|
|
370
|
-
<script type="application/json" id="deriv-payload">${serializeJsonForScript({
|
|
371
|
-
dates,
|
|
372
|
-
prices,
|
|
373
|
-
smaValues,
|
|
374
|
-
fastSmaValues: hasFastSma ? fastSmaValues : null,
|
|
375
|
-
macdHistogram,
|
|
376
|
-
macdLine,
|
|
377
|
-
macdSignal,
|
|
378
|
-
macdHistUp,
|
|
379
|
-
macdHistDown,
|
|
380
|
-
rsiValues,
|
|
381
|
-
interpBull,
|
|
382
|
-
interpBullWeak,
|
|
383
|
-
interpOB,
|
|
384
|
-
interpBear,
|
|
385
|
-
interpBearWeak,
|
|
386
|
-
interpOS,
|
|
387
|
-
interpBullBlock,
|
|
388
|
-
interpBullWeakBlock,
|
|
389
|
-
interpOBBlock,
|
|
390
|
-
interpBearBlock,
|
|
391
|
-
interpBearWeakBlock,
|
|
392
|
-
interpOSBlock,
|
|
393
|
-
interpValues,
|
|
394
|
-
interpState,
|
|
395
|
-
interpBars,
|
|
396
|
-
entryBias,
|
|
397
|
-
entryBiasLabel,
|
|
398
|
-
signalPhase,
|
|
399
|
-
bullWeakEntryMarkers,
|
|
400
|
-
bullConfirmationMarkers,
|
|
401
|
-
lateBullMarkers,
|
|
402
|
-
bearWeakEntryMarkers,
|
|
403
|
-
bearConfirmationMarkers,
|
|
404
|
-
lateBearMarkers,
|
|
405
|
-
smaUp,
|
|
406
|
-
smaDown,
|
|
407
|
-
smaConf,
|
|
408
|
-
smaNum,
|
|
409
|
-
fastSmaUp: hasFastSma ? fastSmaUp : null,
|
|
410
|
-
fastSmaDown: hasFastSma ? fastSmaDown : null,
|
|
411
|
-
fastSmaConf: hasFastSma ? fastSmaConf : null,
|
|
412
|
-
fastSmaNum: hasFastSma ? fastSmaNum : null,
|
|
413
|
-
rsiOB,
|
|
414
|
-
rsiOS,
|
|
415
|
-
})}</script>
|
|
416
|
-
<script>
|
|
417
|
-
const payload = JSON.parse(document.getElementById('deriv-payload').textContent);
|
|
418
|
-
const dates = payload.dates;
|
|
419
|
-
const prices = payload.prices;
|
|
420
|
-
const smaValues = payload.smaValues;
|
|
421
|
-
const fastSmaValues = payload.fastSmaValues || [];
|
|
422
|
-
const macdHistogram = payload.macdHistogram;
|
|
423
|
-
const macdLine = payload.macdLine;
|
|
424
|
-
const macdSignal = payload.macdSignal;
|
|
425
|
-
const macdHistUp = payload.macdHistUp;
|
|
426
|
-
const macdHistDown = payload.macdHistDown;
|
|
427
|
-
const rsiValues = payload.rsiValues;
|
|
428
|
-
const interpBull = payload.interpBull;
|
|
429
|
-
const interpBullWeak = payload.interpBullWeak;
|
|
430
|
-
const interpOB = payload.interpOB;
|
|
431
|
-
const interpBear = payload.interpBear;
|
|
432
|
-
const interpBearWeak = payload.interpBearWeak;
|
|
433
|
-
const interpOS = payload.interpOS;
|
|
434
|
-
const interpBullBlock = payload.interpBullBlock;
|
|
435
|
-
const interpBullWeakBlock = payload.interpBullWeakBlock;
|
|
436
|
-
const interpOBBlock = payload.interpOBBlock;
|
|
437
|
-
const interpBearBlock = payload.interpBearBlock;
|
|
438
|
-
const interpBearWeakBlock = payload.interpBearWeakBlock;
|
|
439
|
-
const interpOSBlock = payload.interpOSBlock;
|
|
440
|
-
const interpValues = payload.interpValues;
|
|
441
|
-
const interpState = payload.interpState;
|
|
442
|
-
const interpBars = payload.interpBars;
|
|
443
|
-
const entryBias = payload.entryBias;
|
|
444
|
-
const entryBiasLabel = payload.entryBiasLabel;
|
|
445
|
-
const signalPhase = payload.signalPhase;
|
|
446
|
-
const bullWeakEntryMarkers = payload.bullWeakEntryMarkers;
|
|
447
|
-
const bullConfirmationMarkers = payload.bullConfirmationMarkers;
|
|
448
|
-
const lateBullMarkers = payload.lateBullMarkers;
|
|
449
|
-
const bearWeakEntryMarkers = payload.bearWeakEntryMarkers;
|
|
450
|
-
const bearConfirmationMarkers = payload.bearConfirmationMarkers;
|
|
451
|
-
const lateBearMarkers = payload.lateBearMarkers;
|
|
452
|
-
const smaUp = payload.smaUp;
|
|
453
|
-
const smaDown = payload.smaDown;
|
|
454
|
-
const smaConf = payload.smaConf;
|
|
455
|
-
const smaNum = payload.smaNum;
|
|
456
|
-
const hasFastSma = Array.isArray(payload.fastSmaValues) && payload.fastSmaValues.length > 0;
|
|
457
|
-
const fastSmaUp = payload.fastSmaUp || [];
|
|
458
|
-
const fastSmaDown = payload.fastSmaDown || [];
|
|
459
|
-
const fastSmaConf = payload.fastSmaConf || [];
|
|
460
|
-
const fastSmaNum = payload.fastSmaNum || [];
|
|
461
|
-
const rsiOB = payload.rsiOB;
|
|
462
|
-
const rsiOS = payload.rsiOS;
|
|
463
|
-
const chartGroupId = ${JSON.stringify(chartId)};
|
|
464
|
-
const THEME = {
|
|
465
|
-
text: '#ccc',
|
|
466
|
-
muted: '#888',
|
|
467
|
-
background: '#0e1117',
|
|
468
|
-
grid: '#1e2330',
|
|
469
|
-
axis: '#2a2e3e',
|
|
470
|
-
};
|
|
471
|
-
const SIGNAL_GREEN = 'rgba(38,166,154,0.45)';
|
|
472
|
-
const SIGNAL_GREEN_WEAK = 'rgba(38,166,154,0.22)';
|
|
473
|
-
const SIGNAL_GREEN_LIGHT = 'rgba(38,166,154,0.18)';
|
|
474
|
-
const SIGNAL_RED = 'rgba(239,83,80,0.45)';
|
|
475
|
-
const SIGNAL_RED_WEAK = 'rgba(239,83,80,0.22)';
|
|
476
|
-
const SIGNAL_RED_LIGHT = 'rgba(239,83,80,0.18)';
|
|
477
|
-
function initChart(domId, opts, data) {
|
|
478
|
-
if (typeof uPlot === 'undefined') throw new Error('uPlot library did not load');
|
|
479
|
-
const el = document.getElementById(domId);
|
|
480
|
-
const rect = el.getBoundingClientRect();
|
|
481
|
-
const chart = new uPlot({
|
|
482
|
-
...opts,
|
|
483
|
-
width: Math.max(320, Math.floor(rect.width)),
|
|
484
|
-
height: Math.max(110, Math.floor(rect.height)),
|
|
485
|
-
}, data, el);
|
|
486
|
-
chart.root.style.background = THEME.background;
|
|
487
|
-
return chart;
|
|
488
|
-
}
|
|
489
|
-
function fmtShortDate(sec) {
|
|
490
|
-
const d = new Date(sec * 1000);
|
|
491
|
-
return d.toLocaleDateString(undefined, { month: '2-digit', day: '2-digit' });
|
|
492
|
-
}
|
|
493
|
-
function padRange(min, max, lower = 0.04, upper = 0.04) {
|
|
494
|
-
if (!Number.isFinite(min) || !Number.isFinite(max)) return null;
|
|
495
|
-
if (min === max) {
|
|
496
|
-
const delta = Math.abs(min) * 0.03 || 1;
|
|
497
|
-
return [min - delta, max + delta];
|
|
498
|
-
}
|
|
499
|
-
const span = max - min;
|
|
500
|
-
return [min - span * lower, max + span * upper];
|
|
501
|
-
}
|
|
502
|
-
function makeAxis(show, type) {
|
|
503
|
-
return {
|
|
504
|
-
show,
|
|
505
|
-
scale: type,
|
|
506
|
-
stroke: THEME.axis,
|
|
507
|
-
grid: { show: false },
|
|
508
|
-
ticks: { show: true, stroke: THEME.axis, width: 1 },
|
|
509
|
-
size: show ? 34 : 0,
|
|
510
|
-
space: 50,
|
|
511
|
-
font: '10px Segoe UI, sans-serif',
|
|
512
|
-
label: '',
|
|
513
|
-
values: show ? (u, splits) => splits.map((v) => fmtShortDate(v)) : () => [],
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
function makeYAxis(show, formatter, size = 58, label = '') {
|
|
517
|
-
return {
|
|
518
|
-
show,
|
|
519
|
-
scale: 'y',
|
|
520
|
-
stroke: THEME.axis,
|
|
521
|
-
grid: { show: true, stroke: THEME.grid },
|
|
522
|
-
ticks: { show: true, stroke: THEME.axis, width: 1 },
|
|
523
|
-
size,
|
|
524
|
-
space: 60,
|
|
525
|
-
font: '10px Segoe UI, sans-serif',
|
|
526
|
-
values: formatter,
|
|
527
|
-
label,
|
|
528
|
-
labelSize: label ? 14 : 0,
|
|
529
|
-
labelGap: 4,
|
|
530
|
-
labelFont: '10px Segoe UI, sans-serif',
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function makeCursor() {
|
|
534
|
-
return {
|
|
535
|
-
show: true,
|
|
536
|
-
x: true,
|
|
537
|
-
y: true,
|
|
538
|
-
points: { show: false },
|
|
539
|
-
drag: { x: false, y: false, setScale: false },
|
|
540
|
-
sync: { key: chartGroupId, setSeries: false, scales: ['x', null] },
|
|
541
|
-
focus: { prox: -1 },
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
function makePlotBase(showX, yFormatter, yScale) {
|
|
545
|
-
return {
|
|
546
|
-
width: 0,
|
|
547
|
-
height: 0,
|
|
548
|
-
title: null,
|
|
549
|
-
legend: { show: false },
|
|
550
|
-
cursor: makeCursor(),
|
|
551
|
-
select: { show: false },
|
|
552
|
-
scales: {
|
|
553
|
-
x: { time: true },
|
|
554
|
-
y: yScale,
|
|
555
|
-
},
|
|
556
|
-
axes: [
|
|
557
|
-
makeAxis(showX, 'x'),
|
|
558
|
-
makeYAxis(true, yFormatter),
|
|
559
|
-
],
|
|
560
|
-
series: [
|
|
561
|
-
{ label: 'Time' },
|
|
562
|
-
],
|
|
563
|
-
padding: [10, 16, 0, 0],
|
|
564
|
-
hooks: {
|
|
565
|
-
ready: [
|
|
566
|
-
(u) => {
|
|
567
|
-
u.root.style.background = THEME.background;
|
|
568
|
-
},
|
|
569
|
-
],
|
|
570
|
-
},
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
function lineSeries(name, color, width, extra = {}) {
|
|
574
|
-
return {
|
|
575
|
-
label: name,
|
|
576
|
-
stroke: color,
|
|
577
|
-
width,
|
|
578
|
-
points: { show: false },
|
|
579
|
-
fill: null,
|
|
580
|
-
...extra,
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
function barSeries(name, color, fill) {
|
|
584
|
-
return {
|
|
585
|
-
label: name,
|
|
586
|
-
stroke: color,
|
|
587
|
-
fill,
|
|
588
|
-
width: 1,
|
|
589
|
-
points: { show: false },
|
|
590
|
-
paths: uPlot.paths.bars({ align: 0, gap: 1, size: [0.72, 14, 1] }),
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function blockSeries(name, color, fill) {
|
|
594
|
-
return {
|
|
595
|
-
label: name,
|
|
596
|
-
stroke: color,
|
|
597
|
-
fill,
|
|
598
|
-
width: 1,
|
|
599
|
-
points: { show: false },
|
|
600
|
-
paths: uPlot.paths.bars({ align: 0, gap: 0, size: [0.96, 18, 1] }),
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
function markerSeries(name, color, size = 7) {
|
|
604
|
-
return {
|
|
605
|
-
label: name,
|
|
606
|
-
stroke: 'transparent',
|
|
607
|
-
width: 0,
|
|
608
|
-
points: { show: true, size, space: 0, fill: color, stroke: color },
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
function tooltipPlugin() {
|
|
612
|
-
const tooltip = document.getElementById('global-tooltip');
|
|
613
|
-
let lastIdx = -1;
|
|
614
|
-
function updateTooltip(u) {
|
|
615
|
-
const idx = u.cursor.idx;
|
|
616
|
-
if (idx == null || idx === lastIdx) return;
|
|
617
|
-
lastIdx = idx;
|
|
618
|
-
const d = new Date(dates[idx] * 1000);
|
|
619
|
-
const dateStr = d.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })
|
|
620
|
-
+ ' ' + d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
|
|
621
|
-
const priceVal = prices[idx];
|
|
622
|
-
const smaVal = smaValues[idx];
|
|
623
|
-
const fsVal = hasFastSma ? fastSmaValues[idx] : null;
|
|
624
|
-
const macdL = macdLine[idx];
|
|
625
|
-
const macdS = macdSignal[idx];
|
|
626
|
-
const macdH = macdHistogram[idx];
|
|
627
|
-
const rsiVal = rsiValues[idx];
|
|
628
|
-
const state = interpState[idx];
|
|
629
|
-
const entry = entryBiasLabel[idx];
|
|
630
|
-
const bars = interpBars[idx];
|
|
631
|
-
const rows = [
|
|
632
|
-
'<div class="tt-head">' + dateStr + '</div>',
|
|
633
|
-
];
|
|
634
|
-
if (Number.isFinite(priceVal)) {
|
|
635
|
-
rows.push('<div class="tt-row"><span class="tt-label">Price</span><span class="tt-val">' + priceVal.toFixed(6) + '</span></div>');
|
|
636
|
-
}
|
|
637
|
-
if (Number.isFinite(smaVal)) {
|
|
638
|
-
rows.push('<div class="tt-row"><span class="tt-label">SMA(' + smaPeriod + ')</span><span class="tt-val">' + smaVal.toFixed(6) + '</span></div>');
|
|
639
|
-
}
|
|
640
|
-
if (hasFastSma && Number.isFinite(fsVal)) {
|
|
641
|
-
rows.push('<div class="tt-row"><span class="tt-label">fastSMA</span><span class="tt-val">' + fsVal.toFixed(6) + '</span></div>');
|
|
642
|
-
}
|
|
643
|
-
rows.push('<div class="tt-sep"></div>');
|
|
644
|
-
if (entry && entry !== 'No fresh entry') {
|
|
645
|
-
const entryColor = entry.includes('Long') ? '#26a69a' : entry.includes('Short') ? '#ef5350' : '#ccc';
|
|
646
|
-
rows.push('<div class="tt-row"><span class="tt-label">Entry</span><span class="tt-val" style="color:' + entryColor + '">' + entry + '</span></div>');
|
|
647
|
-
}
|
|
648
|
-
if (state && state !== 'NEUTRAL') {
|
|
649
|
-
const stateColor = state.startsWith('BULL') || state === 'OVERBOUGHT' ? '#26a69a' : state.startsWith('BEAR') || state === 'OVERSOLD' ? '#ef5350' : '#ccc';
|
|
650
|
-
rows.push('<div class="tt-row"><span class="tt-label">State</span><span class="tt-val" style="color:' + stateColor + '">' + state + (bars > 0 ? ' (' + bars + ' bars)' : '') + '</span></div>');
|
|
651
|
-
}
|
|
652
|
-
rows.push('<div class="tt-sep"></div>');
|
|
653
|
-
if (Number.isFinite(macdL) && Number.isFinite(macdS)) {
|
|
654
|
-
rows.push('<div class="tt-row"><span class="tt-label">MACD</span><span class="tt-val">' + macdL.toFixed(4) + '</span></div>');
|
|
655
|
-
rows.push('<div class="tt-row"><span class="tt-label">Signal</span><span class="tt-val">' + macdS.toFixed(4) + '</span></div>');
|
|
656
|
-
rows.push('<div class="tt-row"><span class="tt-label">Hist</span><span class="tt-val">' + (macdH >= 0 ? '+' : '') + macdH.toFixed(4) + '</span></div>');
|
|
657
|
-
}
|
|
658
|
-
if (Number.isFinite(rsiVal)) {
|
|
659
|
-
rows.push('<div class="tt-row"><span class="tt-label">RSI</span><span class="tt-val">' + rsiVal.toFixed(1) + '</span></div>');
|
|
660
|
-
}
|
|
661
|
-
tooltip.innerHTML = rows.join('');
|
|
662
|
-
}
|
|
663
|
-
return {
|
|
664
|
-
hooks: {
|
|
665
|
-
init: [(u) => {
|
|
666
|
-
u.over.addEventListener('mouseenter', () => { tooltip.style.display = 'block'; });
|
|
667
|
-
u.over.addEventListener('mouseleave', () => { tooltip.style.display = 'none'; lastIdx = -1; });
|
|
668
|
-
}],
|
|
669
|
-
setCursor: [(u) => {
|
|
670
|
-
updateTooltip(u);
|
|
671
|
-
const { left, top } = u.cursor;
|
|
672
|
-
const rect = u.root.getBoundingClientRect();
|
|
673
|
-
const ttWidth = tooltip.offsetWidth || 220;
|
|
674
|
-
const ttHeight = tooltip.offsetHeight || 180;
|
|
675
|
-
let x = rect.left + left + 16;
|
|
676
|
-
let y = rect.top + top + 16;
|
|
677
|
-
if (x + ttWidth > window.innerWidth - 12) x = rect.left + left - ttWidth - 16;
|
|
678
|
-
if (y + ttHeight > window.innerHeight - 12) y = rect.top + top - ttHeight - 16;
|
|
679
|
-
tooltip.style.left = x + 'px';
|
|
680
|
-
tooltip.style.top = y + 'px';
|
|
681
|
-
}],
|
|
682
|
-
},
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
function applyChartHeights() {
|
|
686
|
-
const available = Math.max(window.innerHeight - 44, 300);
|
|
687
|
-
const specs = [
|
|
688
|
-
['price-chart', 2.35],
|
|
689
|
-
['deriv-chart', 0.78],
|
|
690
|
-
['interp-chart', 1.22],
|
|
691
|
-
['macd-chart', 1.05],
|
|
692
|
-
['rsi-chart', 1.28],
|
|
693
|
-
];
|
|
694
|
-
const minHeight = 60;
|
|
695
|
-
const extraAvailable = Math.max(0, available - (minHeight * specs.length));
|
|
696
|
-
const totalWeight = specs.reduce((sum, [, weight]) => sum + weight, 0);
|
|
697
|
-
let assignedExtra = 0;
|
|
698
|
-
specs.forEach(([id, weight], idx) => {
|
|
699
|
-
const extra = idx === specs.length - 1
|
|
700
|
-
? extraAvailable - assignedExtra
|
|
701
|
-
: Math.floor((extraAvailable * weight) / totalWeight);
|
|
702
|
-
assignedExtra += extra;
|
|
703
|
-
document.getElementById(id).style.height = (minHeight + extra) + 'px';
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
function syncHoverState(chart) {
|
|
707
|
-
const root = chart.root;
|
|
708
|
-
root.addEventListener('mouseenter', () => root.classList.add('is-hovered'));
|
|
709
|
-
root.addEventListener('mouseleave', () => root.classList.remove('is-hovered'));
|
|
710
|
-
}
|
|
711
|
-
let priceChart;
|
|
712
|
-
let derivChart;
|
|
713
|
-
let interpChart;
|
|
714
|
-
let macdChart;
|
|
715
|
-
let rsiChart;
|
|
716
|
-
let charts: any[] = [];
|
|
717
|
-
let pendingRange: any = null;
|
|
718
|
-
let pendingRangeRaf = 0;
|
|
719
|
-
const [xMin, xMax] = [dates[0], dates[dates.length - 1]];
|
|
720
|
-
try {
|
|
721
|
-
priceChart = initChart('price-chart', {
|
|
722
|
-
...makePlotBase(false, (u, vals) => vals.map((v) => fixedTo(v, 6)), {
|
|
723
|
-
auto: true,
|
|
724
|
-
distr: 3,
|
|
725
|
-
log: 10,
|
|
726
|
-
range: (u, min, max) => {
|
|
727
|
-
if (!Number.isFinite(min) || !Number.isFinite(max) || min <= 0 || max <= 0) {
|
|
728
|
-
return [min, max];
|
|
729
|
-
}
|
|
730
|
-
return [min * 0.98, max * 1.03];
|
|
731
|
-
},
|
|
732
|
-
}),
|
|
733
|
-
axes: [
|
|
734
|
-
makeAxis(false, 'x'),
|
|
735
|
-
makeYAxis(true, (u, vals) => vals.map((v) => fixedTo(v, 6)), 62, 'Price'),
|
|
736
|
-
],
|
|
737
|
-
plugins: [tooltipPlugin()],
|
|
738
|
-
series: [
|
|
739
|
-
{ label: 'Time' },
|
|
740
|
-
lineSeries('Price', '#67a8ff', 2.35, { fill: 'rgba(103,168,255,0.08)' }),
|
|
741
|
-
lineSeries('SMA(${smaPeriod})', '#f2b94d', 2),
|
|
742
|
-
${hasFastSma ? `lineSeries('fastSMA(${fastSmaPeriod})', '#ff9d4d', 1.9),` : ''}
|
|
743
|
-
],
|
|
744
|
-
}, [dates, prices, smaValues${hasFastSma ? ', fastSmaValues' : ''}]);
|
|
745
|
-
derivChart = initChart('deriv-chart', {
|
|
746
|
-
...makePlotBase(false, (u, vals) => vals.map((v) => (v === 1 ? 'UP' : v === -1 ? 'DOWN' : '—')), {
|
|
747
|
-
auto: true,
|
|
748
|
-
range: (u, min, max) => [-1.15, 1.15],
|
|
749
|
-
}),
|
|
750
|
-
axes: [
|
|
751
|
-
makeAxis(false, 'x'),
|
|
752
|
-
makeYAxis(true, (u, vals) => vals.map((v) => (v === 1 ? 'UP' : v === -1 ? 'DOWN' : '—')), 56, 'Trend'),
|
|
753
|
-
],
|
|
754
|
-
series: [
|
|
755
|
-
{ label: 'Time' },
|
|
756
|
-
blockSeries('SMA Up', 'rgba(83,214,184,0.88)', 'rgba(83,214,184,0.88)'),
|
|
757
|
-
blockSeries('SMA Down', 'rgba(255,114,105,0.88)', 'rgba(255,114,105,0.88)'),
|
|
758
|
-
${hasFastSma ? `blockSeries('fastSMA Up', 'rgba(251,146,60,0.35)', 'rgba(251,146,60,0.35)'),
|
|
759
|
-
blockSeries('fastSMA Down', 'rgba(251,146,60,0.35)', 'rgba(251,146,60,0.35)'),` : ''}
|
|
760
|
-
lineSeries('Zero', 'rgba(255,255,255,0.20)', 1),
|
|
761
|
-
],
|
|
762
|
-
}, [dates, smaUp, smaDown, ${hasFastSma ? 'fastSmaUp, fastSmaDown, ' : ''}dates.map(() => 0)]);
|
|
763
|
-
interpChart = initChart('interp-chart', {
|
|
764
|
-
...makePlotBase(false, (u, vals) => vals.map((v) => {
|
|
765
|
-
if (v === 1) return 'BULL';
|
|
766
|
-
if (v === 0.75) return 'OS';
|
|
767
|
-
if (v === 0.5) return 'WEAK';
|
|
768
|
-
if (v === 0.35) return 'WEAK';
|
|
769
|
-
if (v === -0.35) return 'WEAK';
|
|
770
|
-
if (v === -0.5) return 'WEAK';
|
|
771
|
-
if (v === -0.75) return 'OB';
|
|
772
|
-
if (v === -1) return 'BEAR';
|
|
773
|
-
return '—';
|
|
774
|
-
}), {
|
|
775
|
-
auto: true,
|
|
776
|
-
range: (u, min, max) => [-1.15, 1.15],
|
|
777
|
-
}),
|
|
778
|
-
axes: [
|
|
779
|
-
makeAxis(false, 'x'),
|
|
780
|
-
makeYAxis(true, (u, vals) => vals.map((v) => {
|
|
781
|
-
if (v === 1) return 'BULL';
|
|
782
|
-
if (v === 0.75) return 'OS';
|
|
783
|
-
if (v === 0.5 || v === -0.5) return 'WEAK';
|
|
784
|
-
if (v === -0.75) return 'OB';
|
|
785
|
-
if (v === -1) return 'BEAR';
|
|
786
|
-
return '—';
|
|
787
|
-
}), 56, 'Signal'),
|
|
788
|
-
],
|
|
789
|
-
series: [
|
|
790
|
-
{ label: 'Time' },
|
|
791
|
-
blockSeries('Bull', SIGNAL_GREEN, SIGNAL_GREEN),
|
|
792
|
-
blockSeries('Bull Weak', SIGNAL_GREEN_WEAK, SIGNAL_GREEN_WEAK),
|
|
793
|
-
blockSeries('Overbought', SIGNAL_GREEN_LIGHT, SIGNAL_GREEN_LIGHT),
|
|
794
|
-
blockSeries('Bear', SIGNAL_RED, SIGNAL_RED),
|
|
795
|
-
blockSeries('Bear Weak', SIGNAL_RED_WEAK, SIGNAL_RED_WEAK),
|
|
796
|
-
blockSeries('Oversold', SIGNAL_RED_LIGHT, SIGNAL_RED_LIGHT),
|
|
797
|
-
lineSeries('Interp', 'rgba(255,255,255,0.35)', 1, { dash: [4, 4] }),
|
|
798
|
-
markerSeries('Early Long', '#67e8f9', 7),
|
|
799
|
-
markerSeries('Confirm Long', '#34d399', 8),
|
|
800
|
-
markerSeries('Late Long', '#f59e0b', 8),
|
|
801
|
-
markerSeries('Early Short', '#fca5a5', 7),
|
|
802
|
-
markerSeries('Confirm Short', '#ef4444', 8),
|
|
803
|
-
markerSeries('Late Short', '#fb7185', 8),
|
|
804
|
-
],
|
|
805
|
-
}, [dates, interpBullBlock, interpBullWeakBlock, interpOBBlock, interpBearBlock, interpBearWeakBlock, interpOSBlock, interpValues, bullWeakEntryMarkers, bullConfirmationMarkers, lateBullMarkers, bearWeakEntryMarkers, bearConfirmationMarkers, lateBearMarkers]);
|
|
806
|
-
macdChart = initChart('macd-chart', {
|
|
807
|
-
...makePlotBase(false, (u, vals) => vals.map((v) => fixedTo(v, 4)), {
|
|
808
|
-
auto: true,
|
|
809
|
-
range: (u, min, max) => {
|
|
810
|
-
const base = padRange(min, max, 0.12, 0.12);
|
|
811
|
-
return base || [min, max];
|
|
812
|
-
},
|
|
813
|
-
}),
|
|
814
|
-
axes: [
|
|
815
|
-
makeAxis(false, 'x'),
|
|
816
|
-
makeYAxis(true, (u, vals) => vals.map((v) => fixedTo(v, 4)), 62, 'MACD %'),
|
|
817
|
-
],
|
|
818
|
-
series: [
|
|
819
|
-
{ label: 'Time' },
|
|
820
|
-
barSeries('Hist+', 'rgba(83,214,184,0.40)', 'rgba(83,214,184,0.40)'),
|
|
821
|
-
barSeries('Hist-', 'rgba(255,114,105,0.40)', 'rgba(255,114,105,0.40)'),
|
|
822
|
-
lineSeries('MACD', '#67a8ff', 1.5),
|
|
823
|
-
lineSeries('Signal', '#ff9d4d', 1.5),
|
|
824
|
-
lineSeries('Zero', 'rgba(255,255,255,0.22)', 1),
|
|
825
|
-
],
|
|
826
|
-
}, [dates, macdHistUp, macdHistDown, macdLine, macdSignal, dates.map(() => 0)]);
|
|
827
|
-
rsiChart = initChart('rsi-chart', {
|
|
828
|
-
...makePlotBase(true, (u, vals) => vals.map((v) => fixedTo(v, 1)), {
|
|
829
|
-
range: (u, min, max) => [0, 100],
|
|
830
|
-
}),
|
|
831
|
-
axes: [
|
|
832
|
-
makeAxis(true, 'x'),
|
|
833
|
-
makeYAxis(true, (u, vals) => vals.map((v) => fixedTo(v, 1)), 56, 'RSI'),
|
|
834
|
-
],
|
|
835
|
-
series: [
|
|
836
|
-
{ label: 'Time' },
|
|
837
|
-
lineSeries('OB', 'rgba(255,114,105,0.35)', 1),
|
|
838
|
-
lineSeries('OS', 'rgba(83,214,184,0.35)', 1),
|
|
839
|
-
lineSeries('Mid', 'rgba(255,255,255,0.18)', 1),
|
|
840
|
-
lineSeries('RSI(${rsiPeriod})', '#c4a5ff', 1.55),
|
|
841
|
-
],
|
|
842
|
-
}, [dates, dates.map(() => rsiOB), dates.map(() => rsiOS), dates.map(() => 50), rsiValues]);
|
|
843
|
-
} catch (err) {
|
|
844
|
-
console.error(err);
|
|
845
|
-
document.getElementById('charts').innerHTML = '<div style="padding:20px;color:#ef5350;white-space:pre-wrap;">' + String(err && err.message ? err.message : err) + '</div>';
|
|
846
|
-
throw err;
|
|
847
|
-
}
|
|
848
|
-
charts = [priceChart, derivChart, interpChart, macdChart, rsiChart];
|
|
849
|
-
${UPLOT_SHARED_SCRIPT}
|
|
850
|
-
function bindHoverState(chart) {
|
|
851
|
-
const root = chart.root;
|
|
852
|
-
root.addEventListener('mouseenter', () => root.classList.add('is-hovered'));
|
|
853
|
-
root.addEventListener('mouseleave', () => root.classList.remove('is-hovered'));
|
|
854
|
-
}
|
|
855
|
-
function resetZoom() {
|
|
856
|
-
syncXRange(xMin, xMax);
|
|
857
|
-
}
|
|
858
|
-
function sizeCharts() {
|
|
859
|
-
applyChartHeights();
|
|
860
|
-
for (const chart of charts) {
|
|
861
|
-
const rect = chart.root.parentElement.getBoundingClientRect();
|
|
862
|
-
chart.setSize({ width: Math.max(320, Math.floor(rect.width)), height: Math.max(100, Math.floor(rect.height)) });
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
window.addEventListener('resize', sizeCharts);
|
|
866
|
-
window.addEventListener('keydown', (e) => {
|
|
867
|
-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === '0') resetZoom();
|
|
868
|
-
});
|
|
869
|
-
charts.forEach((chart) => {
|
|
870
|
-
bindWheelZoom(chart);
|
|
871
|
-
bindPan(chart);
|
|
872
|
-
bindHoverState(chart);
|
|
873
|
-
});
|
|
874
|
-
const raf = window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : (fn) => setTimeout(fn, 0);
|
|
875
|
-
raf(() => sizeCharts());
|
|
876
|
-
</script>
|
|
877
|
-
</body>
|
|
878
|
-
</html>`;
|
|
879
|
-
}
|
|
880
|
-
async function main() {
|
|
881
|
-
const cfg = parseArgs();
|
|
882
|
-
const data = readJSON(cfg.inputFile);
|
|
883
|
-
const html = generateHTML(data, cfg.title);
|
|
884
|
-
ensureDir(path.dirname(cfg.outputFile));
|
|
885
|
-
fs.writeFileSync(cfg.outputFile, html, 'utf8');
|
|
886
|
-
if (!cfg.quiet)
|
|
887
|
-
console.log(`Chart written to ${cfg.outputFile}`);
|
|
888
|
-
}
|
|
889
|
-
if (require.main === module) {
|
|
890
|
-
main().catch((err) => {
|
|
891
|
-
console.error(err);
|
|
892
|
-
process.exit(1);
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
module.exports = { generateHTML, parseArgs, showHelp, trendToNum };
|
|
896
|
-
//# sourceMappingURL=derivative_chart_generator.js.map
|