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,662 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* modules/account_orders.ts - Order Grid Persistence Layer
|
|
4
|
+
*
|
|
5
|
+
* Local persistence for order grid snapshots and state.
|
|
6
|
+
* Enables bot recovery after crashes or restarts.
|
|
7
|
+
*
|
|
8
|
+
* Per-Bot Architecture:
|
|
9
|
+
* Each bot has its own dedicated file: profiles/orders/{botKey}.json
|
|
10
|
+
* The file stores a single bot's data directly (no per-file wrapper),
|
|
11
|
+
* which makes the doubled-entry bug structurally impossible.
|
|
12
|
+
*
|
|
13
|
+
* ===============================================================================
|
|
14
|
+
* EXPORTS (1 class + 1 helper)
|
|
15
|
+
* ===============================================================================
|
|
16
|
+
*
|
|
17
|
+
* 1. AccountOrders(botKey) - Class for per-bot order persistence
|
|
18
|
+
* Methods: readOrders(), writeOrders(meta, grid, state), deleteOrders(), etc.
|
|
19
|
+
* Constructor requires botKey (throws if missing)
|
|
20
|
+
*
|
|
21
|
+
* 2. createBotKey(accountName, assetA, assetB) - Generate unique bot key string
|
|
22
|
+
*
|
|
23
|
+
* ===============================================================================
|
|
24
|
+
*
|
|
25
|
+
* FILE STRUCTURE (profiles/orders/{botKey}.json):
|
|
26
|
+
* {
|
|
27
|
+
* "meta": {
|
|
28
|
+
* "name": "Bot name",
|
|
29
|
+
* "assetA": "BTS",
|
|
30
|
+
* "assetB": "USD",
|
|
31
|
+
* "active": true,
|
|
32
|
+
* "index": 0
|
|
33
|
+
* },
|
|
34
|
+
* "grid": [
|
|
35
|
+
* { "id": "slot-0", "type": "buy", "state": "virtual", "price": 100, "size": 1, "orderId": null },
|
|
36
|
+
* ...
|
|
37
|
+
* ],
|
|
38
|
+
* "btsFeesOwed": 0.1,
|
|
39
|
+
* "createdAt": "ISO timestamp",
|
|
40
|
+
* "lastUpdated": "ISO timestamp"
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* GRID ENTRY FIELDS:
|
|
44
|
+
* - id: Unique identifier (format: slot-N or custom)
|
|
45
|
+
* - type: 'buy', 'sell', or 'spread'
|
|
46
|
+
* - state: 'virtual', 'active', or 'partial'
|
|
47
|
+
* - price: Price level
|
|
48
|
+
* - size: Order size in base asset
|
|
49
|
+
* - orderId: Blockchain order ID (null for VIRTUAL)
|
|
50
|
+
*
|
|
51
|
+
* ===============================================================================
|
|
52
|
+
*/
|
|
53
|
+
const { path } = require('./path_api');
|
|
54
|
+
const { getStorage } = require('./storage');
|
|
55
|
+
const storage = getStorage();
|
|
56
|
+
const { ORDER_TYPES, ORDER_STATES } = require('./constants');
|
|
57
|
+
const { PATHS } = require('./paths');
|
|
58
|
+
const AsyncLock = require('./order/async_lock');
|
|
59
|
+
const { isPhantomOrder } = require('./order/utils/order');
|
|
60
|
+
const Format = require('./order/format');
|
|
61
|
+
const { toFiniteNumber } = Format;
|
|
62
|
+
const { ensureDir } = require('./order/utils/system');
|
|
63
|
+
const Logger = require('./logger');
|
|
64
|
+
const accountOrdersLogger = new Logger('AccountOrders');
|
|
65
|
+
/**
|
|
66
|
+
* Ensures that the directory for the given file path exists.
|
|
67
|
+
* @param {string} filePath - The file path to check.
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
function ensureDirExists(filePath) {
|
|
71
|
+
ensureDir(path.dirname(filePath));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sanitizes a string to be used as a key in storage.
|
|
75
|
+
* @param {string} source - The source string.
|
|
76
|
+
* @returns {string} The sanitized string.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
function sanitizeKey(source) {
|
|
80
|
+
if (!source)
|
|
81
|
+
return 'bot';
|
|
82
|
+
return String(source)
|
|
83
|
+
.trim()
|
|
84
|
+
.toLowerCase()
|
|
85
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
86
|
+
.replace(/^-+|-+$/g, '') || 'bot';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate a unique key for identifying a bot in storage.
|
|
90
|
+
* Bot names are enforced unique, so for named bots the key is simply
|
|
91
|
+
* the sanitized name. Unnamed bots fall back to sanitized asset pair + index.
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} bot - Bot configuration
|
|
94
|
+
* @param {number} index - Index in bots array (used for unnamed fallback)
|
|
95
|
+
* @returns {string} Sanitized key
|
|
96
|
+
*/
|
|
97
|
+
function createBotKey(bot, index) {
|
|
98
|
+
if (bot && bot.name) {
|
|
99
|
+
return sanitizeKey(bot.name);
|
|
100
|
+
}
|
|
101
|
+
const identifier = bot && bot.assetA && bot.assetB
|
|
102
|
+
? `${bot.assetA}/${bot.assetB}`
|
|
103
|
+
: bot && bot.assetAId && bot.assetBId
|
|
104
|
+
? `${bot.assetAId}/${bot.assetBId}`
|
|
105
|
+
: `bot-${index}`;
|
|
106
|
+
return `${sanitizeKey(identifier)}-${index}`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Returns the current date and time in ISO format.
|
|
110
|
+
* @returns {string} ISO timestamp.
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
function nowIso() {
|
|
114
|
+
return new Date().toISOString();
|
|
115
|
+
}
|
|
116
|
+
const SENSITIVE_KEY_PATTERN = /(private|secret|password|credential|wif|token|hmac|memo)/i;
|
|
117
|
+
function cloneForDebug(value, seen = new WeakSet()) {
|
|
118
|
+
if (typeof value === 'bigint')
|
|
119
|
+
return value.toString();
|
|
120
|
+
if (value === null || typeof value !== 'object')
|
|
121
|
+
return value;
|
|
122
|
+
if (seen.has(value))
|
|
123
|
+
return '[Circular]';
|
|
124
|
+
if (value instanceof Map) {
|
|
125
|
+
seen.add(value);
|
|
126
|
+
return Object.fromEntries(Array.from(value.entries(), ([key, item]) => [
|
|
127
|
+
key,
|
|
128
|
+
SENSITIVE_KEY_PATTERN.test(String(key)) ? '[REDACTED]' : cloneForDebug(item, seen)
|
|
129
|
+
]));
|
|
130
|
+
}
|
|
131
|
+
if (value instanceof Set) {
|
|
132
|
+
seen.add(value);
|
|
133
|
+
return Array.from(value.values(), item => cloneForDebug(item, seen));
|
|
134
|
+
}
|
|
135
|
+
if (value instanceof Date)
|
|
136
|
+
return value.toISOString();
|
|
137
|
+
seen.add(value);
|
|
138
|
+
if (Array.isArray(value)) {
|
|
139
|
+
return value.map(item => cloneForDebug(item, seen));
|
|
140
|
+
}
|
|
141
|
+
const result = {};
|
|
142
|
+
for (const [key, item] of Object.entries(value)) {
|
|
143
|
+
if (typeof item === 'function')
|
|
144
|
+
continue;
|
|
145
|
+
result[key] = SENSITIVE_KEY_PATTERN.test(key) ? '[REDACTED]' : cloneForDebug(item, seen);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Builds an empty per-bot data object. The file is single-object, so this is
|
|
151
|
+
* the default content when the file does not yet exist.
|
|
152
|
+
* @returns {Object} Fresh data object
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
function emptyData() {
|
|
156
|
+
const timestamp = nowIso();
|
|
157
|
+
return {
|
|
158
|
+
meta: null,
|
|
159
|
+
grid: [],
|
|
160
|
+
btsFeesOwed: 0,
|
|
161
|
+
btsBalance: null,
|
|
162
|
+
boundaryIdx: null,
|
|
163
|
+
assets: null,
|
|
164
|
+
debugInputs: null,
|
|
165
|
+
processedFills: {},
|
|
166
|
+
createdAt: timestamp,
|
|
167
|
+
lastUpdated: timestamp
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* AccountOrders class - manages order grid persistence
|
|
172
|
+
*
|
|
173
|
+
* Provides methods to:
|
|
174
|
+
* - Store and load order grid snapshots
|
|
175
|
+
* - Track bot metadata and state
|
|
176
|
+
* - Calculate asset balances from stored grids
|
|
177
|
+
*
|
|
178
|
+
* Each bot has its own file: {botkey}.json
|
|
179
|
+
* The file holds the bot's data directly (no `bots: { [key]: ... }` wrapper).
|
|
180
|
+
*
|
|
181
|
+
* @class
|
|
182
|
+
*/
|
|
183
|
+
class AccountOrders {
|
|
184
|
+
botKey;
|
|
185
|
+
profilesPath;
|
|
186
|
+
_persistenceLock;
|
|
187
|
+
_needsBootstrapSave;
|
|
188
|
+
data;
|
|
189
|
+
/**
|
|
190
|
+
* Create an AccountOrders instance.
|
|
191
|
+
* @param {Object} options - Configuration options
|
|
192
|
+
* @param {string} options.botKey - Bot identifier (e.g., 'xrp-bts-0', 'h-bts-1')
|
|
193
|
+
* @param {string} [options.ordersDir] - Optional override for the per-bot storage directory
|
|
194
|
+
* @param {string} [options.profilesPath] - Optional override for the per-bot storage file path
|
|
195
|
+
*/
|
|
196
|
+
constructor(options = { botKey: '' }) {
|
|
197
|
+
if (!options.botKey)
|
|
198
|
+
throw new Error("botKey required for AccountOrders");
|
|
199
|
+
this.botKey = options.botKey;
|
|
200
|
+
// Use per-bot file: {botKey}.json
|
|
201
|
+
const ordersDir = options.ordersDir || PATHS.ORDERS_DIR;
|
|
202
|
+
this.profilesPath = options.profilesPath || path.join(ordersDir, `${this.botKey}.json`);
|
|
203
|
+
// AsyncLock prevents concurrent read-modify-write races on file I/O
|
|
204
|
+
this._persistenceLock = new AsyncLock();
|
|
205
|
+
this._needsBootstrapSave = !storage.exists(this.profilesPath);
|
|
206
|
+
this.data = this._loadData() || emptyData();
|
|
207
|
+
// One-time upgrade migration: pre-1.1.0 files used a { bots: { [key]: ... } }
|
|
208
|
+
// wrapper. Strip it and rewrite the file in the flat shape so the bot keeps
|
|
209
|
+
// its grid across the upgrade.
|
|
210
|
+
if (this._migrateLegacyWrapper()) {
|
|
211
|
+
this._needsBootstrapSave = true;
|
|
212
|
+
}
|
|
213
|
+
if (this._needsBootstrapSave) {
|
|
214
|
+
this._persist();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Loads the data for the current bot from its profile file.
|
|
219
|
+
* @returns {Object|null} The loaded data or null if not found.
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
_loadData() {
|
|
223
|
+
// Load the file directly - per-bot files only contain their own bot's data
|
|
224
|
+
return this._readFile(this.profilesPath);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Detects the pre-1.1.0 `{ bots: { [key]: ... } }` wrapper in `this.data` and,
|
|
228
|
+
* if present, extracts the entry matching this.botKey (and warns about any
|
|
229
|
+
* other keys, which were the doubled-entry bug). Returns true when a rewrite
|
|
230
|
+
* is required.
|
|
231
|
+
* @returns {boolean} True when this.data was rewritten and needs persistence.
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
_migrateLegacyWrapper() {
|
|
235
|
+
const data = this.data;
|
|
236
|
+
if (!data || typeof data !== 'object' || Array.isArray(data))
|
|
237
|
+
return false;
|
|
238
|
+
if (!data.bots || typeof data.bots !== 'object' || Array.isArray(data.bots))
|
|
239
|
+
return false;
|
|
240
|
+
const bots = data.bots;
|
|
241
|
+
const keys = Object.keys(bots);
|
|
242
|
+
if (keys.length === 0) {
|
|
243
|
+
this.data = emptyData();
|
|
244
|
+
accountOrdersLogger.info(`Migrated legacy empty bots wrapper for ${this.botKey}`);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
const matching = bots[this.botKey];
|
|
248
|
+
if (matching && typeof matching === 'object' && !Array.isArray(matching)) {
|
|
249
|
+
this.data = { ...emptyData(), ...matching };
|
|
250
|
+
const orphans = keys.filter((k) => k !== this.botKey);
|
|
251
|
+
if (orphans.length > 0) {
|
|
252
|
+
accountOrdersLogger.warn(`Discarded ${orphans.length} orphan bot entr${orphans.length === 1 ? 'y' : 'ies'} ` +
|
|
253
|
+
`from legacy wrapper in ${this.botKey}.json: ${orphans.join(', ')}`);
|
|
254
|
+
}
|
|
255
|
+
accountOrdersLogger.info(`Migrated legacy { bots: { ... } } wrapper for ${this.botKey}`);
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
// No usable entry for this bot. Pick the first object-valued entry, or
|
|
259
|
+
// start fresh if every value is corrupt (array / primitive / null).
|
|
260
|
+
const fallbackKey = keys.find((k) => {
|
|
261
|
+
const v = bots[k];
|
|
262
|
+
return v && typeof v === 'object' && !Array.isArray(v);
|
|
263
|
+
});
|
|
264
|
+
if (fallbackKey) {
|
|
265
|
+
const fallback = bots[fallbackKey];
|
|
266
|
+
accountOrdersLogger.warn(`Legacy wrapper in ${this.botKey}.json had no entry for this bot; ` +
|
|
267
|
+
`falling back to ${fallbackKey}`);
|
|
268
|
+
this.data = { ...emptyData(), ...fallback };
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
accountOrdersLogger.warn(`Legacy wrapper in ${this.botKey}.json had no object entry; starting with empty data`);
|
|
272
|
+
this.data = emptyData();
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Reads and parses a JSON file.
|
|
277
|
+
* @param {string} filePath - The path to the file.
|
|
278
|
+
* @returns {Object|null} The parsed object or null on failure.
|
|
279
|
+
* @private
|
|
280
|
+
*/
|
|
281
|
+
_readFile(filePath) {
|
|
282
|
+
try {
|
|
283
|
+
const parsed = storage.readJSON(filePath);
|
|
284
|
+
if (typeof parsed === 'object' && parsed !== null)
|
|
285
|
+
return parsed;
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
if (err?.code !== 'ENOENT' && !(err instanceof SyntaxError)) {
|
|
289
|
+
accountOrdersLogger.warn(`Failed to read ${filePath} - ${err.message}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Persists the current data to the profile file.
|
|
296
|
+
* @private
|
|
297
|
+
*/
|
|
298
|
+
_persist() {
|
|
299
|
+
ensureDirExists(this.profilesPath);
|
|
300
|
+
storage.writeJSON(this.profilesPath, this.data, { fsync: true });
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Sync the persisted meta for this bot from its bots.json entry.
|
|
304
|
+
* Creates a new file if the meta was never written; updates the existing
|
|
305
|
+
* meta in place if it has drifted. The grid and other state are not touched.
|
|
306
|
+
* @param {Object} botConfig - The bot config matching this.botKey
|
|
307
|
+
*/
|
|
308
|
+
async syncMeta(botConfig) {
|
|
309
|
+
if (!botConfig)
|
|
310
|
+
return;
|
|
311
|
+
await this._persistenceLock.acquire(async () => {
|
|
312
|
+
// Reload from disk to ensure we have the latest state
|
|
313
|
+
this.data = this._loadData() || emptyData();
|
|
314
|
+
const newMeta = this._buildMeta(botConfig, this.botKey, botConfig.botIndex ?? 0, this.data.meta);
|
|
315
|
+
const prevMeta = this.data.meta;
|
|
316
|
+
if (this._metaChanged(prevMeta, newMeta)) {
|
|
317
|
+
accountOrdersLogger.info(`Metadata changed for bot ${this.botKey}: updating from old metadata to new`);
|
|
318
|
+
accountOrdersLogger.info(` OLD: name=${prevMeta?.name}, assetA=${prevMeta?.assetA}, assetB=${prevMeta?.assetB}, active=${prevMeta?.active}`);
|
|
319
|
+
accountOrdersLogger.info(` NEW: name=${newMeta.name}, assetA=${newMeta.assetA}, assetB=${newMeta.assetB}, active=${newMeta.active}`);
|
|
320
|
+
this.data.meta = { ...(prevMeta || {}), ...newMeta, createdAt: prevMeta?.createdAt || newMeta.createdAt };
|
|
321
|
+
this.data.lastUpdated = nowIso();
|
|
322
|
+
this._persist();
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
accountOrdersLogger.info(`No metadata change for bot ${this.botKey} - skipping update`);
|
|
326
|
+
accountOrdersLogger.info(` CURRENT: name=${prevMeta?.name}, assetA=${prevMeta?.assetA}, assetB=${prevMeta?.assetB}, active=${prevMeta?.active}`);
|
|
327
|
+
accountOrdersLogger.info(` PASSED: name=${newMeta.name}, assetA=${newMeta.assetA}, assetB=${newMeta.assetB}, active=${newMeta.active}`);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Checks whether two meta objects differ on the relevant fields.
|
|
333
|
+
* @param {Object} existing - The existing meta (possibly null).
|
|
334
|
+
* @param {Object} next - The new meta.
|
|
335
|
+
* @returns {boolean} True if meta has changed.
|
|
336
|
+
* @private
|
|
337
|
+
*/
|
|
338
|
+
_metaChanged(existing, next) {
|
|
339
|
+
if (!existing)
|
|
340
|
+
return true;
|
|
341
|
+
return existing.name !== next.name ||
|
|
342
|
+
existing.assetA !== next.assetA ||
|
|
343
|
+
existing.assetB !== next.assetB ||
|
|
344
|
+
existing.active !== next.active ||
|
|
345
|
+
existing.index !== next.index;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Builds a metadata object for a bot.
|
|
349
|
+
* @param {Object} bot - The bot configuration.
|
|
350
|
+
* @param {string} key - The bot key.
|
|
351
|
+
* @param {number} index - The bot index.
|
|
352
|
+
* @param {Object} [existing={}] - Existing metadata for preserving createdAt.
|
|
353
|
+
* @returns {Object} The new meta object.
|
|
354
|
+
* @private
|
|
355
|
+
*/
|
|
356
|
+
_buildMeta(bot, key, index, existing = null) {
|
|
357
|
+
const timestamp = nowIso();
|
|
358
|
+
return {
|
|
359
|
+
key,
|
|
360
|
+
name: bot.name || null,
|
|
361
|
+
assetA: bot.assetA || null,
|
|
362
|
+
assetB: bot.assetB || null,
|
|
363
|
+
active: !!bot.active,
|
|
364
|
+
index,
|
|
365
|
+
createdAt: (existing && existing.createdAt) || timestamp,
|
|
366
|
+
updatedAt: timestamp
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Save the current order grid snapshot for this bot.
|
|
371
|
+
* Called after grid changes (initialization, fills, syncs).
|
|
372
|
+
* @param {Array} orders - Array of order objects from OrderManager
|
|
373
|
+
* @param {number|null} btsFeesOwed - Optional BTS blockchain fees owed
|
|
374
|
+
* @param {number|null} boundaryIdx - Optional master boundary index for StrategyEngine
|
|
375
|
+
* @param {Object|null} assets - Optional asset metadata { assetA, assetB }
|
|
376
|
+
* @param {Object|null} debugInputs - Optional debug-only input snapshot
|
|
377
|
+
*/
|
|
378
|
+
async storeMasterGrid(orders = [], btsFeesOwed = null, boundaryIdx = null, assets = null, debugInputs = null) {
|
|
379
|
+
// Use AsyncLock to serialize read-modify-write operations
|
|
380
|
+
await this._persistenceLock.acquire(async () => {
|
|
381
|
+
// Reload from disk before writing to prevent race conditions
|
|
382
|
+
this.data = this._loadData() || emptyData();
|
|
383
|
+
const snapshot = Array.isArray(orders) ? orders.map(order => this._serializeOrder(order)) : [];
|
|
384
|
+
const debugSnapshot = debugInputs ? cloneForDebug(debugInputs) : null;
|
|
385
|
+
this.data.grid = snapshot;
|
|
386
|
+
if (Number.isFinite(btsFeesOwed)) {
|
|
387
|
+
this.data.btsFeesOwed = btsFeesOwed;
|
|
388
|
+
}
|
|
389
|
+
if (Number.isFinite(boundaryIdx)) {
|
|
390
|
+
this.data.boundaryIdx = boundaryIdx;
|
|
391
|
+
}
|
|
392
|
+
if (assets) {
|
|
393
|
+
this.data.assets = assets;
|
|
394
|
+
}
|
|
395
|
+
if (debugSnapshot) {
|
|
396
|
+
this.data.debugInputs = debugSnapshot;
|
|
397
|
+
}
|
|
398
|
+
// Persist btsBalance for non-BTS pairs (passed via debugInputs)
|
|
399
|
+
if (debugSnapshot && debugSnapshot.btsBalance) {
|
|
400
|
+
this.data.btsBalance = debugSnapshot.btsBalance;
|
|
401
|
+
}
|
|
402
|
+
// Initialize processedFills if missing (backward compat)
|
|
403
|
+
if (!this.data.processedFills) {
|
|
404
|
+
this.data.processedFills = {};
|
|
405
|
+
}
|
|
406
|
+
const timestamp = nowIso();
|
|
407
|
+
this.data.lastUpdated = timestamp;
|
|
408
|
+
if (this.data.meta)
|
|
409
|
+
this.data.meta.updatedAt = timestamp;
|
|
410
|
+
this._persist();
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Load the persisted order grid for this bot.
|
|
415
|
+
* @param {boolean} forceReload - If true, reload from disk to ensure fresh data
|
|
416
|
+
* @returns {Array|null} Order grid array or null if not found
|
|
417
|
+
*/
|
|
418
|
+
loadGrid(forceReload = false) {
|
|
419
|
+
if (forceReload) {
|
|
420
|
+
this.data = this._loadData() || emptyData();
|
|
421
|
+
}
|
|
422
|
+
return (this.data && Array.isArray(this.data.grid)) ? this.data.grid : null;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Load persisted asset metadata for this bot.
|
|
426
|
+
* @param {boolean} forceReload - If true, reload from disk
|
|
427
|
+
* @returns {Object|null} Asset metadata { assetA, assetB } or null if not found
|
|
428
|
+
*/
|
|
429
|
+
loadPersistedAssets(forceReload = false) {
|
|
430
|
+
if (forceReload) {
|
|
431
|
+
this.data = this._loadData() || emptyData();
|
|
432
|
+
}
|
|
433
|
+
if (this.data && this.data.assets) {
|
|
434
|
+
return this.data.assets;
|
|
435
|
+
}
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Load the master boundary index for this bot.
|
|
440
|
+
* @param {boolean} forceReload - If true, reload from disk
|
|
441
|
+
* @returns {number|null} Boundary index or null if not found
|
|
442
|
+
*/
|
|
443
|
+
loadBoundaryIdx(forceReload = false) {
|
|
444
|
+
if (forceReload) {
|
|
445
|
+
this.data = this._loadData() || emptyData();
|
|
446
|
+
}
|
|
447
|
+
if (this.data) {
|
|
448
|
+
const idx = this.data.boundaryIdx;
|
|
449
|
+
if (typeof idx === 'number' && Number.isFinite(idx)) {
|
|
450
|
+
return idx;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Load persisted BTS balance for this bot (non-BTS pairs only).
|
|
457
|
+
* @param {boolean} forceReload - If true, reload from disk
|
|
458
|
+
* @returns {Object|null} BTS balance { free, total, locked } or null if not found
|
|
459
|
+
*/
|
|
460
|
+
loadBtsBalance(forceReload = false) {
|
|
461
|
+
if (forceReload) {
|
|
462
|
+
this.data = this._loadData() || emptyData();
|
|
463
|
+
}
|
|
464
|
+
if (this.data && this.data.btsBalance && typeof this.data.btsBalance === 'object') {
|
|
465
|
+
return this.data.btsBalance;
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Load BTS blockchain fees owed for this bot.
|
|
471
|
+
* BTS fees accumulate during fill processing and must persist across restarts
|
|
472
|
+
* to ensure they are properly deducted from proceeds during rotation.
|
|
473
|
+
* @param {boolean} forceReload - If true, reload from disk to ensure fresh data
|
|
474
|
+
* @returns {number} BTS fees owed or 0 if not found
|
|
475
|
+
*/
|
|
476
|
+
loadBtsFeesOwed(forceReload = false) {
|
|
477
|
+
if (forceReload) {
|
|
478
|
+
this.data = this._loadData() || emptyData();
|
|
479
|
+
}
|
|
480
|
+
if (this.data) {
|
|
481
|
+
const fees = this.data.btsFeesOwed;
|
|
482
|
+
if (typeof fees === 'number' && Number.isFinite(fees)) {
|
|
483
|
+
return fees;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return 0;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Update (persist) BTS blockchain fees for this bot.
|
|
490
|
+
* BTS fees are deducted during fill processing and must be tracked across
|
|
491
|
+
* restarts to prevent fund loss if the bot crashes before rotation.
|
|
492
|
+
* @param {number} btsFeesOwed - BTS blockchain fees owed
|
|
493
|
+
*/
|
|
494
|
+
async updateBtsFeesOwed(btsFeesOwed) {
|
|
495
|
+
await this._persistenceLock.acquire(async () => {
|
|
496
|
+
this.data = this._loadData() || emptyData();
|
|
497
|
+
this.data.btsFeesOwed = btsFeesOwed || 0;
|
|
498
|
+
this.data.lastUpdated = nowIso();
|
|
499
|
+
this._persist();
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Clear the persisted grid for this bot.
|
|
504
|
+
* @returns {Promise<boolean>} true if cleared successfully
|
|
505
|
+
*/
|
|
506
|
+
async clearGrid() {
|
|
507
|
+
return await this._persistenceLock.acquire(async () => {
|
|
508
|
+
this.data = this._loadData() || emptyData();
|
|
509
|
+
this.data.grid = [];
|
|
510
|
+
this.data.btsFeesOwed = 0;
|
|
511
|
+
this.data.lastUpdated = nowIso();
|
|
512
|
+
this._persist();
|
|
513
|
+
return true;
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Load processed fill IDs for this bot to prevent reprocessing fills across
|
|
518
|
+
* restarts. Returns a Map of fillKey => timestamp for fills already processed.
|
|
519
|
+
* @param {boolean|Object} options - Reload/filter options
|
|
520
|
+
* @returns {Map} Map of fillKey => timestamp
|
|
521
|
+
*/
|
|
522
|
+
loadProcessedFills(options = {}) {
|
|
523
|
+
const forceReload = typeof options === 'boolean' ? options : options?.forceReload === true;
|
|
524
|
+
const minTimestamp = typeof options === 'object' && options !== null && Number.isFinite(options.minTimestamp)
|
|
525
|
+
? options.minTimestamp
|
|
526
|
+
: null;
|
|
527
|
+
if (forceReload) {
|
|
528
|
+
this.data = this._loadData() || emptyData();
|
|
529
|
+
}
|
|
530
|
+
if (this.data) {
|
|
531
|
+
const fills = this.data.processedFills || {};
|
|
532
|
+
const entries = Object.entries(fills).filter(([, timestamp]) => minTimestamp === null || (Number.isFinite(timestamp) && timestamp >= minTimestamp));
|
|
533
|
+
return new Map(entries);
|
|
534
|
+
}
|
|
535
|
+
return new Map();
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Persist a batch of processed fill records in one locked disk write.
|
|
539
|
+
* @param {Map<string, number>} fills - Processed fill entries
|
|
540
|
+
*/
|
|
541
|
+
async updateProcessedFillsBatch(fills) {
|
|
542
|
+
if (!(fills instanceof Map) || fills.size === 0)
|
|
543
|
+
return;
|
|
544
|
+
await this._persistenceLock.acquire(async () => {
|
|
545
|
+
this.data = this._loadData() || emptyData();
|
|
546
|
+
if (!this.data.processedFills) {
|
|
547
|
+
this.data.processedFills = {};
|
|
548
|
+
}
|
|
549
|
+
let changed = false;
|
|
550
|
+
for (const [fillKey, timestamp] of fills) {
|
|
551
|
+
if (!fillKey)
|
|
552
|
+
continue;
|
|
553
|
+
if (this.data.processedFills[fillKey] === timestamp)
|
|
554
|
+
continue;
|
|
555
|
+
this.data.processedFills[fillKey] = timestamp;
|
|
556
|
+
changed = true;
|
|
557
|
+
}
|
|
558
|
+
if (!changed)
|
|
559
|
+
return;
|
|
560
|
+
this.data.lastUpdated = nowIso();
|
|
561
|
+
this._persist();
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Clean up old processed fill records (remove entries older than specified age).
|
|
566
|
+
* Prevents processedFills from growing unbounded over time.
|
|
567
|
+
* @param {number} olderThanMs - Remove fills processed more than this many milliseconds ago
|
|
568
|
+
*/
|
|
569
|
+
async cleanOldProcessedFills(olderThanMs = 3600000) {
|
|
570
|
+
// Default: 1 hour (3600000ms)
|
|
571
|
+
await this._persistenceLock.acquire(async () => {
|
|
572
|
+
this.data = this._loadData() || emptyData();
|
|
573
|
+
if (!this.data.processedFills) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const now = Date.now();
|
|
577
|
+
const fills = this.data.processedFills;
|
|
578
|
+
let deletedCount = 0;
|
|
579
|
+
for (const [fillKey, timestamp] of Object.entries(fills)) {
|
|
580
|
+
if (now - timestamp > olderThanMs) {
|
|
581
|
+
delete fills[fillKey];
|
|
582
|
+
deletedCount++;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (deletedCount > 0) {
|
|
586
|
+
this.data.lastUpdated = nowIso();
|
|
587
|
+
this._persist();
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Calculate asset balances from the persisted grid for this bot.
|
|
593
|
+
* Sums order sizes by asset and state (active vs virtual).
|
|
594
|
+
* @param {boolean} forceReload - If true, reload from disk to ensure fresh data
|
|
595
|
+
* @returns {Object|null} Balance summary or null if no data
|
|
596
|
+
*/
|
|
597
|
+
getAssetBalances(forceReload = false) {
|
|
598
|
+
if (forceReload) {
|
|
599
|
+
this.data = this._loadData() || emptyData();
|
|
600
|
+
}
|
|
601
|
+
if (!this.data)
|
|
602
|
+
return null;
|
|
603
|
+
const meta = this.data.meta || {};
|
|
604
|
+
const grid = Array.isArray(this.data.grid) ? this.data.grid : [];
|
|
605
|
+
const sums = {
|
|
606
|
+
assetA: { active: 0, virtual: 0 },
|
|
607
|
+
assetB: { active: 0, virtual: 0 },
|
|
608
|
+
meta: { key: this.botKey, name: meta.name || null, assetA: meta.assetA || null, assetB: meta.assetB || null }
|
|
609
|
+
};
|
|
610
|
+
for (const o of grid) {
|
|
611
|
+
const size = toFiniteNumber(o?.size);
|
|
612
|
+
const state = o && o.state || '';
|
|
613
|
+
const typ = o && o.type || '';
|
|
614
|
+
if (typ === ORDER_TYPES.SELL) {
|
|
615
|
+
if (state === ORDER_STATES.ACTIVE || state === ORDER_STATES.PARTIAL)
|
|
616
|
+
sums.assetA.active += size;
|
|
617
|
+
else if (state === ORDER_STATES.VIRTUAL)
|
|
618
|
+
sums.assetA.virtual += size;
|
|
619
|
+
}
|
|
620
|
+
else if (typ === ORDER_TYPES.BUY) {
|
|
621
|
+
if (state === ORDER_STATES.ACTIVE || state === ORDER_STATES.PARTIAL)
|
|
622
|
+
sums.assetB.active += size;
|
|
623
|
+
else if (state === ORDER_STATES.VIRTUAL)
|
|
624
|
+
sums.assetB.virtual += size;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return sums;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Serializes an order object for persistence.
|
|
631
|
+
* @param {Object} [order={}] - The order object to serialize.
|
|
632
|
+
* @returns {Object} The serialized order.
|
|
633
|
+
* @private
|
|
634
|
+
*/
|
|
635
|
+
_serializeOrder(order = {}) {
|
|
636
|
+
const priceValue = toFiniteNumber(order.price);
|
|
637
|
+
const sizeValue = toFiniteNumber(order.size);
|
|
638
|
+
// SANITY CHECK: If order is ACTIVE/PARTIAL but has no orderId, it's corrupted.
|
|
639
|
+
// Downgrade to VIRTUAL to prevent persisting phantom active orders.
|
|
640
|
+
// This fixes the root cause of "Active No ID" state in JSON files.
|
|
641
|
+
let state = order.state || null;
|
|
642
|
+
let orderId = order.orderId || '';
|
|
643
|
+
if (isPhantomOrder(order)) {
|
|
644
|
+
state = ORDER_STATES.VIRTUAL;
|
|
645
|
+
orderId = '';
|
|
646
|
+
}
|
|
647
|
+
const serialized = {
|
|
648
|
+
id: order.id || null,
|
|
649
|
+
type: order.type || null,
|
|
650
|
+
state: state,
|
|
651
|
+
price: Number.isFinite(priceValue) ? priceValue : 0,
|
|
652
|
+
size: Number.isFinite(sizeValue) ? sizeValue : 0,
|
|
653
|
+
orderId
|
|
654
|
+
};
|
|
655
|
+
return serialized;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
module.exports = {
|
|
659
|
+
AccountOrders,
|
|
660
|
+
createBotKey
|
|
661
|
+
};
|
|
662
|
+
//# sourceMappingURL=account_orders.js.map
|