dexbot 1.6.7 → 1.6.8
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/CHANGELOG.md +49 -1
- package/README.md +3 -3
- package/analysis/README.md +2 -3
- package/analysis/tradingview/README.md +78 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
- package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
- package/dist/analysis/tradingview/grid_reset_config.js +235 -0
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
- package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
- package/dist/dexbot.js +22 -6
- package/dist/market_adapter/core/market_adapter_service.js +14 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
- package/dist/market_adapter/inputs/window_cache.js +302 -48
- package/dist/market_adapter/market_adapter.d.ts +8 -1
- package/dist/market_adapter/market_adapter.js +22 -4
- package/dist/modules/account_bots.js +10 -0
- package/dist/modules/account_orders.d.ts +24 -2
- package/dist/modules/account_orders.js +41 -4
- package/dist/modules/bot_settings.js +10 -1
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.js +1 -0
- package/dist/modules/constants.d.ts +11 -3
- package/dist/modules/constants.js +116 -37
- package/dist/modules/dexbot_class.d.ts +6 -76
- package/dist/modules/dexbot_class.js +0 -32
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
- package/dist/modules/dexbot_cow_runtime.js +4 -87
- package/dist/modules/dexbot_maintenance_runtime.d.ts +15 -1
- package/dist/modules/dexbot_maintenance_runtime.js +59 -11
- package/dist/modules/dexbot_startup_runtime.js +73 -20
- package/dist/modules/dexbot_state_recovery.d.ts +6 -0
- package/dist/modules/dexbot_state_recovery.js +21 -0
- package/dist/modules/order/async_lock.d.ts +8 -0
- package/dist/modules/order/async_lock.js +15 -0
- package/dist/modules/order/genesis_policy.d.ts +162 -0
- package/dist/modules/order/genesis_policy.js +267 -0
- package/dist/modules/order/grid.js +76 -134
- package/dist/modules/order/grid_reconcile.d.ts +9 -0
- package/dist/modules/order/grid_reconcile.js +13 -4
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/manager.d.ts +4 -0
- package/dist/modules/order/manager.js +14 -1
- package/dist/modules/order/sync_engine.d.ts +19 -0
- package/dist/modules/order/sync_engine.js +284 -344
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +64 -1
- package/dist/modules/order/utils/order.d.ts +43 -58
- package/dist/modules/order/utils/order.js +220 -197
- package/dist/modules/order/utils/system.js +8 -1
- package/dist/modules/paths.d.ts +1 -0
- package/dist/modules/paths.js +1 -0
- package/dist/modules/version_notice.d.ts +165 -0
- package/dist/modules/version_notice.js +364 -0
- package/dist/pm2.js +9 -0
- package/dist/unlock.js +28 -0
- package/docs/BITSHARES_ONBOARDING.md +8 -1
- package/docs/COW_INVARIANTS.md +3 -2
- package/docs/DEXBOT_COMPARISON.md +4 -4
- package/docs/EVOLUTION.md +20 -19
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +149 -31
- package/docs/GRID_RECALCULATION.md +12 -0
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +1 -1
- package/modules/README.md +18 -1
- package/package.json +13 -5
- package/scripts/README.md +28 -2
- package/scripts/clear-all.sh +13 -4
- package/scripts/clear-logs.sh +13 -4
- package/scripts/clear-market-adapter.sh +6 -0
- package/scripts/clear-orders.sh +5 -0
- package/scripts/lib/dexbot-paths.sh +108 -0
- package/tests/README.md +11 -3
- package/analysis/account_resolver.ts +0 -161
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
- package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
- package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
- package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
- package/analysis/analyze_dynamic_weight.ts +0 -243
- package/analysis/analyze_kalman.ts +0 -157
- package/analysis/analyze_regime.ts +0 -158
- package/analysis/analyze_regime_windows.ts +0 -470
- package/analysis/analyze_risk_profile.ts +0 -199
- package/analysis/analyze_trade_heatmap.ts +0 -362
- package/analysis/analyze_volatility.ts +0 -182
- package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
- package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
- package/analysis/bot_fitting/shared_utils.ts +0 -52
- package/analysis/bot_key_utils.ts +0 -426
- package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
- package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
- package/analysis/chain_pool.ts +0 -47
- package/analysis/chart_css.ts +0 -62
- package/analysis/chart_ui.ts +0 -105
- package/analysis/chart_utils.ts +0 -210
- package/analysis/fills_source.ts +0 -228
- package/analysis/grid_correction_check.ts +0 -786
- package/analysis/math_utils.ts +0 -53
- package/analysis/price_sources.ts +0 -136
- package/analysis/resolve_bot_accounts.ts +0 -199
- package/analysis/resolve_source.ts +0 -99
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/trade_profitability.ts +0 -1335
- package/analysis/tradingview/analyze_tradingview.ts +0 -280
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
- package/analysis/trend_detection/hurst_analyzer.ts +0 -7
- package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
- package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
- package/analysis/trend_detection/package.json +0 -23
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
- package/analysis/trend_detection/regime_chart_generator.ts +0 -338
- package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
- package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
- package/analysis/tsconfig.json +0 -29
- package/claw/tests/package.json +0 -3
- package/claw/tests/test_claw_bridge.ts +0 -570
- package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
- package/claw/tests/test_claw_chain_layer.ts +0 -739
- package/claw/tests/test_claw_data_flow.ts +0 -525
- package/claw/tests/test_claw_domain_logic.ts +0 -471
- package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
- package/claw/tests/test_claw_mcp_transport.ts +0 -243
- package/claw/tests/test_claw_regressions.ts +0 -711
- package/claw/tests/test_claw_skill_generation.ts +0 -103
- package/claw/tests/test_claw_state_store.ts +0 -44
- package/claw/tests/test_dexbot_profiles.ts +0 -654
- package/claw/tests/test_memu_bridge.ts +0 -189
- package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
- package/claw/tests/test_position_health.ts +0 -343
- package/claw/tests/test_position_manager.ts +0 -429
- package/claw/tests/test_position_manager_watch_health.ts +0 -100
- package/claw/tests/test_short_mpa_strategy.ts +0 -232
- package/dist/analysis/account_resolver.d.ts.map +0 -1
- package/dist/analysis/account_resolver.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/chain_pool.d.ts.map +0 -1
- package/dist/analysis/chain_pool.js.map +0 -1
- package/dist/analysis/chart_css.d.ts.map +0 -1
- package/dist/analysis/chart_css.js.map +0 -1
- package/dist/analysis/chart_ui.d.ts.map +0 -1
- package/dist/analysis/chart_ui.js.map +0 -1
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/fills_source.d.ts.map +0 -1
- package/dist/analysis/fills_source.js.map +0 -1
- package/dist/analysis/grid_correction_check.d.ts.map +0 -1
- package/dist/analysis/grid_correction_check.js.map +0 -1
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/resolve_bot_accounts.js.map +0 -1
- package/dist/analysis/resolve_source.d.ts.map +0 -1
- package/dist/analysis/resolve_source.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- 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 -128
- 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 -37
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
- package/dist/bot.d.ts.map +0 -1
- package/dist/bot.js.map +0 -1
- package/dist/credential-daemon.d.ts.map +0 -1
- package/dist/credential-daemon.js.map +0 -1
- package/dist/dexbot.d.ts.map +0 -1
- package/dist/dexbot.js.map +0 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
- package/dist/market_adapter/ama_signal_runner.js.map +0 -1
- package/dist/market_adapter/candle_utils.d.ts.map +0 -1
- package/dist/market_adapter/candle_utils.js.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
- package/dist/market_adapter/core/config_normalizers.js.map +0 -1
- package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_candles.js.map +0 -1
- package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_client.js.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
- package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
- package/dist/market_adapter/inputs/window_cache.js.map +0 -1
- package/dist/market_adapter/interval_utils.d.ts.map +0 -1
- package/dist/market_adapter/interval_utils.js.map +0 -1
- package/dist/market_adapter/log_format.d.ts.map +0 -1
- package/dist/market_adapter/log_format.js.map +0 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_core.js.map +0 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_runner.js.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
- package/dist/market_adapter/market_adapter.d.ts.map +0 -1
- package/dist/market_adapter/market_adapter.js.map +0 -1
- package/dist/market_adapter/test_helpers.d.ts.map +0 -1
- package/dist/market_adapter/test_helpers.js.map +0 -1
- package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
- package/dist/market_adapter/utils/adapter_client.js.map +0 -1
- package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
- package/dist/market_adapter/utils/atomic_write.js.map +0 -1
- package/dist/market_adapter/utils/chain.d.ts.map +0 -1
- package/dist/market_adapter/utils/chain.js.map +0 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
- package/dist/market_adapter/utils/data_discovery.js.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
- package/dist/market_adapter/utils/file_lock.js.map +0 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
- package/dist/market_adapter/utils/native_history.js.map +0 -1
- package/dist/modules/account_bots.d.ts.map +0 -1
- package/dist/modules/account_bots.js.map +0 -1
- package/dist/modules/account_orders.d.ts.map +0 -1
- package/dist/modules/account_orders.js.map +0 -1
- package/dist/modules/authority_resolver.d.ts.map +0 -1
- package/dist/modules/authority_resolver.js.map +0 -1
- package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/chain_client.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
- package/dist/modules/bitshares-native/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/index.js.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
- package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
- package/dist/modules/bitshares-native/resolvers.js.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/index.js.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
- package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/types.js.map +0 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/signing_client.js.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
- package/dist/modules/bitshares-native/transport.js.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
- package/dist/modules/bitshares_client.d.ts.map +0 -1
- package/dist/modules/bitshares_client.js.map +0 -1
- package/dist/modules/bot_defaults.d.ts.map +0 -1
- package/dist/modules/bot_defaults.js.map +0 -1
- package/dist/modules/bot_settings.d.ts.map +0 -1
- package/dist/modules/bot_settings.js.map +0 -1
- package/dist/modules/bots_file_lock.d.ts.map +0 -1
- package/dist/modules/bots_file_lock.js.map +0 -1
- package/dist/modules/broadcast_failure.d.ts.map +0 -1
- package/dist/modules/broadcast_failure.js.map +0 -1
- package/dist/modules/chain_keys.d.ts.map +0 -1
- package/dist/modules/chain_keys.js.map +0 -1
- package/dist/modules/chain_orders.d.ts.map +0 -1
- package/dist/modules/chain_orders.js.map +0 -1
- package/dist/modules/cli_colors.d.ts.map +0 -1
- package/dist/modules/cli_colors.js.map +0 -1
- package/dist/modules/cli_start_onboarding.d.ts.map +0 -1
- package/dist/modules/cli_start_onboarding.js.map +0 -1
- package/dist/modules/cli_start_output.d.ts.map +0 -1
- package/dist/modules/cli_start_output.js.map +0 -1
- package/dist/modules/config.d.ts.map +0 -1
- package/dist/modules/config.js.map +0 -1
- package/dist/modules/constants.d.ts.map +0 -1
- package/dist/modules/constants.js.map +0 -1
- package/dist/modules/cr_planner.d.ts.map +0 -1
- package/dist/modules/cr_planner.js.map +0 -1
- package/dist/modules/credential_policy.d.ts.map +0 -1
- package/dist/modules/credential_policy.js.map +0 -1
- package/dist/modules/credential_runtime.d.ts.map +0 -1
- package/dist/modules/credential_runtime.js.map +0 -1
- package/dist/modules/credential_session_cache.d.ts.map +0 -1
- package/dist/modules/credential_session_cache.js.map +0 -1
- package/dist/modules/credit_pricing.d.ts.map +0 -1
- package/dist/modules/credit_pricing.js.map +0 -1
- package/dist/modules/credit_runtime.d.ts.map +0 -1
- package/dist/modules/credit_runtime.js.map +0 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
- package/dist/modules/crypto/browser_provider.js.map +0 -1
- package/dist/modules/crypto/index.d.ts.map +0 -1
- package/dist/modules/crypto/index.js.map +0 -1
- package/dist/modules/crypto/node_provider.d.ts.map +0 -1
- package/dist/modules/crypto/node_provider.js.map +0 -1
- package/dist/modules/crypto/provider.d.ts.map +0 -1
- package/dist/modules/crypto/provider.js.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
- package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
- package/dist/modules/crypto/pure_scrypt.js.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
- package/dist/modules/crypto/sync.d.ts.map +0 -1
- package/dist/modules/crypto/sync.js.map +0 -1
- package/dist/modules/daemon_node_health.d.ts.map +0 -1
- package/dist/modules/daemon_node_health.js.map +0 -1
- package/dist/modules/dexbot_class.d.ts.map +0 -1
- package/dist/modules/dexbot_class.js.map +0 -1
- package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_cow_runtime.js.map +0 -1
- package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
- package/dist/modules/dexbot_credential_client.js.map +0 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_fill_runtime.js.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_startup_runtime.js.map +0 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
- package/dist/modules/dexbot_state_recovery.js.map +0 -1
- package/dist/modules/env.d.ts.map +0 -1
- package/dist/modules/env.js.map +0 -1
- package/dist/modules/fund_registry.d.ts.map +0 -1
- package/dist/modules/fund_registry.js.map +0 -1
- package/dist/modules/general_settings.d.ts.map +0 -1
- package/dist/modules/general_settings.js.map +0 -1
- package/dist/modules/graceful_shutdown.d.ts.map +0 -1
- package/dist/modules/graceful_shutdown.js.map +0 -1
- package/dist/modules/grid_price_source.d.ts.map +0 -1
- package/dist/modules/grid_price_source.js.map +0 -1
- package/dist/modules/key_store.d.ts.map +0 -1
- package/dist/modules/key_store.js.map +0 -1
- package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
- package/dist/modules/launcher/adapter_requirement.js.map +0 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
- package/dist/modules/launcher/bot_supervisor.js.map +0 -1
- package/dist/modules/launcher/child_env.d.ts.map +0 -1
- package/dist/modules/launcher/child_env.js.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/credential_daemon.js.map +0 -1
- package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
- package/dist/modules/launcher/credential_secret.js.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
- package/dist/modules/launcher/headless_password.d.ts.map +0 -1
- package/dist/modules/launcher/headless_password.js.map +0 -1
- package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
- package/dist/modules/launcher/launch_modes.js.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
- package/dist/modules/launcher/runtime_entry.js.map +0 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
- package/dist/modules/launcher/status_reporting.js.map +0 -1
- package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
- package/dist/modules/launcher/supervisor_control.js.map +0 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
- package/dist/modules/market_adapter_whitelist.js.map +0 -1
- package/dist/modules/node_connect_policy.d.ts.map +0 -1
- package/dist/modules/node_connect_policy.js.map +0 -1
- package/dist/modules/node_failure_ledger.d.ts.map +0 -1
- package/dist/modules/node_failure_ledger.js.map +0 -1
- package/dist/modules/node_health_cache.d.ts.map +0 -1
- package/dist/modules/node_health_cache.js.map +0 -1
- package/dist/modules/node_manager.d.ts.map +0 -1
- package/dist/modules/node_manager.js.map +0 -1
- package/dist/modules/order/accounting.d.ts.map +0 -1
- package/dist/modules/order/accounting.js.map +0 -1
- package/dist/modules/order/async_lock.d.ts.map +0 -1
- package/dist/modules/order/async_lock.js.map +0 -1
- package/dist/modules/order/export.d.ts.map +0 -1
- package/dist/modules/order/export.js.map +0 -1
- package/dist/modules/order/format.d.ts.map +0 -1
- package/dist/modules/order/format.js.map +0 -1
- package/dist/modules/order/grid.d.ts.map +0 -1
- package/dist/modules/order/grid.js.map +0 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile.js.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
- package/dist/modules/order/index.d.ts.map +0 -1
- package/dist/modules/order/index.js.map +0 -1
- package/dist/modules/order/logger.d.ts.map +0 -1
- package/dist/modules/order/logger.js.map +0 -1
- package/dist/modules/order/logger_state.d.ts.map +0 -1
- package/dist/modules/order/logger_state.js.map +0 -1
- package/dist/modules/order/manager.d.ts.map +0 -1
- package/dist/modules/order/manager.js.map +0 -1
- package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
- package/dist/modules/order/processed_fill_store.js.map +0 -1
- package/dist/modules/order/strategy.d.ts.map +0 -1
- package/dist/modules/order/strategy.js.map +0 -1
- package/dist/modules/order/sync_engine.d.ts.map +0 -1
- package/dist/modules/order/sync_engine.js.map +0 -1
- package/dist/modules/order/utils/math.d.ts.map +0 -1
- package/dist/modules/order/utils/math.js.map +0 -1
- package/dist/modules/order/utils/order.d.ts.map +0 -1
- package/dist/modules/order/utils/order.js.map +0 -1
- package/dist/modules/order/utils/slot.d.ts.map +0 -1
- package/dist/modules/order/utils/slot.js.map +0 -1
- package/dist/modules/order/utils/system.d.ts.map +0 -1
- package/dist/modules/order/utils/system.js.map +0 -1
- package/dist/modules/order/utils/timeout.d.ts.map +0 -1
- package/dist/modules/order/utils/timeout.js.map +0 -1
- package/dist/modules/order/utils/validate.d.ts.map +0 -1
- package/dist/modules/order/utils/validate.js.map +0 -1
- package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
- package/dist/modules/order/utils/withPoolRef.js.map +0 -1
- package/dist/modules/order/working_grid.d.ts.map +0 -1
- package/dist/modules/order/working_grid.js.map +0 -1
- package/dist/modules/path_api.d.ts.map +0 -1
- package/dist/modules/path_api.js.map +0 -1
- package/dist/modules/paths.d.ts.map +0 -1
- package/dist/modules/paths.js.map +0 -1
- package/dist/modules/process_discovery.d.ts.map +0 -1
- package/dist/modules/process_discovery.js.map +0 -1
- package/dist/modules/runtime.d.ts.map +0 -1
- package/dist/modules/runtime.js.map +0 -1
- package/dist/modules/runtime_settings.d.ts.map +0 -1
- package/dist/modules/runtime_settings.js.map +0 -1
- package/dist/modules/settings_merge.d.ts.map +0 -1
- package/dist/modules/settings_merge.js.map +0 -1
- package/dist/modules/socket_json_client.d.ts.map +0 -1
- package/dist/modules/socket_json_client.js.map +0 -1
- package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
- package/dist/modules/storage/browser_adapter.js.map +0 -1
- package/dist/modules/storage/index.d.ts.map +0 -1
- package/dist/modules/storage/index.js.map +0 -1
- package/dist/modules/storage/node_adapter.d.ts.map +0 -1
- package/dist/modules/storage/node_adapter.js.map +0 -1
- package/dist/modules/storage/types.d.ts.map +0 -1
- package/dist/modules/storage/types.js.map +0 -1
- package/dist/modules/types.d.ts.map +0 -1
- package/dist/modules/types.js.map +0 -1
- package/dist/modules/utils/base58check.d.ts.map +0 -1
- package/dist/modules/utils/base58check.js.map +0 -1
- package/dist/modules/utils/build_dir.d.ts.map +0 -1
- package/dist/modules/utils/build_dir.js.map +0 -1
- package/dist/modules/utils/chain_logs.d.ts.map +0 -1
- package/dist/modules/utils/chain_logs.js.map +0 -1
- package/dist/modules/utils/errors.d.ts.map +0 -1
- package/dist/modules/utils/errors.js.map +0 -1
- package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
- package/dist/modules/utils/sanitize_key.js.map +0 -1
- package/dist/modules/utils/text_width.d.ts.map +0 -1
- package/dist/modules/utils/text_width.js.map +0 -1
- package/dist/modules/validate_profiles.d.ts.map +0 -1
- package/dist/modules/validate_profiles.js.map +0 -1
- package/dist/pm2.d.ts.map +0 -1
- package/dist/pm2.js.map +0 -1
- package/dist/scripts/analyze-credit.d.ts.map +0 -1
- package/dist/scripts/analyze-credit.js.map +0 -1
- package/dist/scripts/analyze-git.d.ts.map +0 -1
- package/dist/scripts/analyze-git.js.map +0 -1
- package/dist/scripts/analyze-orders.d.ts.map +0 -1
- package/dist/scripts/analyze-orders.js.map +0 -1
- package/dist/scripts/chart_command.d.ts.map +0 -1
- package/dist/scripts/chart_command.js.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
- package/dist/scripts/diagnose-pool-history.js.map +0 -1
- package/dist/scripts/divergence-calc.d.ts.map +0 -1
- package/dist/scripts/divergence-calc.js.map +0 -1
- package/dist/scripts/dw.d.ts.map +0 -1
- package/dist/scripts/dw.js.map +0 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
- package/dist/scripts/generate_lp_chart.js.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
- package/dist/scripts/native_release_gates.d.ts.map +0 -1
- package/dist/scripts/native_release_gates.js.map +0 -1
- package/dist/scripts/print_grid.d.ts.map +0 -1
- package/dist/scripts/print_grid.js.map +0 -1
- package/dist/scripts/run-tests.d.ts.map +0 -1
- package/dist/scripts/run-tests.js.map +0 -1
- package/dist/scripts/runner.d.ts.map +0 -1
- package/dist/scripts/runner.js.map +0 -1
- package/dist/scripts/sync-version.d.ts.map +0 -1
- package/dist/scripts/sync-version.js.map +0 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
- package/dist/scripts/test-credit-renewal.js.map +0 -1
- package/dist/scripts/tv.d.ts.map +0 -1
- package/dist/scripts/tv.js.map +0 -1
- package/dist/scripts/update.d.ts.map +0 -1
- package/dist/scripts/update.js.map +0 -1
- package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
- package/dist/scripts/update_dist_freshness.js.map +0 -1
- package/dist/scripts/validate_bots.d.ts.map +0 -1
- package/dist/scripts/validate_bots.js.map +0 -1
- package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
- package/dist/scripts/verify-browser-bundle.js.map +0 -1
- package/dist/unlock.d.ts.map +0 -1
- package/dist/unlock.js.map +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { getStorage } from '../../modules/storage/index.js';
|
|
4
|
-
const { readJSON } = getStorage();
|
|
5
|
-
import { normalizeCandle } from '../math_utils.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared utilities for bot-fitting scripts.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function toCandles(arr: any[]) {
|
|
13
|
-
// Canonical accessor transform (market_adapter/candle_utils via math_utils)
|
|
14
|
-
// instead of hand-rolled array indexing.
|
|
15
|
-
return arr
|
|
16
|
-
.map((c: any) => normalizeCandle(c))
|
|
17
|
-
.filter(Boolean)
|
|
18
|
-
.map((c: any) => ({
|
|
19
|
-
timestamp: c.time * 1000,
|
|
20
|
-
open: c.open,
|
|
21
|
-
high: c.high,
|
|
22
|
-
low: c.low,
|
|
23
|
-
close: c.close,
|
|
24
|
-
volume: c.volume,
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function parseListOrRange(spec: any, fallback: any) {
|
|
29
|
-
if (!spec) return fallback;
|
|
30
|
-
if (spec.includes(':')) {
|
|
31
|
-
const [a, b, s] = spec.split(':').map(Number);
|
|
32
|
-
if (!Number.isFinite(a) || !Number.isFinite(b) || !Number.isFinite(s) || s <= 0) return fallback;
|
|
33
|
-
const out: number[] = [];
|
|
34
|
-
for (let v = a; v <= b + 1e-9; v += s) out.push(Number(v.toFixed(4)));
|
|
35
|
-
return out;
|
|
36
|
-
}
|
|
37
|
-
const vals = spec.split(',').map((x: any) => Number(x.trim())).filter(Number.isFinite);
|
|
38
|
-
return vals.length ? vals : fallback;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function loadLpData(filePath: string) {
|
|
42
|
-
const json = readJSON(filePath);
|
|
43
|
-
return { candles: toCandles(json.candles ?? json), meta: json.meta ?? null };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function fmt(x: number, d = 2) {
|
|
47
|
-
if (!Number.isFinite(x)) return ' n/a';
|
|
48
|
-
return Number(x).toFixed(d);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { parseListOrRange, loadLpData, fmt }
|
|
52
|
-
|
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { PATHS } from '../modules/paths.js';
|
|
6
|
-
import { getStorage } from '../modules/storage/index.js';
|
|
7
|
-
const { readJSON, writeJSON } = getStorage();
|
|
8
|
-
import { parseJsonWithComments } from '../modules/order/utils/system.js';
|
|
9
|
-
import { MARKET_ADAPTER } from '../modules/constants.js';
|
|
10
|
-
import { loadMarketProfiles } from './tradingview/tradingview_uplot_chart_generator.js';
|
|
11
|
-
import { sanitizeKey } from '../modules/utils/sanitize_key.js';
|
|
12
|
-
// Single source of truth for bot keys (named AND unnamed bots) so analysis
|
|
13
|
-
// tools resolve the same files production writes.
|
|
14
|
-
import { createBotKey } from '../modules/account_orders.js';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const DEFAULT_AMA_KEY = String(MARKET_ADAPTER.DEFAULT_AMA_KEY).toUpperCase();
|
|
18
|
-
const BUILTIN_AMAS = MARKET_ADAPTER.AMAS as Record<string, typeof MARKET_ADAPTER.AMAS.AMA1>;
|
|
19
|
-
const AMA_KEYWORDS = new Set(['ama', 'ama1', 'ama2', 'ama3', 'ama4']);
|
|
20
|
-
|
|
21
|
-
function loadBotSettings(filePath = PATHS.PROFILES.BOTS_JSON) {
|
|
22
|
-
if (!filePath || !fs.existsSync(filePath)) return null;
|
|
23
|
-
try {
|
|
24
|
-
return readJSON(filePath);
|
|
25
|
-
} catch (_) {
|
|
26
|
-
// The bot editor reads/writes through a comment-tolerant parser, so
|
|
27
|
-
// operator comments may legally exist — fall back before giving up.
|
|
28
|
-
try {
|
|
29
|
-
return parseJsonWithComments(fs.readFileSync(filePath, 'utf8'));
|
|
30
|
-
} catch (_) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function computeBotKey(bot: any, index: number) {
|
|
37
|
-
// Delegate to the production key generator (modules/account_orders.ts):
|
|
38
|
-
// named bots → sanitized name; unnamed bots → sanitized asset pair + index.
|
|
39
|
-
// The previous local fallback produced `bot-<idx>-<idx>` keys that could
|
|
40
|
-
// never match what the bot runtime actually wrote to disk.
|
|
41
|
-
return createBotKey(bot, index);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function resolveBotKey(botName: any, filePath = PATHS.PROFILES.BOTS_JSON) {
|
|
45
|
-
if (!botName) return null;
|
|
46
|
-
const settings = loadBotSettings(filePath);
|
|
47
|
-
const entries = Array.isArray(settings?.bots) ? settings.bots : [];
|
|
48
|
-
const sanitized = sanitizeKey(botName);
|
|
49
|
-
const entry = entries.find((b: any) => sanitizeKey(b.name) === sanitized);
|
|
50
|
-
if (!entry) return null;
|
|
51
|
-
return computeBotKey(entry, entries.indexOf(entry));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function candleFileForBot(botKey: string, intervalLabel: string, dataDir = PATHS.MARKET_ADAPTER.DATA_DIR) {
|
|
55
|
-
return path.join(dataDir, `market_adapter_${botKey}_${intervalLabel}.json`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function resolveCandleFile(botKey: string, intervalLabel: string, dataDir = PATHS.MARKET_ADAPTER.DATA_DIR, botsFile = PATHS.PROFILES.BOTS_JSON) {
|
|
59
|
-
const directPath = candleFileForBot(botKey, intervalLabel, dataDir);
|
|
60
|
-
if (fs.existsSync(directPath)) return directPath;
|
|
61
|
-
const resolved = resolveBotKey(botKey, botsFile);
|
|
62
|
-
if (resolved) {
|
|
63
|
-
const resolvedPath = candleFileForBot(resolved, intervalLabel, dataDir);
|
|
64
|
-
if (fs.existsSync(resolvedPath)) return resolvedPath;
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function loadBotMeta(botKey: any, filePath = PATHS.PROFILES.BOTS_JSON) {
|
|
70
|
-
const settings = loadBotSettings(filePath);
|
|
71
|
-
const entries = Array.isArray(settings?.bots) ? settings.bots : [];
|
|
72
|
-
if (!botKey) return null;
|
|
73
|
-
const normalizedKey = String(botKey).toLowerCase();
|
|
74
|
-
const exact = entries.find((bot: any, index: number) => computeBotKey(bot, index) === normalizedKey);
|
|
75
|
-
if (exact) return exact;
|
|
76
|
-
const loose = entries.find((bot: any) => sanitizeKey(bot?.name) === normalizedKey.replace(/-\d+$/, ''));
|
|
77
|
-
return loose || null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Locate the source span of the entryIndex-th object literal inside the
|
|
82
|
-
* top-level "bots" array of a (possibly comment-bearing) JSON document.
|
|
83
|
-
* Strings and // + block comments are skipped while scanning, so braces
|
|
84
|
-
* inside them never disturb the balance count. Returns null when the
|
|
85
|
-
* document shape is unexpected — callers fall back to a full rewrite.
|
|
86
|
-
*/
|
|
87
|
-
function findBotsEntrySpan(raw: string, entryIndex: number): { start: number; end: number } | null {
|
|
88
|
-
const m = /"bots"\s*:\s*\[/.exec(raw);
|
|
89
|
-
if (!m) return null;
|
|
90
|
-
let i = m.index + m[0].length; // just past '['
|
|
91
|
-
const n = raw.length;
|
|
92
|
-
let count = 0;
|
|
93
|
-
const skipWsComments = () => {
|
|
94
|
-
while (i < n) {
|
|
95
|
-
const c = raw[i];
|
|
96
|
-
if (c === ' ' || c === '\t' || c === '\n' || c === '\r') { i++; continue; }
|
|
97
|
-
if (c === '/' && raw[i + 1] === '/') { while (i < n && raw[i] !== '\n') i++; continue; }
|
|
98
|
-
if (c === '/' && raw[i + 1] === '*') { i += 2; while (i < n && !(raw[i] === '*' && raw[i + 1] === '/')) i++; i += 2; continue; }
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const skipString = () => {
|
|
103
|
-
const q = raw[i];
|
|
104
|
-
i++;
|
|
105
|
-
while (i < n) {
|
|
106
|
-
const c = raw[i];
|
|
107
|
-
if (c === '\\') { i += 2; continue; }
|
|
108
|
-
if (c === q) { i++; return; }
|
|
109
|
-
i++;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
// Skip one JSON value starting at raw[i]; false on malformed input.
|
|
113
|
-
const skipValue = (): boolean => {
|
|
114
|
-
skipWsComments();
|
|
115
|
-
if (i >= n) return false;
|
|
116
|
-
const c = raw[i];
|
|
117
|
-
if (c === '"' || c === "'") { skipString(); return true; }
|
|
118
|
-
if (c === '{' || c === '[') {
|
|
119
|
-
const open = c;
|
|
120
|
-
const close = c === '{' ? '}' : ']';
|
|
121
|
-
i++;
|
|
122
|
-
let depth = 1;
|
|
123
|
-
while (i < n && depth > 0) {
|
|
124
|
-
const d = raw[i];
|
|
125
|
-
if (d === '"' || d === "'") { skipString(); continue; }
|
|
126
|
-
if (d === '/' && raw[i + 1] === '/') { while (i < n && raw[i] !== '\n') i++; continue; }
|
|
127
|
-
if (d === '/' && raw[i + 1] === '*') { i += 2; while (i < n && !(raw[i] === '*' && raw[i + 1] === '/')) i++; i += 2; continue; }
|
|
128
|
-
if (d === open) depth++;
|
|
129
|
-
else if (d === close) depth--;
|
|
130
|
-
i++;
|
|
131
|
-
}
|
|
132
|
-
return depth === 0;
|
|
133
|
-
}
|
|
134
|
-
while (i < n && raw[i] !== ',' && raw[i] !== ']' && raw[i] !== '}') i++;
|
|
135
|
-
return true;
|
|
136
|
-
};
|
|
137
|
-
for (;;) {
|
|
138
|
-
skipWsComments();
|
|
139
|
-
if (i >= n) return null;
|
|
140
|
-
if (raw[i] === ']') return null; // array ended before entryIndex
|
|
141
|
-
if (raw[i] === '{') {
|
|
142
|
-
const start = i;
|
|
143
|
-
if (!skipValue()) return null;
|
|
144
|
-
if (count === entryIndex) return { start, end: i };
|
|
145
|
-
count++;
|
|
146
|
-
} else if (!skipValue()) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
skipWsComments();
|
|
150
|
-
if (i < n && raw[i] === ',') { i++; continue; }
|
|
151
|
-
if (i < n && raw[i] === ']') return null;
|
|
152
|
-
return null; // malformed separator
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Locate the string value of a top-level key inside one bot-entry source
|
|
158
|
-
* span. Unlike a regex, this scan skips over // and block comments as well
|
|
159
|
-
* as string literals, so a key-looking fragment inside a comment (e.g.
|
|
160
|
-
* `// "accountId": "1.2.9999" (old)`) can never be mistaken for the real
|
|
161
|
-
* key. Returns the span of the quoted value (including quotes), or null
|
|
162
|
-
* when the key is absent or its value is not a string.
|
|
163
|
-
*/
|
|
164
|
-
function findEntryKeyValueSpan(entrySrc: string, key: string): { valueStart: number; valueEnd: number } | null {
|
|
165
|
-
const n = entrySrc.length;
|
|
166
|
-
const isWs = (c: string) => c === ' ' || c === '\t' || c === '\n' || c === '\r';
|
|
167
|
-
let i = 0;
|
|
168
|
-
let depth = 0;
|
|
169
|
-
while (i < n) {
|
|
170
|
-
const c = entrySrc[i];
|
|
171
|
-
if (isWs(c)) { i++; continue; }
|
|
172
|
-
if (c === '/' && entrySrc[i + 1] === '/') { while (i < n && entrySrc[i] !== '\n') i++; continue; }
|
|
173
|
-
if (c === '/' && entrySrc[i + 1] === '*') { i += 2; while (i < n && !(entrySrc[i] === '*' && entrySrc[i + 1] === '/')) i++; i += 2; continue; }
|
|
174
|
-
if (c === '{' || c === '[') { depth++; i++; continue; }
|
|
175
|
-
if (c === '}' || c === ']') { depth--; i++; continue; }
|
|
176
|
-
if (c !== '"') { i++; continue; }
|
|
177
|
-
// String literal: read it (honoring backslash escapes).
|
|
178
|
-
let j = i + 1;
|
|
179
|
-
let str = '';
|
|
180
|
-
while (j < n) {
|
|
181
|
-
const d = entrySrc[j];
|
|
182
|
-
if (d === '\\') { str += entrySrc.slice(j, j + 2); j += 2; continue; }
|
|
183
|
-
if (d === '"') break;
|
|
184
|
-
str += d; j++;
|
|
185
|
-
}
|
|
186
|
-
if (j >= n) return null;
|
|
187
|
-
const closingQuote = j;
|
|
188
|
-
if (depth !== 1 || str !== key) { i = closingQuote + 1; continue; }
|
|
189
|
-
// Candidate key at top level: expect `:` then a quoted value.
|
|
190
|
-
let k = closingQuote + 1;
|
|
191
|
-
while (k < n && isWs(entrySrc[k])) k++;
|
|
192
|
-
if (entrySrc[k] !== ':') { i = closingQuote + 1; continue; }
|
|
193
|
-
k++;
|
|
194
|
-
while (k < n && isWs(entrySrc[k])) k++;
|
|
195
|
-
if (entrySrc[k] !== '"') { i = closingQuote + 1; continue; }
|
|
196
|
-
let m = k + 1;
|
|
197
|
-
while (m < n) {
|
|
198
|
-
const e = entrySrc[m];
|
|
199
|
-
if (e === '\\') { m += 2; continue; }
|
|
200
|
-
if (e === '"') return { valueStart: k, valueEnd: m + 1 };
|
|
201
|
-
m++;
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Byte-preserving accountId update: replaces the value in place, or inserts
|
|
210
|
-
* `"accountId"` right after `"preferredAccount"` keeping the line indent, so
|
|
211
|
-
* comments, key order and formatting elsewhere in the file survive. The
|
|
212
|
-
* patched document is re-parsed (comments allowed) and the value asserted
|
|
213
|
-
* before the atomic tmp+rename write. Returns false on any uncertainty —
|
|
214
|
-
* callers fall back to a full rewrite.
|
|
215
|
-
*/
|
|
216
|
-
function patchAccountIdInRaw(filePath: string, entryIndex: number, accountId: string): boolean {
|
|
217
|
-
let raw: string;
|
|
218
|
-
try {
|
|
219
|
-
raw = fs.readFileSync(filePath, 'utf8');
|
|
220
|
-
} catch (_) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
const span = findBotsEntrySpan(raw, entryIndex);
|
|
224
|
-
if (!span) return false;
|
|
225
|
-
const entrySrc = raw.slice(span.start, span.end);
|
|
226
|
-
let patchedEntry: string | null = null;
|
|
227
|
-
const idSpan = findEntryKeyValueSpan(entrySrc, 'accountId');
|
|
228
|
-
if (idSpan) {
|
|
229
|
-
patchedEntry = entrySrc.slice(0, idSpan.valueStart)
|
|
230
|
-
+ `"${accountId}"`
|
|
231
|
-
+ entrySrc.slice(idSpan.valueEnd);
|
|
232
|
-
} else {
|
|
233
|
-
const prefSpan = findEntryKeyValueSpan(entrySrc, 'preferredAccount');
|
|
234
|
-
if (!prefSpan) return false;
|
|
235
|
-
const lineStart = entrySrc.lastIndexOf('\n', prefSpan.valueEnd) + 1;
|
|
236
|
-
const indentMatch = /^[ \t]*/.exec(entrySrc.slice(lineStart));
|
|
237
|
-
const indent = indentMatch ? indentMatch[0] : ' ';
|
|
238
|
-
patchedEntry = entrySrc.slice(0, prefSpan.valueEnd)
|
|
239
|
-
+ `,\n${indent}"accountId": "${accountId}"`
|
|
240
|
-
+ entrySrc.slice(prefSpan.valueEnd);
|
|
241
|
-
}
|
|
242
|
-
if (!patchedEntry || patchedEntry === entrySrc) return false;
|
|
243
|
-
const patched = raw.slice(0, span.start) + patchedEntry + raw.slice(span.end);
|
|
244
|
-
try {
|
|
245
|
-
const reparsed = parseJsonWithComments(patched);
|
|
246
|
-
const checkEntries = Array.isArray(reparsed?.bots) ? reparsed.bots : [];
|
|
247
|
-
if (checkEntries[entryIndex]?.accountId !== accountId) return false;
|
|
248
|
-
} catch (_) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
const tmpPath = `${filePath}.tmp-persist-${process.pid}-${Date.now()}`;
|
|
252
|
-
try {
|
|
253
|
-
fs.writeFileSync(tmpPath, patched, 'utf8');
|
|
254
|
-
fs.renameSync(tmpPath, filePath);
|
|
255
|
-
return true;
|
|
256
|
-
} catch (_) {
|
|
257
|
-
try { fs.unlinkSync(tmpPath); } catch (_) { /* best-effort cleanup */ }
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Persist a resolved account name → ID mapping onto the bot entry in
|
|
264
|
-
* profiles/bots.json (`accountId` next to `preferredAccount`), so analysis
|
|
265
|
-
* tools can skip the chain lookup on subsequent runs. No-op when the stored
|
|
266
|
-
* value already matches. Prefers a byte-preserving textual patch (comments,
|
|
267
|
-
* key order and formatting survive); falls back to a full rewrite using the
|
|
268
|
-
* same atomic writeJSON serialization the bot editor uses. Returns true when
|
|
269
|
-
* the file was updated.
|
|
270
|
-
*/
|
|
271
|
-
function persistBotAccountId(botKey: any, accountId: string, filePath = PATHS.PROFILES.BOTS_JSON): boolean {
|
|
272
|
-
if (!botKey || !/^1\.2\.\d+$/.test(String(accountId))) return false;
|
|
273
|
-
let settings: any = null;
|
|
274
|
-
try {
|
|
275
|
-
settings = loadBotSettings(filePath);
|
|
276
|
-
} catch (_) {
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
const entries = Array.isArray(settings?.bots) ? settings.bots : [];
|
|
280
|
-
const normalizedKey = String(botKey).toLowerCase();
|
|
281
|
-
const index = entries.findIndex((bot: any, i: number) => computeBotKey(bot, i) === normalizedKey);
|
|
282
|
-
if (index < 0 || entries[index]?.accountId === accountId) return false;
|
|
283
|
-
try {
|
|
284
|
-
if (patchAccountIdInRaw(filePath, index, String(accountId))) return true;
|
|
285
|
-
} catch (_) {
|
|
286
|
-
// Fall through to the full rewrite below.
|
|
287
|
-
}
|
|
288
|
-
entries[index].accountId = String(accountId);
|
|
289
|
-
try {
|
|
290
|
-
writeJSON(filePath, settings);
|
|
291
|
-
return true;
|
|
292
|
-
} catch (_) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Return the stored chain account ID for a bot key, or null when none is
|
|
299
|
-
* stamped yet. When expectedRef is given, the stored ID is only returned if
|
|
300
|
-
* the entry's current preferredAccount still matches it — a rename must
|
|
301
|
-
* never silently reuse a stale ID.
|
|
302
|
-
*/
|
|
303
|
-
function getStoredBotAccountId(botKey: any, expectedRef?: string | null, filePath = PATHS.PROFILES.BOTS_JSON): string | null {
|
|
304
|
-
if (!botKey) return null;
|
|
305
|
-
let meta: any = null;
|
|
306
|
-
try {
|
|
307
|
-
meta = loadBotMeta(botKey, filePath);
|
|
308
|
-
} catch (_) {
|
|
309
|
-
return null;
|
|
310
|
-
}
|
|
311
|
-
const stored = meta && /^1\.2\.\d+$/.test(String(meta.accountId ?? '')) ? String(meta.accountId) : null;
|
|
312
|
-
if (!stored) return null;
|
|
313
|
-
if (expectedRef != null && String(meta.preferredAccount ?? '').toLowerCase() !== String(expectedRef).toLowerCase()) return null;
|
|
314
|
-
return stored;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Find the bot entry whose preferredAccount matches a raw account reference
|
|
319
|
-
* (case-insensitive). Used by tools that accept a bare account name to locate
|
|
320
|
-
* the stored accountId and the persist target. Returns null for 1.2.x input
|
|
321
|
-
* or when no bot claims the name.
|
|
322
|
-
*/
|
|
323
|
-
function findBotKeyByAccountRef(ref: any, filePath = PATHS.PROFILES.BOTS_JSON): { botKey: string; meta: any } | null {
|
|
324
|
-
if (!ref || /^1\.2\.\d+$/.test(String(ref))) return null;
|
|
325
|
-
let settings: any = null;
|
|
326
|
-
try {
|
|
327
|
-
settings = loadBotSettings(filePath);
|
|
328
|
-
} catch (_) {
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
const entries = Array.isArray(settings?.bots) ? settings.bots : [];
|
|
332
|
-
const want = String(ref).toLowerCase();
|
|
333
|
-
for (let i = 0; i < entries.length; i++) {
|
|
334
|
-
const entry = entries[i];
|
|
335
|
-
if (entry && String(entry.preferredAccount ?? '').toLowerCase() === want) {
|
|
336
|
-
return { botKey: computeBotKey(entry, i), meta: entry };
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function resolveAmaConfig(botKey: any) {
|
|
343
|
-
const botMeta = loadBotMeta(botKey);
|
|
344
|
-
// Unknown bot key: fall back to the global erSmoothPeriod default (same
|
|
345
|
-
// resolution path production uses) instead of forcing 0 — a typo'd
|
|
346
|
-
// --bot-key must not silently research with different ER smoothing.
|
|
347
|
-
if (!botMeta) return { ...MARKET_ADAPTER.AMAS.AMA3, erSmoothPeriod: Number(MARKET_ADAPTER.AMA_ER_SMOOTH_FAST_PERIOD) };
|
|
348
|
-
|
|
349
|
-
const rawGridPrice = String(botMeta?.gridPrice || '').trim().toLowerCase();
|
|
350
|
-
const isAmaKeyword = AMA_KEYWORDS.has(rawGridPrice);
|
|
351
|
-
|
|
352
|
-
// erSmoothPeriod: bot.ama inline > global default (matches production resolveErSmoothPeriodForBot)
|
|
353
|
-
const botAmaInline = (botMeta?.ama && typeof botMeta.ama === 'object') ? botMeta.ama : null;
|
|
354
|
-
const rawErSmooth = botAmaInline && Object.prototype.hasOwnProperty.call(botAmaInline, 'erSmoothPeriod')
|
|
355
|
-
? Number(botAmaInline.erSmoothPeriod)
|
|
356
|
-
: Number(MARKET_ADAPTER.AMA_ER_SMOOTH_FAST_PERIOD);
|
|
357
|
-
const erSmoothPeriod = rawErSmooth === 0 ? 0
|
|
358
|
-
: (Number.isFinite(rawErSmooth) && rawErSmooth >= 1 ? rawErSmooth : 0);
|
|
359
|
-
|
|
360
|
-
// Priority: inline bot.ama overrides market profile for analysis visibility.
|
|
361
|
-
// Production inverts this (profiles first, inline as fallback — market_adapter.ts:694-730).
|
|
362
|
-
if (botAmaInline) {
|
|
363
|
-
const cfg: any = {
|
|
364
|
-
erPeriod: Number(botAmaInline.erPeriod),
|
|
365
|
-
fastPeriod: Number(botAmaInline.fastPeriod),
|
|
366
|
-
slowPeriod: Number(botAmaInline.slowPeriod),
|
|
367
|
-
erSmoothPeriod,
|
|
368
|
-
};
|
|
369
|
-
if (isAmaKeyword) {
|
|
370
|
-
const key = rawGridPrice === 'ama' ? DEFAULT_AMA_KEY : rawGridPrice.toUpperCase();
|
|
371
|
-
const preset = BUILTIN_AMAS[key];
|
|
372
|
-
if (preset) {
|
|
373
|
-
if (!Number.isFinite(cfg.erPeriod) || cfg.erPeriod < 1) cfg.erPeriod = preset.erPeriod;
|
|
374
|
-
if (!Number.isFinite(cfg.fastPeriod) || cfg.fastPeriod < 1) cfg.fastPeriod = preset.fastPeriod;
|
|
375
|
-
if (!Number.isFinite(cfg.slowPeriod) || cfg.slowPeriod < 1) cfg.slowPeriod = preset.slowPeriod;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
if (!Number.isFinite(cfg.erPeriod) || cfg.erPeriod < 1) cfg.erPeriod = MARKET_ADAPTER.AMAS.AMA3.erPeriod;
|
|
379
|
-
if (!Number.isFinite(cfg.fastPeriod) || cfg.fastPeriod < 1) cfg.fastPeriod = MARKET_ADAPTER.AMAS.AMA3.fastPeriod;
|
|
380
|
-
if (!Number.isFinite(cfg.slowPeriod) || cfg.slowPeriod < 1) cfg.slowPeriod = MARKET_ADAPTER.AMAS.AMA3.slowPeriod;
|
|
381
|
-
if (cfg.fastPeriod > cfg.slowPeriod) {
|
|
382
|
-
const t = cfg.fastPeriod; cfg.fastPeriod = cfg.slowPeriod; cfg.slowPeriod = t;
|
|
383
|
-
}
|
|
384
|
-
return cfg;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
const marketProfiles = loadMarketProfiles();
|
|
388
|
-
const selectedProfile = marketProfiles?.profiles
|
|
389
|
-
? marketProfiles.profiles.find((entry: any) =>
|
|
390
|
-
String(entry.assetA) === String(botMeta.assetA) &&
|
|
391
|
-
String(entry.assetB) === String(botMeta.assetB) &&
|
|
392
|
-
Number(entry.intervalSeconds) === 3600)
|
|
393
|
-
: null;
|
|
394
|
-
|
|
395
|
-
if (selectedProfile?.amas) {
|
|
396
|
-
const fallbackKey = selectedProfile.defaultAma || DEFAULT_AMA_KEY;
|
|
397
|
-
const requestedKey = isAmaKeyword
|
|
398
|
-
? (rawGridPrice === 'ama' ? fallbackKey : rawGridPrice.toUpperCase())
|
|
399
|
-
: fallbackKey;
|
|
400
|
-
const fromProfile = selectedProfile.amas[requestedKey] || selectedProfile.amas[fallbackKey];
|
|
401
|
-
const fromBuiltin = BUILTIN_AMAS[requestedKey] || BUILTIN_AMAS[fallbackKey];
|
|
402
|
-
const base = fromProfile || fromBuiltin;
|
|
403
|
-
if (base) {
|
|
404
|
-
return { erPeriod: base.erPeriod, fastPeriod: base.fastPeriod, slowPeriod: base.slowPeriod, erSmoothPeriod };
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const key = isAmaKeyword
|
|
409
|
-
? (rawGridPrice === 'ama' ? DEFAULT_AMA_KEY : rawGridPrice.toUpperCase())
|
|
410
|
-
: DEFAULT_AMA_KEY;
|
|
411
|
-
const builtin = BUILTIN_AMAS[key] || MARKET_ADAPTER.AMAS.AMA3;
|
|
412
|
-
return { erPeriod: builtin.erPeriod, fastPeriod: builtin.fastPeriod, slowPeriod: builtin.slowPeriod, erSmoothPeriod };
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function resolveAmaKey(botKey: any) {
|
|
416
|
-
const botMeta = loadBotMeta(botKey);
|
|
417
|
-
if (!botMeta) return 'AMA3';
|
|
418
|
-
const rawGridPrice = String(botMeta?.gridPrice || '').trim().toLowerCase();
|
|
419
|
-
if (AMA_KEYWORDS.has(rawGridPrice)) {
|
|
420
|
-
return rawGridPrice === 'ama' ? DEFAULT_AMA_KEY : rawGridPrice.toUpperCase();
|
|
421
|
-
}
|
|
422
|
-
return 'AMA3';
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
export { loadBotSettings, sanitizeKey, computeBotKey, resolveBotKey, candleFileForBot, resolveCandleFile, loadBotMeta, getStoredBotAccountId, findBotKeyByAccountRef, persistBotAccountId, resolveAmaConfig, resolveAmaKey }
|
|
426
|
-
|