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,874 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { toIntervalLabel } = require('./interval_utils');
|
|
3
|
+
const { escapeHtml, serializeJsonForScript } = require('../analysis/chart_utils');
|
|
4
|
+
const { fixedTo, roundTo, roundToDecimals } = require('../modules/utils/math_utils');
|
|
5
|
+
function formatPct(v) {
|
|
6
|
+
const num = Number(v);
|
|
7
|
+
if (!Number.isFinite(num))
|
|
8
|
+
return 'n/a';
|
|
9
|
+
return `${num >= 0 ? '+' : ''}${num.toFixed(2)}%`;
|
|
10
|
+
}
|
|
11
|
+
function padRange(min, max, lower = 0.04, upper = 0.04) {
|
|
12
|
+
if (!Number.isFinite(min) || !Number.isFinite(max))
|
|
13
|
+
return null;
|
|
14
|
+
if (min === max) {
|
|
15
|
+
const delta = Math.abs(min) * 0.03 || 1;
|
|
16
|
+
return [min - delta, max + delta];
|
|
17
|
+
}
|
|
18
|
+
const span = max - min;
|
|
19
|
+
return [min - span * lower, max + span * upper];
|
|
20
|
+
}
|
|
21
|
+
function generateHTML(meta, candles, amaResults) {
|
|
22
|
+
const { assetA = {}, assetB = {}, intervalSeconds, fetchedAt, pool, thresholds = [], sigmaAmaDelta } = meta || {};
|
|
23
|
+
if (!Array.isArray(candles) || candles.length === 0) {
|
|
24
|
+
throw new Error('No candles supplied to LP uPlot renderer');
|
|
25
|
+
}
|
|
26
|
+
if (!Array.isArray(amaResults) || amaResults.length === 0) {
|
|
27
|
+
throw new Error('No AMA results supplied to LP uPlot renderer');
|
|
28
|
+
}
|
|
29
|
+
const poolLabel = pool
|
|
30
|
+
? `Pool ${String(pool).replace('1.19.', '')}`
|
|
31
|
+
: `${assetA.symbol || '?'} / ${assetB.symbol || '?'}`;
|
|
32
|
+
const intervalLabel = toIntervalLabel(intervalSeconds);
|
|
33
|
+
const ts = candles.map((c) => Math.round(Number(c[0]) / 1000));
|
|
34
|
+
const closes = candles.map((c) => roundToDecimals(Number(c[4]), 6));
|
|
35
|
+
const volumes = candles.map((c) => roundToDecimals(Number(c[5] ?? 0), 4));
|
|
36
|
+
const primary = amaResults[0];
|
|
37
|
+
const primaryValues = Array.isArray(primary.values) ? primary.values : [];
|
|
38
|
+
const primarySkip = Number.isFinite(primary.erPeriod) ? primary.erPeriod : 0;
|
|
39
|
+
const validCloses = closes.slice(primarySkip);
|
|
40
|
+
const validPrimary = primaryValues.slice(primarySkip);
|
|
41
|
+
const maxDev = validCloses.length && validPrimary.length
|
|
42
|
+
? Math.max(...validCloses.map((p, i) => Math.abs((p - validPrimary[i]) / validPrimary[i]) * 100))
|
|
43
|
+
: 0;
|
|
44
|
+
const lastPrice = closes[closes.length - 1];
|
|
45
|
+
const amaStats = amaResults.map((a) => {
|
|
46
|
+
const values = Array.isArray(a.values) ? a.values : [];
|
|
47
|
+
const lastVal = values[values.length - 1];
|
|
48
|
+
const dev = Number.isFinite(lastVal) && lastVal !== 0
|
|
49
|
+
? ((lastPrice - lastVal) / lastVal) * 100
|
|
50
|
+
: 0;
|
|
51
|
+
return { name: a.name, color: a.color, lastVal, dev };
|
|
52
|
+
});
|
|
53
|
+
const chartId = `lp-uplot-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
54
|
+
const amaMeta = amaResults.map((a) => ({
|
|
55
|
+
name: a.name,
|
|
56
|
+
color: a.color,
|
|
57
|
+
lineWidth: a.lineWidth,
|
|
58
|
+
erPeriod: a.erPeriod,
|
|
59
|
+
fastPeriod: a.fastPeriod,
|
|
60
|
+
slowPeriod: a.slowPeriod,
|
|
61
|
+
}));
|
|
62
|
+
return `<!DOCTYPE html>
|
|
63
|
+
<html lang="en">
|
|
64
|
+
<head>
|
|
65
|
+
<meta charset="UTF-8">
|
|
66
|
+
<meta name="darkreader-lock">
|
|
67
|
+
<meta name="color-scheme" content="dark">
|
|
68
|
+
<title>${escapeHtml(poolLabel)} LP Price · ${escapeHtml(intervalLabel)}</title>
|
|
69
|
+
<link rel="stylesheet" href="../uplot/uPlot.min.css">
|
|
70
|
+
<script src="../uplot/uPlot.iife.min.js"></script>
|
|
71
|
+
<style>
|
|
72
|
+
:root { color-scheme: dark; }
|
|
73
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
74
|
+
body {
|
|
75
|
+
background: #0e1117;
|
|
76
|
+
color: #e0e0e0;
|
|
77
|
+
font-family: 'Segoe UI', sans-serif;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
#header {
|
|
81
|
+
position: fixed;
|
|
82
|
+
top: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
right: 0;
|
|
85
|
+
z-index: 100;
|
|
86
|
+
background: rgba(14,17,23,0.92);
|
|
87
|
+
backdrop-filter: blur(4px);
|
|
88
|
+
border-bottom: 1px solid #2a2e3e;
|
|
89
|
+
padding: 10px 20px;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: baseline;
|
|
92
|
+
gap: 20px;
|
|
93
|
+
}
|
|
94
|
+
#header h1 {
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
color: #fff;
|
|
98
|
+
}
|
|
99
|
+
#header .sub {
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
color: #b8c0d0;
|
|
102
|
+
}
|
|
103
|
+
#stats, #params, #live {
|
|
104
|
+
position: absolute;
|
|
105
|
+
right: 12px;
|
|
106
|
+
z-index: 100;
|
|
107
|
+
background: rgba(20,24,32,0.88);
|
|
108
|
+
backdrop-filter: blur(4px);
|
|
109
|
+
border: 1px solid #2a2e3e;
|
|
110
|
+
border-radius: 6px;
|
|
111
|
+
padding: 10px 14px;
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
line-height: 1.8;
|
|
114
|
+
min-width: 240px;
|
|
115
|
+
}
|
|
116
|
+
#right-panel {
|
|
117
|
+
position: fixed;
|
|
118
|
+
top: 50px;
|
|
119
|
+
right: 0;
|
|
120
|
+
width: 276px;
|
|
121
|
+
bottom: 0;
|
|
122
|
+
overflow-y: auto;
|
|
123
|
+
padding: 12px;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 12px;
|
|
127
|
+
}
|
|
128
|
+
#stats, #params, #live {
|
|
129
|
+
position: relative;
|
|
130
|
+
right: 0;
|
|
131
|
+
width: 100%;
|
|
132
|
+
}
|
|
133
|
+
#stats .label, #params .label, #live .label { color: #c0c8d8; }
|
|
134
|
+
#stats .val, #params .val, #live .val { color: #f1f5ff; font-weight: 600; }
|
|
135
|
+
#stats .pos { color: #26a69a; }
|
|
136
|
+
#stats .neg { color: #ef5350; }
|
|
137
|
+
#params table { border-collapse: collapse; width: 100%; margin-top: 4px; }
|
|
138
|
+
#live table { border-collapse: collapse; width: 100%; margin-top: 4px; }
|
|
139
|
+
#params td { padding: 1px 6px 1px 0; font-size: 11px; color: #edf2ff; white-space: nowrap; }
|
|
140
|
+
#live td { padding: 1px 6px 1px 0; font-size: 11px; color: #edf2ff; white-space: nowrap; }
|
|
141
|
+
#params td:first-child { padding-left: 0; }
|
|
142
|
+
#params th { font-size: 10px; color: #d3daea; font-weight: 400; text-align: left; padding: 0 6px 3px 0; }
|
|
143
|
+
#live td:first-child { padding-left: 0; }
|
|
144
|
+
#live th { font-size: 10px; color: #d3daea; font-weight: 400; text-align: left; padding: 0 6px 3px 0; }
|
|
145
|
+
#charts {
|
|
146
|
+
position: fixed;
|
|
147
|
+
top: 44px;
|
|
148
|
+
left: 0;
|
|
149
|
+
right: 276px;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
padding-top: 0;
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
gap: 0;
|
|
155
|
+
border-right: 1px solid #2a2e3e;
|
|
156
|
+
}
|
|
157
|
+
.chart {
|
|
158
|
+
width: 100%;
|
|
159
|
+
min-height: 120px;
|
|
160
|
+
position: relative;
|
|
161
|
+
}
|
|
162
|
+
#price-chart { flex: 3.1; }
|
|
163
|
+
#dev-chart { flex: 1.1; }
|
|
164
|
+
#vol-chart { flex: 0.9; }
|
|
165
|
+
.uplot {
|
|
166
|
+
background: #0e1117;
|
|
167
|
+
}
|
|
168
|
+
.u-cursor-y {
|
|
169
|
+
display: none !important;
|
|
170
|
+
border-top: 1px dashed rgba(255, 255, 255, 0.35) !important;
|
|
171
|
+
background: transparent !important;
|
|
172
|
+
}
|
|
173
|
+
.uplot.is-hovered .u-cursor-y {
|
|
174
|
+
display: block !important;
|
|
175
|
+
}
|
|
176
|
+
.u-cursor-x {
|
|
177
|
+
border-left: 1px dashed rgba(255, 255, 255, 0.35) !important;
|
|
178
|
+
background: transparent !important;
|
|
179
|
+
}
|
|
180
|
+
.u-legend {
|
|
181
|
+
display: none !important;
|
|
182
|
+
}
|
|
183
|
+
</style>
|
|
184
|
+
</head>
|
|
185
|
+
<body>
|
|
186
|
+
|
|
187
|
+
<div id="header">
|
|
188
|
+
<h1><span style="color:#fb8c00">${escapeHtml(poolLabel)}</span> LP Swap Price</h1>
|
|
189
|
+
<span class="sub">BitShares DEX · ${escapeHtml(intervalLabel)} buckets · ${amaResults.length} AMAs</span>
|
|
190
|
+
<span class="sub" style="margin-left:auto">Fetched: ${fetchedAt ? escapeHtml(new Date(fetchedAt).toLocaleString()) : 'n/a'}</span>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div id="right-panel">
|
|
194
|
+
<div id="stats">
|
|
195
|
+
<div><span class="label">Last Price </span><span class="val">${Number.isFinite(lastPrice) ? lastPrice.toFixed(6) : 'n/a'}</span></div>
|
|
196
|
+
<div style="margin-top:4px; margin-bottom:2px"><span class="label" style="font-size:10px">── Deviations ──</span></div>
|
|
197
|
+
${amaStats.map((s) => `<div><span style="color:${s.color}">● </span><span class="label" style="font-size:11px">${escapeHtml(String(s.name || '').padEnd(22))}</span><span class="${s.dev >= 0 ? 'pos' : 'neg'}">${formatPct(s.dev)}</span></div>`).join('\n ')}
|
|
198
|
+
<div style="margin-top:6px"><span class="label">Max |dev| </span><span class="val">${maxDev.toFixed(3)}% (primary)</span></div>
|
|
199
|
+
${thresholds.length ? `<div style="margin-top:4px; margin-bottom:2px"><span class="label" style="font-size:10px">── Clamping Thresholds ──</span></div>
|
|
200
|
+
${thresholds.map((t) => `<div><span class="label" style="font-size:11px">${(t.quantile * 100).toFixed(3)}%</span><span class="val" style="margin-left:8px">${t.multiplier}x</span></div>`).join('')}` : ''}
|
|
201
|
+
${sigmaAmaDelta !== null && sigmaAmaDelta !== undefined ? `<div><span class="label">σ_ama_delta </span><span class="val">${sigmaAmaDelta}% (hourly)</span></div>` : ''}
|
|
202
|
+
<div style="margin-top:6px"><span class="label">Candles </span><span class="val">${candles.length}</span></div>
|
|
203
|
+
<div><span class="label">Source </span><span class="label" style="font-size:10px">Kibana LP (op_type 63)</span></div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<div id="params">
|
|
207
|
+
<div style="margin-bottom:2px"><span class="label" style="font-size:10px">── AMA Parameters ──</span></div>
|
|
208
|
+
<table id="params-table"></table>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<div id="live">
|
|
212
|
+
<div style="margin-bottom:2px"><span class="label" style="font-size:10px">── Live Values ──</span></div>
|
|
213
|
+
<table id="live-table"></table>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
<div id="charts">
|
|
217
|
+
<div id="price-chart" class="chart"></div>
|
|
218
|
+
<div id="dev-chart" class="chart"></div>
|
|
219
|
+
<div id="vol-chart" class="chart"></div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<script type="application/json" id="lp-payload">${serializeJsonForScript({
|
|
223
|
+
ts,
|
|
224
|
+
closes,
|
|
225
|
+
volumes,
|
|
226
|
+
amaMeta,
|
|
227
|
+
amaArrays: amaResults.map((a) => (Array.isArray(a.values) ? a.values.map((v) => roundToDecimals(Number(v), 6)) : [])),
|
|
228
|
+
})}</script>
|
|
229
|
+
|
|
230
|
+
<script>
|
|
231
|
+
const payload = JSON.parse(document.getElementById('lp-payload').textContent);
|
|
232
|
+
const ts = payload.ts;
|
|
233
|
+
const closes = payload.closes;
|
|
234
|
+
const volumes = payload.volumes;
|
|
235
|
+
const amaMeta = payload.amaMeta;
|
|
236
|
+
const amaArrays = payload.amaArrays;
|
|
237
|
+
const chartGroupId = ${JSON.stringify(chartId)};
|
|
238
|
+
|
|
239
|
+
const THEME = {
|
|
240
|
+
text: '#f1f5ff',
|
|
241
|
+
muted: '#c0c8d8',
|
|
242
|
+
background: '#0e1117',
|
|
243
|
+
grid: '#1e2330',
|
|
244
|
+
axis: '#8d96ad',
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
function initChart(domId, opts, data) {
|
|
248
|
+
if (typeof uPlot === 'undefined') {
|
|
249
|
+
throw new Error('uPlot library did not load');
|
|
250
|
+
}
|
|
251
|
+
const el = document.getElementById(domId);
|
|
252
|
+
const rect = el.getBoundingClientRect();
|
|
253
|
+
const chart = new uPlot({
|
|
254
|
+
...opts,
|
|
255
|
+
width: Math.max(320, Math.floor(rect.width)),
|
|
256
|
+
height: Math.max(120, Math.floor(rect.height)),
|
|
257
|
+
}, data, el);
|
|
258
|
+
chart.root.style.background = THEME.background;
|
|
259
|
+
return chart;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function fmtDateTime(sec) {
|
|
263
|
+
const d = new Date(sec * 1000);
|
|
264
|
+
return d.toLocaleDateString(undefined, {
|
|
265
|
+
month: '2-digit',
|
|
266
|
+
day: '2-digit',
|
|
267
|
+
hour: '2-digit',
|
|
268
|
+
minute: '2-digit',
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function fmtShortDate(sec) {
|
|
273
|
+
const d = new Date(sec * 1000);
|
|
274
|
+
return d.toLocaleDateString(undefined, {
|
|
275
|
+
month: '2-digit',
|
|
276
|
+
day: '2-digit',
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
${escapeHtml.toString()}
|
|
281
|
+
|
|
282
|
+
${formatPct.toString()}
|
|
283
|
+
|
|
284
|
+
${padRange.toString()}
|
|
285
|
+
|
|
286
|
+
${roundTo.toString()}
|
|
287
|
+
|
|
288
|
+
${fixedTo.toString()}
|
|
289
|
+
|
|
290
|
+
${roundToDecimals.toString()}
|
|
291
|
+
|
|
292
|
+
function formatCompactNumber(v) {
|
|
293
|
+
const num = Number(v);
|
|
294
|
+
if (!Number.isFinite(num)) return 'n/a';
|
|
295
|
+
const abs = Math.abs(num);
|
|
296
|
+
const sign = num < 0 ? '-' : '';
|
|
297
|
+
if (abs >= 1e9) return sign + (abs / 1e9).toFixed(abs >= 1e10 ? 0 : 2) + 'b';
|
|
298
|
+
if (abs >= 1e6) return sign + (abs / 1e6).toFixed(abs >= 1e7 ? 0 : 2) + 'm';
|
|
299
|
+
if (abs >= 1e3) return sign + (abs / 1e3).toFixed(abs >= 1e4 ? 0 : 2) + 'k';
|
|
300
|
+
if (abs >= 100) return sign + abs.toFixed(0);
|
|
301
|
+
if (abs >= 10) return sign + abs.toFixed(1);
|
|
302
|
+
return sign + abs.toFixed(2);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function makeAxis(show, type) {
|
|
306
|
+
return {
|
|
307
|
+
show,
|
|
308
|
+
scale: type,
|
|
309
|
+
stroke: THEME.axis,
|
|
310
|
+
grid: { show: false },
|
|
311
|
+
ticks: { show: true, stroke: THEME.axis, width: 1 },
|
|
312
|
+
size: show ? 34 : 0,
|
|
313
|
+
space: 50,
|
|
314
|
+
font: '11px Segoe UI, sans-serif',
|
|
315
|
+
label: '',
|
|
316
|
+
values: show ? (u, splits) => splits.map((v) => fmtShortDate(v)) : () => [],
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function makeYAxis(show, formatter, size = 58) {
|
|
321
|
+
return {
|
|
322
|
+
show,
|
|
323
|
+
scale: 'y',
|
|
324
|
+
stroke: THEME.axis,
|
|
325
|
+
grid: { show: true, stroke: THEME.grid },
|
|
326
|
+
ticks: { show: true, stroke: THEME.axis, width: 1 },
|
|
327
|
+
size,
|
|
328
|
+
space: 72,
|
|
329
|
+
font: '11px Segoe UI, sans-serif',
|
|
330
|
+
values: formatter || undefined,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function makeCursor() {
|
|
335
|
+
return {
|
|
336
|
+
show: true,
|
|
337
|
+
x: true,
|
|
338
|
+
y: true,
|
|
339
|
+
points: { show: false },
|
|
340
|
+
drag: { x: false, y: false, setScale: false },
|
|
341
|
+
sync: { key: chartGroupId, setSeries: false, scales: ['x', null] },
|
|
342
|
+
focus: { prox: -1 },
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function makePlotBase(showX, yFormatter, yScale, yRange, extraHooks = {}) {
|
|
347
|
+
return {
|
|
348
|
+
width: 0,
|
|
349
|
+
height: 0,
|
|
350
|
+
title: null,
|
|
351
|
+
legend: { show: false },
|
|
352
|
+
cursor: makeCursor(),
|
|
353
|
+
select: { show: false },
|
|
354
|
+
scales: {
|
|
355
|
+
x: {
|
|
356
|
+
time: true,
|
|
357
|
+
},
|
|
358
|
+
y: yScale,
|
|
359
|
+
},
|
|
360
|
+
axes: [
|
|
361
|
+
makeAxis(showX, 'x'),
|
|
362
|
+
makeYAxis(true, yFormatter),
|
|
363
|
+
],
|
|
364
|
+
series: [
|
|
365
|
+
{ label: 'Time' },
|
|
366
|
+
],
|
|
367
|
+
padding: [8, 8, 0, 8],
|
|
368
|
+
hooks: {
|
|
369
|
+
ready: [
|
|
370
|
+
(u) => {
|
|
371
|
+
u.root.style.background = THEME.background;
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
...extraHooks,
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function lineSeries(name, color, width, dash, extra = {}) {
|
|
380
|
+
return {
|
|
381
|
+
label: name,
|
|
382
|
+
stroke: color,
|
|
383
|
+
width,
|
|
384
|
+
points: { show: false },
|
|
385
|
+
fill: null,
|
|
386
|
+
...extra,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function makeDevSplits(scaleMin, scaleMax, foundIncr, foundSpace) {
|
|
391
|
+
if (!Number.isFinite(scaleMin) || !Number.isFinite(scaleMax)) return [];
|
|
392
|
+
|
|
393
|
+
const span = scaleMax - scaleMin;
|
|
394
|
+
const step = span <= 75 || foundSpace >= 60 ? 12.5 : 25;
|
|
395
|
+
const start = Math.ceil(scaleMin / step) * step;
|
|
396
|
+
const end = Math.floor(scaleMax / step) * step;
|
|
397
|
+
const splits = [];
|
|
398
|
+
|
|
399
|
+
for (let v = start; v <= end + 1e-9; v += step) {
|
|
400
|
+
const rounded = roundTo(v, 100);
|
|
401
|
+
if (!splits.length || splits[splits.length - 1] !== rounded) splits.push(rounded);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (scaleMin <= 0 && scaleMax >= 0 && !splits.includes(0)) {
|
|
405
|
+
splits.push(0);
|
|
406
|
+
splits.sort((a, b) => a - b);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return splits;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function makeVolumeSplits(scaleMin, scaleMax, foundIncr, foundSpace) {
|
|
413
|
+
if (!Number.isFinite(scaleMin) || !Number.isFinite(scaleMax)) return [];
|
|
414
|
+
|
|
415
|
+
if (scaleMax <= scaleMin) return [];
|
|
416
|
+
|
|
417
|
+
const start = roundTo(scaleMin, 100);
|
|
418
|
+
const mid = roundToDecimals((scaleMin + scaleMax) / 2, 2);
|
|
419
|
+
const end = roundTo(scaleMax, 100);
|
|
420
|
+
const splits = [start];
|
|
421
|
+
|
|
422
|
+
if (mid > start && mid < end) splits.push(mid);
|
|
423
|
+
if (end > start) splits.push(end);
|
|
424
|
+
|
|
425
|
+
return splits;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const liveCells = {
|
|
429
|
+
time: null,
|
|
430
|
+
price: null,
|
|
431
|
+
amas: [],
|
|
432
|
+
devs: [],
|
|
433
|
+
volume: null,
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
function setLiveCell(td, value, className = null) {
|
|
437
|
+
if (!td) return;
|
|
438
|
+
td.textContent = value;
|
|
439
|
+
if (className != null) td.className = className;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function renderLiveTable() {
|
|
443
|
+
const tbl = document.getElementById('live-table');
|
|
444
|
+
const rows = [
|
|
445
|
+
['Time', null],
|
|
446
|
+
['Price', null],
|
|
447
|
+
];
|
|
448
|
+
|
|
449
|
+
amaMeta.forEach((a) => rows.push([a.name.split(' - ')[0], a.color]));
|
|
450
|
+
amaMeta.forEach((a) => rows.push([a.name.split(' - ')[0] + ' Dev', a.color]));
|
|
451
|
+
rows.push(['Volume', '#5c9ee6']);
|
|
452
|
+
|
|
453
|
+
rows.forEach(([label, color], i) => {
|
|
454
|
+
const tr = tbl.insertRow();
|
|
455
|
+
const labelCell = tr.insertCell();
|
|
456
|
+
labelCell.innerHTML = color ? '<span style="color:' + color + '">● </span>' + escapeHtml(label) : escapeHtml(label);
|
|
457
|
+
const valueCell = tr.insertCell();
|
|
458
|
+
valueCell.className = 'val';
|
|
459
|
+
valueCell.textContent = '--';
|
|
460
|
+
|
|
461
|
+
if (i === 0) liveCells.time = valueCell;
|
|
462
|
+
else if (i === 1) liveCells.price = valueCell;
|
|
463
|
+
else if (i > 1 && i <= 1 + amaMeta.length) liveCells.amas.push(valueCell);
|
|
464
|
+
else if (i > 1 + amaMeta.length && i <= 1 + amaMeta.length * 2) liveCells.devs.push(valueCell);
|
|
465
|
+
else liveCells.volume = valueCell;
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function updateLivePanelAtIndex(idx) {
|
|
470
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= ts.length) return;
|
|
471
|
+
|
|
472
|
+
setLiveCell(liveCells.time, fmtDateTime(ts[idx]));
|
|
473
|
+
setLiveCell(liveCells.price, Number.isFinite(closes[idx]) ? closes[idx].toFixed(6) : 'n/a');
|
|
474
|
+
|
|
475
|
+
amaArrays.forEach((arr, i) => {
|
|
476
|
+
const val = arr[idx];
|
|
477
|
+
setLiveCell(liveCells.amas[i], Number.isFinite(val) ? val.toFixed(6) : 'n/a');
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
amaDevArrays.forEach((arr, i) => {
|
|
481
|
+
const val = arr[idx];
|
|
482
|
+
setLiveCell(liveCells.devs[i], Number.isFinite(val) ? formatPct(val) : 'n/a');
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
setLiveCell(liveCells.volume, Number.isFinite(volumes[idx]) ? formatCompactNumber(volumes[idx]) : 'n/a');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
let lastLiveIdx = -1;
|
|
489
|
+
|
|
490
|
+
function updateLivePanel(u) {
|
|
491
|
+
const idx = u && u.cursor ? u.cursor.idx : null;
|
|
492
|
+
if (idx == null) {
|
|
493
|
+
// cursor left the chart — restore last-candle values
|
|
494
|
+
if (lastLiveIdx >= 0) updateLivePanelAtIndex(lastLiveIdx);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
updateLivePanelAtIndex(idx);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function applyChartHeights() {
|
|
501
|
+
const available = Math.max(window.innerHeight - 44, 600);
|
|
502
|
+
const priceH = Math.max(320, Math.floor(available * 0.60));
|
|
503
|
+
const devH = Math.max(150, Math.floor(available * 0.22));
|
|
504
|
+
const volH = Math.max(120, Math.max(available - priceH - devH, Math.floor(available * 0.18)));
|
|
505
|
+
document.getElementById('price-chart').style.height = priceH + 'px';
|
|
506
|
+
document.getElementById('dev-chart').style.height = devH + 'px';
|
|
507
|
+
document.getElementById('vol-chart').style.height = volH + 'px';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function showFatal(message) {
|
|
511
|
+
const charts = document.getElementById('charts');
|
|
512
|
+
charts.innerHTML = '<div style="padding:20px;color:#ef5350;font-size:14px;white-space:pre-wrap;">' + String(message) + '</div>';
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
(function renderParamsTable() {
|
|
516
|
+
const tbl = document.getElementById('params-table');
|
|
517
|
+
const hdr = tbl.insertRow();
|
|
518
|
+
['', 'ER', 'Fast', 'Slow'].forEach((h) => {
|
|
519
|
+
const th = document.createElement('th');
|
|
520
|
+
th.textContent = h;
|
|
521
|
+
hdr.appendChild(th);
|
|
522
|
+
});
|
|
523
|
+
amaMeta.forEach((a) => {
|
|
524
|
+
const row = tbl.insertRow();
|
|
525
|
+
const dot = document.createElement('td');
|
|
526
|
+
dot.innerHTML = \`<span style="color:\${a.color}">●</span> \${a.name.split(' - ')[0]}\`;
|
|
527
|
+
row.appendChild(dot);
|
|
528
|
+
[a.erPeriod, a.fastPeriod, a.slowPeriod].forEach((v) => {
|
|
529
|
+
const td = row.insertCell();
|
|
530
|
+
td.textContent = v ?? '—';
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
})();
|
|
534
|
+
|
|
535
|
+
const amaDevArrays = amaArrays.map((values, i) =>
|
|
536
|
+
closes.map((p, idx) => {
|
|
537
|
+
const v = values[idx];
|
|
538
|
+
if (!Number.isFinite(v) || v === 0) return null;
|
|
539
|
+
return roundToDecimals(((p - v) / v) * 100, 2);
|
|
540
|
+
})
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
renderLiveTable();
|
|
544
|
+
applyChartHeights();
|
|
545
|
+
|
|
546
|
+
const priceData = [ts, closes, ...amaArrays];
|
|
547
|
+
const devData = [ts, ...amaDevArrays];
|
|
548
|
+
const volData = [ts, volumes];
|
|
549
|
+
|
|
550
|
+
let priceChart;
|
|
551
|
+
let devChart;
|
|
552
|
+
let volChart;
|
|
553
|
+
let charts = [];
|
|
554
|
+
|
|
555
|
+
try {
|
|
556
|
+
priceChart = initChart('price-chart', {
|
|
557
|
+
...makePlotBase(false, (u, vals) => vals.map((v) => fixedTo(v, 6)), {
|
|
558
|
+
auto: true,
|
|
559
|
+
distr: 3,
|
|
560
|
+
log: 10,
|
|
561
|
+
range: (u, min, max) => {
|
|
562
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || min <= 0 || max <= 0) {
|
|
563
|
+
return [min, max];
|
|
564
|
+
}
|
|
565
|
+
return [min * 0.98, max * 1.03];
|
|
566
|
+
},
|
|
567
|
+
}),
|
|
568
|
+
axes: [
|
|
569
|
+
makeAxis(false, 'x'),
|
|
570
|
+
{
|
|
571
|
+
...makeYAxis(true, null, 80),
|
|
572
|
+
border: { show: true, stroke: THEME.axis, width: 2 },
|
|
573
|
+
grid: { show: true, stroke: THEME.grid, width: 2 },
|
|
574
|
+
},
|
|
575
|
+
],
|
|
576
|
+
padding: [8, 8, 12, 8],
|
|
577
|
+
series: [
|
|
578
|
+
{ label: 'Time' },
|
|
579
|
+
lineSeries('${escapeHtml(assetA.symbol || '?')}/${escapeHtml(assetB.symbol || '?')} VWAP', '#5c9ee6', 1.5),
|
|
580
|
+
...amaMeta.map((cfg) => lineSeries(cfg.name, cfg.color, cfg.lineWidth || 1.5)),
|
|
581
|
+
],
|
|
582
|
+
}, priceData);
|
|
583
|
+
|
|
584
|
+
devChart = initChart('dev-chart', {
|
|
585
|
+
...makePlotBase(false, (u, vals) => vals.map((v) => fixedTo(v, 2) + '%'), {
|
|
586
|
+
auto: true,
|
|
587
|
+
range: (u, min, max) => {
|
|
588
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return [min, max];
|
|
589
|
+
const maxAbs = Math.max(Math.abs(min), Math.abs(max));
|
|
590
|
+
const limit = Math.max(maxAbs * 1.15, 25);
|
|
591
|
+
return [-limit, limit];
|
|
592
|
+
},
|
|
593
|
+
}),
|
|
594
|
+
axes: [
|
|
595
|
+
makeAxis(false, 'x'),
|
|
596
|
+
{
|
|
597
|
+
...makeYAxis(true, (u, vals) => vals.map((v) => fixedTo(v, 2) + '%'), 82),
|
|
598
|
+
border: { show: true, stroke: THEME.axis, width: 2 },
|
|
599
|
+
grid: { show: true, stroke: THEME.grid, width: 2 },
|
|
600
|
+
splits: (u, axisIdx, scaleMin, scaleMax) => makeDevSplits(scaleMin, scaleMax),
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
series: [
|
|
604
|
+
{ label: 'Time' },
|
|
605
|
+
...amaMeta.map((cfg) => lineSeries(cfg.name, cfg.color, 1.25)),
|
|
606
|
+
],
|
|
607
|
+
padding: [8, 8, 12, 8],
|
|
608
|
+
}, devData);
|
|
609
|
+
|
|
610
|
+
volChart = initChart('vol-chart', {
|
|
611
|
+
...makePlotBase(true, (u, vals) => vals.map((v) => Number(v).toLocaleString()), {
|
|
612
|
+
auto: true,
|
|
613
|
+
range: (u, min, max) => padRange(min, max, 0.04, 0.04) || [min, max],
|
|
614
|
+
}),
|
|
615
|
+
axes: [
|
|
616
|
+
makeAxis(true, 'x'),
|
|
617
|
+
{
|
|
618
|
+
...makeYAxis(true, (u, vals) => vals.map((v) => Number(v).toLocaleString()), 82),
|
|
619
|
+
border: { show: true, stroke: THEME.axis, width: 2 },
|
|
620
|
+
grid: { show: true, stroke: THEME.grid, width: 2 },
|
|
621
|
+
ticks: { show: true, stroke: THEME.axis, width: 2 },
|
|
622
|
+
splits: (u, axisIdx, scaleMin, scaleMax, foundIncr, foundSpace) => makeVolumeSplits(scaleMin, scaleMax, foundIncr, foundSpace),
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
series: [
|
|
626
|
+
{ label: 'Time' },
|
|
627
|
+
{
|
|
628
|
+
label: 'Volume (' + ${JSON.stringify(escapeHtml(assetA.symbol || '?'))} + ')',
|
|
629
|
+
stroke: 'rgba(92,158,230,1)',
|
|
630
|
+
fill: 'rgba(92,158,230,1)',
|
|
631
|
+
width: 1,
|
|
632
|
+
points: { show: false },
|
|
633
|
+
paths: uPlot.paths.bars({ align: 0, gap: 1, size: [0.72, 14, 1] }),
|
|
634
|
+
},
|
|
635
|
+
],
|
|
636
|
+
}, volData);
|
|
637
|
+
} catch (err) {
|
|
638
|
+
console.error(err);
|
|
639
|
+
showFatal(err && err.message ? err.message : String(err));
|
|
640
|
+
throw err;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
charts = [priceChart, devChart, volChart];
|
|
644
|
+
const [xMin, xMax] = [ts[0], ts[ts.length - 1]];
|
|
645
|
+
let pendingRange = null;
|
|
646
|
+
let pendingRangeRaf = 0;
|
|
647
|
+
|
|
648
|
+
function clampXRange(min, max) {
|
|
649
|
+
let nextMin = min;
|
|
650
|
+
let nextMax = max;
|
|
651
|
+
const span = nextMax - nextMin;
|
|
652
|
+
if (!Number.isFinite(span) || span <= 0) {
|
|
653
|
+
return { min: xMin, max: xMax };
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (nextMin < xMin) {
|
|
657
|
+
nextMax += xMin - nextMin;
|
|
658
|
+
nextMin = xMin;
|
|
659
|
+
}
|
|
660
|
+
if (nextMax > xMax) {
|
|
661
|
+
nextMin -= nextMax - xMax;
|
|
662
|
+
nextMax = xMax;
|
|
663
|
+
}
|
|
664
|
+
if (nextMin < xMin) nextMin = xMin;
|
|
665
|
+
if (nextMax > xMax) nextMax = xMax;
|
|
666
|
+
if (nextMax <= nextMin) {
|
|
667
|
+
return { min: xMin, max: xMax };
|
|
668
|
+
}
|
|
669
|
+
return { min: nextMin, max: nextMax };
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function syncXRange(min, max) {
|
|
673
|
+
pendingRange = clampXRange(min, max);
|
|
674
|
+
if (pendingRangeRaf) return;
|
|
675
|
+
|
|
676
|
+
const rafSync = window.requestAnimationFrame
|
|
677
|
+
? window.requestAnimationFrame.bind(window)
|
|
678
|
+
: (fn) => setTimeout(fn, 0);
|
|
679
|
+
|
|
680
|
+
pendingRangeRaf = rafSync(() => {
|
|
681
|
+
const next = pendingRange;
|
|
682
|
+
pendingRange = null;
|
|
683
|
+
pendingRangeRaf = 0;
|
|
684
|
+
if (!next) return;
|
|
685
|
+
charts.forEach((chart) => {
|
|
686
|
+
chart.batch(() => {
|
|
687
|
+
chart.setScale('x', next);
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
function bindWheelZoom(chart) {
|
|
694
|
+
const onWheel = (e) => {
|
|
695
|
+
if (!e) return;
|
|
696
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
697
|
+
e.preventDefault();
|
|
698
|
+
e.stopPropagation();
|
|
699
|
+
|
|
700
|
+
const rect = chart.root.getBoundingClientRect();
|
|
701
|
+
|
|
702
|
+
// Correctly calculate plot-relative 'left' for accurate centering
|
|
703
|
+
const left = e.clientX - rect.left - (chart.bbox.left / (chart.pxRatio || 1));
|
|
704
|
+
const center = chart.posToVal(left, 'x');
|
|
705
|
+
|
|
706
|
+
const xScale = chart.scales.x || {};
|
|
707
|
+
const currMin = Number.isFinite(xScale.min) ? xScale.min : xMin;
|
|
708
|
+
const currMax = Number.isFinite(xScale.max) ? xScale.max : xMax;
|
|
709
|
+
const span = currMax - currMin;
|
|
710
|
+
if (!Number.isFinite(span) || span <= 0) return;
|
|
711
|
+
|
|
712
|
+
const factor = e.deltaY < 0 ? 0.85 : 1.15;
|
|
713
|
+
const nextSpan = Math.max(1, Math.min(xMax - xMin, span * factor));
|
|
714
|
+
const ratio = (center - currMin) / span;
|
|
715
|
+
const nextMin = center - nextSpan * ratio;
|
|
716
|
+
const nextMax = nextMin + nextSpan;
|
|
717
|
+
|
|
718
|
+
syncXRange(nextMin, nextMax);
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
chart.root.addEventListener('wheel', onWheel, { passive: false });
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
function bindPan(chart) {
|
|
725
|
+
let dragging = false;
|
|
726
|
+
let startClientX = 0;
|
|
727
|
+
let startClientY = 0;
|
|
728
|
+
let startMin = xMin;
|
|
729
|
+
let startMax = xMax;
|
|
730
|
+
let xUnitsPerPx = 0;
|
|
731
|
+
|
|
732
|
+
const getCurrentScale = () => {
|
|
733
|
+
const xScale = chart.scales.x || {};
|
|
734
|
+
const currMin = Number.isFinite(xScale.min) ? xScale.min : xMin;
|
|
735
|
+
const currMax = Number.isFinite(xScale.max) ? xScale.max : xMax;
|
|
736
|
+
return { currMin, currMax };
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const onMouseMove = (e) => {
|
|
740
|
+
if (!dragging) return;
|
|
741
|
+
|
|
742
|
+
// Ignore if vertical movement is dominant (likely scrolling)
|
|
743
|
+
if (Math.abs(e.clientY - startClientY) > 20) return;
|
|
744
|
+
|
|
745
|
+
e.preventDefault();
|
|
746
|
+
const deltaPx = e.clientX - startClientX;
|
|
747
|
+
const deltaVal = deltaPx * xUnitsPerPx;
|
|
748
|
+
|
|
749
|
+
syncXRange(startMin - deltaVal, startMax - deltaVal);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
const endDrag = () => {
|
|
753
|
+
if (!dragging) return;
|
|
754
|
+
dragging = false;
|
|
755
|
+
document.body.style.cursor = '';
|
|
756
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
757
|
+
window.removeEventListener('mouseup', endDrag);
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
const onMouseDown = (e) => {
|
|
761
|
+
if (!e || e.button !== 0) return;
|
|
762
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
763
|
+
|
|
764
|
+
const rect = chart.root.getBoundingClientRect();
|
|
765
|
+
const inside = e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom;
|
|
766
|
+
if (!inside) return;
|
|
767
|
+
|
|
768
|
+
e.preventDefault();
|
|
769
|
+
e.stopPropagation();
|
|
770
|
+
|
|
771
|
+
dragging = true;
|
|
772
|
+
startClientX = e.clientX;
|
|
773
|
+
startClientY = e.clientY;
|
|
774
|
+
const current = getCurrentScale();
|
|
775
|
+
startMin = current.currMin;
|
|
776
|
+
startMax = current.currMax;
|
|
777
|
+
|
|
778
|
+
// Calculate units per pixel once at start of drag to avoid sliding bug
|
|
779
|
+
// chart.bbox.width is in device pixels; divide by pxRatio for CSS pixels
|
|
780
|
+
xUnitsPerPx = (current.currMax - current.currMin) / (chart.bbox.width / (chart.pxRatio || 1));
|
|
781
|
+
|
|
782
|
+
document.body.style.cursor = 'grabbing';
|
|
783
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
784
|
+
window.addEventListener('mouseup', endDrag, { once: true });
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
chart.root.addEventListener('mousedown', onMouseDown);
|
|
788
|
+
chart.root.addEventListener('mouseleave', () => {
|
|
789
|
+
if (!dragging) return;
|
|
790
|
+
document.body.style.cursor = 'grabbing';
|
|
791
|
+
});
|
|
792
|
+
window.addEventListener('blur', endDrag);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function bindHoverState(chart) {
|
|
796
|
+
const root = chart.root;
|
|
797
|
+
root.addEventListener('mouseenter', () => {
|
|
798
|
+
root.classList.add('is-hovered');
|
|
799
|
+
});
|
|
800
|
+
root.addEventListener('mouseleave', () => {
|
|
801
|
+
root.classList.remove('is-hovered');
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
function resetZoom() {
|
|
806
|
+
pendingRange = null;
|
|
807
|
+
syncXRange(xMin, xMax);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function sizeCharts() {
|
|
811
|
+
applyChartHeights();
|
|
812
|
+
for (const chart of charts) {
|
|
813
|
+
const rect = chart.root.parentElement.getBoundingClientRect();
|
|
814
|
+
const width = Math.max(320, Math.floor(rect.width));
|
|
815
|
+
const height = Math.max(120, Math.floor(rect.height));
|
|
816
|
+
chart.setSize({ width, height });
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
window.addEventListener('resize', sizeCharts);
|
|
821
|
+
window.addEventListener('keydown', (e) => {
|
|
822
|
+
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === '0') {
|
|
823
|
+
resetZoom();
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
charts.forEach((chart) => {
|
|
828
|
+
bindWheelZoom(chart);
|
|
829
|
+
bindPan(chart);
|
|
830
|
+
});
|
|
831
|
+
bindHoverState(priceChart);
|
|
832
|
+
bindHoverState(devChart);
|
|
833
|
+
bindHoverState(volChart);
|
|
834
|
+
|
|
835
|
+
// Wire live panel to all chart plot areas. All charts share the same x-data,
|
|
836
|
+
// so cursor.idx is identical across them. Track lastLiveIdx so mouseleave
|
|
837
|
+
// restores the most-recently-hovered candle (not just the last data point).
|
|
838
|
+
lastLiveIdx = ts.length - 1;
|
|
839
|
+
|
|
840
|
+
let leavePending = null;
|
|
841
|
+
|
|
842
|
+
charts.forEach((chart) => {
|
|
843
|
+
chart.over.addEventListener('mousemove', () => {
|
|
844
|
+
if (leavePending !== null) { clearTimeout(leavePending); leavePending = null; }
|
|
845
|
+
const idx = chart.cursor.idx;
|
|
846
|
+
if (idx != null) {
|
|
847
|
+
lastLiveIdx = idx;
|
|
848
|
+
updateLivePanelAtIndex(idx);
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
chart.over.addEventListener('mouseleave', () => {
|
|
852
|
+
// Small delay so moving between charts doesn't flash the last-candle values
|
|
853
|
+
leavePending = setTimeout(() => {
|
|
854
|
+
leavePending = null;
|
|
855
|
+
updateLivePanelAtIndex(lastLiveIdx);
|
|
856
|
+
}, 60);
|
|
857
|
+
});
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
const raf = window.requestAnimationFrame
|
|
861
|
+
? window.requestAnimationFrame.bind(window)
|
|
862
|
+
: (fn) => setTimeout(fn, 0);
|
|
863
|
+
|
|
864
|
+
raf(() => {
|
|
865
|
+
sizeCharts();
|
|
866
|
+
// Set panel to last candle after all init-time setCursor events have settled
|
|
867
|
+
updateLivePanelAtIndex(lastLiveIdx);
|
|
868
|
+
});
|
|
869
|
+
</script>
|
|
870
|
+
</body>
|
|
871
|
+
</html>`;
|
|
872
|
+
}
|
|
873
|
+
module.exports = { generateHTML };
|
|
874
|
+
//# sourceMappingURL=lp_chart_core.js.map
|