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,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* modules/order/sync_engine.ts - SyncEngine
|
|
3
|
+
*
|
|
4
|
+
* Blockchain synchronization and reconciliation engine.
|
|
5
|
+
* Exports a single SyncEngine class handling all blockchain state matching.
|
|
6
|
+
*
|
|
7
|
+
* Responsibilities:
|
|
8
|
+
* - Match blockchain open orders to grid orders
|
|
9
|
+
* - Detect and handle partial fills
|
|
10
|
+
* - Process fill history events
|
|
11
|
+
* - Update fund state based on blockchain
|
|
12
|
+
* - Fetch and cache account balances
|
|
13
|
+
* - Initialize asset metadata
|
|
14
|
+
*
|
|
15
|
+
* Uses AsyncLock to prevent concurrent sync operations (defense-in-depth locking).
|
|
16
|
+
*
|
|
17
|
+
* ===============================================================================
|
|
18
|
+
* TABLE OF CONTENTS - SyncEngine Class (8 methods) + 1 module-level helper
|
|
19
|
+
* ===============================================================================
|
|
20
|
+
*
|
|
21
|
+
* MODULE-LEVEL HELPER (internal, not exported):
|
|
22
|
+
* hasEquivalentRawOnChainOrder(a, b) - Compare two chain orders for equivalence
|
|
23
|
+
* Used internally during sync to detect redundant/duplicate chain entries
|
|
24
|
+
*
|
|
25
|
+
* INITIALIZATION (1 method)
|
|
26
|
+
* 1. constructor(manager) - Create new SyncEngine with manager reference
|
|
27
|
+
*
|
|
28
|
+
* BLOCKCHAIN SYNCHRONIZATION (3 methods - async)
|
|
29
|
+
* 2. syncFromOpenOrders(chainOrders, options) - Main sync entry point (async)
|
|
30
|
+
* Reconciles grid against fresh blockchain snapshot
|
|
31
|
+
* Uses AsyncLock to ensure only one sync at a time (defense-in-depth)
|
|
32
|
+
* Performs two-pass reconciliation (grid→chain, then chain→grid)
|
|
33
|
+
*
|
|
34
|
+
* 3. _doSyncFromOpenOrders(chainOrders, options) - Execute sync with locking (async, internal)
|
|
35
|
+
* Acquires _syncLock, validates chain orders, calls _performSyncFromOpenOrders
|
|
36
|
+
*
|
|
37
|
+
* 4. _performSyncFromOpenOrders(mgr, precA, precB, parsedChain, rawChain, options) - Core sync logic (internal)
|
|
38
|
+
* Performs actual two-pass reconciliation without locking
|
|
39
|
+
* Pass 1: Match grid orders to chain (known grid → chain, includes orphan cleanup)
|
|
40
|
+
* Pass 2: Add missing chain orders (unknown chain → grid)
|
|
41
|
+
*
|
|
42
|
+
* FILL PROCESSING (1 method)
|
|
43
|
+
* 5. syncFromFillHistory(fill) - Process fill event synchronously
|
|
44
|
+
* Updates grid order state based on fill data
|
|
45
|
+
* Updates fund state and accounting
|
|
46
|
+
* Handles both maker and taker fills
|
|
47
|
+
*
|
|
48
|
+
* FULL SYNCHRONIZATION (1 method - async)
|
|
49
|
+
* 6. synchronizeWithChain(chainData, source) - Full sync (fetch + sync) (async)
|
|
50
|
+
* Fetches fresh account balances
|
|
51
|
+
* Calls syncFromOpenOrders() with chain data
|
|
52
|
+
* Source: event type that triggered sync (fill, poll, broadcast, etc.)
|
|
53
|
+
*
|
|
54
|
+
* ACCOUNT STATE (2 methods - async)
|
|
55
|
+
* 7. fetchAccountBalancesAndSetTotals(accountId) - Fetch account totals (async)
|
|
56
|
+
* Retrieves BUY/SELL totals and free balances from blockchain
|
|
57
|
+
* Sets manager.accountTotals
|
|
58
|
+
* Triggers fund recalculation
|
|
59
|
+
*
|
|
60
|
+
* 8. initializeAssets() - Initialize asset metadata (async)
|
|
61
|
+
* Fetches asset precision and other metadata
|
|
62
|
+
* Sets manager.assets
|
|
63
|
+
* Called once at bot startup
|
|
64
|
+
*
|
|
65
|
+
* ===============================================================================
|
|
66
|
+
*
|
|
67
|
+
* LOCK HIERARCHY:
|
|
68
|
+
* 1. _syncLock (AsyncLock): Ensures only one full-sync at a time
|
|
69
|
+
* 2. Per-order locks (shadowOrderIds): Protect specific orders during sync
|
|
70
|
+
* 3. Lock refresh mechanism: Prevents timeout during long reconciliation
|
|
71
|
+
*
|
|
72
|
+
* TWO-PASS RECONCILIATION:
|
|
73
|
+
* PASS 1: Grid → Chain
|
|
74
|
+
* - For each grid order with orderId, find matching chain order
|
|
75
|
+
* - Detect partial fills (chain size < grid size)
|
|
76
|
+
* - Update sizes and mark as filled if needed
|
|
77
|
+
* - Downgrade to VIRTUAL if not found on-chain
|
|
78
|
+
*
|
|
79
|
+
* PASS 2: Chain → Grid
|
|
80
|
+
* - For each chain order not matched to grid order
|
|
81
|
+
* - Create new grid order for unexpected chain order
|
|
82
|
+
* - Mark as ACTIVE with blockchain orderId
|
|
83
|
+
*
|
|
84
|
+
* ===============================================================================
|
|
85
|
+
*/
|
|
86
|
+
declare class SyncEngine {
|
|
87
|
+
private manager;
|
|
88
|
+
/**
|
|
89
|
+
* @param {Object} manager - OrderManager instance
|
|
90
|
+
*/
|
|
91
|
+
constructor(manager: any);
|
|
92
|
+
/**
|
|
93
|
+
* Reconcile grid orders against fresh blockchain open orders snapshot.
|
|
94
|
+
* This is the MAIN SYNCHRONIZATION MECHANISM that corrects the grid state when
|
|
95
|
+
* the blockchain state diverges from our local expectations.
|
|
96
|
+
*
|
|
97
|
+
* CRITICAL: This method uses AsyncLock (defense-in-depth) to ensure only one
|
|
98
|
+
* full-sync operation runs at a time. WITHIN that lock, per-order locks prevent
|
|
99
|
+
* concurrent createOrder/cancelOrder races.
|
|
100
|
+
*
|
|
101
|
+
* LOCK HIERARCHY:
|
|
102
|
+
* 1. _syncLock (AsyncLock): Ensures only one full-sync at a time
|
|
103
|
+
* 2. Per-order locks (shadowOrderIds): Protect specific orders during sync
|
|
104
|
+
* 3. Lock refresh mechanism: Prevents timeout during long reconciliation
|
|
105
|
+
*
|
|
106
|
+
* RECONCILIATION FLOW:
|
|
107
|
+
* ========================================================================
|
|
108
|
+
* This method performs a two-pass reconciliation:
|
|
109
|
+
*
|
|
110
|
+
* PASS 1: Match grid orders to chain orders (known grid → chain lookup)
|
|
111
|
+
* - For each grid order with an orderId, find the matching chain order
|
|
112
|
+
* - Detect partial fills: if chain size < grid size, downgrade to PARTIAL state
|
|
113
|
+
* - Detect full fills: if order no longer exists on chain, convert to SPREAD
|
|
114
|
+
* - Detect price slippage: flag orders for price correction if needed
|
|
115
|
+
* - Update grid order sizes to match chain reality
|
|
116
|
+
*
|
|
117
|
+
* PASS 2: Orphan chain orders (chain → grid lookup)
|
|
118
|
+
* - For chain orders not matched in Pass 1, find best grid slot match
|
|
119
|
+
* - This handles cases where an order was placed but grid lost track (race condition)
|
|
120
|
+
* - Uses price tolerance and geometric proximity to find the best match
|
|
121
|
+
* - Once matched, retroactively assign orderId and synchronize state
|
|
122
|
+
*
|
|
123
|
+
* CRITICAL RULES:
|
|
124
|
+
* 1. ACTIVE orders can only stay ACTIVE if size matches chain exactly
|
|
125
|
+
* If chain size < grid size → must transition to PARTIAL
|
|
126
|
+
* 2. If an ACTIVE order is not found on chain → it filled → convert to SPREAD
|
|
127
|
+
* 3. Precision matters: Use blockchain integer arithmetic to compare sizes
|
|
128
|
+
* Floating point comparisons can give false positives for partial fills
|
|
129
|
+
* 4. Size updates are applied via applyChainSizeToGridOrder() which handles
|
|
130
|
+
* precision conversion and may adjust sizes slightly for blockchain granularity
|
|
131
|
+
*
|
|
132
|
+
* PRICE TOLERANCE CALCULATION:
|
|
133
|
+
* calculatePriceTolerance() can return null in these cases:
|
|
134
|
+
* 1. assets parameter is null/missing
|
|
135
|
+
* 2. gridPrice is 0 or null (invalid price)
|
|
136
|
+
* 3. orderSize is 0 or null (invalid size - orders should not sync with 0 size)
|
|
137
|
+
* 4. assetA or assetB precision is undefined (asset metadata not loaded)
|
|
138
|
+
* When tolerance is null, we treat it as 0 (strict: any price difference flagged).
|
|
139
|
+
* This is safe because null signals a configuration/data issue, not a real order.
|
|
140
|
+
*
|
|
141
|
+
* RETURNS: { filledOrders, updatedOrders, ordersNeedingCorrection }
|
|
142
|
+
* - filledOrders: Orders that completed (now SPREAD placeholders)
|
|
143
|
+
* - updatedOrders: All orders modified during sync (state changes, size updates)
|
|
144
|
+
* - ordersNeedingCorrection: Orders with price slippage requiring correction
|
|
145
|
+
*
|
|
146
|
+
* EDGE CASES HANDLED:
|
|
147
|
+
* - Orphan chain orders (placed but grid lost track due to race condition)
|
|
148
|
+
* - Partial fills (size reduced on chain)
|
|
149
|
+
* - Full fills (order removed from chain completely)
|
|
150
|
+
* - Price tolerance (small slippage acceptable, large slippage flagged)
|
|
151
|
+
* - Precision mismatches (blockchain integer precision vs float grid)
|
|
152
|
+
* - Double spending prevention (each chain order matched to at most one grid order)
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* Synchronize grid orders with blockchain open orders snapshot.
|
|
156
|
+
* @param {Array|null} chainOrders - Array of blockchain order objects
|
|
157
|
+
* @param {Object} [options={}] - Sync options (e.g., { skipAccounting: true })
|
|
158
|
+
* @returns {Promise<Object>} Result with filledOrders, updatedOrders, ordersNeedingCorrection
|
|
159
|
+
*/
|
|
160
|
+
syncFromOpenOrders(chainOrders: any[] | null, options?: Record<string, any>): Promise<any>;
|
|
161
|
+
/**
|
|
162
|
+
* Internal method that performs the actual sync logic within lock context.
|
|
163
|
+
*
|
|
164
|
+
* This is the core synchronization implementation that runs inside _syncLock
|
|
165
|
+
* to ensure exclusive access. It validates inputs, parses chain orders, and
|
|
166
|
+
* delegates to _performSyncFromOpenOrders for the actual reconciliation.
|
|
167
|
+
*
|
|
168
|
+
* VALIDATION CHECKS:
|
|
169
|
+
* - Manager must be initialized
|
|
170
|
+
* - Chain orders must be a valid array
|
|
171
|
+
* - Manager.orders must be initialized as Map
|
|
172
|
+
* - Asset precisions must be available
|
|
173
|
+
*
|
|
174
|
+
* PARSING:
|
|
175
|
+
* Converts raw blockchain order objects to normalized format using parseChainOrder()
|
|
176
|
+
* with appropriate asset precision.
|
|
177
|
+
*
|
|
178
|
+
* @param {Array<Object>|null} chainOrders - Array of raw blockchain order objects
|
|
179
|
+
* Each object contains sell_price, for_sale, id, etc. from blockchain
|
|
180
|
+
* @param {Object} options - Sync options
|
|
181
|
+
* - validateOnly {boolean}: If true, only validate without applying changes
|
|
182
|
+
* - skipFundRecalc {boolean}: If true, skip fund recalculation after sync
|
|
183
|
+
* @returns {Promise<Object>} Sync result:
|
|
184
|
+
* - filledOrders {Array}: Orders that were detected as filled
|
|
185
|
+
* - updatedOrders {Array}: Orders that were updated during sync
|
|
186
|
+
* - ordersNeedingCorrection {Array}: Orders flagged for price correction
|
|
187
|
+
* @async
|
|
188
|
+
* @private
|
|
189
|
+
*/
|
|
190
|
+
_doSyncFromOpenOrders(chainOrders: any[] | null, options: Record<string, any>): Promise<{
|
|
191
|
+
filledOrders: any[];
|
|
192
|
+
updatedOrders: any[];
|
|
193
|
+
ordersNeedingCorrection: any[];
|
|
194
|
+
unmatchedChainOrders: any[];
|
|
195
|
+
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Internal two-pass reconciliation with locks already held.
|
|
198
|
+
* @param {Object} mgr - OrderManager instance
|
|
199
|
+
* @param {number} assetAPrecision - Asset A precision
|
|
200
|
+
* @param {number} assetBPrecision - Asset B precision
|
|
201
|
+
* @param {Map<string, import('./types').ParsedChainOrder>} parsedChainOrders - Parsed chain orders by ID
|
|
202
|
+
* @param {Map<string, Object>} rawChainOrders - Raw blockchain order objects by ID
|
|
203
|
+
* @param {Set<string>} chainOrderIdsOnGrid - Output set: chain order IDs matched to grid
|
|
204
|
+
* @param {Set<string>} matchedGridOrderIds - Output set: grid order IDs matched to chain
|
|
205
|
+
* @param {Array<Object>} filledOrders - Output array: orders detected as filled
|
|
206
|
+
* @param {Array<Object>} updatedOrders - Output array: orders updated during sync
|
|
207
|
+
* @param {Array<Object>} ordersNeedingCorrection - Output array: orders flagged for price correction
|
|
208
|
+
* @param {Array<Object>} unmatchedChainOrders - Output array: open chain orders with no adoptable grid slot
|
|
209
|
+
* @param {Object} options - Sync options (skipAccounting, etc.)
|
|
210
|
+
* @returns {Promise<{filledOrders: Array, updatedOrders: Array, ordersNeedingCorrection: Array, unmatchedChainOrders: Array}>}
|
|
211
|
+
*/
|
|
212
|
+
_performSyncFromOpenOrders(mgr: any, assetAPrecision: number, assetBPrecision: number, parsedChainOrders: Map<string, any>, rawChainOrders: Map<string, any>, chainOrderIdsOnGrid: Set<string>, matchedGridOrderIds: Set<string>, filledOrders: any[], updatedOrders: any[], ordersNeedingCorrection: any[], unmatchedChainOrders: any[], options: Record<string, any>): Promise<{
|
|
213
|
+
filledOrders: any[];
|
|
214
|
+
updatedOrders: any[];
|
|
215
|
+
ordersNeedingCorrection: any[];
|
|
216
|
+
unmatchedChainOrders: any[];
|
|
217
|
+
}>;
|
|
218
|
+
/**
|
|
219
|
+
* Process one incremental fill-history event.
|
|
220
|
+
* Returns `{ filledOrders, updatedOrders, partialFill, requiresOpenOrdersSync }`.
|
|
221
|
+
* @param {Object} fill - Fill history event object
|
|
222
|
+
* @param {Object} [options] - Persistence mode options
|
|
223
|
+
* @returns {Promise<Object>} { filledOrders, updatedOrders, partialFill, requiresOpenOrdersSync }
|
|
224
|
+
*/
|
|
225
|
+
syncFromFillHistory(fill: any, options?: Record<string, any>): Promise<{
|
|
226
|
+
filledOrders: any[];
|
|
227
|
+
updatedOrders: any[];
|
|
228
|
+
partialFill: boolean;
|
|
229
|
+
requiresOpenOrdersSync: boolean;
|
|
230
|
+
} | {
|
|
231
|
+
filledOrders: any[];
|
|
232
|
+
updatedOrders: any[];
|
|
233
|
+
partialFill: boolean;
|
|
234
|
+
requiresOpenOrdersSync?: undefined;
|
|
235
|
+
}>;
|
|
236
|
+
/**
|
|
237
|
+
* High-level dispatcher for different blockchain synchronization sources.
|
|
238
|
+
* Routes to the appropriate sync strategy based on the data source.
|
|
239
|
+
*
|
|
240
|
+
* SOURCES AND STRATEGIES:
|
|
241
|
+
* ========================================================================
|
|
242
|
+
* source: 'createOrder'
|
|
243
|
+
* Purpose: Grid order was successfully placed on-chain
|
|
244
|
+
* Data: { gridOrderId, chainOrderId, isPartialPlacement, fee }
|
|
245
|
+
* Action:
|
|
246
|
+
* 1. Look up grid order by gridOrderId
|
|
247
|
+
* 2. Assign the returned chainOrderId (so we can find it later)
|
|
248
|
+
* 3. Transition state based on isPartialPlacement:
|
|
249
|
+
* - false → ACTIVE (full order placed)
|
|
250
|
+
* - true → PARTIAL (placed as partial, likely due to insufficient funds)
|
|
251
|
+
* 4. Update optimistic chainFree balance (deduct fees if BTS pair)
|
|
252
|
+
* Fund Impact: Funds transition from free → locked/committed
|
|
253
|
+
*
|
|
254
|
+
* source: 'cancelOrder'
|
|
255
|
+
* Purpose: Grid order was successfully cancelled on-chain
|
|
256
|
+
* Data: The chainOrderId to cancel
|
|
257
|
+
* Action:
|
|
258
|
+
* 1. Find grid order by orderId (reverse lookup)
|
|
259
|
+
* 2. Transition to VIRTUAL (order no longer on-chain)
|
|
260
|
+
* 3. Clear orderId so it can be re-used
|
|
261
|
+
* 4. Update optimistic chainFree balance (add funds back as free)
|
|
262
|
+
* Fund Impact: Funds transition from locked → free
|
|
263
|
+
* Note: This is used for direct cancellations (not rotation/consolidation)
|
|
264
|
+
*
|
|
265
|
+
* source: 'readOpenOrders' or 'periodicBlockchainFetch'
|
|
266
|
+
* Purpose: Full snapshot sync of all open orders from blockchain
|
|
267
|
+
* Data: Array of chain orders from blockchain API
|
|
268
|
+
* Action: Delegates to syncFromOpenOrders() for full reconciliation
|
|
269
|
+
* Use Case: Periodic health check or startup initialization
|
|
270
|
+
*
|
|
271
|
+
* FUND TRACKING:
|
|
272
|
+
* Both 'createOrder' and 'cancelOrder' call updateOptimisticFreeBalance() to
|
|
273
|
+
* keep the optimistic chainFree balance in sync with actual on-chain state.
|
|
274
|
+
* This prevents fund leaks where placed orders weren't deducted or cancelled
|
|
275
|
+
* orders weren't released.
|
|
276
|
+
*
|
|
277
|
+
* RETURNS: { newOrders, ordersNeedingCorrection }
|
|
278
|
+
* Most callers use ordersNeedingCorrection to flag price corrections needed.
|
|
279
|
+
* Only syncFromOpenOrders() populates ordersNeedingCorrection.
|
|
280
|
+
*
|
|
281
|
+
* @param {Object} chainData - Chain event data
|
|
282
|
+
* @param {string} source - Source identifier ('createOrder', 'cancelOrder', 'readOpenOrders', etc.)
|
|
283
|
+
* @param {Object} [options] - Sync options forwarded to open-order reconciliation
|
|
284
|
+
* @returns {Promise<Object>} { newOrders, ordersNeedingCorrection }
|
|
285
|
+
*/
|
|
286
|
+
synchronizeWithChain(chainData: any, source: string, options?: Record<string, any>): Promise<any>;
|
|
287
|
+
/**
|
|
288
|
+
* Fetch account balances from blockchain and update optimistic fund totals.
|
|
289
|
+
* This is a critical method for financial accuracy and must be called periodically.
|
|
290
|
+
*
|
|
291
|
+
* BALANCE FETCHING:
|
|
292
|
+
* ========================================================================
|
|
293
|
+
* This method queries the blockchain for the actual account balances in both
|
|
294
|
+
* assetA and assetB. It retrieves:
|
|
295
|
+
* - total: Total balance (including locked amounts)
|
|
296
|
+
* - free: Available balance (not locked in orders)
|
|
297
|
+
*
|
|
298
|
+
* These are stored in mgr.accountTotals as:
|
|
299
|
+
* - sell: assetA total (what we can sell)
|
|
300
|
+
* - sellFree: assetA available
|
|
301
|
+
* - buy: assetB total (what we can buy with)
|
|
302
|
+
* - buyFree: assetB available
|
|
303
|
+
*
|
|
304
|
+
* IMPORTANCE FOR FUND TRACKING:
|
|
305
|
+
* The grid maintains an "optimistic" free balance that tracks fund deductions
|
|
306
|
+
* as orders transition states. However, the blockchain is the source of truth.
|
|
307
|
+
* Periodically fetching actual balances allows us to:
|
|
308
|
+
*
|
|
309
|
+
* 1. RECONCILE: Detect if optimistic state diverged from reality
|
|
310
|
+
* Example: If we think buyFree=1000 but blockchain says 950,
|
|
311
|
+
* something was deducted (fee, slippage, etc.) that we didn't track.
|
|
312
|
+
*
|
|
313
|
+
* 2. RECOVER: Identify "orphaned" funds that got stuck somewhere
|
|
314
|
+
* If actual > optimistic, we can reabsorb the extra into available pool.
|
|
315
|
+
*
|
|
316
|
+
* 3. PREVENT OVERSPEND: Use actual totals as the hard ceiling
|
|
317
|
+
* Even if optimistic calc says we have X funds, we never exceed actual total.
|
|
318
|
+
*
|
|
319
|
+
* FUND FORMULA:
|
|
320
|
+
* At any time, this should hold:
|
|
321
|
+
* chainTotal = chainFree + chainCommitted
|
|
322
|
+
* Where:
|
|
323
|
+
* chainTotal = actual on-chain total from blockchain
|
|
324
|
+
* chainFree = free balance (unallocated)
|
|
325
|
+
* chainCommitted = sum of all ACTIVE/PARTIAL order sizes on-chain
|
|
326
|
+
*
|
|
327
|
+
* ASSET INITIALIZATION:
|
|
328
|
+
* First calls initializeAssets() to ensure assetA and assetB metadata is loaded.
|
|
329
|
+
* Without this, we can't convert between blockchain precision and float values.
|
|
330
|
+
*
|
|
331
|
+
* ERROR HANDLING:
|
|
332
|
+
* Gracefully handles lookup failures. If blockchain fetch fails, we don't crash
|
|
333
|
+
* but instead log a warning. The system continues with last-known balances.
|
|
334
|
+
*
|
|
335
|
+
* @returns {Promise<void>}
|
|
336
|
+
*/
|
|
337
|
+
fetchAccountBalancesAndSetTotals(): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* Initialize asset metadata for assetA and assetB.
|
|
340
|
+
* This must be called before any blockchain operations, as asset metadata
|
|
341
|
+
* (ID, precision) is required for all conversions and lookups.
|
|
342
|
+
*
|
|
343
|
+
* WHY ASSET METADATA MATTERS:
|
|
344
|
+
* ========================================================================
|
|
345
|
+
* The blockchain and grid use different representations for amounts:
|
|
346
|
+
*
|
|
347
|
+
* Blockchain: Uses integers (atomic units based on asset precision)
|
|
348
|
+
* - BTS: precision 5 → 1 BTS = 100000 satoshis
|
|
349
|
+
* - USDT: precision 6 → 1 USDT = 1000000 satoshis
|
|
350
|
+
* Storage on-chain is always integer to prevent floating-point errors
|
|
351
|
+
*
|
|
352
|
+
* Grid: Uses floats for all calculations
|
|
353
|
+
* - Easier to work with for price/size calculations
|
|
354
|
+
* - Must round-trip correctly through blockchain precision
|
|
355
|
+
*
|
|
356
|
+
* Asset Metadata Needed:
|
|
357
|
+
* 1. asset_id: Required to match orders on-chain
|
|
358
|
+
* When we see an order selling assetA for assetB, we identify it by comparing
|
|
359
|
+
* the asset_ids in the sell_price object.
|
|
360
|
+
*
|
|
361
|
+
* 2. precision: Required for float ↔ integer conversions
|
|
362
|
+
* floatToBlockchainInt(1.5, precision=5) = 150000
|
|
363
|
+
* blockchainToFloat(150000, precision=5) = 1.5
|
|
364
|
+
*
|
|
365
|
+
* Without precision, we can't:
|
|
366
|
+
* - Compare order sizes (float vs blockchain int)
|
|
367
|
+
* - Calculate fills (precision matters at extreme sizes)
|
|
368
|
+
* - Match chain orders to grid orders (need correct ID)
|
|
369
|
+
* - Convert fill amounts to grid sizes
|
|
370
|
+
*
|
|
371
|
+
* INITIALIZATION STRATEGY:
|
|
372
|
+
* Assets are looked up asynchronously via the BitShares API.
|
|
373
|
+
* The lookup is idempotent: if assets are already initialized, returns immediately.
|
|
374
|
+
* This allows safe calls from multiple places without redundant lookups.
|
|
375
|
+
*
|
|
376
|
+
* ERROR HANDLING:
|
|
377
|
+
* If asset lookup fails (asset doesn't exist, API error, etc.), the error
|
|
378
|
+
* is propagated (not caught). This is intentional - a missing asset is a
|
|
379
|
+
* configuration error that must be fixed before the bot can operate.
|
|
380
|
+
*
|
|
381
|
+
* @returns {Promise<void>}
|
|
382
|
+
*/
|
|
383
|
+
initializeAssets(): Promise<void>;
|
|
384
|
+
}
|
|
385
|
+
export = SyncEngine;
|
|
386
|
+
//# sourceMappingURL=sync_engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync_engine.d.ts","sourceRoot":"","sources":["../../../modules/order/sync_engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAkLH,cAAM,UAAU;IACZ,OAAO,CAAC,OAAO,CAAM;IACrB;;OAEG;gBACS,OAAO,EAAE,GAAG;IAIxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DG;IACH;;;;;OAKG;IACG,kBAAkB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAyErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;IA6HnF;;;;;;;;;;;;;;;OAeG;IACG,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9J,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,uBAAuB,EAAE,GAAG,EAAE,EAAE,oBAAoB,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;;IAoV5M;;;;;;OAMG;IACG,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;;;;;;;;;;;IAwQtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACG,oBAAoB,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IA0K5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACG,gCAAgC;IA0CtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACG,gBAAgB;CAgCzB;AAED,SAAS,UAAU,CAAC"}
|