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,743 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FETCH LP PRICE DATA FROM KIBANA — Pool-centric
|
|
3
|
+
*
|
|
4
|
+
* Reads profiles/server-profiles/bots.json for asset pairs, connects to
|
|
5
|
+
* the BitShares blockchain to resolve asset precisions and the pool ID
|
|
6
|
+
* (using the same logic as derivePoolPrice in modules/order/utils/system.ts),
|
|
7
|
+
* then fetches all swap history from Kibana and exports OHLCV candles to JSON.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* tsx market_adapter/inputs/fetch_lp_data.ts
|
|
11
|
+
* tsx market_adapter/inputs/fetch_lp_data.ts --bot <botName> --interval 4h --lookback 8760h
|
|
12
|
+
*
|
|
13
|
+
* Manual override (no blockchain connection needed):
|
|
14
|
+
* tsx market_adapter/inputs/fetch_lp_data.ts --pool <poolId> --precA <precA> --precB <precB>
|
|
15
|
+
*
|
|
16
|
+
* Date range fetch (for historical windows or multi-step fetching):
|
|
17
|
+
* tsx market_adapter/inputs/fetch_lp_data.ts --pool <poolId> --precA <precA> --precB <precB> --interval 1h --start 2024-03-06 --end 2025-03-06
|
|
18
|
+
* tsx market_adapter/inputs/fetch_lp_data.ts --pool <poolId> --precA <precA> --precB <precB> --interval 1h --start 2025-03-06 --end 2026-03-06
|
|
19
|
+
*
|
|
20
|
+
* Output:
|
|
21
|
+
* market_adapter/data/lp/<assetA>_<assetB>/lp_pool_<poolId>_<interval>.json
|
|
22
|
+
*
|
|
23
|
+
* Precision:
|
|
24
|
+
* Resolved automatically from the BitShares blockchain via lookup_asset_symbols.
|
|
25
|
+
* Use --precA / --precB to override if needed.
|
|
26
|
+
*/
|
|
27
|
+
'use strict';
|
|
28
|
+
const { path } = require('../../modules/path_api');
|
|
29
|
+
const { getStorage } = require('../../modules/storage');
|
|
30
|
+
const storage = getStorage();
|
|
31
|
+
const kibanaSource = require('./kibana_source');
|
|
32
|
+
const { mergeCandles } = require('../candle_utils');
|
|
33
|
+
const { toIntervalLabel } = require('../interval_utils');
|
|
34
|
+
const { parseJsonWithComments } = require('../../modules/order/utils/system');
|
|
35
|
+
const { MARKET_ADAPTER } = require('../../modules/constants');
|
|
36
|
+
const { normalizePoolId, resolveAsset, findPoolByAssets } = require('../utils/chain');
|
|
37
|
+
const { writeJsonAtomic } = require('../utils/atomic_write');
|
|
38
|
+
const { readJSON } = require('../../modules/utils/fs_utils');
|
|
39
|
+
// ─── Defaults ─────────────────────────────────────────────────────────────────
|
|
40
|
+
const DEFAULT_CONFIG = {
|
|
41
|
+
intervalSeconds: 3600,
|
|
42
|
+
lookbackHours: 26280,
|
|
43
|
+
apiKey: null,
|
|
44
|
+
chunkMonths: MARKET_ADAPTER.KIBANA_FETCH_CHUNK_MONTHS,
|
|
45
|
+
};
|
|
46
|
+
const FETCH_TIMEOUT_MS = MARKET_ADAPTER.KIBANA_REQUEST_TIMEOUT_MS;
|
|
47
|
+
const FETCH_MAX_ATTEMPTS = MARKET_ADAPTER.RUNTIME_DEFAULTS.sourceRetries;
|
|
48
|
+
const FETCH_MANIFEST_VERSION = 1;
|
|
49
|
+
const { PATHS } = require('../../modules/paths');
|
|
50
|
+
const PROJECT_ROOT = PATHS.PROJECT_ROOT;
|
|
51
|
+
const BOTS_JSON = PATHS.PROFILES.BOTS_JSON;
|
|
52
|
+
// ─── CLI ──────────────────────────────────────────────────────────────────────
|
|
53
|
+
function parseArgs() {
|
|
54
|
+
const args = process.argv.slice(2);
|
|
55
|
+
const config = { ...DEFAULT_CONFIG };
|
|
56
|
+
let poolId = null; // null = auto-discover from bots.json
|
|
57
|
+
let botName = null;
|
|
58
|
+
let precA = null; // null = auto from blockchain
|
|
59
|
+
let precB = null;
|
|
60
|
+
const intervalMap = { '1m': 60, '5m': 300, '15m': 900, '1h': 3600, '4h': 14400, '1d': 86400 };
|
|
61
|
+
for (let i = 0; i < args.length; i++) {
|
|
62
|
+
const arg = args[i];
|
|
63
|
+
const val = args[i + 1];
|
|
64
|
+
switch (arg) {
|
|
65
|
+
case '--bot':
|
|
66
|
+
botName = val;
|
|
67
|
+
i++;
|
|
68
|
+
break;
|
|
69
|
+
case '--pool':
|
|
70
|
+
poolId = val;
|
|
71
|
+
i++;
|
|
72
|
+
break;
|
|
73
|
+
case '--interval':
|
|
74
|
+
config.intervalSeconds = intervalMap[val] ?? parseInt(val, 10);
|
|
75
|
+
i++;
|
|
76
|
+
break;
|
|
77
|
+
case '--lookback':
|
|
78
|
+
config.lookbackHours = parseInt(val.replace('h', ''), 10);
|
|
79
|
+
i++;
|
|
80
|
+
break;
|
|
81
|
+
case '--chunkMonths':
|
|
82
|
+
config.chunkMonths = parseInt(val, 10);
|
|
83
|
+
i++;
|
|
84
|
+
break;
|
|
85
|
+
case '--precA':
|
|
86
|
+
precA = parseInt(val, 10);
|
|
87
|
+
i++;
|
|
88
|
+
break;
|
|
89
|
+
case '--precB':
|
|
90
|
+
precB = parseInt(val, 10);
|
|
91
|
+
i++;
|
|
92
|
+
break;
|
|
93
|
+
case '--apiKey':
|
|
94
|
+
config.apiKey = val;
|
|
95
|
+
i++;
|
|
96
|
+
break;
|
|
97
|
+
case '--start':
|
|
98
|
+
config.timeRange = { ...(config.timeRange || {}), gte: val };
|
|
99
|
+
i++;
|
|
100
|
+
break;
|
|
101
|
+
case '--end':
|
|
102
|
+
config.timeRange = { ...(config.timeRange || {}), lte: val };
|
|
103
|
+
i++;
|
|
104
|
+
break;
|
|
105
|
+
case '--out':
|
|
106
|
+
config.outPath = val;
|
|
107
|
+
i++;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { poolId, botName, precA, precB, config };
|
|
112
|
+
}
|
|
113
|
+
// ─── Output path ──────────────────────────────────────────────────────────────
|
|
114
|
+
function slugPart(value) {
|
|
115
|
+
return String(value || '')
|
|
116
|
+
.trim()
|
|
117
|
+
.toLowerCase()
|
|
118
|
+
.replace(/[^a-z0-9]+/g, '_')
|
|
119
|
+
.replace(/^_+|_+$/g, '') || 'unknown';
|
|
120
|
+
}
|
|
121
|
+
function pairFolderName(assetA, assetB) {
|
|
122
|
+
return `${slugPart(assetA?.symbol)}_${slugPart(assetB?.symbol)}`;
|
|
123
|
+
}
|
|
124
|
+
function outputPath(poolId, intervalSeconds, assetA, assetB) {
|
|
125
|
+
const label = toIntervalLabel(intervalSeconds);
|
|
126
|
+
const id = String(poolId).replace('1.19.', '');
|
|
127
|
+
const pairFolder = pairFolderName(assetA, assetB);
|
|
128
|
+
return path.join(PROJECT_ROOT, 'market_adapter', 'data', 'lp', pairFolder, `lp_pool_${id}_${label}.json`);
|
|
129
|
+
}
|
|
130
|
+
function applyPrecisionOverrides(assetA, assetB, precA, precB) {
|
|
131
|
+
return {
|
|
132
|
+
assetA: precA != null ? { ...assetA, precision: precA } : assetA,
|
|
133
|
+
assetB: precB != null ? { ...assetB, precision: precB } : assetB,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function pairFolderPath(assetASymbol, assetBSymbol) {
|
|
137
|
+
return path.join(PROJECT_ROOT, 'market_adapter', 'data', 'lp', pairFolderName({ symbol: assetASymbol }, { symbol: assetBSymbol }));
|
|
138
|
+
}
|
|
139
|
+
function manifestPathFor(outPath) {
|
|
140
|
+
return `${outPath}.fetch_manifest.json`;
|
|
141
|
+
}
|
|
142
|
+
function chunkPathFor(outPath, index, window) {
|
|
143
|
+
const parsed = path.parse(outPath);
|
|
144
|
+
const start = window.gte.slice(0, 10);
|
|
145
|
+
const end = window.lte.slice(0, 10);
|
|
146
|
+
return path.join(parsed.dir, `${parsed.name}.chunk_${String(index).padStart(2, '0')}_${start}_${end}${parsed.ext}`);
|
|
147
|
+
}
|
|
148
|
+
function addUtcMonths(date, months) {
|
|
149
|
+
const result = new Date(date.getTime());
|
|
150
|
+
const day = result.getUTCDate();
|
|
151
|
+
result.setUTCDate(1);
|
|
152
|
+
result.setUTCMonth(result.getUTCMonth() + months);
|
|
153
|
+
const lastDay = new Date(Date.UTC(result.getUTCFullYear(), result.getUTCMonth() + 1, 0)).getUTCDate();
|
|
154
|
+
result.setUTCDate(Math.min(day, lastDay));
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
function normalizeDateInput(raw, label) {
|
|
158
|
+
const ms = Date.parse(String(raw || ''));
|
|
159
|
+
if (!Number.isFinite(ms)) {
|
|
160
|
+
throw new Error(`Invalid ${label} date: ${raw}`);
|
|
161
|
+
}
|
|
162
|
+
return new Date(ms);
|
|
163
|
+
}
|
|
164
|
+
function resolveChunkMonths(config) {
|
|
165
|
+
const months = Number(config.chunkMonths);
|
|
166
|
+
if (!Number.isFinite(months) || months <= 0) {
|
|
167
|
+
throw new Error(`Invalid chunkMonths: ${config.chunkMonths}`);
|
|
168
|
+
}
|
|
169
|
+
return Math.max(1, Math.round(months));
|
|
170
|
+
}
|
|
171
|
+
function normalizeLookbackRange(config, nowMs = Date.now()) {
|
|
172
|
+
const lookbackHours = Number(config.lookbackHours);
|
|
173
|
+
if (!Number.isFinite(lookbackHours) || lookbackHours <= 0) {
|
|
174
|
+
throw new Error(`Invalid lookbackHours: ${config.lookbackHours}`);
|
|
175
|
+
}
|
|
176
|
+
const bucketMs = Number(config.intervalSeconds) * 1000;
|
|
177
|
+
const safeBucketMs = Number.isFinite(bucketMs) && bucketMs > 0 ? bucketMs : MARKET_ADAPTER.RUNTIME_DEFAULTS.intervalSeconds * 1000;
|
|
178
|
+
const endMs = Math.floor(nowMs / safeBucketMs) * safeBucketMs;
|
|
179
|
+
const startMs = endMs - (lookbackHours * 3600 * 1000);
|
|
180
|
+
return {
|
|
181
|
+
gte: new Date(startMs).toISOString(),
|
|
182
|
+
lte: new Date(endMs).toISOString(),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function buildFetchWindowsFromRange(timeRange, chunkMonths) {
|
|
186
|
+
let start;
|
|
187
|
+
let end;
|
|
188
|
+
start = normalizeDateInput(timeRange.gte, 'start');
|
|
189
|
+
end = normalizeDateInput(timeRange.lte, 'end');
|
|
190
|
+
if (start >= end) {
|
|
191
|
+
throw new Error(`Invalid fetch range: ${start.toISOString()} must be earlier than ${end.toISOString()}`);
|
|
192
|
+
}
|
|
193
|
+
const windows = [];
|
|
194
|
+
let cursor = start;
|
|
195
|
+
while (cursor < end) {
|
|
196
|
+
const next = addUtcMonths(cursor, chunkMonths);
|
|
197
|
+
const windowEnd = next < end ? next : end;
|
|
198
|
+
windows.push({
|
|
199
|
+
gte: cursor.toISOString(),
|
|
200
|
+
lte: windowEnd.toISOString(),
|
|
201
|
+
});
|
|
202
|
+
cursor = windowEnd;
|
|
203
|
+
}
|
|
204
|
+
return windows;
|
|
205
|
+
}
|
|
206
|
+
function loadManifest(manifestPath) {
|
|
207
|
+
if (!storage.exists(manifestPath))
|
|
208
|
+
return null;
|
|
209
|
+
try {
|
|
210
|
+
return readJSON(manifestPath);
|
|
211
|
+
}
|
|
212
|
+
catch (_) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function loadCachedFetchContext(bot, intervalSeconds) {
|
|
217
|
+
const dir = pairFolderPath(bot.assetA, bot.assetB);
|
|
218
|
+
if (!storage.exists(dir))
|
|
219
|
+
return null;
|
|
220
|
+
const label = toIntervalLabel(intervalSeconds);
|
|
221
|
+
const manifestFiles = storage.readdir(dir)
|
|
222
|
+
.filter((name) => name.endsWith(`${label}.json.fetch_manifest.json`))
|
|
223
|
+
.sort();
|
|
224
|
+
for (const file of manifestFiles) {
|
|
225
|
+
const manifest = loadManifest(path.join(dir, file));
|
|
226
|
+
const request = manifest?.request;
|
|
227
|
+
if (!request)
|
|
228
|
+
continue;
|
|
229
|
+
if (request.intervalSeconds !== intervalSeconds)
|
|
230
|
+
continue;
|
|
231
|
+
if (request.assetA?.symbol !== bot.assetA)
|
|
232
|
+
continue;
|
|
233
|
+
if (request.assetB?.symbol !== bot.assetB)
|
|
234
|
+
continue;
|
|
235
|
+
if (!request.pool || !request.assetA?.id || !request.assetB?.id)
|
|
236
|
+
continue;
|
|
237
|
+
if (!Number.isFinite(request.assetA?.precision) || !Number.isFinite(request.assetB?.precision))
|
|
238
|
+
continue;
|
|
239
|
+
return {
|
|
240
|
+
poolId: request.pool,
|
|
241
|
+
assetA: request.assetA,
|
|
242
|
+
assetB: request.assetB,
|
|
243
|
+
source: 'manifest',
|
|
244
|
+
path: path.join(dir, file),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const dataFiles = storage.readdir(dir)
|
|
248
|
+
.filter((name) => name.endsWith(`${label}.json`) && !name.includes('.chunk_') && !name.endsWith('.fetch_manifest.json'))
|
|
249
|
+
.sort();
|
|
250
|
+
for (const file of dataFiles) {
|
|
251
|
+
try {
|
|
252
|
+
const parsed = readJSON(path.join(dir, file));
|
|
253
|
+
const meta = parsed?.meta;
|
|
254
|
+
if (!meta)
|
|
255
|
+
continue;
|
|
256
|
+
if (meta.intervalSeconds !== intervalSeconds)
|
|
257
|
+
continue;
|
|
258
|
+
if (meta.assetA?.symbol !== bot.assetA)
|
|
259
|
+
continue;
|
|
260
|
+
if (meta.assetB?.symbol !== bot.assetB)
|
|
261
|
+
continue;
|
|
262
|
+
if (!meta.pool || !meta.assetA?.id || !meta.assetB?.id)
|
|
263
|
+
continue;
|
|
264
|
+
if (!Number.isFinite(meta.assetA?.precision) || !Number.isFinite(meta.assetB?.precision))
|
|
265
|
+
continue;
|
|
266
|
+
return {
|
|
267
|
+
poolId: meta.pool,
|
|
268
|
+
assetA: meta.assetA,
|
|
269
|
+
assetB: meta.assetB,
|
|
270
|
+
source: 'data',
|
|
271
|
+
path: path.join(dir, file),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch (_) { }
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
function sameRequest(a, b) {
|
|
279
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
280
|
+
}
|
|
281
|
+
function buildRequestKey(config, fullPoolId, assetA, assetB, timeRange, outPath) {
|
|
282
|
+
const chunkMonths = resolveChunkMonths(config);
|
|
283
|
+
return {
|
|
284
|
+
pool: fullPoolId,
|
|
285
|
+
assetA: { id: assetA.id, precision: assetA.precision, symbol: assetA.symbol },
|
|
286
|
+
assetB: { id: assetB.id, precision: assetB.precision, symbol: assetB.symbol },
|
|
287
|
+
intervalSeconds: config.intervalSeconds,
|
|
288
|
+
lookbackHours: config.timeRange ? null : config.lookbackHours,
|
|
289
|
+
timeRange,
|
|
290
|
+
outPath: path.resolve(outPath),
|
|
291
|
+
chunkMonths,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function buildManifest(requestKey, windows, outPath) {
|
|
295
|
+
return {
|
|
296
|
+
version: FETCH_MANIFEST_VERSION,
|
|
297
|
+
createdAt: new Date().toISOString(),
|
|
298
|
+
updatedAt: new Date().toISOString(),
|
|
299
|
+
request: requestKey,
|
|
300
|
+
status: 'in_progress',
|
|
301
|
+
windows: windows.map((window, idx) => ({
|
|
302
|
+
index: idx + 1,
|
|
303
|
+
gte: window.gte,
|
|
304
|
+
lte: window.lte,
|
|
305
|
+
file: chunkPathFor(outPath, idx + 1, window),
|
|
306
|
+
status: 'pending',
|
|
307
|
+
candleCount: null,
|
|
308
|
+
firstTs: null,
|
|
309
|
+
lastTs: null,
|
|
310
|
+
completedAt: null,
|
|
311
|
+
lastError: null,
|
|
312
|
+
})),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function saveManifest(manifestPath, manifest) {
|
|
316
|
+
manifest.updatedAt = new Date().toISOString();
|
|
317
|
+
writeJsonAtomic(manifestPath, manifest);
|
|
318
|
+
}
|
|
319
|
+
function validateChunkFile(chunkFile, requestKey, windowEntry) {
|
|
320
|
+
if (!storage.exists(chunkFile))
|
|
321
|
+
return null;
|
|
322
|
+
try {
|
|
323
|
+
const parsed = readJSON(chunkFile);
|
|
324
|
+
const meta = parsed?.meta || {};
|
|
325
|
+
if (meta.pool !== requestKey.pool)
|
|
326
|
+
return null;
|
|
327
|
+
if (meta.intervalSeconds !== requestKey.intervalSeconds)
|
|
328
|
+
return null;
|
|
329
|
+
if (meta.assetA?.id !== requestKey.assetA.id || meta.assetB?.id !== requestKey.assetB.id)
|
|
330
|
+
return null;
|
|
331
|
+
if (meta.assetA?.precision !== requestKey.assetA.precision || meta.assetB?.precision !== requestKey.assetB.precision)
|
|
332
|
+
return null;
|
|
333
|
+
if (meta.timeRange?.gte !== windowEntry.gte || meta.timeRange?.lte !== windowEntry.lte)
|
|
334
|
+
return null;
|
|
335
|
+
if (!Array.isArray(parsed.candles))
|
|
336
|
+
return null;
|
|
337
|
+
const candles = parsed.candles;
|
|
338
|
+
return {
|
|
339
|
+
candles,
|
|
340
|
+
candleCount: candles.length,
|
|
341
|
+
firstTs: candles.length > 0 ? new Date(candles[0][0]).toISOString() : null,
|
|
342
|
+
lastTs: candles.length > 0 ? new Date(candles[candles.length - 1][0]).toISOString() : null,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
catch (_) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function persistChunkFile(chunkFile, requestKey, windowEntry, candles) {
|
|
350
|
+
const payload = {
|
|
351
|
+
meta: {
|
|
352
|
+
fetchedAt: new Date().toISOString(),
|
|
353
|
+
source: `https://kibana.bitshares.dev (bitshares-*, op_type 63, pool ${requestKey.pool})`,
|
|
354
|
+
pool: requestKey.pool,
|
|
355
|
+
assetA: requestKey.assetA,
|
|
356
|
+
assetB: requestKey.assetB,
|
|
357
|
+
intervalSeconds: requestKey.intervalSeconds,
|
|
358
|
+
candleCount: candles.length,
|
|
359
|
+
chunkIndex: windowEntry.index,
|
|
360
|
+
timeRange: {
|
|
361
|
+
gte: windowEntry.gte,
|
|
362
|
+
lte: windowEntry.lte,
|
|
363
|
+
},
|
|
364
|
+
format: '[timestamp_ms, open, high, low, close, volume_A]',
|
|
365
|
+
},
|
|
366
|
+
candles,
|
|
367
|
+
};
|
|
368
|
+
writeJsonAtomic(chunkFile, payload);
|
|
369
|
+
}
|
|
370
|
+
function ensureManifest(config, fullPoolId, assetA, assetB, outPath, nowMs = Date.now()) {
|
|
371
|
+
const manifestPath = manifestPathFor(outPath);
|
|
372
|
+
const existing = loadManifest(manifestPath);
|
|
373
|
+
const chunkMonths = resolveChunkMonths(config);
|
|
374
|
+
const resolvedOutPath = path.resolve(outPath);
|
|
375
|
+
if (existing
|
|
376
|
+
&& existing.version === FETCH_MANIFEST_VERSION
|
|
377
|
+
&& !config.timeRange
|
|
378
|
+
&& existing.status !== 'complete'
|
|
379
|
+
&& existing.request?.pool === fullPoolId
|
|
380
|
+
&& existing.request?.intervalSeconds === config.intervalSeconds
|
|
381
|
+
&& existing.request?.lookbackHours === config.lookbackHours
|
|
382
|
+
&& existing.request?.outPath === resolvedOutPath
|
|
383
|
+
&& existing.request?.chunkMonths === chunkMonths
|
|
384
|
+
&& existing.request?.assetA?.id === assetA.id
|
|
385
|
+
&& existing.request?.assetA?.precision === assetA.precision
|
|
386
|
+
&& existing.request?.assetB?.id === assetB.id
|
|
387
|
+
&& existing.request?.assetB?.precision === assetB.precision
|
|
388
|
+
&& Array.isArray(existing.windows)
|
|
389
|
+
&& existing.windows.length > 0) {
|
|
390
|
+
return { manifestPath, manifest: existing, requestKey: existing.request };
|
|
391
|
+
}
|
|
392
|
+
const effectiveTimeRange = config.timeRange
|
|
393
|
+
? { gte: config.timeRange.gte, lte: config.timeRange.lte }
|
|
394
|
+
: normalizeLookbackRange(config, nowMs);
|
|
395
|
+
const requestKey = buildRequestKey(config, fullPoolId, assetA, assetB, effectiveTimeRange, outPath);
|
|
396
|
+
if (existing && existing.version === FETCH_MANIFEST_VERSION && sameRequest(existing.request, requestKey) && Array.isArray(existing.windows) && existing.windows.length > 0) {
|
|
397
|
+
return { manifestPath, manifest: existing, requestKey };
|
|
398
|
+
}
|
|
399
|
+
const windows = buildFetchWindowsFromRange(effectiveTimeRange, chunkMonths);
|
|
400
|
+
const manifest = buildManifest(requestKey, windows, outPath);
|
|
401
|
+
saveManifest(manifestPath, manifest);
|
|
402
|
+
return { manifestPath, manifest, requestKey };
|
|
403
|
+
}
|
|
404
|
+
async function withTimeout(run, timeoutMs, description) {
|
|
405
|
+
const controller = new AbortController();
|
|
406
|
+
let timeoutId = null;
|
|
407
|
+
let timedOut = false;
|
|
408
|
+
const timeoutMessage = `${description} timed out after ${Math.round(timeoutMs / 1000)}s`;
|
|
409
|
+
timeoutId = setTimeout(() => {
|
|
410
|
+
timedOut = true;
|
|
411
|
+
controller.abort(new Error(timeoutMessage));
|
|
412
|
+
}, timeoutMs);
|
|
413
|
+
try {
|
|
414
|
+
return await run(controller.signal);
|
|
415
|
+
}
|
|
416
|
+
catch (err) {
|
|
417
|
+
if (timedOut && (err?.name === 'AbortError' || err?.message === timeoutMessage)) {
|
|
418
|
+
throw new Error(timeoutMessage);
|
|
419
|
+
}
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
finally {
|
|
423
|
+
if (timeoutId)
|
|
424
|
+
clearTimeout(timeoutId);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async function fetchWindowCandles(fullPoolId, assetA, assetB, config, windowEntry, total) {
|
|
428
|
+
const label = `${windowEntry.gte} → ${windowEntry.lte}`;
|
|
429
|
+
let lastErr = null;
|
|
430
|
+
for (let attempt = 1; attempt <= FETCH_MAX_ATTEMPTS; attempt++) {
|
|
431
|
+
console.log(` Chunk ${windowEntry.index}/${total}: ${label} (attempt ${attempt}/${FETCH_MAX_ATTEMPTS})`);
|
|
432
|
+
try {
|
|
433
|
+
const candles = await withTimeout((signal) => kibanaSource.getLpCandlesForPool(fullPoolId, assetA, assetB, {
|
|
434
|
+
...config,
|
|
435
|
+
timeout: FETCH_TIMEOUT_MS,
|
|
436
|
+
signal,
|
|
437
|
+
timeRange: {
|
|
438
|
+
gte: windowEntry.gte,
|
|
439
|
+
lte: windowEntry.lte,
|
|
440
|
+
},
|
|
441
|
+
}), FETCH_TIMEOUT_MS, `Chunk ${windowEntry.index}/${total}`);
|
|
442
|
+
console.log(` -> ${candles.length} candles`);
|
|
443
|
+
return candles;
|
|
444
|
+
}
|
|
445
|
+
catch (err) {
|
|
446
|
+
lastErr = err;
|
|
447
|
+
console.warn(` retrying after failure: ${err.message}`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
throw lastErr;
|
|
451
|
+
}
|
|
452
|
+
async function fetchCandlesSequentially(fullPoolId, assetA, assetB, config, outPath) {
|
|
453
|
+
const { manifestPath, manifest, requestKey } = ensureManifest(config, fullPoolId, assetA, assetB, outPath);
|
|
454
|
+
const total = manifest.windows.length;
|
|
455
|
+
const chunkMonths = resolveChunkMonths(config);
|
|
456
|
+
if (total > 1) {
|
|
457
|
+
console.log(` Auto-splitting fetch into ${total} sequential ${chunkMonths}-month chunks`);
|
|
458
|
+
}
|
|
459
|
+
for (const windowEntry of manifest.windows) {
|
|
460
|
+
const cached = validateChunkFile(windowEntry.file, requestKey, windowEntry);
|
|
461
|
+
if (cached) {
|
|
462
|
+
windowEntry.status = 'done';
|
|
463
|
+
windowEntry.candleCount = cached.candleCount;
|
|
464
|
+
windowEntry.firstTs = cached.firstTs;
|
|
465
|
+
windowEntry.lastTs = cached.lastTs;
|
|
466
|
+
windowEntry.lastError = null;
|
|
467
|
+
console.log(` Chunk ${windowEntry.index}/${total}: ${windowEntry.gte} → ${windowEntry.lte} (cached ${cached.candleCount} candles)`);
|
|
468
|
+
saveManifest(manifestPath, manifest);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
windowEntry.status = 'fetching';
|
|
472
|
+
windowEntry.lastError = null;
|
|
473
|
+
saveManifest(manifestPath, manifest);
|
|
474
|
+
try {
|
|
475
|
+
const candles = await fetchWindowCandles(fullPoolId, assetA, assetB, config, windowEntry, total);
|
|
476
|
+
persistChunkFile(windowEntry.file, requestKey, windowEntry, candles);
|
|
477
|
+
windowEntry.status = 'done';
|
|
478
|
+
windowEntry.candleCount = candles.length;
|
|
479
|
+
windowEntry.firstTs = candles.length > 0 ? new Date(candles[0][0]).toISOString() : null;
|
|
480
|
+
windowEntry.lastTs = candles.length > 0 ? new Date(candles[candles.length - 1][0]).toISOString() : null;
|
|
481
|
+
windowEntry.completedAt = new Date().toISOString();
|
|
482
|
+
windowEntry.lastError = null;
|
|
483
|
+
saveManifest(manifestPath, manifest);
|
|
484
|
+
}
|
|
485
|
+
catch (err) {
|
|
486
|
+
windowEntry.status = 'failed';
|
|
487
|
+
windowEntry.lastError = err.message;
|
|
488
|
+
saveManifest(manifestPath, manifest);
|
|
489
|
+
throw err;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
let merged = [];
|
|
493
|
+
for (const windowEntry of manifest.windows) {
|
|
494
|
+
const cached = validateChunkFile(windowEntry.file, requestKey, windowEntry);
|
|
495
|
+
if (!cached) {
|
|
496
|
+
throw new Error(`Chunk file missing or invalid after fetch: ${path.relative(process.cwd(), windowEntry.file)}`);
|
|
497
|
+
}
|
|
498
|
+
merged = merged.length === 0
|
|
499
|
+
? cached.candles
|
|
500
|
+
: mergeCandles(merged, cached.candles, {
|
|
501
|
+
onCollision: (existing, incoming) => incoming[5] > existing[5] ? incoming : existing,
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
manifest.status = 'complete';
|
|
505
|
+
saveManifest(manifestPath, manifest);
|
|
506
|
+
return merged;
|
|
507
|
+
}
|
|
508
|
+
// ─── bots.json helper ─────────────────────────────────────────────────────────
|
|
509
|
+
function loadBotsJson() {
|
|
510
|
+
if (!storage.exists(BOTS_JSON)) {
|
|
511
|
+
throw new Error(`bots.json not found at ${BOTS_JSON}`);
|
|
512
|
+
}
|
|
513
|
+
return parseBotsConfig(storage.readFile(BOTS_JSON), BOTS_JSON);
|
|
514
|
+
}
|
|
515
|
+
function parseBotsConfig(raw, sourceLabel = BOTS_JSON) {
|
|
516
|
+
const parsed = parseJsonWithComments(raw);
|
|
517
|
+
const bots = Array.isArray(parsed?.bots) ? parsed.bots : (Array.isArray(parsed) ? parsed : null);
|
|
518
|
+
if (!bots) {
|
|
519
|
+
throw new Error(`Invalid bots.json format: ${sourceLabel}`);
|
|
520
|
+
}
|
|
521
|
+
return bots;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Pick a bot: by name if given, otherwise first active bot with startPrice: "pool".
|
|
525
|
+
*/
|
|
526
|
+
function selectBot(bots, botName) {
|
|
527
|
+
if (botName) {
|
|
528
|
+
const bot = bots.find(b => b.name === botName);
|
|
529
|
+
if (!bot)
|
|
530
|
+
throw new Error(`Bot "${botName}" not found in bots.json`);
|
|
531
|
+
return bot;
|
|
532
|
+
}
|
|
533
|
+
const bot = bots.find(b => b.active && b.startPrice === 'pool');
|
|
534
|
+
if (!bot)
|
|
535
|
+
throw new Error('No active pool-price bot found in bots.json. Use --bot NAME to specify one.');
|
|
536
|
+
return bot;
|
|
537
|
+
}
|
|
538
|
+
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
539
|
+
async function run() {
|
|
540
|
+
const { poolId: cliPoolId, botName, precA: cliPrecA, precB: cliPrecB, config } = parseArgs();
|
|
541
|
+
const bucketLabel = toIntervalLabel(config.intervalSeconds);
|
|
542
|
+
console.log('══════════════════════════════════════════════');
|
|
543
|
+
console.log(' Kibana LP Fetcher — Pool-centric');
|
|
544
|
+
console.log('══════════════════════════════════════════════');
|
|
545
|
+
let fullPoolId, assetA, assetB;
|
|
546
|
+
// ── Mode A: manual --pool override (no blockchain connection needed) ──────
|
|
547
|
+
if (cliPoolId) {
|
|
548
|
+
console.log(` Mode: Manual (--pool ${cliPoolId})`);
|
|
549
|
+
fullPoolId = normalizePoolId(cliPoolId);
|
|
550
|
+
// Still need to discover asset IDs from Kibana; precisions from CLI or default
|
|
551
|
+
console.log(` Pool: ${fullPoolId}`);
|
|
552
|
+
console.log(` Interval: ${bucketLabel} candles`);
|
|
553
|
+
console.log(` Range: ${config.timeRange ? `${config.timeRange.gte} → ${config.timeRange.lte}` : `last ${config.lookbackHours}h (${(config.lookbackHours / 24 / 365).toFixed(2)} years)`}`);
|
|
554
|
+
console.log('══════════════════════════════════════════════');
|
|
555
|
+
console.log(`\n[1/4] Discovering assets in pool ${fullPoolId}...`);
|
|
556
|
+
let assetIds;
|
|
557
|
+
try {
|
|
558
|
+
assetIds = await kibanaSource.discoverPoolAssets(fullPoolId, config);
|
|
559
|
+
}
|
|
560
|
+
catch (err) {
|
|
561
|
+
console.error(` Discovery failed: ${err.message}`);
|
|
562
|
+
process.exit(1);
|
|
563
|
+
}
|
|
564
|
+
if (assetIds.length < 2) {
|
|
565
|
+
console.error(` Expected 2 asset IDs, found: [${assetIds.join(', ')}]`);
|
|
566
|
+
process.exit(1);
|
|
567
|
+
}
|
|
568
|
+
const [idA, idB] = assetIds;
|
|
569
|
+
if (cliPrecA == null || cliPrecB == null) {
|
|
570
|
+
console.error(`Precisions required in manual mode. Use --precA and --precB.`);
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
const precA = cliPrecA;
|
|
574
|
+
const precB = cliPrecB;
|
|
575
|
+
console.log(` Asset A: ${idA} (precision ${precA})`);
|
|
576
|
+
console.log(` Asset B: ${idB} (precision ${precB})`);
|
|
577
|
+
assetA = { id: idA, precision: precA, symbol: idA };
|
|
578
|
+
assetB = { id: idB, precision: precB, symbol: idB };
|
|
579
|
+
// ── Mode B: auto-resolve from bots.json + blockchain (default) ───────────
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
const bots = loadBotsJson();
|
|
583
|
+
const bot = selectBot(bots, botName);
|
|
584
|
+
const cachedContext = loadCachedFetchContext(bot, config.intervalSeconds);
|
|
585
|
+
console.log(` Mode: Auto (bots.json → blockchain → Kibana)`);
|
|
586
|
+
console.log(` Bot: ${bot.name} (${bot.assetA} / ${bot.assetB})`);
|
|
587
|
+
console.log(` Interval: ${bucketLabel} candles`);
|
|
588
|
+
console.log(` Range: ${config.timeRange ? `${config.timeRange.gte} → ${config.timeRange.lte}` : `last ${config.lookbackHours}h (${(config.lookbackHours / 24 / 365).toFixed(2)} years)`}`);
|
|
589
|
+
console.log(` Auth: ${config.apiKey ? 'API key set' : 'open (no auth)'}`);
|
|
590
|
+
console.log('══════════════════════════════════════════════');
|
|
591
|
+
if (cachedContext) {
|
|
592
|
+
console.log('\n[1/4] Reusing cached fetch context...');
|
|
593
|
+
assetA = { ...cachedContext.assetA, symbol: bot.assetA };
|
|
594
|
+
assetB = { ...cachedContext.assetB, symbol: bot.assetB };
|
|
595
|
+
({ assetA, assetB } = applyPrecisionOverrides(assetA, assetB, cliPrecA, cliPrecB));
|
|
596
|
+
fullPoolId = cachedContext.poolId;
|
|
597
|
+
console.log(` Source: ${cachedContext.source} (${path.relative(process.cwd(), cachedContext.path)})`);
|
|
598
|
+
console.log(` Asset A: ${bot.assetA} → ${assetA.id} (precision ${assetA.precision})`);
|
|
599
|
+
console.log(` Asset B: ${bot.assetB} → ${assetB.id} (precision ${assetB.precision})`);
|
|
600
|
+
console.log(` Pool: ${fullPoolId}`);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
const bitsharesClient = require('../../modules/bitshares_client');
|
|
604
|
+
const { waitForConnected } = bitsharesClient;
|
|
605
|
+
// ── Step 1: Connect + resolve asset metadata ─────────────────────────
|
|
606
|
+
console.log('\n[1/4] Connecting to BitShares and resolving asset metadata...');
|
|
607
|
+
await waitForConnected();
|
|
608
|
+
console.log(' Connected.');
|
|
609
|
+
let metaA, metaB;
|
|
610
|
+
try {
|
|
611
|
+
[metaA, metaB] = await Promise.all([
|
|
612
|
+
resolveAsset(bot.assetA, bitsharesClient),
|
|
613
|
+
resolveAsset(bot.assetB, bitsharesClient),
|
|
614
|
+
]);
|
|
615
|
+
}
|
|
616
|
+
catch (err) {
|
|
617
|
+
console.error(` Asset resolution failed: ${err.message}`);
|
|
618
|
+
process.exit(1);
|
|
619
|
+
}
|
|
620
|
+
assetA = { id: metaA.id, precision: metaA.precision, symbol: bot.assetA };
|
|
621
|
+
assetB = { id: metaB.id, precision: metaB.precision, symbol: bot.assetB };
|
|
622
|
+
({ assetA, assetB } = applyPrecisionOverrides(assetA, assetB, cliPrecA, cliPrecB));
|
|
623
|
+
console.log(` Asset A: ${bot.assetA} → ${assetA.id} (precision ${assetA.precision})`);
|
|
624
|
+
console.log(` Asset B: ${bot.assetB} → ${assetB.id} (precision ${assetB.precision})`);
|
|
625
|
+
// ── Step 2: Find liquidity pool ───────────────────────────────────────
|
|
626
|
+
console.log(`\n[2/4] Finding liquidity pool for ${bot.assetA} / ${bot.assetB}...`);
|
|
627
|
+
let pool;
|
|
628
|
+
try {
|
|
629
|
+
pool = await findPoolByAssets(assetA.id, assetB.id, { bitsharesClient, sortBy: 'assetABalance' });
|
|
630
|
+
}
|
|
631
|
+
catch (err) {
|
|
632
|
+
console.error(` Pool lookup failed: ${err.message}`);
|
|
633
|
+
process.exit(1);
|
|
634
|
+
}
|
|
635
|
+
fullPoolId = pool.id;
|
|
636
|
+
console.log(` Pool: ${fullPoolId}`);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
// ── Probe (or renumber steps in manual mode) ──────────────────────────────
|
|
640
|
+
const stepProbe = cliPoolId ? 2 : 3;
|
|
641
|
+
const stepFetch = cliPoolId ? 3 : 4;
|
|
642
|
+
console.log(`\n[${stepProbe}/4] Probing data availability (last 48h)...`);
|
|
643
|
+
try {
|
|
644
|
+
const probeCandles = await kibanaSource.getLpCandlesForPool(fullPoolId, assetA, assetB, {
|
|
645
|
+
...config,
|
|
646
|
+
timeout: FETCH_TIMEOUT_MS,
|
|
647
|
+
lookbackHours: Math.min(config.lookbackHours, 48),
|
|
648
|
+
fillGaps: false,
|
|
649
|
+
fillGapsToRequestedRange: false,
|
|
650
|
+
});
|
|
651
|
+
const volumeCandles = probeCandles.filter((c) => Number(c[5] || 0) > 0);
|
|
652
|
+
const nonFlatCandles = volumeCandles.filter((c) => c[1] !== c[2] || c[1] !== c[3] || c[1] !== c[4]);
|
|
653
|
+
console.log(` Candles with trades in 48h: ${volumeCandles.length}`);
|
|
654
|
+
console.log(` Non-flat OHLC candles: ${nonFlatCandles.length}`);
|
|
655
|
+
const sample = volumeCandles[0];
|
|
656
|
+
if (sample) {
|
|
657
|
+
console.log(` Sample candle: ${new Date(sample[0]).toISOString()} O=${sample[1]} H=${sample[2]} L=${sample[3]} C=${sample[4]} vol=${sample[5]}`);
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
console.warn(' No trade candles in last 48h — pool may be low-activity. Proceeding with full lookback.');
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
catch (err) {
|
|
664
|
+
console.error(` Probe failed: ${err.message}`);
|
|
665
|
+
process.exit(1);
|
|
666
|
+
}
|
|
667
|
+
const outPath = config.outPath
|
|
668
|
+
? path.resolve(config.outPath)
|
|
669
|
+
: outputPath(fullPoolId, config.intervalSeconds, assetA, assetB);
|
|
670
|
+
// ── Fetch full history ────────────────────────────────────────────────────
|
|
671
|
+
console.log(`\n[${stepFetch}/4] Fetching full history (${config.lookbackHours}h, ${bucketLabel} buckets)...`);
|
|
672
|
+
let candles;
|
|
673
|
+
try {
|
|
674
|
+
candles = await fetchCandlesSequentially(fullPoolId, assetA, assetB, config, outPath);
|
|
675
|
+
console.log(` Total candles: ${candles.length}`);
|
|
676
|
+
if (candles.length === 0) {
|
|
677
|
+
console.error(' No candles returned.');
|
|
678
|
+
process.exit(1);
|
|
679
|
+
}
|
|
680
|
+
const firstTs = new Date(candles[0][0]).toISOString();
|
|
681
|
+
const lastTs = new Date(candles[candles.length - 1][0]).toISOString();
|
|
682
|
+
const closes = candles.map(c => c[4]);
|
|
683
|
+
const minPrice = Math.min(...closes);
|
|
684
|
+
const maxPrice = Math.max(...closes);
|
|
685
|
+
const avgPrice = closes.reduce((a, b) => a + b, 0) / closes.length;
|
|
686
|
+
console.log(` Date range: ${firstTs} → ${lastTs}`);
|
|
687
|
+
console.log(` Price range: ${minPrice.toFixed(8)} – ${maxPrice.toFixed(8)}`);
|
|
688
|
+
console.log(` Avg price: ${avgPrice.toFixed(8)} (${assetB.symbol} per ${assetA.symbol})`);
|
|
689
|
+
}
|
|
690
|
+
catch (err) {
|
|
691
|
+
console.error(` Fetch failed: ${err.message}`);
|
|
692
|
+
process.exit(1);
|
|
693
|
+
}
|
|
694
|
+
// ── Save ──────────────────────────────────────────────────────────────────
|
|
695
|
+
console.log('\n[4/4] Saving...');
|
|
696
|
+
const pair = {
|
|
697
|
+
symbols: `${assetA.symbol}/${assetB.symbol}`,
|
|
698
|
+
ids: `${assetA.id}/${assetB.id}`,
|
|
699
|
+
keyBySymbols: `${assetA.symbol}|${assetB.symbol}`,
|
|
700
|
+
keyByIds: `${assetA.id}|${assetB.id}`,
|
|
701
|
+
};
|
|
702
|
+
const output = {
|
|
703
|
+
meta: {
|
|
704
|
+
fetchedAt: new Date().toISOString(),
|
|
705
|
+
source: `https://kibana.bitshares.dev (bitshares-*, op_type 63, pool ${fullPoolId})`,
|
|
706
|
+
pool: fullPoolId,
|
|
707
|
+
assetA,
|
|
708
|
+
assetB,
|
|
709
|
+
pair,
|
|
710
|
+
intervalSeconds: config.intervalSeconds,
|
|
711
|
+
lookbackHours: config.lookbackHours,
|
|
712
|
+
candleCount: candles.length,
|
|
713
|
+
priceUnit: `${assetB.symbol} per ${assetA.symbol}`,
|
|
714
|
+
// Candle format: [timestamp_ms, open, high, low, close, volume_in_assetA]
|
|
715
|
+
// Raw Kibana LP exchange documents are ordered and converted to true OHLC.
|
|
716
|
+
// If both swap directions exist in the same interval, they share one
|
|
717
|
+
// B-per-A candle and volume is expressed in assetA units.
|
|
718
|
+
// Actual received used (operation_result_object), not min_to_receive.
|
|
719
|
+
format: '[timestamp_ms, open, high, low, close, volume_A]',
|
|
720
|
+
},
|
|
721
|
+
candles,
|
|
722
|
+
};
|
|
723
|
+
writeJsonAtomic(outPath, output);
|
|
724
|
+
const kb = (storage.stat(outPath).size / 1024).toFixed(1);
|
|
725
|
+
console.log(` Saved: ${path.relative(process.cwd(), outPath)} (${kb} KB)`);
|
|
726
|
+
console.log('\nNext — chart it:');
|
|
727
|
+
console.log(` npm run lp:chart -- --data ${path.relative(process.cwd(), outPath)}`);
|
|
728
|
+
}
|
|
729
|
+
if (require.main === module) {
|
|
730
|
+
run().catch((err) => {
|
|
731
|
+
console.error('Fatal:', err);
|
|
732
|
+
process.exit(1);
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
module.exports = {
|
|
736
|
+
applyPrecisionOverrides,
|
|
737
|
+
parseBotsConfig,
|
|
738
|
+
loadBotsJson,
|
|
739
|
+
loadCachedFetchContext,
|
|
740
|
+
selectBot,
|
|
741
|
+
outputPath,
|
|
742
|
+
};
|
|
743
|
+
//# sourceMappingURL=fetch_lp_data.js.map
|