dexbot 1.3.3 → 1.4.1
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 +144 -63
- 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 +122 -91
- 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 +346 -212
- 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 +80 -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 +159 -73
- 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 +103 -45
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +271 -150
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +35 -47
- package/dist/modules/order/utils/validate.d.ts.map +1 -1
- package/dist/modules/order/utils/validate.js +233 -116
- 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
|
@@ -31,17 +31,71 @@
|
|
|
31
31
|
*
|
|
32
32
|
* ===============================================================================
|
|
33
33
|
*/
|
|
34
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
35
|
+
if (k2 === undefined) k2 = k;
|
|
36
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
37
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
38
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
39
|
+
}
|
|
40
|
+
Object.defineProperty(o, k2, desc);
|
|
41
|
+
}) : (function(o, m, k, k2) {
|
|
42
|
+
if (k2 === undefined) k2 = k;
|
|
43
|
+
o[k2] = m[k];
|
|
44
|
+
}));
|
|
45
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
46
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
47
|
+
}) : function(o, v) {
|
|
48
|
+
o["default"] = v;
|
|
49
|
+
});
|
|
50
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
51
|
+
var ownKeys = function(o) {
|
|
52
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
53
|
+
var ar = [];
|
|
54
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
55
|
+
return ar;
|
|
56
|
+
};
|
|
57
|
+
return ownKeys(o);
|
|
58
|
+
};
|
|
59
|
+
return function (mod) {
|
|
60
|
+
if (mod && mod.__esModule) return mod;
|
|
61
|
+
var result = {};
|
|
62
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
63
|
+
__setModuleDefault(result, mod);
|
|
64
|
+
return result;
|
|
65
|
+
};
|
|
66
|
+
})();
|
|
67
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
|
+
exports.VALID_ORDER_TYPES = exports.VALID_ORDER_STATES = void 0;
|
|
69
|
+
exports.validateOrder = validateOrder;
|
|
70
|
+
exports.validateGridForPersistence = validateGridForPersistence;
|
|
71
|
+
exports.calculateRequiredFunds = calculateRequiredFunds;
|
|
72
|
+
exports.validateWorkingGridFunds = validateWorkingGridFunds;
|
|
73
|
+
exports.checkFundDrift = checkFundDrift;
|
|
74
|
+
exports.reconcileGrid = reconcileGrid;
|
|
75
|
+
exports.optimizeRebalanceActions = optimizeRebalanceActions;
|
|
76
|
+
exports.summarizeActions = summarizeActions;
|
|
77
|
+
exports.hasExecutableActions = hasExecutableActions;
|
|
78
|
+
exports.validateCreateTargetSlots = validateCreateTargetSlots;
|
|
79
|
+
exports.hasActionForOrder = hasActionForOrder;
|
|
80
|
+
exports.removeActionsForOrder = removeActionsForOrder;
|
|
81
|
+
exports.projectTargetToWorkingGrid = projectTargetToWorkingGrid;
|
|
82
|
+
exports.buildStateUpdates = buildStateUpdates;
|
|
83
|
+
exports.buildAbortedResult = buildAbortedResult;
|
|
84
|
+
exports.buildSuccessResult = buildSuccessResult;
|
|
85
|
+
exports.evaluateCommit = evaluateCommit;
|
|
34
86
|
// ===============================================================================
|
|
35
87
|
// SECTION 1: EXTERNAL DEPENDENCIES
|
|
36
88
|
// ===============================================================================
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
89
|
+
const Format = __importStar(require("../format"));
|
|
90
|
+
const constants_1 = require("../../constants");
|
|
91
|
+
const math_1 = require("./math");
|
|
92
|
+
const order_1 = require("./order");
|
|
41
93
|
const { isValidNumber, toFiniteNumber } = Format;
|
|
42
94
|
// Pre-computed valid sets
|
|
43
|
-
const VALID_ORDER_STATES = new Set(Object.values(ORDER_STATES));
|
|
44
|
-
|
|
95
|
+
const VALID_ORDER_STATES = new Set(Object.values(constants_1.ORDER_STATES));
|
|
96
|
+
exports.VALID_ORDER_STATES = VALID_ORDER_STATES;
|
|
97
|
+
const VALID_ORDER_TYPES = new Set(Object.values(constants_1.ORDER_TYPES));
|
|
98
|
+
exports.VALID_ORDER_TYPES = VALID_ORDER_TYPES;
|
|
45
99
|
// ===============================================================================
|
|
46
100
|
// SECTION 2: VALIDATION
|
|
47
101
|
// ===============================================================================
|
|
@@ -60,10 +114,10 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
|
|
|
60
114
|
errors.push({ code: 'MISSING_ID', message: 'Refusing to update order: missing ID' });
|
|
61
115
|
return { isValid: false, errors, warnings, normalizedOrder: null };
|
|
62
116
|
}
|
|
63
|
-
if (!normalizedOrder.type && normalizedOrder.state === ORDER_STATES.VIRTUAL) {
|
|
117
|
+
if (!normalizedOrder.type && normalizedOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
|
|
64
118
|
const placeholderSize = toFiniteNumber(normalizedOrder.size);
|
|
65
119
|
if (placeholderSize === 0) {
|
|
66
|
-
normalizedOrder.type = ORDER_TYPES.SPREAD;
|
|
120
|
+
normalizedOrder.type = constants_1.ORDER_TYPES.SPREAD;
|
|
67
121
|
}
|
|
68
122
|
}
|
|
69
123
|
if (!VALID_ORDER_STATES.has(normalizedOrder.state)) {
|
|
@@ -78,47 +132,47 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
|
|
|
78
132
|
message: `Refusing to update order ${order.id}: invalid type '${normalizedOrder.type}' (context: ${context})`
|
|
79
133
|
});
|
|
80
134
|
}
|
|
81
|
-
if (normalizedOrder.type === ORDER_TYPES.SPREAD && toFiniteNumber(normalizedOrder.size) !== 0) {
|
|
135
|
+
if (normalizedOrder.type === constants_1.ORDER_TYPES.SPREAD && toFiniteNumber(normalizedOrder.size) !== 0) {
|
|
82
136
|
warnings.push({
|
|
83
137
|
code: 'SPREAD_SIZE_NORMALIZED',
|
|
84
138
|
message: `[INVARIANT] Normalizing SPREAD order ${order.id} size ${normalizedOrder.size} -> 0 (context: ${context})`
|
|
85
139
|
});
|
|
86
140
|
normalizedOrder.size = 0;
|
|
87
141
|
}
|
|
88
|
-
const isOnChainState = (normalizedOrder.state === ORDER_STATES.ACTIVE ||
|
|
89
|
-
normalizedOrder.state === ORDER_STATES.PARTIAL);
|
|
90
|
-
if (normalizedOrder.type === ORDER_TYPES.SPREAD && isOnChainState) {
|
|
142
|
+
const isOnChainState = (normalizedOrder.state === constants_1.ORDER_STATES.ACTIVE ||
|
|
143
|
+
normalizedOrder.state === constants_1.ORDER_STATES.PARTIAL);
|
|
144
|
+
if (normalizedOrder.type === constants_1.ORDER_TYPES.SPREAD && isOnChainState) {
|
|
91
145
|
errors.push({
|
|
92
146
|
code: 'ILLEGAL_SPREAD_STATE',
|
|
93
147
|
message: `ILLEGAL STATE: Refusing to move SPREAD order ${order.id} to ${normalizedOrder.state}. SPREAD orders must remain VIRTUAL.`,
|
|
94
148
|
isFatal: true
|
|
95
149
|
});
|
|
96
150
|
}
|
|
97
|
-
if (isPhantomOrder(normalizedOrder)) {
|
|
151
|
+
if ((0, order_1.isPhantomOrder)(normalizedOrder)) {
|
|
98
152
|
errors.push({
|
|
99
153
|
code: 'PHANTOM_ORDER',
|
|
100
154
|
message: `ILLEGAL STATE: Refusing to set order ${order.id} to ${normalizedOrder.state} without orderId. Context: ${context}. This would create a phantom order that doubles fund tracking.`,
|
|
101
155
|
autoCorrect: {
|
|
102
|
-
state: ORDER_STATES.VIRTUAL,
|
|
156
|
+
state: constants_1.ORDER_STATES.VIRTUAL,
|
|
103
157
|
orderId: null,
|
|
104
158
|
rawOnChain: null,
|
|
105
159
|
size: 0
|
|
106
160
|
}
|
|
107
161
|
});
|
|
108
162
|
}
|
|
109
|
-
if (normalizedOrder.type === ORDER_TYPES.BUY || normalizedOrder.type === ORDER_TYPES.SELL) {
|
|
163
|
+
if (normalizedOrder.type === constants_1.ORDER_TYPES.BUY || normalizedOrder.type === constants_1.ORDER_TYPES.SELL) {
|
|
110
164
|
normalizedOrder.committedSide = normalizedOrder.type;
|
|
111
165
|
}
|
|
112
166
|
else if (!normalizedOrder.committedSide && oldOrder) {
|
|
113
167
|
if (oldOrder.committedSide) {
|
|
114
168
|
normalizedOrder.committedSide = oldOrder.committedSide;
|
|
115
169
|
}
|
|
116
|
-
else if (oldOrder.type === ORDER_TYPES.BUY || oldOrder.type === ORDER_TYPES.SELL) {
|
|
170
|
+
else if (oldOrder.type === constants_1.ORDER_TYPES.BUY || oldOrder.type === constants_1.ORDER_TYPES.SELL) {
|
|
117
171
|
normalizedOrder.committedSide = oldOrder.type;
|
|
118
172
|
}
|
|
119
173
|
}
|
|
120
174
|
return {
|
|
121
|
-
isValid: errors.length === 0 || !errors.some(e => e.isFatal),
|
|
175
|
+
isValid: errors.length === 0 || !errors.some((e) => e.isFatal),
|
|
122
176
|
errors,
|
|
123
177
|
warnings,
|
|
124
178
|
normalizedOrder
|
|
@@ -132,7 +186,7 @@ function validateOrder(order, oldOrder = null, context = 'validate') {
|
|
|
132
186
|
*/
|
|
133
187
|
function validateGridForPersistence(orders, accountTotals) {
|
|
134
188
|
for (const order of orders.values()) {
|
|
135
|
-
if (isPhantomOrder(order)) {
|
|
189
|
+
if ((0, order_1.isPhantomOrder)(order)) {
|
|
136
190
|
return {
|
|
137
191
|
isValid: false,
|
|
138
192
|
reason: `Phantom order detected: order ${order.id} is ${order.state} but has no orderId`
|
|
@@ -161,21 +215,21 @@ function calculateRequiredFunds(grid, precisions = {}) {
|
|
|
161
215
|
for (const order of grid.values()) {
|
|
162
216
|
const size = toFiniteNumber(order.size ?? order.amount);
|
|
163
217
|
const state = order.state;
|
|
164
|
-
const isActive = state === ORDER_STATES.ACTIVE || state === ORDER_STATES.PARTIAL;
|
|
165
|
-
if (isActive && isOrderOnChain(order)) {
|
|
166
|
-
if (order.type === ORDER_TYPES.BUY) {
|
|
167
|
-
buyRequiredInt += floatToBlockchainInt(size, buyPrecision);
|
|
218
|
+
const isActive = state === constants_1.ORDER_STATES.ACTIVE || state === constants_1.ORDER_STATES.PARTIAL;
|
|
219
|
+
if (isActive && (0, order_1.isOrderOnChain)(order)) {
|
|
220
|
+
if (order.type === constants_1.ORDER_TYPES.BUY) {
|
|
221
|
+
buyRequiredInt += (0, math_1.floatToBlockchainInt)(size, buyPrecision);
|
|
168
222
|
}
|
|
169
|
-
else if (order.type === ORDER_TYPES.SELL) {
|
|
170
|
-
sellRequiredInt += floatToBlockchainInt(size, sellPrecision);
|
|
223
|
+
else if (order.type === constants_1.ORDER_TYPES.SELL) {
|
|
224
|
+
sellRequiredInt += (0, math_1.floatToBlockchainInt)(size, sellPrecision);
|
|
171
225
|
}
|
|
172
226
|
}
|
|
173
227
|
}
|
|
174
228
|
return {
|
|
175
229
|
buyInt: buyRequiredInt,
|
|
176
230
|
sellInt: sellRequiredInt,
|
|
177
|
-
buy: blockchainToFloat(buyRequiredInt, buyPrecision),
|
|
178
|
-
sell: blockchainToFloat(sellRequiredInt, sellPrecision)
|
|
231
|
+
buy: (0, math_1.blockchainToFloat)(buyRequiredInt, buyPrecision),
|
|
232
|
+
sell: (0, math_1.blockchainToFloat)(sellRequiredInt, sellPrecision)
|
|
179
233
|
};
|
|
180
234
|
}
|
|
181
235
|
/**
|
|
@@ -201,26 +255,26 @@ function validateWorkingGridFunds(workingGrid, projectedFunds, precisions = {},
|
|
|
201
255
|
? Number(projectedFunds.chainTotalSell)
|
|
202
256
|
: toFiniteNumber(projectedFunds?.freeSell ?? projectedFunds?.chainFreeSell);
|
|
203
257
|
const shortfalls = [];
|
|
204
|
-
const availableBuyInt = floatToBlockchainInt(availableBuy, buyPrecision);
|
|
205
|
-
const availableSellInt = floatToBlockchainInt(availableSell, sellPrecision);
|
|
258
|
+
const availableBuyInt = (0, math_1.floatToBlockchainInt)(availableBuy, buyPrecision);
|
|
259
|
+
const availableSellInt = (0, math_1.floatToBlockchainInt)(availableSell, sellPrecision);
|
|
206
260
|
if (required.buyInt > availableBuyInt) {
|
|
207
|
-
const requiredBuyFloat = blockchainToFloat(required.buyInt, buyPrecision);
|
|
208
|
-
const availableBuyFloat = blockchainToFloat(availableBuyInt, buyPrecision);
|
|
261
|
+
const requiredBuyFloat = (0, math_1.blockchainToFloat)(required.buyInt, buyPrecision);
|
|
262
|
+
const availableBuyFloat = (0, math_1.blockchainToFloat)(availableBuyInt, buyPrecision);
|
|
209
263
|
shortfalls.push({
|
|
210
264
|
asset: assets?.assetB?.symbol || 'buyAsset',
|
|
211
265
|
required: requiredBuyFloat,
|
|
212
266
|
available: availableBuyFloat,
|
|
213
|
-
deficit: blockchainToFloat(required.buyInt - availableBuyInt, buyPrecision)
|
|
267
|
+
deficit: (0, math_1.blockchainToFloat)(required.buyInt - availableBuyInt, buyPrecision)
|
|
214
268
|
});
|
|
215
269
|
}
|
|
216
270
|
if (required.sellInt > availableSellInt) {
|
|
217
|
-
const requiredSellFloat = blockchainToFloat(required.sellInt, sellPrecision);
|
|
218
|
-
const availableSellFloat = blockchainToFloat(availableSellInt, sellPrecision);
|
|
271
|
+
const requiredSellFloat = (0, math_1.blockchainToFloat)(required.sellInt, sellPrecision);
|
|
272
|
+
const availableSellFloat = (0, math_1.blockchainToFloat)(availableSellInt, sellPrecision);
|
|
219
273
|
shortfalls.push({
|
|
220
274
|
asset: assets?.assetA?.symbol || 'sellAsset',
|
|
221
275
|
required: requiredSellFloat,
|
|
222
276
|
available: availableSellFloat,
|
|
223
|
-
deficit: blockchainToFloat(required.sellInt - availableSellInt, sellPrecision)
|
|
277
|
+
deficit: (0, math_1.blockchainToFloat)(required.sellInt - availableSellInt, sellPrecision)
|
|
224
278
|
});
|
|
225
279
|
}
|
|
226
280
|
return {
|
|
@@ -242,11 +296,11 @@ function checkFundDrift(orders, accountTotals, assets = null, gridLimits = null)
|
|
|
242
296
|
let gridBuy = 0, gridSell = 0;
|
|
243
297
|
for (const order of Array.from(orders.values())) {
|
|
244
298
|
const size = toFiniteNumber(order.size);
|
|
245
|
-
if (size <= 0 || !isOrderOnChain(order))
|
|
299
|
+
if (size <= 0 || !(0, order_1.isOrderOnChain)(order))
|
|
246
300
|
continue;
|
|
247
|
-
if (order.type === ORDER_TYPES.BUY)
|
|
301
|
+
if (order.type === constants_1.ORDER_TYPES.BUY)
|
|
248
302
|
gridBuy += size;
|
|
249
|
-
else if (order.type === ORDER_TYPES.SELL)
|
|
303
|
+
else if (order.type === constants_1.ORDER_TYPES.SELL)
|
|
250
304
|
gridSell += size;
|
|
251
305
|
}
|
|
252
306
|
const chainFreeBuy = accountTotals?.buyFree || 0;
|
|
@@ -262,9 +316,9 @@ function checkFundDrift(orders, accountTotals, assets = null, gridLimits = null)
|
|
|
262
316
|
if (!isValidNumber(buyPrecision) || !isValidNumber(sellPrecision)) {
|
|
263
317
|
return { isValid: true, reason: 'Skipped: precision not available', driftBuy, driftSell };
|
|
264
318
|
}
|
|
265
|
-
const precisionSlackBuy = getPrecisionSlack(buyPrecision);
|
|
266
|
-
const precisionSlackSell = getPrecisionSlack(sellPrecision);
|
|
267
|
-
const fundInvariantTolerance = gridLimits?.FUND_INVARIANT_PERCENT_TOLERANCE ?? GRID_LIMITS.FUND_INVARIANT_PERCENT_TOLERANCE;
|
|
319
|
+
const precisionSlackBuy = (0, math_1.getPrecisionSlack)(buyPrecision);
|
|
320
|
+
const precisionSlackSell = (0, math_1.getPrecisionSlack)(sellPrecision);
|
|
321
|
+
const fundInvariantTolerance = gridLimits?.FUND_INVARIANT_PERCENT_TOLERANCE ?? constants_1.GRID_LIMITS.FUND_INVARIANT_PERCENT_TOLERANCE;
|
|
268
322
|
const percentTolerance = fundInvariantTolerance / 100;
|
|
269
323
|
const allowedDriftBuy = Math.max(precisionSlackBuy, actualBuy * percentTolerance);
|
|
270
324
|
const allowedDriftSell = Math.max(precisionSlackSell, actualSell * percentTolerance);
|
|
@@ -307,7 +361,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
307
361
|
const idealSize = toFiniteNumber(order.idealSize || order.size);
|
|
308
362
|
if (idealSize <= 0)
|
|
309
363
|
return true;
|
|
310
|
-
const minHealthy = getDoubleDustThreshold(idealSize, dustThresholdPercent);
|
|
364
|
+
const minHealthy = (0, math_1.getDoubleDustThreshold)(idealSize, dustThresholdPercent);
|
|
311
365
|
if (order.size < minHealthy) {
|
|
312
366
|
if (logger) {
|
|
313
367
|
logger(`[RECONCILE] Skipping dust target order: ${order.id} ` +
|
|
@@ -331,40 +385,40 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
331
385
|
}
|
|
332
386
|
for (const [id, targetOrder] of targetGrid) {
|
|
333
387
|
const masterOrder = masterGrid.get(id);
|
|
334
|
-
if (!masterOrder || masterOrder.state === ORDER_STATES.VIRTUAL) {
|
|
388
|
+
if (!masterOrder || masterOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
|
|
335
389
|
// Slot is empty or virtual - check if we need to fill it
|
|
336
|
-
if (targetOrder.size > 0 && targetOrder.state === ORDER_STATES.ACTIVE) {
|
|
390
|
+
if (targetOrder.size > 0 && targetOrder.state === constants_1.ORDER_STATES.ACTIVE) {
|
|
337
391
|
// This is a hole that needs filling
|
|
338
|
-
if (targetOrder.type === ORDER_TYPES.BUY) {
|
|
392
|
+
if (targetOrder.type === constants_1.ORDER_TYPES.BUY) {
|
|
339
393
|
holesBuy.push({ id, order: targetOrder });
|
|
340
394
|
}
|
|
341
|
-
else if (targetOrder.type === ORDER_TYPES.SELL) {
|
|
395
|
+
else if (targetOrder.type === constants_1.ORDER_TYPES.SELL) {
|
|
342
396
|
holesSell.push({ id, order: targetOrder });
|
|
343
397
|
}
|
|
344
398
|
}
|
|
345
399
|
continue;
|
|
346
400
|
}
|
|
347
401
|
if (masterOrder.type !== targetOrder.type) {
|
|
348
|
-
actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'type-mismatch' });
|
|
349
|
-
if (targetOrder.size > 0 && targetOrder.state === ORDER_STATES.ACTIVE && isCreateHealthy(targetOrder)) {
|
|
350
|
-
actions.push({ type: COW_ACTIONS.CREATE, id, order: targetOrder });
|
|
402
|
+
actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'type-mismatch' });
|
|
403
|
+
if (targetOrder.size > 0 && targetOrder.state === constants_1.ORDER_STATES.ACTIVE && isCreateHealthy(targetOrder)) {
|
|
404
|
+
actions.push({ type: constants_1.COW_ACTIONS.CREATE, id, order: targetOrder });
|
|
351
405
|
}
|
|
352
406
|
continue;
|
|
353
407
|
}
|
|
354
408
|
// If master is on-chain but target should be VIRTUAL (outside window),
|
|
355
409
|
// this is a surplus candidate for rotation.
|
|
356
|
-
if (isOrderOnChain(masterOrder) && targetOrder.state === ORDER_STATES.VIRTUAL) {
|
|
357
|
-
if (masterOrder.type === ORDER_TYPES.BUY) {
|
|
410
|
+
if ((0, order_1.isOrderOnChain)(masterOrder) && targetOrder.state === constants_1.ORDER_STATES.VIRTUAL) {
|
|
411
|
+
if (masterOrder.type === constants_1.ORDER_TYPES.BUY) {
|
|
358
412
|
surplusesBuy.push({ id, master: masterOrder, target: targetOrder });
|
|
359
413
|
}
|
|
360
|
-
else if (masterOrder.type === ORDER_TYPES.SELL) {
|
|
414
|
+
else if (masterOrder.type === constants_1.ORDER_TYPES.SELL) {
|
|
361
415
|
surplusesSell.push({ id, master: masterOrder, target: targetOrder });
|
|
362
416
|
}
|
|
363
417
|
continue;
|
|
364
418
|
}
|
|
365
419
|
if (masterOrder.size !== targetOrder.size) {
|
|
366
420
|
if (targetOrder.size === 0) {
|
|
367
|
-
actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'target-size-zero' });
|
|
421
|
+
actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'target-size-zero' });
|
|
368
422
|
}
|
|
369
423
|
// Intentionally no in-place size UPDATE here.
|
|
370
424
|
// Fill-driven COW rebalance keeps updates rotation-only (newGridId path).
|
|
@@ -375,12 +429,12 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
375
429
|
const cancelSurpluses = (surpluses) => {
|
|
376
430
|
for (const surplus of surpluses) {
|
|
377
431
|
if (surplus.master.orderId) {
|
|
378
|
-
actions.push({ type: COW_ACTIONS.CANCEL, id: surplus.id, orderId: surplus.master.orderId, reason: 'surplus-no-rotation-target' });
|
|
432
|
+
actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id: surplus.id, orderId: surplus.master.orderId, reason: 'surplus-no-rotation-target' });
|
|
379
433
|
}
|
|
380
434
|
}
|
|
381
435
|
};
|
|
382
436
|
const pairRotations = (surpluses, holes) => {
|
|
383
|
-
const healthyHoles = holes.filter(hole => isCreateHealthy(hole.order));
|
|
437
|
+
const healthyHoles = holes.filter((hole) => isCreateHealthy(hole.order));
|
|
384
438
|
if (healthyHoles.length === 0) {
|
|
385
439
|
// No viable rotation targets — cancel all unmatched surpluses
|
|
386
440
|
cancelSurpluses(surpluses);
|
|
@@ -388,11 +442,11 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
388
442
|
}
|
|
389
443
|
if (surpluses.length === 0) {
|
|
390
444
|
for (const hole of healthyHoles) {
|
|
391
|
-
actions.push({ type: COW_ACTIONS.CREATE, id: hole.id, order: hole.order });
|
|
445
|
+
actions.push({ type: constants_1.COW_ACTIONS.CREATE, id: hole.id, order: hole.order });
|
|
392
446
|
}
|
|
393
447
|
return;
|
|
394
448
|
}
|
|
395
|
-
const isBuy = surpluses[0]?.master?.type === ORDER_TYPES.BUY;
|
|
449
|
+
const isBuy = surpluses[0]?.master?.type === constants_1.ORDER_TYPES.BUY;
|
|
396
450
|
healthyHoles.sort((a, b) => isBuy ? b.order.price - a.order.price : a.order.price - b.order.price);
|
|
397
451
|
surpluses.sort((a, b) => isBuy ? a.master.price - b.master.price : b.master.price - a.master.price);
|
|
398
452
|
const rotationCount = Math.min(surpluses.length, healthyHoles.length);
|
|
@@ -400,7 +454,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
400
454
|
const surplus = surpluses[i];
|
|
401
455
|
const hole = healthyHoles[i];
|
|
402
456
|
actions.push({
|
|
403
|
-
type: COW_ACTIONS.UPDATE,
|
|
457
|
+
type: constants_1.COW_ACTIONS.UPDATE,
|
|
404
458
|
id: surplus.id,
|
|
405
459
|
orderId: surplus.master.orderId,
|
|
406
460
|
newGridId: hole.id,
|
|
@@ -411,7 +465,7 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
411
465
|
});
|
|
412
466
|
}
|
|
413
467
|
for (let i = rotationCount; i < healthyHoles.length; i++) {
|
|
414
|
-
actions.push({ type: COW_ACTIONS.CREATE, id: healthyHoles[i].id, order: healthyHoles[i].order });
|
|
468
|
+
actions.push({ type: constants_1.COW_ACTIONS.CREATE, id: healthyHoles[i].id, order: healthyHoles[i].order });
|
|
415
469
|
}
|
|
416
470
|
// Cancel any surpluses that couldn't be paired with a hole
|
|
417
471
|
cancelSurpluses(surpluses.slice(rotationCount));
|
|
@@ -419,8 +473,8 @@ function reconcileGrid(masterGrid, targetGrid, targetBoundary, options = {}) {
|
|
|
419
473
|
pairRotations(surplusesBuy, holesBuy);
|
|
420
474
|
pairRotations(surplusesSell, holesSell);
|
|
421
475
|
for (const [id, masterOrder] of masterGrid) {
|
|
422
|
-
if (!targetGrid.has(id) && isOrderOnChain(masterOrder)) {
|
|
423
|
-
actions.push({ type: COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'orphan-slot' });
|
|
476
|
+
if (!targetGrid.has(id) && (0, order_1.isOrderOnChain)(masterOrder)) {
|
|
477
|
+
actions.push({ type: constants_1.COW_ACTIONS.CANCEL, id, orderId: masterOrder.orderId, reason: 'orphan-slot' });
|
|
424
478
|
}
|
|
425
479
|
}
|
|
426
480
|
return {
|
|
@@ -446,10 +500,10 @@ function optimizeRebalanceActions(actions, masterGrid) {
|
|
|
446
500
|
const cancels = [];
|
|
447
501
|
const passthrough = [];
|
|
448
502
|
for (const action of actions) {
|
|
449
|
-
if (action?.type === COW_ACTIONS.CREATE) {
|
|
503
|
+
if (action?.type === constants_1.COW_ACTIONS.CREATE) {
|
|
450
504
|
creates.push(action);
|
|
451
505
|
}
|
|
452
|
-
else if (action?.type === COW_ACTIONS.CANCEL) {
|
|
506
|
+
else if (action?.type === constants_1.COW_ACTIONS.CANCEL) {
|
|
453
507
|
cancels.push(action);
|
|
454
508
|
}
|
|
455
509
|
else {
|
|
@@ -489,7 +543,7 @@ function optimizeRebalanceActions(actions, masterGrid) {
|
|
|
489
543
|
}
|
|
490
544
|
const createAction = remainingCreates.splice(bestIdx, 1)[0];
|
|
491
545
|
optimized.push({
|
|
492
|
-
type: COW_ACTIONS.UPDATE,
|
|
546
|
+
type: constants_1.COW_ACTIONS.UPDATE,
|
|
493
547
|
id: cancelAction.id,
|
|
494
548
|
orderId: cancelAction.orderId,
|
|
495
549
|
newGridId: createAction.id,
|
|
@@ -512,9 +566,9 @@ function optimizeRebalanceActions(actions, masterGrid) {
|
|
|
512
566
|
function summarizeActions(actions) {
|
|
513
567
|
return {
|
|
514
568
|
total: actions.length,
|
|
515
|
-
creates: actions.filter(a => a.type === COW_ACTIONS.CREATE).length,
|
|
516
|
-
cancels: actions.filter(a => a.type === COW_ACTIONS.CANCEL).length,
|
|
517
|
-
updates: actions.filter(a => a.type === COW_ACTIONS.UPDATE).length
|
|
569
|
+
creates: actions.filter((a) => a.type === constants_1.COW_ACTIONS.CREATE).length,
|
|
570
|
+
cancels: actions.filter((a) => a.type === constants_1.COW_ACTIONS.CANCEL).length,
|
|
571
|
+
updates: actions.filter((a) => a.type === constants_1.COW_ACTIONS.UPDATE).length
|
|
518
572
|
};
|
|
519
573
|
}
|
|
520
574
|
/**
|
|
@@ -528,23 +582,33 @@ function hasExecutableActions(rebalanceResult) {
|
|
|
528
582
|
return Array.isArray(actions) && actions.length > 0;
|
|
529
583
|
}
|
|
530
584
|
/**
|
|
531
|
-
* Validate that CREATE actions target slots that are not already occupied on-chain
|
|
532
|
-
*
|
|
585
|
+
* Validate that CREATE actions target slots that are not already occupied on-chain
|
|
586
|
+
* and that no CREATE price collides with an existing placed order or unmatched
|
|
587
|
+
* on-chain order. Checks four layers:
|
|
588
|
+
* 1. Slot occupancy — target grid slot already has a placed order
|
|
589
|
+
* 2. Master grid price collision — a placed order in the grid has the same price
|
|
590
|
+
* 3. Chain orphan collision — an unmatched on-chain order has the same price
|
|
591
|
+
* 4. Same-batch duplicate — two CREATEs in the same batch have identical prices
|
|
592
|
+
*
|
|
593
|
+
* Cancel and rotation-released slots are considered free.
|
|
533
594
|
*
|
|
534
595
|
* @param {Array<import('./types').CowAction>} actions - List of COW actions
|
|
535
596
|
* @param {Map} orders - Current order grid
|
|
536
|
-
* @
|
|
597
|
+
* @param {Object|null} [assets=null] - Asset metadata for tolerance calculation
|
|
598
|
+
* @param {Array<Object>} [chainOrderCandidates=[]] - Unmatched on-chain orders
|
|
599
|
+
* with {chainOrderId, price, size, type} to check beyond the grid
|
|
600
|
+
* @returns {{isValid: boolean, violations: Array<Object>}} Validation result
|
|
537
601
|
*/
|
|
538
|
-
function validateCreateTargetSlots(actions, orders) {
|
|
602
|
+
function validateCreateTargetSlots(actions, orders, assets = null, chainOrderCandidates = []) {
|
|
539
603
|
const safeActions = Array.isArray(actions) ? actions : [];
|
|
540
604
|
const orderMap = orders instanceof Map ? orders : new Map();
|
|
541
605
|
const releasedSlotIds = new Set();
|
|
542
606
|
for (const action of safeActions) {
|
|
543
|
-
if (action?.type === COW_ACTIONS.CANCEL && action.id) {
|
|
607
|
+
if (action?.type === constants_1.COW_ACTIONS.CANCEL && action.id) {
|
|
544
608
|
releasedSlotIds.add(action.id);
|
|
545
609
|
continue;
|
|
546
610
|
}
|
|
547
|
-
if (action?.type === COW_ACTIONS.UPDATE &&
|
|
611
|
+
if (action?.type === constants_1.COW_ACTIONS.UPDATE &&
|
|
548
612
|
action.id &&
|
|
549
613
|
action.newGridId &&
|
|
550
614
|
action.newGridId !== action.id) {
|
|
@@ -552,23 +616,99 @@ function validateCreateTargetSlots(actions, orders) {
|
|
|
552
616
|
}
|
|
553
617
|
}
|
|
554
618
|
const violations = [];
|
|
619
|
+
const createEntries = [];
|
|
555
620
|
for (const action of safeActions) {
|
|
556
|
-
if (action?.type !== COW_ACTIONS.CREATE)
|
|
621
|
+
if (action?.type !== constants_1.COW_ACTIONS.CREATE)
|
|
557
622
|
continue;
|
|
558
623
|
const targetId = action.id || action.order?.id;
|
|
559
624
|
if (!targetId || releasedSlotIds.has(targetId))
|
|
560
625
|
continue;
|
|
561
626
|
const current = orderMap.get(targetId);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (isOrderOnChain(current)) {
|
|
627
|
+
// isOrderOnChain already checks orderId is truthy
|
|
628
|
+
if (current && (0, order_1.isOrderOnChain)(current)) {
|
|
565
629
|
violations.push({
|
|
566
630
|
targetId,
|
|
567
631
|
currentOrderId: current.orderId,
|
|
568
632
|
currentType: current.type,
|
|
569
|
-
currentState: current.state
|
|
633
|
+
currentState: current.state,
|
|
634
|
+
reason: 'slot_occupied'
|
|
570
635
|
});
|
|
571
636
|
}
|
|
637
|
+
if (action.order?.price != null && action.order?.type != null) {
|
|
638
|
+
const liveSlot = orderMap.get(targetId);
|
|
639
|
+
const livePrice = liveSlot && Number.isFinite(Number(liveSlot.price))
|
|
640
|
+
? Number(liveSlot.price)
|
|
641
|
+
: null;
|
|
642
|
+
const effectivePrice = livePrice !== null ? livePrice : Number(action.order.price);
|
|
643
|
+
createEntries.push({
|
|
644
|
+
targetId,
|
|
645
|
+
action,
|
|
646
|
+
price: effectivePrice,
|
|
647
|
+
size: Number(action.order.size || 0),
|
|
648
|
+
type: action.order.type,
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (assets && createEntries.length > 0) {
|
|
653
|
+
for (const entry of createEntries) {
|
|
654
|
+
const collision = (0, math_1.findPriceCollision)(orderMap.values(), entry.targetId, entry.price, entry.size, entry.type, assets, (o) => (0, order_1.isOrderPlaced)(o) && o.id !== entry.targetId);
|
|
655
|
+
if (collision) {
|
|
656
|
+
violations.push({
|
|
657
|
+
targetId: entry.targetId,
|
|
658
|
+
currentOrderId: collision.orderId,
|
|
659
|
+
currentType: entry.type,
|
|
660
|
+
currentState: collision.state,
|
|
661
|
+
reason: 'price_collision',
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
// Filter out malformed chain entries (missing chainOrderId); all production
|
|
666
|
+
// set sites guard this, but a defensive skip prevents crashes on
|
|
667
|
+
// unexpected data shapes during development or deserialization.
|
|
668
|
+
const validChainCandidates = chainOrderCandidates.length > 0
|
|
669
|
+
? chainOrderCandidates.filter((u) => u.chainOrderId && typeof u.price === 'number')
|
|
670
|
+
: [];
|
|
671
|
+
if (validChainCandidates.length > 0) {
|
|
672
|
+
const mapped = validChainCandidates.map((u) => ({
|
|
673
|
+
id: u.chainOrderId,
|
|
674
|
+
price: u.price,
|
|
675
|
+
size: u.size || 0,
|
|
676
|
+
orderId: u.chainOrderId,
|
|
677
|
+
}));
|
|
678
|
+
for (const entry of createEntries) {
|
|
679
|
+
const chainCollision = (0, math_1.findPriceCollision)(mapped, entry.targetId, entry.price, entry.size, entry.type, assets, (item) => item.price != null);
|
|
680
|
+
if (chainCollision) {
|
|
681
|
+
violations.push({
|
|
682
|
+
targetId: entry.targetId,
|
|
683
|
+
currentOrderId: chainCollision.orderId,
|
|
684
|
+
currentType: entry.type,
|
|
685
|
+
currentState: 'CHAIN_ORPHAN',
|
|
686
|
+
reason: 'chain_orphan_collision',
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
// Exact-equality sanity net: same-batch CREATEs from the same calculation
|
|
692
|
+
// produce identical float prices. 1e-8 is far below any precision-based
|
|
693
|
+
// tolerance (calculatePriceTolerance returns ~1e-5 at minimum), so this
|
|
694
|
+
// strictly catches bit-identical duplicates — not near-matches. Near-matches
|
|
695
|
+
// are caught by the tolerance-based findPriceCollision check below in the
|
|
696
|
+
// COW loop's batchCollision guard.
|
|
697
|
+
for (let i = 0; i < createEntries.length; i++) {
|
|
698
|
+
for (let j = i + 1; j < createEntries.length; j++) {
|
|
699
|
+
const a = createEntries[i];
|
|
700
|
+
const b = createEntries[j];
|
|
701
|
+
if (Math.abs(a.price - b.price) <= 1e-8) {
|
|
702
|
+
violations.push({
|
|
703
|
+
targetId: b.targetId,
|
|
704
|
+
currentOrderId: null,
|
|
705
|
+
currentType: b.type,
|
|
706
|
+
currentState: 'CREATE',
|
|
707
|
+
reason: 'same_batch_price_collision',
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
572
712
|
}
|
|
573
713
|
return {
|
|
574
714
|
isValid: violations.length === 0,
|
|
@@ -602,7 +742,7 @@ function actionMatchesOrder(action, orderRef) {
|
|
|
602
742
|
function hasActionForOrder(actions, actionType, orderRef) {
|
|
603
743
|
if (!Array.isArray(actions))
|
|
604
744
|
return false;
|
|
605
|
-
return actions.some(action => {
|
|
745
|
+
return actions.some((action) => {
|
|
606
746
|
if (actionType && action?.type !== actionType)
|
|
607
747
|
return false;
|
|
608
748
|
return actionMatchesOrder(action, orderRef);
|
|
@@ -643,7 +783,7 @@ function _buildUpdateSelectors(actions) {
|
|
|
643
783
|
if (!Array.isArray(actions))
|
|
644
784
|
return selectors;
|
|
645
785
|
for (const action of actions) {
|
|
646
|
-
if (action?.type !== COW_ACTIONS.UPDATE)
|
|
786
|
+
if (action?.type !== constants_1.COW_ACTIONS.UPDATE)
|
|
647
787
|
continue;
|
|
648
788
|
if (action.id)
|
|
649
789
|
selectors.slotIds.add(String(action.id));
|
|
@@ -708,13 +848,13 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
|
|
|
708
848
|
workingGrid.set(id, {
|
|
709
849
|
...targetOrder,
|
|
710
850
|
size: Math.max(0, targetSize),
|
|
711
|
-
state: ORDER_STATES.VIRTUAL,
|
|
851
|
+
state: constants_1.ORDER_STATES.VIRTUAL,
|
|
712
852
|
orderId: null
|
|
713
853
|
});
|
|
714
854
|
continue;
|
|
715
855
|
}
|
|
716
856
|
if (targetSize > 0) {
|
|
717
|
-
const keepOrderId = isOrderOnChain(current) && current.type === targetOrder.type;
|
|
857
|
+
const keepOrderId = (0, order_1.isOrderOnChain)(current) && current.type === targetOrder.type;
|
|
718
858
|
const hasExplicitUpdate = _hasExplicitUpdateForOrder(updateSelectors, current, id);
|
|
719
859
|
// Orders without on-chain ID remain VIRTUAL until synchronizeWithChain
|
|
720
860
|
// confirms blockchain placement and triggers accounting deduction.
|
|
@@ -727,7 +867,7 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
|
|
|
727
867
|
const preservedSize = shouldPreserveSize
|
|
728
868
|
? Math.max(0, toFiniteNumber(current.size))
|
|
729
869
|
: targetSize;
|
|
730
|
-
const resultState = keepOrderId ? current.state : ORDER_STATES.VIRTUAL;
|
|
870
|
+
const resultState = keepOrderId ? current.state : constants_1.ORDER_STATES.VIRTUAL;
|
|
731
871
|
const resultOrderId = keepOrderId ? current.orderId : null;
|
|
732
872
|
if (!_isProjectionUnchanged(current, targetOrder, preservedSize, resultState, resultOrderId)) {
|
|
733
873
|
workingGrid.set(id, {
|
|
@@ -740,12 +880,12 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
|
|
|
740
880
|
}
|
|
741
881
|
}
|
|
742
882
|
else {
|
|
743
|
-
if (!_isProjectionUnchanged(current, targetOrder, 0, ORDER_STATES.VIRTUAL, null)) {
|
|
883
|
+
if (!_isProjectionUnchanged(current, targetOrder, 0, constants_1.ORDER_STATES.VIRTUAL, null)) {
|
|
744
884
|
workingGrid.set(id, {
|
|
745
885
|
...current,
|
|
746
886
|
...targetOrder,
|
|
747
887
|
size: 0,
|
|
748
|
-
state: ORDER_STATES.VIRTUAL,
|
|
888
|
+
state: constants_1.ORDER_STATES.VIRTUAL,
|
|
749
889
|
orderId: null
|
|
750
890
|
});
|
|
751
891
|
}
|
|
@@ -754,8 +894,8 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
|
|
|
754
894
|
for (const [id, current] of workingGrid.entries()) {
|
|
755
895
|
if (targetIds.has(id))
|
|
756
896
|
continue;
|
|
757
|
-
if (isOrderOnChain(current)) {
|
|
758
|
-
workingGrid.set(id, convertToSpreadPlaceholder(current));
|
|
897
|
+
if ((0, order_1.isOrderOnChain)(current)) {
|
|
898
|
+
workingGrid.set(id, (0, order_1.convertToSpreadPlaceholder)(current));
|
|
759
899
|
}
|
|
760
900
|
}
|
|
761
901
|
}
|
|
@@ -768,20 +908,20 @@ function projectTargetToWorkingGrid(workingGrid, targetGrid, options = {}) {
|
|
|
768
908
|
function buildStateUpdates(actions, masterGrid) {
|
|
769
909
|
const stateUpdates = [];
|
|
770
910
|
for (const action of actions) {
|
|
771
|
-
if (action.type === COW_ACTIONS.CREATE) {
|
|
911
|
+
if (action.type === constants_1.COW_ACTIONS.CREATE) {
|
|
772
912
|
stateUpdates.push({
|
|
773
913
|
...action.order,
|
|
774
|
-
state: ORDER_STATES.VIRTUAL,
|
|
914
|
+
state: constants_1.ORDER_STATES.VIRTUAL,
|
|
775
915
|
orderId: null
|
|
776
916
|
});
|
|
777
917
|
}
|
|
778
|
-
else if (action.type === COW_ACTIONS.CANCEL) {
|
|
918
|
+
else if (action.type === constants_1.COW_ACTIONS.CANCEL) {
|
|
779
919
|
const masterOrder = masterGrid.get(action.id);
|
|
780
920
|
if (masterOrder) {
|
|
781
|
-
stateUpdates.push(convertToSpreadPlaceholder(masterOrder));
|
|
921
|
+
stateUpdates.push((0, order_1.convertToSpreadPlaceholder)(masterOrder));
|
|
782
922
|
}
|
|
783
923
|
}
|
|
784
|
-
else if (action.type === COW_ACTIONS.UPDATE) {
|
|
924
|
+
else if (action.type === constants_1.COW_ACTIONS.UPDATE) {
|
|
785
925
|
const masterOrder = masterGrid.get(action.id);
|
|
786
926
|
if (masterOrder) {
|
|
787
927
|
const newSize = toFiniteNumber(action.newSize ?? action.order?.size);
|
|
@@ -818,7 +958,7 @@ function buildSuccessResult({ actions, stateUpdates, workingGrid, workingBoundar
|
|
|
818
958
|
return {
|
|
819
959
|
actions,
|
|
820
960
|
stateUpdates,
|
|
821
|
-
hadRotation: actions.some(a => a.type === COW_ACTIONS.CREATE || a.type === COW_ACTIONS.UPDATE),
|
|
961
|
+
hadRotation: actions.some((a) => a.type === constants_1.COW_ACTIONS.CREATE || a.type === constants_1.COW_ACTIONS.UPDATE),
|
|
822
962
|
workingGrid,
|
|
823
963
|
workingIndexes: workingGrid.getIndexes(),
|
|
824
964
|
workingBoundary,
|
|
@@ -834,7 +974,7 @@ function buildSuccessResult({ actions, stateUpdates, workingGrid, workingBoundar
|
|
|
834
974
|
*/
|
|
835
975
|
function evaluateCommit(workingGrid, options = {}) {
|
|
836
976
|
const hasLock = typeof options === 'boolean' ? options : !!options?.hasLock;
|
|
837
|
-
const currentVersion = toFiniteNumber(options?.currentVersion,
|
|
977
|
+
const currentVersion = toFiniteNumber(options?.currentVersion, undefined);
|
|
838
978
|
const masterGrid = typeof options === 'object' ? options.masterGrid : null;
|
|
839
979
|
if (!workingGrid) {
|
|
840
980
|
return {
|
|
@@ -889,27 +1029,4 @@ function evaluateCommit(workingGrid, options = {}) {
|
|
|
889
1029
|
}
|
|
890
1030
|
return { canCommit: true };
|
|
891
1031
|
}
|
|
892
|
-
module.exports = {
|
|
893
|
-
// Validation
|
|
894
|
-
validateOrder,
|
|
895
|
-
validateGridForPersistence,
|
|
896
|
-
calculateRequiredFunds,
|
|
897
|
-
validateWorkingGridFunds,
|
|
898
|
-
checkFundDrift,
|
|
899
|
-
VALID_ORDER_STATES,
|
|
900
|
-
VALID_ORDER_TYPES,
|
|
901
|
-
// Grid reconciliation (COW pipeline)
|
|
902
|
-
reconcileGrid,
|
|
903
|
-
optimizeRebalanceActions,
|
|
904
|
-
summarizeActions,
|
|
905
|
-
hasExecutableActions,
|
|
906
|
-
validateCreateTargetSlots,
|
|
907
|
-
hasActionForOrder,
|
|
908
|
-
removeActionsForOrder,
|
|
909
|
-
projectTargetToWorkingGrid,
|
|
910
|
-
buildStateUpdates,
|
|
911
|
-
buildAbortedResult,
|
|
912
|
-
buildSuccessResult,
|
|
913
|
-
evaluateCommit
|
|
914
|
-
};
|
|
915
1032
|
//# sourceMappingURL=validate.js.map
|