dexbot 1.1.10
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/LICENSE +21 -0
- package/README.md +287 -0
- package/claw/README.md +513 -0
- package/claw/scripts/memu_runner.py +385 -0
- package/claw/skills/bitshares-guide/SKILL.md +14 -0
- package/claw/skills/bitshares-guide/references/example-skill-shells.md +18 -0
- package/claw/skills/bitshares-guide/references/presentation-patterns.md +19 -0
- package/claw/skills/bitshares-guide/references/scope-guardrails.md +9 -0
- package/claw/skills/launcher-ops/SKILL.md +18 -0
- package/claw/skills/launcher-ops/references/launcher-workflow.md +23 -0
- package/claw/skills/margin-trading/SKILL.md +23 -0
- package/claw/skills/margin-trading/references/honest-asset-list.md +74 -0
- package/claw/skills/margin-trading/references/honest-assets.md +44 -0
- package/claw/skills/margin-trading/references/position-management.md +203 -0
- package/claw/skills/margin-trading/references/trading-concepts.md +80 -0
- package/claw/skills/memu-memory/SKILL.md +218 -0
- package/claw/skills/shared/references/js-automation-overview.md +24 -0
- package/claw/skills/shared/references/safety-and-staleness.md +11 -0
- package/claw/skills/shared/references/skill-boundaries.md +17 -0
- package/claw/skills/trend-detection/SKILL.md +33 -0
- package/claw/skills/trend-detection/agents/openai.yaml +3 -0
- package/claw/skills/trend-detection/references/service.md +45 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +3 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +149 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +1 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +3 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +387 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +3 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +200 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +3 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +212 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +1 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +31 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +249 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +1 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +2 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +782 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -0
- package/dist/analysis/analyze_derivatives.d.ts +95 -0
- package/dist/analysis/analyze_derivatives.d.ts.map +1 -0
- package/dist/analysis/analyze_derivatives.js +295 -0
- package/dist/analysis/analyze_derivatives.js.map +1 -0
- package/dist/analysis/analyze_dynamic_weight.d.ts +14 -0
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +1 -0
- package/dist/analysis/analyze_dynamic_weight.js +208 -0
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -0
- package/dist/analysis/analyze_kalman.d.ts +13 -0
- package/dist/analysis/analyze_kalman.d.ts.map +1 -0
- package/dist/analysis/analyze_kalman.js +123 -0
- package/dist/analysis/analyze_kalman.js.map +1 -0
- package/dist/analysis/analyze_regime.d.ts +20 -0
- package/dist/analysis/analyze_regime.d.ts.map +1 -0
- package/dist/analysis/analyze_regime.js +139 -0
- package/dist/analysis/analyze_regime.js.map +1 -0
- package/dist/analysis/analyze_regime_windows.d.ts +19 -0
- package/dist/analysis/analyze_regime_windows.d.ts.map +1 -0
- package/dist/analysis/analyze_regime_windows.js +413 -0
- package/dist/analysis/analyze_regime_windows.js.map +1 -0
- package/dist/analysis/analyze_risk_profile.d.ts +3 -0
- package/dist/analysis/analyze_risk_profile.d.ts.map +1 -0
- package/dist/analysis/analyze_risk_profile.js +159 -0
- package/dist/analysis/analyze_risk_profile.js.map +1 -0
- package/dist/analysis/analyze_trade_heatmap.d.ts +3 -0
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +1 -0
- package/dist/analysis/analyze_trade_heatmap.js +367 -0
- package/dist/analysis/analyze_trade_heatmap.js.map +1 -0
- package/dist/analysis/analyze_volatility.d.ts +22 -0
- package/dist/analysis/analyze_volatility.d.ts.map +1 -0
- package/dist/analysis/analyze_volatility.js +172 -0
- package/dist/analysis/analyze_volatility.js.map +1 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +99 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +804 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +2 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +347 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -0
- package/dist/analysis/bot_fitting/shared_utils.d.ts +15 -0
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/shared_utils.js +48 -0
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -0
- package/dist/analysis/bot_key_utils.d.ts +16 -0
- package/dist/analysis/bot_key_utils.d.ts.map +1 -0
- package/dist/analysis/bot_key_utils.js +61 -0
- package/dist/analysis/bot_key_utils.js.map +1 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +3 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +1 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.js +498 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +546 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.js +427 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -0
- package/dist/analysis/chart_utils.d.ts +13 -0
- package/dist/analysis/chart_utils.d.ts.map +1 -0
- package/dist/analysis/chart_utils.js +142 -0
- package/dist/analysis/chart_utils.js.map +1 -0
- package/dist/analysis/derivative_chart_generator.d.ts +18 -0
- package/dist/analysis/derivative_chart_generator.d.ts.map +1 -0
- package/dist/analysis/derivative_chart_generator.js +896 -0
- package/dist/analysis/derivative_chart_generator.js.map +1 -0
- package/dist/analysis/math_utils.d.ts +35 -0
- package/dist/analysis/math_utils.d.ts.map +1 -0
- package/dist/analysis/math_utils.js +121 -0
- package/dist/analysis/math_utils.js.map +1 -0
- package/dist/analysis/price_sources.d.ts +34 -0
- package/dist/analysis/price_sources.d.ts.map +1 -0
- package/dist/analysis/price_sources.js +103 -0
- package/dist/analysis/price_sources.js.map +1 -0
- package/dist/analysis/trade_profitability.d.ts +115 -0
- package/dist/analysis/trade_profitability.d.ts.map +1 -0
- package/dist/analysis/trade_profitability.js +1247 -0
- package/dist/analysis/trade_profitability.js.map +1 -0
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +38 -0
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +212 -0
- package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +9 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +1717 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +250 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.js +903 -0
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +1449 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +42 -0
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/hurst_analyzer.js +159 -0
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.js +408 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +103 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +229 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +34 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +89 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +39 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +132 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/regime_chart_generator.js +345 -0
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +2 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +130 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +2 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +38 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +1 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.js +732 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -0
- package/dist/bot.d.ts +49 -0
- package/dist/bot.d.ts.map +1 -0
- package/dist/bot.js +221 -0
- package/dist/bot.js.map +1 -0
- package/dist/credential-daemon.d.ts +64 -0
- package/dist/credential-daemon.d.ts.map +1 -0
- package/dist/credential-daemon.js +987 -0
- package/dist/credential-daemon.js.map +1 -0
- package/dist/dexbot.d.ts +87 -0
- package/dist/dexbot.d.ts.map +1 -0
- package/dist/dexbot.js +1222 -0
- package/dist/dexbot.js.map +1 -0
- package/dist/market_adapter/ama_signal_runner.d.ts +3 -0
- package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -0
- package/dist/market_adapter/ama_signal_runner.js +175 -0
- package/dist/market_adapter/ama_signal_runner.js.map +1 -0
- package/dist/market_adapter/candle_utils.d.ts +57 -0
- package/dist/market_adapter/candle_utils.d.ts.map +1 -0
- package/dist/market_adapter/candle_utils.js +252 -0
- package/dist/market_adapter/candle_utils.js.map +1 -0
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +20 -0
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -0
- package/dist/market_adapter/core/asymmetric_bounds.js +88 -0
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -0
- package/dist/market_adapter/core/config_normalizers.d.ts +10 -0
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -0
- package/dist/market_adapter/core/config_normalizers.js +24 -0
- package/dist/market_adapter/core/config_normalizers.js.map +1 -0
- package/dist/market_adapter/core/kibana_candles.d.ts +74 -0
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_candles.js +249 -0
- package/dist/market_adapter/core/kibana_candles.js.map +1 -0
- package/dist/market_adapter/core/kibana_client.d.ts +27 -0
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_client.js +120 -0
- package/dist/market_adapter/core/kibana_client.js.map +1 -0
- package/dist/market_adapter/core/kibana_market_candles.d.ts +143 -0
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_market_candles.js +170 -0
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -0
- package/dist/market_adapter/core/market_adapter_service.d.ts +210 -0
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -0
- package/dist/market_adapter/core/market_adapter_service.js +2328 -0
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -0
- package/dist/market_adapter/core/strategies/ama.d.ts +2 -0
- package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/ama.js +138 -0
- package/dist/market_adapter/core/strategies/ama.js.map +1 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +50 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.js +143 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -0
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +12 -0
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/atr/calculator.js +47 -0
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -0
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +32 -0
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/collateral_manager.js +68 -0
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -0
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +66 -0
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/regime_gate.js +189 -0
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -0
- package/dist/market_adapter/index.d.ts +10 -0
- package/dist/market_adapter/index.d.ts.map +1 -0
- package/dist/market_adapter/index.js +71 -0
- package/dist/market_adapter/index.js.map +1 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts +3 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +1 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +1165 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -0
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +54 -0
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -0
- package/dist/market_adapter/inputs/fetch_lp_data.js +743 -0
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -0
- package/dist/market_adapter/inputs/kibana_source.d.ts +68 -0
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -0
- package/dist/market_adapter/inputs/kibana_source.js +143 -0
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -0
- package/dist/market_adapter/interval_utils.d.ts +6 -0
- package/dist/market_adapter/interval_utils.d.ts.map +1 -0
- package/dist/market_adapter/interval_utils.js +14 -0
- package/dist/market_adapter/interval_utils.js.map +1 -0
- package/dist/market_adapter/log_format.d.ts +16 -0
- package/dist/market_adapter/log_format.d.ts.map +1 -0
- package/dist/market_adapter/log_format.js +72 -0
- package/dist/market_adapter/log_format.js.map +1 -0
- package/dist/market_adapter/lp_chart_core.d.ts +6 -0
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_core.js +874 -0
- package/dist/market_adapter/lp_chart_core.js.map +1 -0
- package/dist/market_adapter/lp_chart_runner.d.ts +135 -0
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_runner.js +337 -0
- package/dist/market_adapter/lp_chart_runner.js.map +1 -0
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +23 -0
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_strategy_loader.js +169 -0
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -0
- package/dist/market_adapter/market_adapter.d.ts +133 -0
- package/dist/market_adapter/market_adapter.d.ts.map +1 -0
- package/dist/market_adapter/market_adapter.js +1331 -0
- package/dist/market_adapter/market_adapter.js.map +1 -0
- package/dist/market_adapter/merge_lp_data.d.ts +3 -0
- package/dist/market_adapter/merge_lp_data.d.ts.map +1 -0
- package/dist/market_adapter/merge_lp_data.js +125 -0
- package/dist/market_adapter/merge_lp_data.js.map +1 -0
- package/dist/market_adapter/test_helpers.d.ts +14 -0
- package/dist/market_adapter/test_helpers.d.ts.map +1 -0
- package/dist/market_adapter/test_helpers.js +22 -0
- package/dist/market_adapter/test_helpers.js.map +1 -0
- package/dist/market_adapter/utils/adapter_client.d.ts +20 -0
- package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -0
- package/dist/market_adapter/utils/adapter_client.js +88 -0
- package/dist/market_adapter/utils/adapter_client.js.map +1 -0
- package/dist/market_adapter/utils/atomic_write.d.ts +9 -0
- package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -0
- package/dist/market_adapter/utils/atomic_write.js +13 -0
- package/dist/market_adapter/utils/atomic_write.js.map +1 -0
- package/dist/market_adapter/utils/chain.d.ts +50 -0
- package/dist/market_adapter/utils/chain.d.ts.map +1 -0
- package/dist/market_adapter/utils/chain.js +196 -0
- package/dist/market_adapter/utils/chain.js.map +1 -0
- package/dist/market_adapter/utils/data_discovery.d.ts +6 -0
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -0
- package/dist/market_adapter/utils/data_discovery.js +35 -0
- package/dist/market_adapter/utils/data_discovery.js.map +1 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +15 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +60 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -0
- package/dist/market_adapter/utils/file_lock.d.ts +19 -0
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -0
- package/dist/market_adapter/utils/file_lock.js +191 -0
- package/dist/market_adapter/utils/file_lock.js.map +1 -0
- package/dist/market_adapter/utils/native_history.d.ts +19 -0
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -0
- package/dist/market_adapter/utils/native_history.js +172 -0
- package/dist/market_adapter/utils/native_history.js.map +1 -0
- package/dist/market_adapter/utils/paths.d.ts +5 -0
- package/dist/market_adapter/utils/paths.d.ts.map +1 -0
- package/dist/market_adapter/utils/paths.js +7 -0
- package/dist/market_adapter/utils/paths.js.map +1 -0
- package/dist/modules/account_bots.d.ts +112 -0
- package/dist/modules/account_bots.d.ts.map +1 -0
- package/dist/modules/account_bots.js +1259 -0
- package/dist/modules/account_bots.js.map +1 -0
- package/dist/modules/account_orders.d.ts +273 -0
- package/dist/modules/account_orders.d.ts.map +1 -0
- package/dist/modules/account_orders.js +662 -0
- package/dist/modules/account_orders.js.map +1 -0
- package/dist/modules/authority_resolver.d.ts +2 -0
- package/dist/modules/authority_resolver.d.ts.map +1 -0
- package/dist/modules/authority_resolver.js +231 -0
- package/dist/modules/authority_resolver.js.map +1 -0
- package/dist/modules/bitshares-native/chain_client.d.ts +38 -0
- package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -0
- package/dist/modules/bitshares-native/chain_client.js +322 -0
- package/dist/modules/bitshares-native/chain_client.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +59 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +456 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.d.ts +66 -0
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.js +557 -0
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +2 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +20 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -0
- package/dist/modules/bitshares-native/index.d.ts +3 -0
- package/dist/modules/bitshares-native/index.d.ts.map +1 -0
- package/dist/modules/bitshares-native/index.js +32 -0
- package/dist/modules/bitshares-native/index.js.map +1 -0
- package/dist/modules/bitshares-native/resolvers.d.ts +40 -0
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -0
- package/dist/modules/bitshares-native/resolvers.js +161 -0
- package/dist/modules/bitshares-native/resolvers.js.map +1 -0
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +56 -0
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/chain_constants.js +92 -0
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -0
- package/dist/modules/bitshares-native/serial/index.d.ts +10 -0
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/index.js +14 -0
- package/dist/modules/bitshares-native/serial/index.js.map +1 -0
- package/dist/modules/bitshares-native/serial/operations.d.ts +102 -0
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/operations.js +615 -0
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -0
- package/dist/modules/bitshares-native/serial/serializer.d.ts +64 -0
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/serializer.js +252 -0
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -0
- package/dist/modules/bitshares-native/serial/types.d.ts +120 -0
- package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/types.js +837 -0
- package/dist/modules/bitshares-native/serial/types.js.map +1 -0
- package/dist/modules/bitshares-native/signing_client.d.ts +6 -0
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -0
- package/dist/modules/bitshares-native/signing_client.js +141 -0
- package/dist/modules/bitshares-native/signing_client.js.map +1 -0
- package/dist/modules/bitshares-native/subscriptions.d.ts +6 -0
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -0
- package/dist/modules/bitshares-native/subscriptions.js +865 -0
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -0
- package/dist/modules/bitshares-native/transport.d.ts +51 -0
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -0
- package/dist/modules/bitshares-native/transport.js +447 -0
- package/dist/modules/bitshares-native/transport.js.map +1 -0
- package/dist/modules/bitshares-native/tx/builder.d.ts +30 -0
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -0
- package/dist/modules/bitshares-native/tx/builder.js +262 -0
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -0
- package/dist/modules/bitshares_client.d.ts +129 -0
- package/dist/modules/bitshares_client.d.ts.map +1 -0
- package/dist/modules/bitshares_client.js +627 -0
- package/dist/modules/bitshares_client.js.map +1 -0
- package/dist/modules/bot_settings.d.ts +33 -0
- package/dist/modules/bot_settings.d.ts.map +1 -0
- package/dist/modules/bot_settings.js +328 -0
- package/dist/modules/bot_settings.js.map +1 -0
- package/dist/modules/bots_file_lock.d.ts +88 -0
- package/dist/modules/bots_file_lock.d.ts.map +1 -0
- package/dist/modules/bots_file_lock.js +161 -0
- package/dist/modules/bots_file_lock.js.map +1 -0
- package/dist/modules/chain_keys.d.ts +302 -0
- package/dist/modules/chain_keys.d.ts.map +1 -0
- package/dist/modules/chain_keys.js +1095 -0
- package/dist/modules/chain_keys.js.map +1 -0
- package/dist/modules/chain_orders.d.ts +423 -0
- package/dist/modules/chain_orders.d.ts.map +1 -0
- package/dist/modules/chain_orders.js +1201 -0
- package/dist/modules/chain_orders.js.map +1 -0
- package/dist/modules/cli_whitelist_args.d.ts +6 -0
- package/dist/modules/cli_whitelist_args.d.ts.map +1 -0
- package/dist/modules/cli_whitelist_args.js +13 -0
- package/dist/modules/cli_whitelist_args.js.map +1 -0
- package/dist/modules/config.d.ts +57 -0
- package/dist/modules/config.d.ts.map +1 -0
- package/dist/modules/config.js +107 -0
- package/dist/modules/config.js.map +1 -0
- package/dist/modules/constants.d.ts +635 -0
- package/dist/modules/constants.d.ts.map +1 -0
- package/dist/modules/constants.js +1464 -0
- package/dist/modules/constants.js.map +1 -0
- package/dist/modules/cr_planner.d.ts +51 -0
- package/dist/modules/cr_planner.d.ts.map +1 -0
- package/dist/modules/cr_planner.js +299 -0
- package/dist/modules/cr_planner.js.map +1 -0
- package/dist/modules/credential_policy.d.ts +188 -0
- package/dist/modules/credential_policy.d.ts.map +1 -0
- package/dist/modules/credential_policy.js +1452 -0
- package/dist/modules/credential_policy.js.map +1 -0
- package/dist/modules/credential_runtime.d.ts +42 -0
- package/dist/modules/credential_runtime.d.ts.map +1 -0
- package/dist/modules/credential_runtime.js +148 -0
- package/dist/modules/credential_runtime.js.map +1 -0
- package/dist/modules/credential_session_cache.d.ts +36 -0
- package/dist/modules/credential_session_cache.d.ts.map +1 -0
- package/dist/modules/credential_session_cache.js +106 -0
- package/dist/modules/credential_session_cache.js.map +1 -0
- package/dist/modules/credit_runtime.d.ts +412 -0
- package/dist/modules/credit_runtime.d.ts.map +1 -0
- package/dist/modules/credit_runtime.js +2866 -0
- package/dist/modules/credit_runtime.js.map +1 -0
- package/dist/modules/crypto/browser_provider.d.ts +15 -0
- package/dist/modules/crypto/browser_provider.d.ts.map +1 -0
- package/dist/modules/crypto/browser_provider.js +113 -0
- package/dist/modules/crypto/browser_provider.js.map +1 -0
- package/dist/modules/crypto/index.d.ts +9 -0
- package/dist/modules/crypto/index.d.ts.map +1 -0
- package/dist/modules/crypto/index.js +44 -0
- package/dist/modules/crypto/index.js.map +1 -0
- package/dist/modules/crypto/node_provider.d.ts +15 -0
- package/dist/modules/crypto/node_provider.d.ts.map +1 -0
- package/dist/modules/crypto/node_provider.js +74 -0
- package/dist/modules/crypto/node_provider.js.map +1 -0
- package/dist/modules/crypto/provider.d.ts +34 -0
- package/dist/modules/crypto/provider.d.ts.map +1 -0
- package/dist/modules/crypto/provider.js +3 -0
- package/dist/modules/crypto/provider.js.map +1 -0
- package/dist/modules/crypto/pure_ripemd160.d.ts +8 -0
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +1 -0
- package/dist/modules/crypto/pure_ripemd160.js +142 -0
- package/dist/modules/crypto/pure_ripemd160.js.map +1 -0
- package/dist/modules/crypto/pure_scrypt.d.ts +23 -0
- package/dist/modules/crypto/pure_scrypt.d.ts.map +1 -0
- package/dist/modules/crypto/pure_scrypt.js +161 -0
- package/dist/modules/crypto/pure_scrypt.js.map +1 -0
- package/dist/modules/crypto/pure_secp256k1.d.ts +29 -0
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -0
- package/dist/modules/crypto/pure_secp256k1.js +195 -0
- package/dist/modules/crypto/pure_secp256k1.js.map +1 -0
- package/dist/modules/crypto/sync.d.ts +13 -0
- package/dist/modules/crypto/sync.d.ts.map +1 -0
- package/dist/modules/crypto/sync.js +37 -0
- package/dist/modules/crypto/sync.js.map +1 -0
- package/dist/modules/dexbot_class.d.ts +1074 -0
- package/dist/modules/dexbot_class.d.ts.map +1 -0
- package/dist/modules/dexbot_class.js +4613 -0
- package/dist/modules/dexbot_class.js.map +1 -0
- package/dist/modules/dexbot_credential_client.d.ts +71 -0
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -0
- package/dist/modules/dexbot_credential_client.js +224 -0
- package/dist/modules/dexbot_credential_client.js.map +1 -0
- package/dist/modules/dexbot_fill_runtime.d.ts +173 -0
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_fill_runtime.js +217 -0
- package/dist/modules/dexbot_fill_runtime.js.map +1 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts +279 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_maintenance_runtime.js +1613 -0
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -0
- package/dist/modules/env.d.ts +12 -0
- package/dist/modules/env.d.ts.map +1 -0
- package/dist/modules/env.js +57 -0
- package/dist/modules/env.js.map +1 -0
- package/dist/modules/fund_registry.d.ts +96 -0
- package/dist/modules/fund_registry.d.ts.map +1 -0
- package/dist/modules/fund_registry.js +261 -0
- package/dist/modules/fund_registry.js.map +1 -0
- package/dist/modules/general_settings.d.ts +36 -0
- package/dist/modules/general_settings.d.ts.map +1 -0
- package/dist/modules/general_settings.js +63 -0
- package/dist/modules/general_settings.js.map +1 -0
- package/dist/modules/graceful_shutdown.d.ts +86 -0
- package/dist/modules/graceful_shutdown.d.ts.map +1 -0
- package/dist/modules/graceful_shutdown.js +164 -0
- package/dist/modules/graceful_shutdown.js.map +1 -0
- package/dist/modules/key_store.d.ts +60 -0
- package/dist/modules/key_store.d.ts.map +1 -0
- package/dist/modules/key_store.js +215 -0
- package/dist/modules/key_store.js.map +1 -0
- package/dist/modules/launcher/bot_supervisor.d.ts +84 -0
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -0
- package/dist/modules/launcher/bot_supervisor.js +1067 -0
- package/dist/modules/launcher/bot_supervisor.js.map +1 -0
- package/dist/modules/launcher/child_env.d.ts +9 -0
- package/dist/modules/launcher/child_env.d.ts.map +1 -0
- package/dist/modules/launcher/child_env.js +78 -0
- package/dist/modules/launcher/child_env.js.map +1 -0
- package/dist/modules/launcher/credential_bootstrap.d.ts +22 -0
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -0
- package/dist/modules/launcher/credential_bootstrap.js +303 -0
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -0
- package/dist/modules/launcher/credential_daemon.d.ts +32 -0
- package/dist/modules/launcher/credential_daemon.d.ts.map +1 -0
- package/dist/modules/launcher/credential_daemon.js +173 -0
- package/dist/modules/launcher/credential_daemon.js.map +1 -0
- package/dist/modules/launcher/credential_secret.d.ts +6 -0
- package/dist/modules/launcher/credential_secret.d.ts.map +1 -0
- package/dist/modules/launcher/credential_secret.js +15 -0
- package/dist/modules/launcher/credential_secret.js.map +1 -0
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +2 -0
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -0
- package/dist/modules/launcher/foreign_cred_daemon.js +166 -0
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -0
- package/dist/modules/launcher/headless_password.d.ts +8 -0
- package/dist/modules/launcher/headless_password.d.ts.map +1 -0
- package/dist/modules/launcher/headless_password.js +33 -0
- package/dist/modules/launcher/headless_password.js.map +1 -0
- package/dist/modules/launcher/launch_modes.d.ts +36 -0
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -0
- package/dist/modules/launcher/launch_modes.js +129 -0
- package/dist/modules/launcher/launch_modes.js.map +1 -0
- package/dist/modules/launcher/market_adapter_runtime.d.ts +43 -0
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -0
- package/dist/modules/launcher/market_adapter_runtime.js +217 -0
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -0
- package/dist/modules/launcher/market_adapter_watchdog.d.ts +26 -0
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -0
- package/dist/modules/launcher/market_adapter_watchdog.js +214 -0
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -0
- package/dist/modules/launcher/monolithic_runtime.d.ts +89 -0
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -0
- package/dist/modules/launcher/monolithic_runtime.js +425 -0
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -0
- package/dist/modules/launcher/runtime_entry.d.ts +26 -0
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -0
- package/dist/modules/launcher/runtime_entry.js +49 -0
- package/dist/modules/launcher/runtime_entry.js.map +1 -0
- package/dist/modules/launcher/status_reporting.d.ts +48 -0
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -0
- package/dist/modules/launcher/status_reporting.js +113 -0
- package/dist/modules/launcher/status_reporting.js.map +1 -0
- package/dist/modules/launcher/supervisor_control.d.ts +6 -0
- package/dist/modules/launcher/supervisor_control.d.ts.map +1 -0
- package/dist/modules/launcher/supervisor_control.js +59 -0
- package/dist/modules/launcher/supervisor_control.js.map +1 -0
- package/dist/modules/logger.d.ts +2 -0
- package/dist/modules/logger.d.ts.map +1 -0
- package/dist/modules/logger.js +71 -0
- package/dist/modules/logger.js.map +1 -0
- package/dist/modules/market_adapter_whitelist.d.ts +22 -0
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -0
- package/dist/modules/market_adapter_whitelist.js +82 -0
- package/dist/modules/market_adapter_whitelist.js.map +1 -0
- package/dist/modules/node_health_cache.d.ts +55 -0
- package/dist/modules/node_health_cache.d.ts.map +1 -0
- package/dist/modules/node_health_cache.js +134 -0
- package/dist/modules/node_health_cache.js.map +1 -0
- package/dist/modules/node_manager.d.ts +215 -0
- package/dist/modules/node_manager.d.ts.map +1 -0
- package/dist/modules/node_manager.js +628 -0
- package/dist/modules/node_manager.js.map +1 -0
- package/dist/modules/order/accounting.d.ts +349 -0
- package/dist/modules/order/accounting.d.ts.map +1 -0
- package/dist/modules/order/accounting.js +1191 -0
- package/dist/modules/order/accounting.js.map +1 -0
- package/dist/modules/order/async_lock.d.ts +126 -0
- package/dist/modules/order/async_lock.d.ts.map +1 -0
- package/dist/modules/order/async_lock.js +195 -0
- package/dist/modules/order/async_lock.js.map +1 -0
- package/dist/modules/order/export.d.ts +129 -0
- package/dist/modules/order/export.d.ts.map +1 -0
- package/dist/modules/order/export.js +316 -0
- package/dist/modules/order/export.js.map +1 -0
- package/dist/modules/order/format.d.ts +158 -0
- package/dist/modules/order/format.d.ts.map +1 -0
- package/dist/modules/order/format.js +232 -0
- package/dist/modules/order/format.js.map +1 -0
- package/dist/modules/order/grid.d.ts +549 -0
- package/dist/modules/order/grid.d.ts.map +1 -0
- package/dist/modules/order/grid.js +1746 -0
- package/dist/modules/order/grid.js.map +1 -0
- package/dist/modules/order/grid_reconcile.d.ts +154 -0
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -0
- package/dist/modules/order/grid_reconcile.js +1192 -0
- package/dist/modules/order/grid_reconcile.js.map +1 -0
- package/dist/modules/order/index.d.ts +55 -0
- package/dist/modules/order/index.d.ts.map +1 -0
- package/dist/modules/order/index.js +79 -0
- package/dist/modules/order/index.js.map +1 -0
- package/dist/modules/order/logger.d.ts +136 -0
- package/dist/modules/order/logger.d.ts.map +1 -0
- package/dist/modules/order/logger.js +614 -0
- package/dist/modules/order/logger.js.map +1 -0
- package/dist/modules/order/logger_state.d.ts +133 -0
- package/dist/modules/order/logger_state.d.ts.map +1 -0
- package/dist/modules/order/logger_state.js +170 -0
- package/dist/modules/order/logger_state.js.map +1 -0
- package/dist/modules/order/manager.d.ts +413 -0
- package/dist/modules/order/manager.d.ts.map +1 -0
- package/dist/modules/order/manager.js +1605 -0
- package/dist/modules/order/manager.js.map +1 -0
- package/dist/modules/order/processed_fill_store.d.ts +135 -0
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -0
- package/dist/modules/order/processed_fill_store.js +288 -0
- package/dist/modules/order/processed_fill_store.js.map +1 -0
- package/dist/modules/order/runner.d.ts +70 -0
- package/dist/modules/order/runner.d.ts.map +1 -0
- package/dist/modules/order/runner.js +140 -0
- package/dist/modules/order/runner.js.map +1 -0
- package/dist/modules/order/strategy.d.ts +196 -0
- package/dist/modules/order/strategy.d.ts.map +1 -0
- package/dist/modules/order/strategy.js +398 -0
- package/dist/modules/order/strategy.js.map +1 -0
- package/dist/modules/order/sync_engine.d.ts +386 -0
- package/dist/modules/order/sync_engine.d.ts.map +1 -0
- package/dist/modules/order/sync_engine.js +1459 -0
- package/dist/modules/order/sync_engine.js.map +1 -0
- package/dist/modules/order/utils/math.d.ts +677 -0
- package/dist/modules/order/utils/math.d.ts.map +1 -0
- package/dist/modules/order/utils/math.js +1172 -0
- package/dist/modules/order/utils/math.js.map +1 -0
- package/dist/modules/order/utils/order.d.ts +572 -0
- package/dist/modules/order/utils/order.d.ts.map +1 -0
- package/dist/modules/order/utils/order.js +1145 -0
- package/dist/modules/order/utils/order.js.map +1 -0
- package/dist/modules/order/utils/system.d.ts +268 -0
- package/dist/modules/order/utils/system.d.ts.map +1 -0
- package/dist/modules/order/utils/system.js +1261 -0
- package/dist/modules/order/utils/system.js.map +1 -0
- package/dist/modules/order/utils/validate.d.ts +280 -0
- package/dist/modules/order/utils/validate.d.ts.map +1 -0
- package/dist/modules/order/utils/validate.js +918 -0
- package/dist/modules/order/utils/validate.js.map +1 -0
- package/dist/modules/order/working_grid.d.ts +212 -0
- package/dist/modules/order/working_grid.d.ts.map +1 -0
- package/dist/modules/order/working_grid.js +279 -0
- package/dist/modules/order/working_grid.js.map +1 -0
- package/dist/modules/path_api.d.ts +32 -0
- package/dist/modules/path_api.d.ts.map +1 -0
- package/dist/modules/path_api.js +148 -0
- package/dist/modules/path_api.js.map +1 -0
- package/dist/modules/paths.d.ts +58 -0
- package/dist/modules/paths.d.ts.map +1 -0
- package/dist/modules/paths.js +82 -0
- package/dist/modules/paths.js.map +1 -0
- package/dist/modules/process_discovery.d.ts +58 -0
- package/dist/modules/process_discovery.d.ts.map +1 -0
- package/dist/modules/process_discovery.js +265 -0
- package/dist/modules/process_discovery.js.map +1 -0
- package/dist/modules/runtime.d.ts +34 -0
- package/dist/modules/runtime.d.ts.map +1 -0
- package/dist/modules/runtime.js +98 -0
- package/dist/modules/runtime.js.map +1 -0
- package/dist/modules/runtime_settings.d.ts +12 -0
- package/dist/modules/runtime_settings.d.ts.map +1 -0
- package/dist/modules/runtime_settings.js +122 -0
- package/dist/modules/runtime_settings.js.map +1 -0
- package/dist/modules/settings_merge.d.ts +38 -0
- package/dist/modules/settings_merge.d.ts.map +1 -0
- package/dist/modules/settings_merge.js +246 -0
- package/dist/modules/settings_merge.js.map +1 -0
- package/dist/modules/storage/browser_adapter.d.ts +56 -0
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -0
- package/dist/modules/storage/browser_adapter.js +231 -0
- package/dist/modules/storage/browser_adapter.js.map +1 -0
- package/dist/modules/storage/index.d.ts +28 -0
- package/dist/modules/storage/index.d.ts.map +1 -0
- package/dist/modules/storage/index.js +52 -0
- package/dist/modules/storage/index.js.map +1 -0
- package/dist/modules/storage/node_adapter.d.ts +49 -0
- package/dist/modules/storage/node_adapter.d.ts.map +1 -0
- package/dist/modules/storage/node_adapter.js +167 -0
- package/dist/modules/storage/node_adapter.js.map +1 -0
- package/dist/modules/storage/types.d.ts +92 -0
- package/dist/modules/storage/types.d.ts.map +1 -0
- package/dist/modules/storage/types.js +3 -0
- package/dist/modules/storage/types.js.map +1 -0
- package/dist/modules/types.d.ts +1382 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +11 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/modules/utils/base58check.d.ts +12 -0
- package/dist/modules/utils/base58check.d.ts.map +1 -0
- package/dist/modules/utils/base58check.js +112 -0
- package/dist/modules/utils/base58check.js.map +1 -0
- package/dist/modules/utils/build_dir.d.ts +7 -0
- package/dist/modules/utils/build_dir.d.ts.map +1 -0
- package/dist/modules/utils/build_dir.js +8 -0
- package/dist/modules/utils/build_dir.js.map +1 -0
- package/dist/modules/utils/fs_utils.d.ts +25 -0
- package/dist/modules/utils/fs_utils.d.ts.map +1 -0
- package/dist/modules/utils/fs_utils.js +27 -0
- package/dist/modules/utils/fs_utils.js.map +1 -0
- package/dist/modules/utils/math_utils.d.ts +10 -0
- package/dist/modules/utils/math_utils.d.ts.map +1 -0
- package/dist/modules/utils/math_utils.js +17 -0
- package/dist/modules/utils/math_utils.js.map +1 -0
- package/dist/modules/validate_profiles.d.ts +37 -0
- package/dist/modules/validate_profiles.d.ts.map +1 -0
- package/dist/modules/validate_profiles.js +369 -0
- package/dist/modules/validate_profiles.js.map +1 -0
- package/dist/pm2.d.ts +167 -0
- package/dist/pm2.d.ts.map +1 -0
- package/dist/pm2.js +998 -0
- package/dist/pm2.js.map +1 -0
- package/dist/scripts/analyze-git.d.ts +11 -0
- package/dist/scripts/analyze-git.d.ts.map +1 -0
- package/dist/scripts/analyze-git.js +851 -0
- package/dist/scripts/analyze-git.js.map +1 -0
- package/dist/scripts/analyze-orders.d.ts +17 -0
- package/dist/scripts/analyze-orders.d.ts.map +1 -0
- package/dist/scripts/analyze-orders.js +1568 -0
- package/dist/scripts/analyze-orders.js.map +1 -0
- package/dist/scripts/diagnose-kibana-candles.d.ts +3 -0
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -0
- package/dist/scripts/diagnose-kibana-candles.js +82 -0
- package/dist/scripts/diagnose-kibana-candles.js.map +1 -0
- package/dist/scripts/diagnose-pool-history.d.ts +3 -0
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -0
- package/dist/scripts/diagnose-pool-history.js +296 -0
- package/dist/scripts/diagnose-pool-history.js.map +1 -0
- package/dist/scripts/divergence-calc.d.ts +26 -0
- package/dist/scripts/divergence-calc.d.ts.map +1 -0
- package/dist/scripts/divergence-calc.js +119 -0
- package/dist/scripts/divergence-calc.js.map +1 -0
- package/dist/scripts/generate_lp_chart.d.ts +31 -0
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -0
- package/dist/scripts/generate_lp_chart.js +92 -0
- package/dist/scripts/generate_lp_chart.js.map +1 -0
- package/dist/scripts/generate_mainnet_corpus_report.d.ts +24 -0
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -0
- package/dist/scripts/generate_mainnet_corpus_report.js +237 -0
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -0
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +2 -0
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -0
- package/dist/scripts/generate_market_adapter_whitelist.js +111 -0
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -0
- package/dist/scripts/migrate_bot_keys.d.ts +6 -0
- package/dist/scripts/migrate_bot_keys.d.ts.map +1 -0
- package/dist/scripts/migrate_bot_keys.js +301 -0
- package/dist/scripts/migrate_bot_keys.js.map +1 -0
- package/dist/scripts/native_release_gates.d.ts +3 -0
- package/dist/scripts/native_release_gates.d.ts.map +1 -0
- package/dist/scripts/native_release_gates.js +52 -0
- package/dist/scripts/native_release_gates.js.map +1 -0
- package/dist/scripts/print_grid.d.ts +16 -0
- package/dist/scripts/print_grid.d.ts.map +1 -0
- package/dist/scripts/print_grid.js +80 -0
- package/dist/scripts/print_grid.js.map +1 -0
- package/dist/scripts/run-tests.d.ts +2 -0
- package/dist/scripts/run-tests.d.ts.map +1 -0
- package/dist/scripts/run-tests.js +49 -0
- package/dist/scripts/run-tests.js.map +1 -0
- package/dist/scripts/sync-version.d.ts +14 -0
- package/dist/scripts/sync-version.d.ts.map +1 -0
- package/dist/scripts/sync-version.js +158 -0
- package/dist/scripts/sync-version.js.map +1 -0
- package/dist/scripts/test-credit-renewal.d.ts +2 -0
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -0
- package/dist/scripts/test-credit-renewal.js +329 -0
- package/dist/scripts/test-credit-renewal.js.map +1 -0
- package/dist/scripts/update.d.ts +24 -0
- package/dist/scripts/update.d.ts.map +1 -0
- package/dist/scripts/update.js +650 -0
- package/dist/scripts/update.js.map +1 -0
- package/dist/scripts/validate_bots.d.ts +16 -0
- package/dist/scripts/validate_bots.d.ts.map +1 -0
- package/dist/scripts/validate_bots.js +106 -0
- package/dist/scripts/validate_bots.js.map +1 -0
- package/dist/scripts/verify-browser-bundle.d.ts +22 -0
- package/dist/scripts/verify-browser-bundle.d.ts.map +1 -0
- package/dist/scripts/verify-browser-bundle.js +339 -0
- package/dist/scripts/verify-browser-bundle.js.map +1 -0
- package/dist/unlock.d.ts +48 -0
- package/dist/unlock.d.ts.map +1 -0
- package/dist/unlock.js +925 -0
- package/dist/unlock.js.map +1 -0
- package/package.json +112 -0
- package/scripts/README.md +356 -0
- package/scripts/clear-all.sh +195 -0
- package/scripts/clear-logs.sh +95 -0
- package/scripts/clear-market-adapter.sh +196 -0
- package/scripts/clear-orders.sh +113 -0
- package/scripts/create-bot-symlinks.sh +51 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/reset-settings.sh +118 -0
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { roundTo } = require('../../modules/utils/math_utils');
|
|
3
|
+
'use strict';
|
|
4
|
+
/**
|
|
5
|
+
* Derivative Analyzer
|
|
6
|
+
*
|
|
7
|
+
* Trend detection from the sign (and magnitude) of the slow SMA derivative.
|
|
8
|
+
*
|
|
9
|
+
* The analyzer intentionally stays narrow:
|
|
10
|
+
* - SMA for direction / regime
|
|
11
|
+
* - MACD for momentum
|
|
12
|
+
* - RSI for exhaustion and counter-trend filtering
|
|
13
|
+
*/
|
|
14
|
+
// ─── Simple Moving Average ───────────────────────────────────────────────────
|
|
15
|
+
class SMA {
|
|
16
|
+
period;
|
|
17
|
+
values;
|
|
18
|
+
constructor(period) {
|
|
19
|
+
this.period = period;
|
|
20
|
+
this.values = [];
|
|
21
|
+
}
|
|
22
|
+
update(price) {
|
|
23
|
+
this.values.push(price);
|
|
24
|
+
if (this.values.length > this.period)
|
|
25
|
+
this.values.shift();
|
|
26
|
+
if (this.values.length < this.period)
|
|
27
|
+
return null;
|
|
28
|
+
return this.values.reduce((a, b) => a + b, 0) / this.period;
|
|
29
|
+
}
|
|
30
|
+
isReady() { return this.values.length >= this.period; }
|
|
31
|
+
reset(period) { this.period = period; this.values = []; }
|
|
32
|
+
}
|
|
33
|
+
// ─── Exponential Moving Average ──────────────────────────────────────────────
|
|
34
|
+
class EMA {
|
|
35
|
+
period;
|
|
36
|
+
multiplier;
|
|
37
|
+
value;
|
|
38
|
+
count;
|
|
39
|
+
_sum;
|
|
40
|
+
constructor(period) {
|
|
41
|
+
this.period = period;
|
|
42
|
+
this.multiplier = 2 / (period + 1);
|
|
43
|
+
this.value = null;
|
|
44
|
+
this.count = 0;
|
|
45
|
+
this._sum = 0;
|
|
46
|
+
}
|
|
47
|
+
update(price) {
|
|
48
|
+
this.count++;
|
|
49
|
+
if (this.count < this.period) {
|
|
50
|
+
this._sum += price;
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (this.count === this.period) {
|
|
54
|
+
this._sum += price;
|
|
55
|
+
this.value = this._sum / this.period;
|
|
56
|
+
return this.value;
|
|
57
|
+
}
|
|
58
|
+
this.value = price * this.multiplier + this.value * (1 - this.multiplier);
|
|
59
|
+
return this.value;
|
|
60
|
+
}
|
|
61
|
+
isReady() { return this.count >= this.period; }
|
|
62
|
+
reset(period) {
|
|
63
|
+
this.period = period ?? this.period;
|
|
64
|
+
this.multiplier = 2 / (this.period + 1);
|
|
65
|
+
this.value = null;
|
|
66
|
+
this.count = 0;
|
|
67
|
+
this._sum = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// ─── MACD ─────────────────────────────────────────────────────────────────────
|
|
71
|
+
class MACD {
|
|
72
|
+
fastPeriod;
|
|
73
|
+
slowPeriod;
|
|
74
|
+
signalPeriod;
|
|
75
|
+
fastEma;
|
|
76
|
+
slowEma;
|
|
77
|
+
signalEma;
|
|
78
|
+
/**
|
|
79
|
+
* Moving Average Convergence Divergence
|
|
80
|
+
* macdLine = EMA(fast) - EMA(slow)
|
|
81
|
+
* signal = EMA(signalPeriod) of macdLine
|
|
82
|
+
* histogram = macdLine - signal
|
|
83
|
+
*/
|
|
84
|
+
constructor(fastPeriod = 12, slowPeriod = 26, signalPeriod = 9) {
|
|
85
|
+
this.fastPeriod = fastPeriod;
|
|
86
|
+
this.slowPeriod = slowPeriod;
|
|
87
|
+
this.signalPeriod = signalPeriod;
|
|
88
|
+
this.fastEma = new EMA(fastPeriod);
|
|
89
|
+
this.slowEma = new EMA(slowPeriod);
|
|
90
|
+
this.signalEma = new EMA(signalPeriod);
|
|
91
|
+
}
|
|
92
|
+
update(price) {
|
|
93
|
+
const fast = this.fastEma.update(price);
|
|
94
|
+
const slow = this.slowEma.update(price);
|
|
95
|
+
if (fast === null || slow === null)
|
|
96
|
+
return null;
|
|
97
|
+
const macdLine = fast - slow;
|
|
98
|
+
const signal = this.signalEma.update(macdLine);
|
|
99
|
+
if (signal === null)
|
|
100
|
+
return null;
|
|
101
|
+
return { macd: macdLine, signal, histogram: macdLine - signal };
|
|
102
|
+
}
|
|
103
|
+
isReady() { return this.slowEma.isReady() && this.signalEma.isReady(); }
|
|
104
|
+
reset(fastPeriod, slowPeriod, signalPeriod) {
|
|
105
|
+
this.fastPeriod = fastPeriod ?? this.fastPeriod;
|
|
106
|
+
this.slowPeriod = slowPeriod ?? this.slowPeriod;
|
|
107
|
+
this.signalPeriod = signalPeriod ?? this.signalPeriod;
|
|
108
|
+
this.fastEma.reset(this.fastPeriod);
|
|
109
|
+
this.slowEma.reset(this.slowPeriod);
|
|
110
|
+
this.signalEma.reset(this.signalPeriod);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// ─── RSI ──────────────────────────────────────────────────────────────────────
|
|
114
|
+
class RSI {
|
|
115
|
+
period;
|
|
116
|
+
count;
|
|
117
|
+
prevPrice;
|
|
118
|
+
avgGain;
|
|
119
|
+
avgLoss;
|
|
120
|
+
/**
|
|
121
|
+
* Relative Strength Index (Wilder smoothing)
|
|
122
|
+
* Overbought > 70, Oversold < 30
|
|
123
|
+
*/
|
|
124
|
+
constructor(period = 14) {
|
|
125
|
+
this.period = period;
|
|
126
|
+
this.count = 0;
|
|
127
|
+
this.prevPrice = null;
|
|
128
|
+
this.avgGain = 0;
|
|
129
|
+
this.avgLoss = 0;
|
|
130
|
+
}
|
|
131
|
+
update(price) {
|
|
132
|
+
if (this.prevPrice === null) {
|
|
133
|
+
this.prevPrice = price;
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const change = price - this.prevPrice;
|
|
137
|
+
this.prevPrice = price;
|
|
138
|
+
const gain = change > 0 ? change : 0;
|
|
139
|
+
const loss = change < 0 ? -change : 0;
|
|
140
|
+
this.count++;
|
|
141
|
+
if (this.count < this.period) {
|
|
142
|
+
this.avgGain += gain;
|
|
143
|
+
this.avgLoss += loss;
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
if (this.count === this.period) {
|
|
147
|
+
this.avgGain = (this.avgGain + gain) / this.period;
|
|
148
|
+
this.avgLoss = (this.avgLoss + loss) / this.period;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.avgGain = (this.avgGain * (this.period - 1) + gain) / this.period;
|
|
152
|
+
this.avgLoss = (this.avgLoss * (this.period - 1) + loss) / this.period;
|
|
153
|
+
}
|
|
154
|
+
if (this.avgLoss === 0)
|
|
155
|
+
return 100;
|
|
156
|
+
return 100 - (100 / (1 + this.avgGain / this.avgLoss));
|
|
157
|
+
}
|
|
158
|
+
isReady() { return this.count >= this.period; }
|
|
159
|
+
reset(period) {
|
|
160
|
+
this.period = period ?? this.period;
|
|
161
|
+
this.count = 0;
|
|
162
|
+
this.prevPrice = null;
|
|
163
|
+
this.avgGain = 0;
|
|
164
|
+
this.avgLoss = 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
class DerivativeAnalyzer {
|
|
168
|
+
minBarsForConfirmation;
|
|
169
|
+
slowSmaPeriod;
|
|
170
|
+
sma;
|
|
171
|
+
fastSmaPeriod;
|
|
172
|
+
fastSma;
|
|
173
|
+
macdConfig;
|
|
174
|
+
macd;
|
|
175
|
+
currMacd;
|
|
176
|
+
prevMacd;
|
|
177
|
+
rsiPeriod;
|
|
178
|
+
rsi;
|
|
179
|
+
currRsi;
|
|
180
|
+
prevRsi;
|
|
181
|
+
interpConfirmBars;
|
|
182
|
+
interpHoldBars;
|
|
183
|
+
rsiOverboughtLevel;
|
|
184
|
+
rsiOversoldLevel;
|
|
185
|
+
rsiBullThreshold;
|
|
186
|
+
rsiBearThreshold;
|
|
187
|
+
macdMinHist;
|
|
188
|
+
fastSmaCommitmentBars;
|
|
189
|
+
trendFilterEnabled;
|
|
190
|
+
trendFilterMinBars;
|
|
191
|
+
momentumGateEnabled;
|
|
192
|
+
momentumGateMinBars;
|
|
193
|
+
momentumGateRsiZone;
|
|
194
|
+
barsInMacdDivergence;
|
|
195
|
+
barsInRsiDivergence;
|
|
196
|
+
priceRegimeGateEnabled;
|
|
197
|
+
priceRegimeMinDistancePct;
|
|
198
|
+
prevRawInterp;
|
|
199
|
+
barsInRawInterp;
|
|
200
|
+
currInterpretation;
|
|
201
|
+
currInterpretationRaw;
|
|
202
|
+
pendingInterp;
|
|
203
|
+
pendingInterpBars;
|
|
204
|
+
entryBias;
|
|
205
|
+
isBullWeakEntry;
|
|
206
|
+
isBullConfirmation;
|
|
207
|
+
isLateBullWithoutWeak;
|
|
208
|
+
isBearWeakEntry;
|
|
209
|
+
isBearConfirmation;
|
|
210
|
+
isLateBearWithoutWeak;
|
|
211
|
+
bullEntrySetupActive;
|
|
212
|
+
bullEntrySetupConfirmed;
|
|
213
|
+
bearEntrySetupActive;
|
|
214
|
+
bearEntrySetupConfirmed;
|
|
215
|
+
prevSma;
|
|
216
|
+
currSma;
|
|
217
|
+
prevFastSma;
|
|
218
|
+
currFastSma;
|
|
219
|
+
prevPrice;
|
|
220
|
+
currPrice;
|
|
221
|
+
prevRawSmaTrend;
|
|
222
|
+
barsInSmaTrend;
|
|
223
|
+
prevRawFastSmaTrend;
|
|
224
|
+
barsInFastSmaTrend;
|
|
225
|
+
barsAboveFastSma;
|
|
226
|
+
barsBelowFastSma;
|
|
227
|
+
updateCount;
|
|
228
|
+
constructor(config = {}) {
|
|
229
|
+
this.minBarsForConfirmation = config.minBarsForConfirmation || 3;
|
|
230
|
+
// SMA (slow)
|
|
231
|
+
this.slowSmaPeriod = config.slowSmaPeriod ?? 500;
|
|
232
|
+
this.sma = this.slowSmaPeriod ? new SMA(this.slowSmaPeriod) : null;
|
|
233
|
+
// SMA (fast)
|
|
234
|
+
this.fastSmaPeriod = config.fastSmaPeriod ?? 100;
|
|
235
|
+
this.fastSma = this.fastSmaPeriod ? new SMA(this.fastSmaPeriod) : null;
|
|
236
|
+
// MACD
|
|
237
|
+
this.macdConfig = {
|
|
238
|
+
fastPeriod: config.macdFastPeriod ?? 12,
|
|
239
|
+
slowPeriod: config.macdSlowPeriod ?? 26,
|
|
240
|
+
signalPeriod: config.macdSignalPeriod ?? 9,
|
|
241
|
+
};
|
|
242
|
+
this.macd = new MACD(this.macdConfig.fastPeriod, this.macdConfig.slowPeriod, this.macdConfig.signalPeriod);
|
|
243
|
+
this.currMacd = null;
|
|
244
|
+
this.prevMacd = null;
|
|
245
|
+
// RSI
|
|
246
|
+
this.rsiPeriod = config.rsiPeriod ?? 14;
|
|
247
|
+
this.rsi = new RSI(this.rsiPeriod);
|
|
248
|
+
this.currRsi = null;
|
|
249
|
+
this.prevRsi = null;
|
|
250
|
+
// Interpretation state
|
|
251
|
+
this.interpConfirmBars = config.interpConfirmBars ?? 3;
|
|
252
|
+
this.interpHoldBars = config.interpHoldBars ?? 0;
|
|
253
|
+
this.rsiOverboughtLevel = config.rsiOverboughtLevel ?? 70;
|
|
254
|
+
this.rsiOversoldLevel = config.rsiOversoldLevel ?? 30;
|
|
255
|
+
this.rsiBullThreshold = config.rsiBullThreshold ?? 55;
|
|
256
|
+
this.rsiBearThreshold = config.rsiBearThreshold ?? 45;
|
|
257
|
+
this.macdMinHist = config.macdMinHist ?? 0;
|
|
258
|
+
this.fastSmaCommitmentBars = config.fastSmaCommitmentBars ?? 2;
|
|
259
|
+
this.trendFilterEnabled = config.trendFilterEnabled ?? false;
|
|
260
|
+
this.trendFilterMinBars = config.trendFilterMinBars ?? 3;
|
|
261
|
+
this.momentumGateEnabled = config.momentumGateEnabled ?? false;
|
|
262
|
+
this.momentumGateMinBars = config.momentumGateMinBars ?? 3;
|
|
263
|
+
this.momentumGateRsiZone = config.momentumGateRsiZone ?? 35;
|
|
264
|
+
this.barsInMacdDivergence = 0;
|
|
265
|
+
this.barsInRsiDivergence = 0;
|
|
266
|
+
this.priceRegimeGateEnabled = config.priceRegimeGateEnabled ?? true;
|
|
267
|
+
this.priceRegimeMinDistancePct = config.priceRegimeMinDistancePct ?? 0.35;
|
|
268
|
+
this.prevRawInterp = null;
|
|
269
|
+
this.barsInRawInterp = 0;
|
|
270
|
+
this.currInterpretation = 'NEUTRAL';
|
|
271
|
+
this.currInterpretationRaw = 'NEUTRAL';
|
|
272
|
+
this.pendingInterp = null;
|
|
273
|
+
this.pendingInterpBars = 0;
|
|
274
|
+
this.entryBias = 'NONE';
|
|
275
|
+
this.isBullWeakEntry = false;
|
|
276
|
+
this.isBullConfirmation = false;
|
|
277
|
+
this.isLateBullWithoutWeak = false;
|
|
278
|
+
this.isBearWeakEntry = false;
|
|
279
|
+
this.isBearConfirmation = false;
|
|
280
|
+
this.isLateBearWithoutWeak = false;
|
|
281
|
+
this.bullEntrySetupActive = false;
|
|
282
|
+
this.bullEntrySetupConfirmed = false;
|
|
283
|
+
this.bearEntrySetupActive = false;
|
|
284
|
+
this.bearEntrySetupConfirmed = false;
|
|
285
|
+
// Previous / current SMA values (for derivative)
|
|
286
|
+
this.prevSma = null;
|
|
287
|
+
this.currSma = null;
|
|
288
|
+
this.prevFastSma = null;
|
|
289
|
+
this.currFastSma = null;
|
|
290
|
+
this.prevPrice = null;
|
|
291
|
+
this.currPrice = null;
|
|
292
|
+
// Independent trend states
|
|
293
|
+
this.prevRawSmaTrend = null;
|
|
294
|
+
this.barsInSmaTrend = 0;
|
|
295
|
+
this.prevRawFastSmaTrend = null;
|
|
296
|
+
this.barsInFastSmaTrend = 0;
|
|
297
|
+
this.barsAboveFastSma = 0;
|
|
298
|
+
this.barsBelowFastSma = 0;
|
|
299
|
+
this.updateCount = 0;
|
|
300
|
+
}
|
|
301
|
+
update(price, timestamp = null) {
|
|
302
|
+
if (!Number.isFinite(price) || price <= 0) {
|
|
303
|
+
throw new Error('price must be a positive finite number');
|
|
304
|
+
}
|
|
305
|
+
// Update current price at the start of the bar (before interpretation)
|
|
306
|
+
this.prevPrice = this.currPrice;
|
|
307
|
+
this.currPrice = price;
|
|
308
|
+
// SMA (slow)
|
|
309
|
+
if (this.sma) {
|
|
310
|
+
this.prevSma = this.currSma;
|
|
311
|
+
this.currSma = this.sma.update(price);
|
|
312
|
+
}
|
|
313
|
+
// SMA (fast)
|
|
314
|
+
if (this.fastSma) {
|
|
315
|
+
this.prevFastSma = this.currFastSma;
|
|
316
|
+
this.currFastSma = this.fastSma.update(price);
|
|
317
|
+
}
|
|
318
|
+
// MACD — normalized as % of price so scale is comparable across all price levels
|
|
319
|
+
if (this.macd) {
|
|
320
|
+
this.prevMacd = this.currMacd;
|
|
321
|
+
const raw = this.macd.update(price);
|
|
322
|
+
if (raw !== null && price > 0) {
|
|
323
|
+
this.currMacd = {
|
|
324
|
+
macd: (raw.macd / price) * 100,
|
|
325
|
+
signal: (raw.signal / price) * 100,
|
|
326
|
+
histogram: (raw.histogram / price) * 100,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.currMacd = null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// RSI
|
|
334
|
+
if (this.rsi) {
|
|
335
|
+
this.prevRsi = this.currRsi;
|
|
336
|
+
this.currRsi = this.rsi.update(price);
|
|
337
|
+
}
|
|
338
|
+
// Advance momentum divergence counters (for Momentum Gate optimization)
|
|
339
|
+
this._advanceMomentumDivergence();
|
|
340
|
+
// Fast-SMA commitment tracking: price vs fast MA position
|
|
341
|
+
this._advancePriceFastSmaPosition();
|
|
342
|
+
// Interpretation (computed after MACD + RSI are updated)
|
|
343
|
+
if (this.macd || this.rsi) {
|
|
344
|
+
const prevInterpretation = this.currInterpretation;
|
|
345
|
+
this._resetEntryBias();
|
|
346
|
+
let rawInterp = this.trendFilterEnabled
|
|
347
|
+
? this._applyTrendFilter(this._computeInterpretation())
|
|
348
|
+
: this._computeInterpretation();
|
|
349
|
+
// Opt 13 — Post-filter MACD line gate (bull/bear trap suppression)
|
|
350
|
+
// The MACD line is the authoritative momentum regime indicator:
|
|
351
|
+
// line > threshold → bullish regime; line < -threshold → bearish regime.
|
|
352
|
+
// Any signal that contradicts the confirmed regime is suppressed to NEUTRAL.
|
|
353
|
+
// This ignores marginal crossings at ~0 and ensures signals only start when
|
|
354
|
+
// momentum is clearly confirmed.
|
|
355
|
+
if (this.macd && this.currMacd !== null) {
|
|
356
|
+
const threshold = this.macdMinHist || 0.02;
|
|
357
|
+
if ((rawInterp === 'BEAR' || rawInterp === 'BEAR_WEAK') && this.currMacd.macd > -threshold)
|
|
358
|
+
rawInterp = 'NEUTRAL';
|
|
359
|
+
if ((rawInterp === 'BULL' || rawInterp === 'BULL_WEAK') && this.currMacd.macd < threshold)
|
|
360
|
+
rawInterp = 'NEUTRAL';
|
|
361
|
+
}
|
|
362
|
+
this.currInterpretationRaw = rawInterp;
|
|
363
|
+
// BULL/BEAR require confirmation bars; other states are immediate
|
|
364
|
+
if (rawInterp === 'BULL' || rawInterp === 'BEAR') {
|
|
365
|
+
// Check if fast-SMA commitment is met (required before counting confirmation)
|
|
366
|
+
let fastSmaPassesCommitment = true;
|
|
367
|
+
if (this.fastSma && this.currFastSma !== null && this.currPrice !== null) {
|
|
368
|
+
if (rawInterp === 'BULL') {
|
|
369
|
+
fastSmaPassesCommitment = this.barsAboveFastSma >= this.fastSmaCommitmentBars;
|
|
370
|
+
}
|
|
371
|
+
else if (rawInterp === 'BEAR') {
|
|
372
|
+
fastSmaPassesCommitment = this.barsBelowFastSma >= this.fastSmaCommitmentBars;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// Only count confirmation bars if the fast-SMA commitment passes
|
|
376
|
+
if (fastSmaPassesCommitment) {
|
|
377
|
+
if (rawInterp === this.prevRawInterp) {
|
|
378
|
+
this.barsInRawInterp++;
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
this.prevRawInterp = rawInterp;
|
|
382
|
+
this.barsInRawInterp = 1;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
// Commitment not met — reset confirmation counter
|
|
387
|
+
this.prevRawInterp = rawInterp === 'BULL' ? 'BEAR' : 'BULL';
|
|
388
|
+
this.barsInRawInterp = 0;
|
|
389
|
+
}
|
|
390
|
+
const confirmed = this.barsInRawInterp >= this.interpConfirmBars
|
|
391
|
+
? rawInterp : 'NEUTRAL';
|
|
392
|
+
this._applyWithHysteresis(confirmed);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
this.prevRawInterp = rawInterp;
|
|
396
|
+
this.barsInRawInterp = 0;
|
|
397
|
+
this._applyWithHysteresis(rawInterp);
|
|
398
|
+
}
|
|
399
|
+
this._advanceEntryBias(prevInterpretation);
|
|
400
|
+
}
|
|
401
|
+
this.updateCount++;
|
|
402
|
+
// Update trend states
|
|
403
|
+
const smaRaw = this._rawSmaTrend();
|
|
404
|
+
const fastSmaRaw = this._rawFastSmaTrend();
|
|
405
|
+
this._advanceTrend(smaRaw, 'Sma');
|
|
406
|
+
this._advanceTrend(fastSmaRaw, 'FastSma');
|
|
407
|
+
const result = this.getAnalysis();
|
|
408
|
+
if (timestamp !== null)
|
|
409
|
+
result.timestamp = timestamp;
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
_advanceTrend(raw, key) {
|
|
413
|
+
const prevKey = `prevRaw${key}Trend`;
|
|
414
|
+
const barsKey = `barsIn${key}Trend`;
|
|
415
|
+
if (raw !== this[prevKey]) {
|
|
416
|
+
this[prevKey] = raw;
|
|
417
|
+
this[barsKey] = 1;
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
this[barsKey]++;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
// ── Derivative signs ───────────────────────────────────────
|
|
424
|
+
_rawSmaTrend() {
|
|
425
|
+
if (!this.sma || this.prevSma === null || this.currSma === null)
|
|
426
|
+
return 'NEUTRAL';
|
|
427
|
+
if (this.currSma > this.prevSma)
|
|
428
|
+
return 'UP';
|
|
429
|
+
if (this.currSma < this.prevSma)
|
|
430
|
+
return 'DOWN';
|
|
431
|
+
return 'NEUTRAL';
|
|
432
|
+
}
|
|
433
|
+
_rawFastSmaTrend() {
|
|
434
|
+
if (!this.fastSma || this.prevFastSma === null || this.currFastSma === null)
|
|
435
|
+
return 'NEUTRAL';
|
|
436
|
+
if (this.currFastSma > this.prevFastSma)
|
|
437
|
+
return 'UP';
|
|
438
|
+
if (this.currFastSma < this.prevFastSma)
|
|
439
|
+
return 'DOWN';
|
|
440
|
+
return 'NEUTRAL';
|
|
441
|
+
}
|
|
442
|
+
_advancePriceFastSmaPosition() {
|
|
443
|
+
if (!this.fastSma || this.currFastSma === null || this.currPrice === null) {
|
|
444
|
+
this.barsAboveFastSma = 0;
|
|
445
|
+
this.barsBelowFastSma = 0;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (this.currPrice > this.currFastSma) {
|
|
449
|
+
this.barsAboveFastSma++;
|
|
450
|
+
this.barsBelowFastSma = 0;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
this.barsBelowFastSma++;
|
|
454
|
+
this.barsAboveFastSma = 0;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
_advanceMomentumDivergence() {
|
|
458
|
+
if (!this.momentumGateEnabled || !this.macd || !this.rsi || !this.sma)
|
|
459
|
+
return;
|
|
460
|
+
if (this.currMacd === null || this.currRsi === null)
|
|
461
|
+
return;
|
|
462
|
+
const slowDir = this._rawSmaTrend();
|
|
463
|
+
if (slowDir === 'NEUTRAL') {
|
|
464
|
+
this.barsInMacdDivergence = 0;
|
|
465
|
+
this.barsInRsiDivergence = 0;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const macdOpposes = (slowDir === 'UP' && this.currMacd.histogram < -this.macdMinHist) ||
|
|
469
|
+
(slowDir === 'DOWN' && this.currMacd.histogram > this.macdMinHist);
|
|
470
|
+
const rsiOpposes = (slowDir === 'UP' && this.currRsi < this.momentumGateRsiZone) ||
|
|
471
|
+
(slowDir === 'DOWN' && this.currRsi > (100 - this.momentumGateRsiZone));
|
|
472
|
+
this.barsInMacdDivergence = macdOpposes ? this.barsInMacdDivergence + 1 : 0;
|
|
473
|
+
this.barsInRsiDivergence = rsiOpposes ? this.barsInRsiDivergence + 1 : 0;
|
|
474
|
+
}
|
|
475
|
+
// ── Trend filter ─────────────────────────────────────────
|
|
476
|
+
_applyTrendFilter(interp) {
|
|
477
|
+
// OB/OS are exit signals — not suppressed by trend direction
|
|
478
|
+
if (interp === 'OVERBOUGHT' || interp === 'OVERSOLD')
|
|
479
|
+
return interp;
|
|
480
|
+
// Compute fast MA direction and sustained bars count
|
|
481
|
+
let fastDir, fastBarsInDir;
|
|
482
|
+
if (this.fastSma) {
|
|
483
|
+
fastDir = this._rawFastSmaTrend();
|
|
484
|
+
fastBarsInDir = (fastDir === this.prevRawFastSmaTrend ? this.barsInFastSmaTrend + 1 : 1);
|
|
485
|
+
}
|
|
486
|
+
else if (this.sma) {
|
|
487
|
+
fastDir = this._rawSmaTrend();
|
|
488
|
+
fastBarsInDir = (fastDir === this.prevRawSmaTrend ? this.barsInSmaTrend + 1 : 1);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
return interp;
|
|
492
|
+
}
|
|
493
|
+
if (fastDir === 'NEUTRAL')
|
|
494
|
+
return interp;
|
|
495
|
+
// Primary gate: fast MA sustained in opposite direction → suppress to NEUTRAL
|
|
496
|
+
let suppressedByTrendFilter = false;
|
|
497
|
+
if (fastBarsInDir >= this.trendFilterMinBars) {
|
|
498
|
+
if (fastDir === 'UP' && (interp === 'BEAR' || interp === 'BEAR_WEAK')) {
|
|
499
|
+
interp = 'NEUTRAL';
|
|
500
|
+
suppressedByTrendFilter = true;
|
|
501
|
+
}
|
|
502
|
+
if (fastDir === 'DOWN' && (interp === 'BULL' || interp === 'BULL_WEAK')) {
|
|
503
|
+
interp = 'NEUTRAL';
|
|
504
|
+
suppressedByTrendFilter = true;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
// Momentum Gate (Opt 11): if MACD + RSI both diverge from SMA(500) for
|
|
508
|
+
// >= momentumGateMinBars, allow signal through as WEAK instead of suppressing to NEUTRAL.
|
|
509
|
+
if (suppressedByTrendFilter && this.momentumGateEnabled && this.sma) {
|
|
510
|
+
const slowDir = this._rawSmaTrend();
|
|
511
|
+
const macdConf = this.barsInMacdDivergence >= this.momentumGateMinBars;
|
|
512
|
+
const rsiConf = this.barsInRsiDivergence >= this.momentumGateMinBars;
|
|
513
|
+
if (macdConf && rsiConf && slowDir !== 'NEUTRAL') {
|
|
514
|
+
if (slowDir === 'UP' && (this.currMacd?.histogram ?? 0) < -this.macdMinHist) {
|
|
515
|
+
interp = 'BEAR_WEAK';
|
|
516
|
+
}
|
|
517
|
+
if (slowDir === 'DOWN' && (this.currMacd?.histogram ?? 0) > this.macdMinHist) {
|
|
518
|
+
interp = 'BULL_WEAK';
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
// Macro regime gate: when fastSMA and SMA(slow) are both present and disagree,
|
|
523
|
+
// cap full BULL/BEAR to WEAK — a short-term dip/bounce against the macro trend
|
|
524
|
+
// does not warrant a confirmed directional signal.
|
|
525
|
+
if (this._violatesMacroDisagreeGate(interp, fastDir)) {
|
|
526
|
+
if (interp === 'BULL')
|
|
527
|
+
return 'BULL_WEAK';
|
|
528
|
+
if (interp === 'BEAR')
|
|
529
|
+
return 'BEAR_WEAK';
|
|
530
|
+
}
|
|
531
|
+
// Fast-SMA commitment gate — price vs fast MA cross-check (N-bar commitment required)
|
|
532
|
+
if (this.fastSma && this.currFastSma !== null && this.currPrice !== null) {
|
|
533
|
+
if (interp === 'BULL' && this.barsAboveFastSma < this.fastSmaCommitmentBars)
|
|
534
|
+
return 'BULL_WEAK';
|
|
535
|
+
if (interp === 'BEAR' && this.barsBelowFastSma < this.fastSmaCommitmentBars)
|
|
536
|
+
return 'BEAR_WEAK';
|
|
537
|
+
}
|
|
538
|
+
// Opt 12 — MACD Line & Histogram regime check
|
|
539
|
+
if (this.macd && this.currMacd !== null) {
|
|
540
|
+
if (interp === 'BULL' && this.currMacd.macd <= 0)
|
|
541
|
+
return 'BULL_WEAK';
|
|
542
|
+
if (interp === 'BEAR' && this.currMacd.macd >= 0)
|
|
543
|
+
return 'BEAR_WEAK';
|
|
544
|
+
if (interp === 'BEAR' && this.currMacd.histogram > 0)
|
|
545
|
+
return 'BEAR_WEAK';
|
|
546
|
+
}
|
|
547
|
+
// Macro price regime gate: require a minimum clearance beyond slow SMA.
|
|
548
|
+
if (this._violatesPriceRegimeGate(interp))
|
|
549
|
+
return 'NEUTRAL';
|
|
550
|
+
return interp;
|
|
551
|
+
}
|
|
552
|
+
// ── Hysteresis ────────────────────────────────────────────
|
|
553
|
+
_applyWithHysteresis(newInterp) {
|
|
554
|
+
// OB/OS are exit signals — always immediate, bypass hold
|
|
555
|
+
if (newInterp === 'OVERBOUGHT' || newInterp === 'OVERSOLD') {
|
|
556
|
+
this.currInterpretation = newInterp;
|
|
557
|
+
this.pendingInterp = null;
|
|
558
|
+
this.pendingInterpBars = 0;
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const curr = this.currInterpretation;
|
|
562
|
+
const isDowngrade = (curr === 'BULL' && newInterp !== 'BULL')
|
|
563
|
+
|| (curr === 'BEAR' && newInterp !== 'BEAR');
|
|
564
|
+
// Hard regime gates define when a confirmed signal is no longer valid at all.
|
|
565
|
+
// In those cases hysteresis must not keep a stale BULL/BEAR alive after invalidation.
|
|
566
|
+
const hardInvalidation = this._isHardInvalidation(curr);
|
|
567
|
+
if (!isDowngrade || this.interpHoldBars <= 0 || hardInvalidation) {
|
|
568
|
+
this.currInterpretation = newInterp;
|
|
569
|
+
this.pendingInterp = null;
|
|
570
|
+
this.pendingInterpBars = 0;
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
// Debounce the downgrade — must hold for interpHoldBars bars
|
|
574
|
+
if (newInterp === this.pendingInterp) {
|
|
575
|
+
this.pendingInterpBars++;
|
|
576
|
+
if (this.pendingInterpBars >= this.interpHoldBars) {
|
|
577
|
+
this.currInterpretation = newInterp;
|
|
578
|
+
this.pendingInterp = null;
|
|
579
|
+
this.pendingInterpBars = 0;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
this.pendingInterp = newInterp;
|
|
584
|
+
this.pendingInterpBars = 1;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
_resetEntryBias() {
|
|
588
|
+
this.entryBias = 'NONE';
|
|
589
|
+
this.isBullWeakEntry = false;
|
|
590
|
+
this.isBullConfirmation = false;
|
|
591
|
+
this.isLateBullWithoutWeak = false;
|
|
592
|
+
this.isBearWeakEntry = false;
|
|
593
|
+
this.isBearConfirmation = false;
|
|
594
|
+
this.isLateBearWithoutWeak = false;
|
|
595
|
+
}
|
|
596
|
+
_advanceEntryBias(prevInterpretation) {
|
|
597
|
+
const curr = this.currInterpretation;
|
|
598
|
+
const slowDir = this._rawSmaTrend();
|
|
599
|
+
const fastDir = this.fastSma ? this._rawFastSmaTrend() : slowDir;
|
|
600
|
+
const prevBullish = prevInterpretation === 'BULL' || prevInterpretation === 'BULL_WEAK';
|
|
601
|
+
const currBullish = curr === 'BULL' || curr === 'BULL_WEAK';
|
|
602
|
+
const prevBearish = prevInterpretation === 'BEAR' || prevInterpretation === 'BEAR_WEAK';
|
|
603
|
+
const currBearish = curr === 'BEAR' || curr === 'BEAR_WEAK';
|
|
604
|
+
const bullMacroAligned = slowDir === 'UP';
|
|
605
|
+
const bearMacroAligned = slowDir === 'DOWN';
|
|
606
|
+
const bullEntryAligned = bullMacroAligned && fastDir === 'UP';
|
|
607
|
+
const bearEntryAligned = bearMacroAligned && fastDir === 'DOWN';
|
|
608
|
+
if (!currBullish) {
|
|
609
|
+
this.bullEntrySetupActive = false;
|
|
610
|
+
this.bullEntrySetupConfirmed = false;
|
|
611
|
+
}
|
|
612
|
+
// Keep weak bullish states visible on the chart, but do not emit long
|
|
613
|
+
// entry events until both slow and fast SMA trends are aligned up.
|
|
614
|
+
if (!bullEntryAligned) {
|
|
615
|
+
this.bullEntrySetupActive = false;
|
|
616
|
+
this.bullEntrySetupConfirmed = false;
|
|
617
|
+
}
|
|
618
|
+
else if (curr === 'BULL_WEAK' && (!prevBullish || !this.bullEntrySetupActive)) {
|
|
619
|
+
this.bullEntrySetupActive = true;
|
|
620
|
+
this.bullEntrySetupConfirmed = false;
|
|
621
|
+
this.entryBias = 'EARLY_LONG';
|
|
622
|
+
this.isBullWeakEntry = true;
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (curr === 'BULL' && prevInterpretation !== 'BULL') {
|
|
626
|
+
if (this.bullEntrySetupActive && !this.bullEntrySetupConfirmed) {
|
|
627
|
+
this.bullEntrySetupConfirmed = true;
|
|
628
|
+
this.entryBias = 'CONFIRM_LONG';
|
|
629
|
+
this.isBullConfirmation = true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (!currBearish) {
|
|
633
|
+
this.bearEntrySetupActive = false;
|
|
634
|
+
this.bearEntrySetupConfirmed = false;
|
|
635
|
+
}
|
|
636
|
+
// Keep weak bearish states visible on the chart, but do not emit short
|
|
637
|
+
// entry events until both slow and fast SMA trends are aligned down.
|
|
638
|
+
if (!bearEntryAligned) {
|
|
639
|
+
this.bearEntrySetupActive = false;
|
|
640
|
+
this.bearEntrySetupConfirmed = false;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (curr === 'BEAR_WEAK' && (!prevBearish || !this.bearEntrySetupActive)) {
|
|
644
|
+
this.bearEntrySetupActive = true;
|
|
645
|
+
this.bearEntrySetupConfirmed = false;
|
|
646
|
+
this.entryBias = 'EARLY_SHORT';
|
|
647
|
+
this.isBearWeakEntry = true;
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (curr === 'BEAR' && prevInterpretation !== 'BEAR') {
|
|
651
|
+
if (this.bearEntrySetupActive && !this.bearEntrySetupConfirmed) {
|
|
652
|
+
this.bearEntrySetupConfirmed = true;
|
|
653
|
+
this.entryBias = 'CONFIRM_SHORT';
|
|
654
|
+
this.isBearConfirmation = true;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
_isHardInvalidation(interp) {
|
|
659
|
+
if (interp !== 'BULL' && interp !== 'BEAR')
|
|
660
|
+
return false;
|
|
661
|
+
if (this.macd && this.currMacd !== null) {
|
|
662
|
+
const threshold = this.macdMinHist || 0.02;
|
|
663
|
+
if (interp === 'BULL' && this.currMacd.macd < threshold)
|
|
664
|
+
return true;
|
|
665
|
+
if (interp === 'BEAR' && this.currMacd.macd > -threshold)
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
if (this._violatesMacroDisagreeGate(interp))
|
|
669
|
+
return true;
|
|
670
|
+
if (this._violatesPriceRegimeGate(interp))
|
|
671
|
+
return true;
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
_violatesMacroDisagreeGate(interp, fastDirOverride = null) {
|
|
675
|
+
if (!this.trendFilterEnabled || !this.fastSma || !this.sma)
|
|
676
|
+
return false;
|
|
677
|
+
if (interp !== 'BULL' && interp !== 'BEAR')
|
|
678
|
+
return false;
|
|
679
|
+
const fastDir = fastDirOverride ?? this._rawFastSmaTrend();
|
|
680
|
+
const slowDir = this._rawSmaTrend();
|
|
681
|
+
const slowBarsInDir = (slowDir === this.prevRawSmaTrend ? this.barsInSmaTrend + 1 : 1);
|
|
682
|
+
if (fastDir === 'NEUTRAL' || slowDir === 'NEUTRAL')
|
|
683
|
+
return false;
|
|
684
|
+
if (slowBarsInDir < this.trendFilterMinBars)
|
|
685
|
+
return false;
|
|
686
|
+
if (fastDir === slowDir)
|
|
687
|
+
return false;
|
|
688
|
+
return fastDir !== slowDir;
|
|
689
|
+
}
|
|
690
|
+
_violatesPriceRegimeGate(interp) {
|
|
691
|
+
if (!this.priceRegimeGateEnabled || !this.sma || this.currSma === null || this.currPrice === null) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
if (!['BULL', 'BULL_WEAK', 'BEAR', 'BEAR_WEAK'].includes(interp))
|
|
695
|
+
return false;
|
|
696
|
+
const distanceMultiplier = this.priceRegimeMinDistancePct / 100;
|
|
697
|
+
const bullFloor = this.currSma * (1 + distanceMultiplier);
|
|
698
|
+
const bearCeiling = this.currSma * (1 - distanceMultiplier);
|
|
699
|
+
if ((interp === 'BULL' || interp === 'BULL_WEAK') && this.currPrice < bullFloor)
|
|
700
|
+
return true;
|
|
701
|
+
if ((interp === 'BEAR' || interp === 'BEAR_WEAK') && this.currPrice > bearCeiling)
|
|
702
|
+
return true;
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
// ── Interpretation ────────────────────────────────────────
|
|
706
|
+
_computeInterpretation() {
|
|
707
|
+
const hist = this.currMacd?.histogram ?? null;
|
|
708
|
+
const macdLine = this.currMacd?.macd ?? null;
|
|
709
|
+
const macdSig = this.currMacd?.signal ?? null;
|
|
710
|
+
const prevHist = this.prevMacd?.histogram ?? null;
|
|
711
|
+
const prevMacdLine = this.prevMacd?.macd ?? null;
|
|
712
|
+
const rsi = this.currRsi;
|
|
713
|
+
if (hist === null && rsi === null)
|
|
714
|
+
return 'NEUTRAL';
|
|
715
|
+
// 1. MACD histogram sign with minimum magnitude filter
|
|
716
|
+
const histBull = hist !== null && hist > this.macdMinHist;
|
|
717
|
+
const histBear = hist !== null && hist < -this.macdMinHist;
|
|
718
|
+
// 2. MACD histogram momentum
|
|
719
|
+
const histMom = (hist !== null && prevHist !== null) ? hist - prevHist : null;
|
|
720
|
+
const histWeakeningBull = histBull && histMom !== null && histMom < 0;
|
|
721
|
+
const histWeakeningBear = histBear && histMom !== null && histMom > 0;
|
|
722
|
+
// 3. MACD zero-line position
|
|
723
|
+
const macdAboveZero = macdLine !== null && macdLine > 0;
|
|
724
|
+
const macdBelowZero = macdLine !== null && macdLine < 0;
|
|
725
|
+
// 5. MACD line slope — is the MACD line itself rising or falling?
|
|
726
|
+
const macdLineSlope = (macdLine !== null && prevMacdLine !== null) ? macdLine - prevMacdLine : null;
|
|
727
|
+
const macdLineRising = macdLineSlope !== null && macdLineSlope > 0;
|
|
728
|
+
const macdLineFalling = macdLineSlope !== null && macdLineSlope < 0;
|
|
729
|
+
// 6. RSI extremes (highest priority — exit signals)
|
|
730
|
+
const rsiOverbought = rsi !== null && rsi > this.rsiOverboughtLevel;
|
|
731
|
+
const rsiOversold = rsi !== null && rsi < this.rsiOversoldLevel;
|
|
732
|
+
// 7. RSI direction — rising or falling?
|
|
733
|
+
const rsiSlope = (rsi !== null && this.prevRsi !== null) ? rsi - this.prevRsi : null;
|
|
734
|
+
const rsiRising = rsiSlope !== null && rsiSlope > 0;
|
|
735
|
+
const rsiFalling = rsiSlope !== null && rsiSlope < 0;
|
|
736
|
+
// 8. RSI counter-trend: in opposing zone AND not recovering (direction confirms divergence)
|
|
737
|
+
const rsiCounterBull = rsi !== null && rsi < this.rsiBearThreshold && !rsiRising;
|
|
738
|
+
const rsiCounterBear = rsi !== null && rsi > this.rsiBullThreshold && !rsiFalling;
|
|
739
|
+
// Base signal driven by MACD histogram (RSI no longer hard-gates)
|
|
740
|
+
let raw = 'NEUTRAL';
|
|
741
|
+
if (histBull)
|
|
742
|
+
raw = 'BULL';
|
|
743
|
+
if (histBear)
|
|
744
|
+
raw = 'BEAR';
|
|
745
|
+
// RSI extreme exit — override immediately
|
|
746
|
+
if (raw === 'BULL' && rsiOverbought)
|
|
747
|
+
return 'OVERBOUGHT';
|
|
748
|
+
if (raw === 'BEAR' && rsiOversold)
|
|
749
|
+
return 'OVERSOLD';
|
|
750
|
+
// Weak conditions:
|
|
751
|
+
// histFading: histogram shrinking AND MACD line not supporting (any zero position)
|
|
752
|
+
// dualWeak: histogram positive but MACD line still on wrong side of zero AND not recovering
|
|
753
|
+
// rsiCounter: RSI in counter-trend territory AND direction confirms (standalone)
|
|
754
|
+
//
|
|
755
|
+
// Note: histogram = MACD line − Signal line, so macdBelowSignal is always false when
|
|
756
|
+
// histBull is true. Signal line crossover is not a valid structural check here.
|
|
757
|
+
const histFadingBull = histWeakeningBull && !macdLineRising;
|
|
758
|
+
const histFadingBear = histWeakeningBear && !macdLineFalling;
|
|
759
|
+
const dualWeakBull = histBull && macdBelowZero && !macdLineRising;
|
|
760
|
+
const dualWeakBear = histBear && macdAboveZero && !macdLineFalling;
|
|
761
|
+
const bullWeak = histFadingBull || dualWeakBull || rsiCounterBull;
|
|
762
|
+
const bearWeak = histFadingBear || dualWeakBear || rsiCounterBear;
|
|
763
|
+
if (raw === 'BULL' && bullWeak)
|
|
764
|
+
return 'BULL_WEAK';
|
|
765
|
+
if (raw === 'BEAR' && bearWeak)
|
|
766
|
+
return 'BEAR_WEAK';
|
|
767
|
+
return raw;
|
|
768
|
+
}
|
|
769
|
+
// ── Analysis ───────────────────────────────────────────────
|
|
770
|
+
getAnalysis() {
|
|
771
|
+
const warmupNeeded = Math.max(this.sma ? this.slowSmaPeriod : 0, this.fastSma ? this.fastSmaPeriod : 0, this.macd ? this.macdConfig.slowPeriod + this.macdConfig.signalPeriod : 0, this.rsi ? this.rsiPeriod + 1 : 0);
|
|
772
|
+
if (this.updateCount < warmupNeeded) {
|
|
773
|
+
return {
|
|
774
|
+
isReady: false,
|
|
775
|
+
reason: `Warming up: ${this.updateCount}/${warmupNeeded} candles`,
|
|
776
|
+
trend: 'NEUTRAL', confidence: 0, isConfirmed: false,
|
|
777
|
+
...this._emptySignals(),
|
|
778
|
+
price: this.currPrice, updateCount: this.updateCount,
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
const smaRaw = this._rawSmaTrend();
|
|
782
|
+
const fastSmaRaw = this._rawFastSmaTrend();
|
|
783
|
+
const smaConf = this._conf(smaRaw, this.barsInSmaTrend);
|
|
784
|
+
const fastSmaConf = this._conf(fastSmaRaw, this.barsInFastSmaTrend);
|
|
785
|
+
const smaConfirmed = smaRaw !== 'NEUTRAL' && this.barsInSmaTrend >= this.minBarsForConfirmation;
|
|
786
|
+
const fastSmaConfirmed = fastSmaRaw !== 'NEUTRAL' && this.barsInFastSmaTrend >= this.minBarsForConfirmation;
|
|
787
|
+
// Primary: fastSMA > SMA
|
|
788
|
+
const primary = this.fastSma ? fastSmaRaw : smaRaw;
|
|
789
|
+
const primConf = this.fastSma ? fastSmaConf : smaConf;
|
|
790
|
+
const primConfirm = this.fastSma ? fastSmaConfirmed : smaConfirmed;
|
|
791
|
+
return {
|
|
792
|
+
isReady: true,
|
|
793
|
+
trend: primConfirm ? primary : 'NEUTRAL',
|
|
794
|
+
confidence: primConf,
|
|
795
|
+
isConfirmed: primConfirm,
|
|
796
|
+
rawTrend: primary,
|
|
797
|
+
barsInTrend: this.fastSma ? this.barsInFastSmaTrend : this.barsInSmaTrend,
|
|
798
|
+
// SMA (slow)
|
|
799
|
+
smaRawTrend: smaRaw,
|
|
800
|
+
smaTrend: smaConfirmed ? smaRaw : 'NEUTRAL',
|
|
801
|
+
smaBarsInTrend: this.barsInSmaTrend,
|
|
802
|
+
smaConfidence: smaConf,
|
|
803
|
+
// SMA (fast)
|
|
804
|
+
fastSmaRawTrend: fastSmaRaw,
|
|
805
|
+
fastSmaTrend: fastSmaConfirmed ? fastSmaRaw : 'NEUTRAL',
|
|
806
|
+
fastSmaBarsInTrend: this.barsInFastSmaTrend,
|
|
807
|
+
fastSmaConfidence: fastSmaConf,
|
|
808
|
+
fastSmaValue: this.currFastSma !== null ? roundTo(this.currFastSma, 1e6) : null,
|
|
809
|
+
// MACD
|
|
810
|
+
macdLine: this.currMacd ? roundTo(this.currMacd.macd, 1e8) : null,
|
|
811
|
+
macdSignal: this.currMacd ? roundTo(this.currMacd.signal, 1e8) : null,
|
|
812
|
+
macdHistogram: this.currMacd ? roundTo(this.currMacd.histogram, 1e8) : null,
|
|
813
|
+
macdTrend: this.currMacd
|
|
814
|
+
? (this.currMacd.histogram > 0 ? 'BULL' : this.currMacd.histogram < 0 ? 'BEAR' : 'NEUTRAL')
|
|
815
|
+
: null,
|
|
816
|
+
// RSI
|
|
817
|
+
rsi: this.currRsi !== null ? roundTo(this.currRsi, 100) : null,
|
|
818
|
+
rsiZone: this.currRsi !== null
|
|
819
|
+
? (this.currRsi > this.rsiOverboughtLevel ? 'OVERBOUGHT' : this.currRsi < this.rsiOversoldLevel ? 'OVERSOLD' : 'NEUTRAL')
|
|
820
|
+
: null,
|
|
821
|
+
// Combined interpretation
|
|
822
|
+
interpretation: this.currInterpretation,
|
|
823
|
+
interpretationRaw: this.currInterpretationRaw,
|
|
824
|
+
interpretationBars: this.barsInRawInterp,
|
|
825
|
+
entryBias: this.entryBias,
|
|
826
|
+
isBullWeakEntry: this.isBullWeakEntry,
|
|
827
|
+
isBullConfirmation: this.isBullConfirmation,
|
|
828
|
+
isLateBullWithoutWeak: this.isLateBullWithoutWeak,
|
|
829
|
+
isBearWeakEntry: this.isBearWeakEntry,
|
|
830
|
+
isBearConfirmation: this.isBearConfirmation,
|
|
831
|
+
isLateBearWithoutWeak: this.isLateBearWithoutWeak,
|
|
832
|
+
// Values
|
|
833
|
+
price: this.currPrice,
|
|
834
|
+
slowSma: this.currSma !== null ? roundTo(this.currSma, 1e6) : null,
|
|
835
|
+
updateCount: this.updateCount,
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
_conf(raw, bars) {
|
|
839
|
+
return raw !== 'NEUTRAL' ? Math.min(100, Math.round((bars / 20) * 100)) : 0;
|
|
840
|
+
}
|
|
841
|
+
_emptySignals() {
|
|
842
|
+
return {
|
|
843
|
+
smaRawTrend: 'NEUTRAL', smaTrend: 'NEUTRAL', smaBarsInTrend: 0, smaConfidence: 0,
|
|
844
|
+
fastSmaRawTrend: 'NEUTRAL', fastSmaTrend: 'NEUTRAL', fastSmaBarsInTrend: 0, fastSmaConfidence: 0, fastSmaValue: null,
|
|
845
|
+
slowSma: null,
|
|
846
|
+
macdLine: null, macdSignal: null, macdHistogram: null, macdTrend: null,
|
|
847
|
+
rsi: null, rsiZone: null,
|
|
848
|
+
interpretation: 'NEUTRAL', interpretationRaw: 'NEUTRAL', interpretationBars: 0,
|
|
849
|
+
entryBias: 'NONE',
|
|
850
|
+
isBullWeakEntry: false,
|
|
851
|
+
isBullConfirmation: false,
|
|
852
|
+
isLateBullWithoutWeak: false,
|
|
853
|
+
isBearWeakEntry: false,
|
|
854
|
+
isBearConfirmation: false,
|
|
855
|
+
isLateBearWithoutWeak: false,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
reset() {
|
|
859
|
+
if (this.sma)
|
|
860
|
+
this.sma.reset(this.slowSmaPeriod);
|
|
861
|
+
if (this.fastSma)
|
|
862
|
+
this.fastSma.reset(this.fastSmaPeriod);
|
|
863
|
+
if (this.macd)
|
|
864
|
+
this.macd.reset(this.macdConfig.fastPeriod, this.macdConfig.slowPeriod, this.macdConfig.signalPeriod);
|
|
865
|
+
if (this.rsi)
|
|
866
|
+
this.rsi.reset(this.rsiPeriod);
|
|
867
|
+
this.currMacd = null;
|
|
868
|
+
this.prevMacd = null;
|
|
869
|
+
this.currRsi = null;
|
|
870
|
+
this.prevRawInterp = null;
|
|
871
|
+
this.barsInRawInterp = 0;
|
|
872
|
+
this.currInterpretation = 'NEUTRAL';
|
|
873
|
+
this.currInterpretationRaw = 'NEUTRAL';
|
|
874
|
+
this.pendingInterp = null;
|
|
875
|
+
this.pendingInterpBars = 0;
|
|
876
|
+
this.entryBias = 'NONE';
|
|
877
|
+
this.isBullWeakEntry = false;
|
|
878
|
+
this.isBullConfirmation = false;
|
|
879
|
+
this.isLateBullWithoutWeak = false;
|
|
880
|
+
this.isBearWeakEntry = false;
|
|
881
|
+
this.isBearConfirmation = false;
|
|
882
|
+
this.isLateBearWithoutWeak = false;
|
|
883
|
+
this.bullEntrySetupActive = false;
|
|
884
|
+
this.bullEntrySetupConfirmed = false;
|
|
885
|
+
this.bearEntrySetupActive = false;
|
|
886
|
+
this.bearEntrySetupConfirmed = false;
|
|
887
|
+
this.prevSma = null;
|
|
888
|
+
this.currSma = null;
|
|
889
|
+
this.prevFastSma = null;
|
|
890
|
+
this.currFastSma = null;
|
|
891
|
+
this.currPrice = null;
|
|
892
|
+
this.prevRawSmaTrend = null;
|
|
893
|
+
this.barsInSmaTrend = 0;
|
|
894
|
+
this.prevRawFastSmaTrend = null;
|
|
895
|
+
this.barsInFastSmaTrend = 0;
|
|
896
|
+
this.barsAboveFastSma = 0;
|
|
897
|
+
this.barsBelowFastSma = 0;
|
|
898
|
+
this.updateCount = 0;
|
|
899
|
+
}
|
|
900
|
+
getUpdateCount() { return this.updateCount; }
|
|
901
|
+
}
|
|
902
|
+
module.exports = { DerivativeAnalyzer };
|
|
903
|
+
//# sourceMappingURL=derivative_analyzer.js.map
|