dexbot 1.4.20 → 1.4.22
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/CHANGELOG.md +53 -0
- package/README.md +23 -13
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +7 -3
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +3 -3
- package/analysis/ama_fitting/calibrate_convergence_er.ts +8 -6
- package/analysis/ama_fitting/fetch_lp_candles.ts +8 -3
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +30 -67
- package/analysis/ama_fitting/optimizer_high_resolution.ts +22 -13
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/analyze_derivatives.ts +4 -4
- package/analysis/analyze_dynamic_weight.ts +21 -5
- package/analysis/analyze_kalman.ts +54 -25
- package/analysis/analyze_regime.ts +2 -2
- package/analysis/analyze_regime_windows.ts +27 -19
- package/analysis/analyze_risk_profile.ts +3 -3
- package/analysis/analyze_trade_heatmap.ts +3 -3
- package/analysis/analyze_volatility.ts +2 -2
- package/analysis/bot_fitting/README.md +93 -19
- package/analysis/bot_fitting/backtest_ama_sweep.ts +316 -199
- package/analysis/bot_fitting/backtest_bot_fitting.ts +520 -85
- package/analysis/bot_fitting/shared_utils.ts +16 -10
- package/analysis/bot_key_utils.ts +14 -11
- package/analysis/bot_usage/discover_bot_accounts.ts +5 -3
- package/analysis/bot_usage/kibana_bot_queries.ts +2 -257
- package/analysis/chart_css.ts +6 -4
- package/analysis/chart_ui.ts +0 -1
- package/analysis/chart_utils.ts +11 -2
- package/analysis/derivative_chart_generator.ts +2 -2
- package/analysis/math_utils.ts +1 -8
- package/analysis/price_sources.ts +8 -2
- package/analysis/resolve_source.ts +1 -1
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +2455 -0
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +218 -0
- package/analysis/trade_profitability.ts +61 -28
- package/analysis/tradingview/analyze_tradingview.ts +1 -1
- package/analysis/tradingview/h-bts_tradingview.html +1570 -0
- package/analysis/tradingview/t-bts_tradingview.html +1570 -0
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +302 -74
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/analysis/trend_detection/derivative_analyzer.ts +12 -3
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +25 -27
- package/analysis/trend_detection/hurst_analyzer.ts +1 -1
- package/analysis/trend_detection/kalman_chart_generator.ts +42 -14
- package/analysis/trend_detection/package.json +1 -1
- package/analysis/trend_detection/regime_chart_generator.ts +39 -19
- package/analysis/trend_detection/tests/test_kalman_trend.ts +1 -1
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +1 -1
- package/analysis/trend_detection/volatility_chart_generator.ts +1 -1
- package/claw/ecosystem.config.cjs +2 -3
- package/claw/examples/memu_integration_example.ts +17 -17
- package/claw/index.ts +1 -1
- package/claw/modules/chain_actions.ts +51 -54
- package/claw/modules/chain_broadcast.ts +66 -104
- package/claw/modules/claw_bridge.ts +63 -83
- package/claw/modules/claw_catalog.ts +48 -17
- package/claw/modules/claw_infra.ts +1 -5
- package/claw/modules/claw_launcher.ts +48 -50
- package/claw/modules/claw_skill_md.ts +15 -21
- package/claw/modules/credit_runtime_adapter.ts +3 -19
- package/claw/modules/decision_loop.ts +9 -9
- package/claw/modules/dexbot_bridge.ts +8 -8
- package/claw/modules/dexbot_profiles.ts +5 -21
- package/claw/modules/feed_price_source.ts +1 -1
- package/claw/modules/honest_ecosystem.ts +24 -8
- package/claw/modules/kibana_price_source.ts +1 -1
- package/claw/modules/launcher_mode_detector.ts +1 -1
- package/claw/modules/launcher_paths.ts +1 -1
- package/claw/modules/liquidity_pools.ts +10 -3
- package/claw/modules/mcp_utils.ts +109 -0
- package/claw/modules/memu_bridge.ts +76 -54
- package/claw/modules/mpa_utils.ts +26 -3
- package/claw/modules/position_discovery.ts +17 -28
- package/claw/modules/position_health.ts +1 -1
- package/claw/modules/position_manager.ts +32 -41
- package/claw/modules/position_manager_watch.ts +3 -2
- package/claw/modules/short_mpa_strategy.ts +1 -9
- package/claw/modules/skill_utils.ts +5 -3
- package/claw/modules/utils.ts +9 -1
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/index.ts +27 -10
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/scripts/claw_bridge.ts +1 -1
- package/claw/scripts/claw_mcp_server.ts +19 -78
- package/claw/scripts/honest_assets_report.ts +19 -84
- package/claw/scripts/memu_mcp_server.ts +57 -155
- package/claw/skills/launcher-ops/references/launcher-workflow.md +2 -2
- package/claw/tests/package.json +1 -1
- package/claw/tests/test_claw_bridge.ts +47 -19
- package/claw/tests/test_claw_catalog_and_credentials.ts +8 -4
- package/claw/tests/test_claw_chain_layer.ts +39 -19
- package/claw/tests/test_claw_data_flow.ts +28 -20
- package/claw/tests/test_claw_domain_logic.ts +25 -19
- package/claw/tests/test_claw_manifest_and_matrix.ts +23 -3
- package/claw/tests/test_claw_mcp_transport.ts +13 -8
- package/claw/tests/test_claw_regressions.ts +254 -128
- package/claw/tests/test_claw_skill_generation.ts +1 -1
- package/claw/tests/test_nullclaw_tmp_integration.ts +2 -3
- package/claw/tests/test_position_health.ts +1 -77
- package/claw/tests/test_position_manager.ts +20 -18
- package/claw/tests/test_position_manager_watch_health.ts +39 -43
- package/claw/tests/test_short_mpa_strategy.ts +20 -17
- package/claw/tsconfig.json +4 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +7 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +1 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +3 -3
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +8 -6
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +8 -3
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +1 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +2 -2
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +31 -75
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +21 -13
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -1
- package/dist/analysis/analyze_derivatives.d.ts +0 -18
- package/dist/analysis/analyze_derivatives.d.ts.map +1 -1
- package/dist/analysis/analyze_derivatives.js +4 -4
- package/dist/analysis/analyze_derivatives.js.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts +0 -11
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.js +19 -5
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
- package/dist/analysis/analyze_kalman.d.ts +0 -10
- package/dist/analysis/analyze_kalman.d.ts.map +1 -1
- package/dist/analysis/analyze_kalman.js +51 -26
- package/dist/analysis/analyze_kalman.js.map +1 -1
- package/dist/analysis/analyze_regime.d.ts +0 -17
- package/dist/analysis/analyze_regime.d.ts.map +1 -1
- package/dist/analysis/analyze_regime.js +2 -2
- package/dist/analysis/analyze_regime.js.map +1 -1
- package/dist/analysis/analyze_regime_windows.d.ts +0 -16
- package/dist/analysis/analyze_regime_windows.d.ts.map +1 -1
- package/dist/analysis/analyze_regime_windows.js +28 -21
- package/dist/analysis/analyze_regime_windows.js.map +1 -1
- package/dist/analysis/analyze_risk_profile.js +3 -3
- package/dist/analysis/analyze_risk_profile.js.map +1 -1
- package/dist/analysis/analyze_trade_heatmap.js +3 -3
- package/dist/analysis/analyze_trade_heatmap.js.map +1 -1
- package/dist/analysis/analyze_volatility.d.ts +0 -19
- package/dist/analysis/analyze_volatility.d.ts.map +1 -1
- package/dist/analysis/analyze_volatility.js +2 -2
- package/dist/analysis/analyze_volatility.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +30 -14
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +330 -193
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +136 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +527 -83
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts +2 -13
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.js +15 -9
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -1
- package/dist/analysis/bot_key_utils.d.ts +1 -1
- package/dist/analysis/bot_key_utils.d.ts.map +1 -1
- package/dist/analysis/bot_key_utils.js +14 -11
- package/dist/analysis/bot_key_utils.js.map +1 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js +5 -3
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +1 -337
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +2 -242
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -1
- package/dist/analysis/chart_css.d.ts +2 -14
- package/dist/analysis/chart_css.d.ts.map +1 -1
- package/dist/analysis/chart_css.js +6 -3
- package/dist/analysis/chart_css.js.map +1 -1
- package/dist/analysis/chart_ui.d.ts.map +1 -1
- package/dist/analysis/chart_ui.js.map +1 -1
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +15 -2
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/derivative_chart_generator.js +2 -2
- package/dist/analysis/derivative_chart_generator.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +3 -5
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +3 -5
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/price_sources.d.ts +1 -0
- package/dist/analysis/price_sources.d.ts.map +1 -1
- package/dist/analysis/price_sources.js +8 -2
- package/dist/analysis/price_sources.js.map +1 -1
- package/dist/analysis/resolve_source.d.ts.map +1 -1
- package/dist/analysis/resolve_source.js +1 -1
- package/dist/analysis/resolve_source.js.map +1 -1
- package/dist/analysis/trade_profitability.d.ts.map +1 -1
- package/dist/analysis/trade_profitability.js +58 -29
- package/dist/analysis/trade_profitability.js.map +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +302 -74
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/derivative_analyzer.js +12 -3
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +26 -27
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +41 -13
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +38 -19
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -1
- package/dist/bot.js +3 -3
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts +1 -1
- package/dist/credential-daemon.js +2 -2
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +25 -22
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +6 -4
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.d.ts +1 -3
- package/dist/market_adapter/candle_utils.d.ts.map +1 -1
- package/dist/market_adapter/candle_utils.js +1 -11
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +33 -30
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +10 -1
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.d.ts +18 -42
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +101 -7
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.d.ts +1 -17
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +40 -7
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts +0 -27
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +22 -13
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +96 -38
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +10 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js +28 -17
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +1 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts +5 -0
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js +24 -24
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +1 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js +5 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +20 -3
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +1 -1
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +2 -2
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +16 -4
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +4 -3
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +16 -8
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +8 -3
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +40 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +116 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +1 -2
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +27 -21
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js +3 -0
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +71 -57
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +0 -26
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +72 -19
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts +5 -30
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +6 -3
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +1 -1
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +10 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +2 -2
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +1 -2
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +5 -5
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +1 -2
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +5 -7
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/test_helpers.d.ts +3 -3
- package/dist/market_adapter/test_helpers.d.ts.map +1 -1
- package/dist/market_adapter/test_helpers.js +3 -3
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +1 -1
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +1 -1
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts +0 -2
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +2 -3
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +24 -8
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +2 -5
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.d.ts +4 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +89 -25
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
- package/dist/market_adapter/utils/native_history.js +5 -1
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/modules/account_bots.d.ts +3 -0
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +157 -47
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +1 -7
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +9 -17
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.js +1 -1
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +1 -1
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +0 -12
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +1 -1
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +1 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.d.ts +0 -2
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +18 -4
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +1 -1
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +1 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +1 -1
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +2 -2
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +5 -14
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.js +1 -1
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +1 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts +3 -2
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +7 -4
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +2 -14
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +32 -41
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +12 -19
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts +1 -1
- package/dist/modules/bots_file_lock.js +1 -1
- package/dist/modules/broadcast_failure.d.ts +13 -0
- package/dist/modules/broadcast_failure.d.ts.map +1 -1
- package/dist/modules/broadcast_failure.js +0 -13
- package/dist/modules/broadcast_failure.js.map +1 -1
- package/dist/modules/chain_keys.js +2 -2
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +2 -3
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +23 -42
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +5 -2
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +21 -21
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +53 -60
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.d.ts +1 -7
- package/dist/modules/cr_planner.d.ts.map +1 -1
- package/dist/modules/cr_planner.js +3 -77
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +0 -4
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +18 -3
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts +0 -7
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +21 -60
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/index.d.ts +0 -2
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +0 -2
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/daemon_node_health.js +1 -1
- package/dist/modules/daemon_node_health.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +8 -134
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +39 -199
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_credential_client.js +1 -1
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +3 -6
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +6 -34
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +27 -19
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +31 -15
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +2 -2
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +11 -7
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +24 -6
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.d.ts +1 -2
- package/dist/modules/general_settings.d.ts.map +1 -1
- package/dist/modules/general_settings.js +1 -2
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +10 -1
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/grid_price_source.d.ts +19 -0
- package/dist/modules/grid_price_source.d.ts.map +1 -0
- package/dist/modules/grid_price_source.js +23 -0
- package/dist/modules/grid_price_source.js.map +1 -0
- package/dist/modules/key_store.d.ts +0 -5
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +1 -14
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +15 -26
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.d.ts +1 -2
- package/dist/modules/launcher/child_env.d.ts.map +1 -1
- package/dist/modules/launcher/child_env.js +1 -1
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +7 -13
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +3 -4
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +10 -29
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +3 -2
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +4 -18
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +4 -5
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -2
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +2 -5
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +1 -1
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +2 -2
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +12 -6
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_failure_ledger.d.ts +23 -0
- package/dist/modules/node_failure_ledger.d.ts.map +1 -1
- package/dist/modules/node_failure_ledger.js +0 -23
- package/dist/modules/node_failure_ledger.js.map +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +3 -3
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.js +3 -3
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +6 -0
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +11 -0
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.d.ts +1 -1
- package/dist/modules/order/export.js +10 -10
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +1 -8
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +0 -14
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +2 -12
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +23 -24
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts +1 -1
- package/dist/modules/order/grid_reconcile.js +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +1 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/logger.d.ts +3 -0
- package/dist/modules/order/logger.d.ts.map +1 -1
- package/dist/modules/order/logger.js +23 -14
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +5 -22
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +6 -25
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +1 -4
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +34 -33
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.d.ts +0 -5
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
- package/dist/modules/order/processed_fill_store.js +10 -15
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.d.ts +6 -4
- package/dist/modules/order/strategy.d.ts.map +1 -1
- package/dist/modules/order/strategy.js +6 -4
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +17 -10
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +7 -1
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +19 -1
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +11 -4
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +3 -8
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +14 -4
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.js +1 -1
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/path_api.js +1 -1
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts +1 -7
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +1 -1
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.d.ts +3 -0
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +15 -1
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime_settings.js +4 -2
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +5 -1
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +17 -4
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/socket_json_client.d.ts.map +1 -1
- package/dist/modules/socket_json_client.js +12 -2
- package/dist/modules/socket_json_client.js.map +1 -1
- package/dist/modules/storage/browser_adapter.d.ts +8 -3
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
- package/dist/modules/storage/browser_adapter.js +58 -7
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +1 -1
- package/dist/modules/storage/index.js +1 -1
- package/dist/modules/types.d.ts +1 -1
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/utils/sanitize_key.d.ts +7 -0
- package/dist/modules/utils/sanitize_key.d.ts.map +1 -0
- package/dist/modules/utils/sanitize_key.js +15 -0
- package/dist/modules/utils/sanitize_key.js.map +1 -0
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +6 -8
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +8 -9
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.d.ts +1 -1
- package/dist/scripts/analyze-git.js +1 -1
- package/dist/scripts/analyze-orders.d.ts +2 -2
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +39 -28
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +1 -1
- package/dist/scripts/divergence-calc.d.ts +1 -1
- package/dist/scripts/divergence-calc.js +3 -3
- package/dist/scripts/native_release_gates.js +4 -2
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.d.ts +1 -1
- package/dist/scripts/print_grid.js +1 -1
- package/dist/scripts/run-tests.js +38 -19
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts +3 -5
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +4 -6
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/sync-version.d.ts +2 -2
- package/dist/scripts/sync-version.js +2 -2
- package/dist/scripts/update.d.ts +1 -1
- package/dist/scripts/update.js +2 -2
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/validate_bots.d.ts +1 -1
- package/dist/scripts/validate_bots.js +1 -1
- package/dist/scripts/verify-browser-bundle.d.ts +1 -1
- package/dist/scripts/verify-browser-bundle.js +1 -1
- package/dist/unlock.js +4 -4
- package/dist/unlock.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +63 -18
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +14 -23
- package/docs/COW_INVARIANTS.md +4 -4
- package/docs/CREDENTIAL_SECURITY.md +0 -11
- package/docs/DEXBOT_COMPARISON.md +12 -12
- package/docs/EVOLUTION.md +17 -43
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +27 -83
- package/docs/GRID_RECALCULATION.md +1 -13
- package/docs/GRID_RECONCILE.md +24 -24
- package/docs/LIFECYCLE.md +4 -4
- package/docs/LOGGING.md +1 -1
- package/docs/MPA_CREDIT_USAGE.md +3 -3
- package/docs/README.md +2 -2
- package/docs/WORKFLOW.md +2 -2
- package/docs/architecture.md +48 -43
- package/docs/developer_guide.md +22 -24
- package/market_adapter/README.md +0 -2
- package/modules/README.md +2 -1
- package/package.json +22 -14
- package/scripts/README.md +34 -8
- package/scripts/clean-dist.js +10 -2
- package/tests/README.md +4 -3
- package/claw/openclaw.plugin.json +0 -13
- package/dist/market_adapter/merge_lp_data.d.ts +0 -3
- package/dist/market_adapter/merge_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/merge_lp_data.js +0 -125
- package/dist/market_adapter/merge_lp_data.js.map +0 -1
- package/dist/market_adapter/utils/paths.d.ts +0 -3
- package/dist/market_adapter/utils/paths.d.ts.map +0 -1
- package/dist/market_adapter/utils/paths.js +0 -5
- package/dist/market_adapter/utils/paths.js.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"generatedAt": "2026-08-26T15:40:53.423Z",
|
|
4
|
+
"dataPath": "market_adapter/data/lp/1_3_5537_1_3_0/lp_pool_133_1h.json",
|
|
5
|
+
"resultsPath": "analysis/ama_fitting/optimization_results_lp_pool_133_1h.json",
|
|
6
|
+
"candles": 26281,
|
|
7
|
+
"activeOrders": "all",
|
|
8
|
+
"feeRoundtripPct": 0.2,
|
|
9
|
+
"btsCreateFee": 0.4826,
|
|
10
|
+
"btsCancelFee": 0.00482,
|
|
11
|
+
"makerCreateFactor": 0.1,
|
|
12
|
+
"txFeePrice": 1,
|
|
13
|
+
"btsFeeCapital": 10000,
|
|
14
|
+
"search": {
|
|
15
|
+
"spreadValues": [
|
|
16
|
+
2,
|
|
17
|
+
4
|
|
18
|
+
],
|
|
19
|
+
"incrementValues": [
|
|
20
|
+
0.5,
|
|
21
|
+
1
|
|
22
|
+
],
|
|
23
|
+
"ratioValues": [
|
|
24
|
+
2,
|
|
25
|
+
3
|
|
26
|
+
],
|
|
27
|
+
"minSpreadFactor": 2.1,
|
|
28
|
+
"repositionPct": 1,
|
|
29
|
+
"asymmetricBounds": false,
|
|
30
|
+
"combosPerAma": 8
|
|
31
|
+
},
|
|
32
|
+
"scoring": {
|
|
33
|
+
"baseScore": "totalNetCaptureAfterFeesPct * (fillEfficiency / 100)",
|
|
34
|
+
"gridModel": "persistent fixed chain prices (createOrderGrid port): master rail at sqrt(1±inc) offsets bounded by [center/ratio, center*ratio], gapSlots spread zone centered on center; prices never follow AMA after placement",
|
|
35
|
+
"spreadParam": "targetSpreadPercent for calculateGapSlots (floored at increment * MIN_SPREAD_FACTOR)",
|
|
36
|
+
"resetTriggers": "(A) AMA drift >= 1% from recorded center (ratchet) (trigger B gated off — asymmetricBounds whitelist)",
|
|
37
|
+
"gridPriceOffset": "disabled (asymmetricBounds whitelist)",
|
|
38
|
+
"repositionAccounting": "unfilled orders canceled + counted (incl armed refills/rebids); bought-and-held base carries across resets in a weighted-average-entry inventory pool (resync never market-sells); end-of-run inventory mark is informational and excluded from scoring",
|
|
39
|
+
"cycleEconomics": "slot rotation: filled buy re-offers one rail step up; that refill selling books ~increment% minus round-trip fee and the freed quote re-bids one step down; unlinked initial-grid sells only execute against held inventory at weighted-average entry (no shorting)",
|
|
40
|
+
"totalGrossCapturePct": "sum of realized per-rotation gross from actual fixed prices (linked rotations + inventory sales)",
|
|
41
|
+
"totalNetCapturePct": "realized gross - roundtrip fee per completed disposition; excludes the end-of-run inventory mark",
|
|
42
|
+
"btsFees": "every order placement (initial grid + armed refills/rebids) pays maker create (0.4826*0.1 BTS), every reset cancel pays 0.00482 BTS; btsFeePts = total BTS * txFeePrice / btsFeeCapital * 100 deducted from net before scoring",
|
|
43
|
+
"warmup": "getAmaWarmupBars(er, slow, 0, fast)",
|
|
44
|
+
"riskPenalty": "avgOpenDurationBars*1 + peakOpenOrders*2 + avgImbalance*1.2 + canceledOnReposition*0.15",
|
|
45
|
+
"finalScore": "baseScore - riskPenalty"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"results": [
|
|
49
|
+
{
|
|
50
|
+
"strategy": {
|
|
51
|
+
"id": "AMA1",
|
|
52
|
+
"name": "AMA1",
|
|
53
|
+
"er": 500,
|
|
54
|
+
"fast": 2,
|
|
55
|
+
"slow": 50
|
|
56
|
+
},
|
|
57
|
+
"best": {
|
|
58
|
+
"spreadPct": 4,
|
|
59
|
+
"incrementPct": 0.01,
|
|
60
|
+
"maxMinRatio": 2,
|
|
61
|
+
"touchedOrders": 17118,
|
|
62
|
+
"matchedPairs": 4463,
|
|
63
|
+
"cyclesTotal": 4463,
|
|
64
|
+
"rotationCount": 1911,
|
|
65
|
+
"inventorySaleCount": 2552,
|
|
66
|
+
"avgCyclesPerSlot": 32.81617647058823,
|
|
67
|
+
"fillEfficiency": 26.071971024652413,
|
|
68
|
+
"totalGrossCapturePct": 74380.64032509834,
|
|
69
|
+
"totalNetCapturePct": 73488.04032508115,
|
|
70
|
+
"btsFeePts": 73.45986739997919,
|
|
71
|
+
"btsFeesBts": 7345.986739997918,
|
|
72
|
+
"totalNetCaptureAfterFeesPct": 73414.58045768116,
|
|
73
|
+
"avgNetPerPair": 16.46606325903678,
|
|
74
|
+
"canceledOnReposition": 129640,
|
|
75
|
+
"repositionCount": 972,
|
|
76
|
+
"driftTriggerCount": 972,
|
|
77
|
+
"slopeTriggerCount": 0,
|
|
78
|
+
"inventoryUnits": 567,
|
|
79
|
+
"inventoryAvgEntry": 1480.717680275907,
|
|
80
|
+
"inventoryNetPts": -8250.559317877065,
|
|
81
|
+
"offsetAppliedCount": 0,
|
|
82
|
+
"avgOpenDurationBars": 7.108843537414966,
|
|
83
|
+
"peakOpenOrders": 136,
|
|
84
|
+
"avgImbalance": 4.6666405484818805,
|
|
85
|
+
"riskPenalty": 19730.708812195593,
|
|
86
|
+
"baseScore": 19140.628144796767,
|
|
87
|
+
"utilization": 67.06103580662854,
|
|
88
|
+
"score": -590.0806673988263
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"strategy": {
|
|
93
|
+
"id": "AMA2",
|
|
94
|
+
"name": "AMA2",
|
|
95
|
+
"er": 500,
|
|
96
|
+
"fast": 2,
|
|
97
|
+
"slow": 50
|
|
98
|
+
},
|
|
99
|
+
"best": {
|
|
100
|
+
"spreadPct": 4,
|
|
101
|
+
"incrementPct": 0.01,
|
|
102
|
+
"maxMinRatio": 2,
|
|
103
|
+
"touchedOrders": 17118,
|
|
104
|
+
"matchedPairs": 4463,
|
|
105
|
+
"cyclesTotal": 4463,
|
|
106
|
+
"rotationCount": 1911,
|
|
107
|
+
"inventorySaleCount": 2552,
|
|
108
|
+
"avgCyclesPerSlot": 32.81617647058823,
|
|
109
|
+
"fillEfficiency": 26.071971024652413,
|
|
110
|
+
"totalGrossCapturePct": 74380.64032509834,
|
|
111
|
+
"totalNetCapturePct": 73488.04032508115,
|
|
112
|
+
"btsFeePts": 73.45986739997919,
|
|
113
|
+
"btsFeesBts": 7345.986739997918,
|
|
114
|
+
"totalNetCaptureAfterFeesPct": 73414.58045768116,
|
|
115
|
+
"avgNetPerPair": 16.46606325903678,
|
|
116
|
+
"canceledOnReposition": 129640,
|
|
117
|
+
"repositionCount": 972,
|
|
118
|
+
"driftTriggerCount": 972,
|
|
119
|
+
"slopeTriggerCount": 0,
|
|
120
|
+
"inventoryUnits": 567,
|
|
121
|
+
"inventoryAvgEntry": 1480.717680275907,
|
|
122
|
+
"inventoryNetPts": -8250.559317877065,
|
|
123
|
+
"offsetAppliedCount": 0,
|
|
124
|
+
"avgOpenDurationBars": 7.108843537414966,
|
|
125
|
+
"peakOpenOrders": 136,
|
|
126
|
+
"avgImbalance": 4.6666405484818805,
|
|
127
|
+
"riskPenalty": 19730.708812195593,
|
|
128
|
+
"baseScore": 19140.628144796767,
|
|
129
|
+
"utilization": 67.06103580662854,
|
|
130
|
+
"score": -590.0806673988263
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"strategy": {
|
|
135
|
+
"id": "AMA3",
|
|
136
|
+
"name": "AMA3",
|
|
137
|
+
"er": 500,
|
|
138
|
+
"fast": 2,
|
|
139
|
+
"slow": 50
|
|
140
|
+
},
|
|
141
|
+
"best": {
|
|
142
|
+
"spreadPct": 4,
|
|
143
|
+
"incrementPct": 0.01,
|
|
144
|
+
"maxMinRatio": 2,
|
|
145
|
+
"touchedOrders": 17118,
|
|
146
|
+
"matchedPairs": 4463,
|
|
147
|
+
"cyclesTotal": 4463,
|
|
148
|
+
"rotationCount": 1911,
|
|
149
|
+
"inventorySaleCount": 2552,
|
|
150
|
+
"avgCyclesPerSlot": 32.81617647058823,
|
|
151
|
+
"fillEfficiency": 26.071971024652413,
|
|
152
|
+
"totalGrossCapturePct": 74380.64032509834,
|
|
153
|
+
"totalNetCapturePct": 73488.04032508115,
|
|
154
|
+
"btsFeePts": 73.45986739997919,
|
|
155
|
+
"btsFeesBts": 7345.986739997918,
|
|
156
|
+
"totalNetCaptureAfterFeesPct": 73414.58045768116,
|
|
157
|
+
"avgNetPerPair": 16.46606325903678,
|
|
158
|
+
"canceledOnReposition": 129640,
|
|
159
|
+
"repositionCount": 972,
|
|
160
|
+
"driftTriggerCount": 972,
|
|
161
|
+
"slopeTriggerCount": 0,
|
|
162
|
+
"inventoryUnits": 567,
|
|
163
|
+
"inventoryAvgEntry": 1480.717680275907,
|
|
164
|
+
"inventoryNetPts": -8250.559317877065,
|
|
165
|
+
"offsetAppliedCount": 0,
|
|
166
|
+
"avgOpenDurationBars": 7.108843537414966,
|
|
167
|
+
"peakOpenOrders": 136,
|
|
168
|
+
"avgImbalance": 4.6666405484818805,
|
|
169
|
+
"riskPenalty": 19730.708812195593,
|
|
170
|
+
"baseScore": 19140.628144796767,
|
|
171
|
+
"utilization": 67.06103580662854,
|
|
172
|
+
"score": -590.0806673988263
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"strategy": {
|
|
177
|
+
"id": "AMA4",
|
|
178
|
+
"name": "AMA4",
|
|
179
|
+
"er": 500,
|
|
180
|
+
"fast": 2,
|
|
181
|
+
"slow": 50
|
|
182
|
+
},
|
|
183
|
+
"best": {
|
|
184
|
+
"spreadPct": 4,
|
|
185
|
+
"incrementPct": 0.01,
|
|
186
|
+
"maxMinRatio": 2,
|
|
187
|
+
"touchedOrders": 17118,
|
|
188
|
+
"matchedPairs": 4463,
|
|
189
|
+
"cyclesTotal": 4463,
|
|
190
|
+
"rotationCount": 1911,
|
|
191
|
+
"inventorySaleCount": 2552,
|
|
192
|
+
"avgCyclesPerSlot": 32.81617647058823,
|
|
193
|
+
"fillEfficiency": 26.071971024652413,
|
|
194
|
+
"totalGrossCapturePct": 74380.64032509834,
|
|
195
|
+
"totalNetCapturePct": 73488.04032508115,
|
|
196
|
+
"btsFeePts": 73.45986739997919,
|
|
197
|
+
"btsFeesBts": 7345.986739997918,
|
|
198
|
+
"totalNetCaptureAfterFeesPct": 73414.58045768116,
|
|
199
|
+
"avgNetPerPair": 16.46606325903678,
|
|
200
|
+
"canceledOnReposition": 129640,
|
|
201
|
+
"repositionCount": 972,
|
|
202
|
+
"driftTriggerCount": 972,
|
|
203
|
+
"slopeTriggerCount": 0,
|
|
204
|
+
"inventoryUnits": 567,
|
|
205
|
+
"inventoryAvgEntry": 1480.717680275907,
|
|
206
|
+
"inventoryNetPts": -8250.559317877065,
|
|
207
|
+
"offsetAppliedCount": 0,
|
|
208
|
+
"avgOpenDurationBars": 7.108843537414966,
|
|
209
|
+
"peakOpenOrders": 136,
|
|
210
|
+
"avgImbalance": 4.6666405484818805,
|
|
211
|
+
"riskPenalty": 19730.708812195593,
|
|
212
|
+
"baseScore": 19140.628144796767,
|
|
213
|
+
"utilization": 67.06103580662854,
|
|
214
|
+
"score": -590.0806673988263
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
@@ -16,15 +16,15 @@ const { kibanaSearch, DEFAULT_CONFIG: BASE_CONFIG } = KC;
|
|
|
16
16
|
* FIFO or sequential (LIFO) inventory tracking per asset pair.
|
|
17
17
|
*
|
|
18
18
|
* Usage:
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
19
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --start 2025-01-01 --end 2025-06-01
|
|
20
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 720
|
|
21
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --start 2025-01-01T00:00:00Z --end 2025-06-01T00:00:00Z
|
|
22
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 168 --asset 1.3.113
|
|
23
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 168 --csv trades.csv
|
|
24
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 168 --json results.json
|
|
25
|
+
* node dist/analysis/trade_profitability.js "account-name" --lookup
|
|
26
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 168 --trades
|
|
27
|
+
* node dist/analysis/trade_profitability.js 1.2.3 --hours 168 --match-mode fifo
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
@@ -188,7 +188,7 @@ interface PairAnalysis {
|
|
|
188
188
|
|
|
189
189
|
function printHelp() {
|
|
190
190
|
console.log(`\
|
|
191
|
-
Usage:
|
|
191
|
+
Usage: node dist/analysis/trade_profitability.js <accountId> [options]
|
|
192
192
|
|
|
193
193
|
Analyzes filled orders for a BitShares account, computing realized PnL
|
|
194
194
|
via FIFO or sequential (LIFO) inventory tracking.
|
|
@@ -212,11 +212,11 @@ Options:
|
|
|
212
212
|
--help, -h Show this help
|
|
213
213
|
|
|
214
214
|
Examples:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
node dist/analysis/trade_profitability.js 1.2.123456 --hours 720
|
|
216
|
+
node dist/analysis/trade_profitability.js 1.2.123456 --start 2025-01-01 --end 2025-06-01
|
|
217
|
+
node dist/analysis/trade_profitability.js "my-bot-account" --lookup --hours 168
|
|
218
|
+
node dist/analysis/trade_profitability.js 1.2.123456 --hours 720 --asset 1.3.113 --csv trades.csv
|
|
219
|
+
node dist/analysis/trade_profitability.js 1.2.123456 --hours 720 --match-mode sequential`);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
function parseArgs() {
|
|
@@ -239,7 +239,7 @@ function parseArgs() {
|
|
|
239
239
|
matchMode: 'sequential',
|
|
240
240
|
showPnlDetail: false,
|
|
241
241
|
verbose: false,
|
|
242
|
-
feePerOrder:
|
|
242
|
+
feePerOrder: null as number | null,
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -423,6 +423,16 @@ async function fetchAllFills(config: any, accountId: string, gte: string, lte: s
|
|
|
423
423
|
|
|
424
424
|
// ─── Fill Classification ─────────────────────────────────────────────────────
|
|
425
425
|
|
|
426
|
+
/**
|
|
427
|
+
* A fill needs strictly positive, finite amounts on both legs. A zero base
|
|
428
|
+
* amount would produce an infinite price (quoteAmount / 0) that poisons
|
|
429
|
+
* downstream inventory lots and PnL aggregates.
|
|
430
|
+
*/
|
|
431
|
+
function isValidFillAmounts(baseAmount: number, quoteAmount: number): boolean {
|
|
432
|
+
return Number.isFinite(baseAmount) && Number.isFinite(quoteAmount)
|
|
433
|
+
&& baseAmount > 0 && quoteAmount > 0;
|
|
434
|
+
}
|
|
435
|
+
|
|
426
436
|
function classifyFills(fills: FillRecord[], filterAsset: string | null): { trades: TradeFill[]; pairs: Set<string> } {
|
|
427
437
|
const trades: TradeFill[] = [];
|
|
428
438
|
const pairs = new Set<string>();
|
|
@@ -450,7 +460,7 @@ function classifyFills(fills: FillRecord[], filterAsset: string | null): { trade
|
|
|
450
460
|
quoteAsset = BTS_ID;
|
|
451
461
|
baseAmount = toReal(f.receives.amount, rAsset);
|
|
452
462
|
quoteAmount = toReal(f.pays.amount, BTS_ID);
|
|
453
|
-
if (
|
|
463
|
+
if (!isValidFillAmounts(baseAmount, quoteAmount)) { skipped++; continue; }
|
|
454
464
|
price = quoteAmount / baseAmount;
|
|
455
465
|
marketFeeReal = feeReal;
|
|
456
466
|
marketFeeAsset = f.fee.asset_id;
|
|
@@ -460,7 +470,7 @@ function classifyFills(fills: FillRecord[], filterAsset: string | null): { trade
|
|
|
460
470
|
quoteAsset = BTS_ID;
|
|
461
471
|
baseAmount = toReal(f.pays.amount, pAsset);
|
|
462
472
|
quoteAmount = toReal(f.receives.amount, BTS_ID);
|
|
463
|
-
if (
|
|
473
|
+
if (!isValidFillAmounts(baseAmount, quoteAmount)) { skipped++; continue; }
|
|
464
474
|
price = quoteAmount / baseAmount;
|
|
465
475
|
marketFeeReal = feeReal;
|
|
466
476
|
marketFeeAsset = f.fee.asset_id;
|
|
@@ -476,7 +486,7 @@ function classifyFills(fills: FillRecord[], filterAsset: string | null): { trade
|
|
|
476
486
|
quoteAsset = isSell ? rAsset : pAsset;
|
|
477
487
|
baseAmount = toReal(isSell ? f.pays.amount : f.receives.amount, baseAsset);
|
|
478
488
|
quoteAmount = toReal(isSell ? f.receives.amount : f.pays.amount, quoteAsset);
|
|
479
|
-
if (
|
|
489
|
+
if (!isValidFillAmounts(baseAmount, quoteAmount)) { skipped++; continue; }
|
|
480
490
|
price = quoteAmount / baseAmount;
|
|
481
491
|
marketFeeReal = feeReal;
|
|
482
492
|
marketFeeAsset = f.fee.asset_id;
|
|
@@ -1295,6 +1305,26 @@ function exportJson(accountId: string, start: string, end: string, pairs: PairAn
|
|
|
1295
1305
|
|
|
1296
1306
|
// ─── Main ────────────────────────────────────────────────────────────────────
|
|
1297
1307
|
|
|
1308
|
+
/**
|
|
1309
|
+
* Normalize a user-supplied time bound into an ES-compatible ISO string.
|
|
1310
|
+
*
|
|
1311
|
+
* Parsing goes through `new Date()` so offset-bearing ISO strings
|
|
1312
|
+
* (e.g. 2026-07-07T12:00:00+02:00) are honored instead of being corrupted by a
|
|
1313
|
+
* blind 'Z' append (+02:00Z). A date-only --end expands to the end of that UTC
|
|
1314
|
+
* day (T23:59:59.999Z) — treating it as midnight silently dropped the final day.
|
|
1315
|
+
*/
|
|
1316
|
+
function normalizeTimeBound(raw: string, isEnd: boolean): string {
|
|
1317
|
+
const parsed = new Date(raw);
|
|
1318
|
+
if (isNaN(parsed.getTime())) {
|
|
1319
|
+
throw new Error(`Invalid ${isEnd ? '--end' : '--start'} time: ${raw}`);
|
|
1320
|
+
}
|
|
1321
|
+
let ms = parsed.getTime();
|
|
1322
|
+
if (isEnd && /^\d{4}-\d{2}-\d{2}$/.test(raw.trim())) {
|
|
1323
|
+
ms += 24 * 3600 * 1000 - 1;
|
|
1324
|
+
}
|
|
1325
|
+
return new Date(ms).toISOString();
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1298
1328
|
async function run() {
|
|
1299
1329
|
const opts = parseArgs();
|
|
1300
1330
|
let accountId = opts.accountId;
|
|
@@ -1313,10 +1343,10 @@ async function run() {
|
|
|
1313
1343
|
let gte: string, lte: string;
|
|
1314
1344
|
|
|
1315
1345
|
if (opts.start && opts.end) {
|
|
1316
|
-
gte = opts.start;
|
|
1317
|
-
lte = opts.end;
|
|
1346
|
+
gte = normalizeTimeBound(opts.start, false);
|
|
1347
|
+
lte = normalizeTimeBound(opts.end, true);
|
|
1318
1348
|
} else if (opts.start) {
|
|
1319
|
-
gte = opts.start;
|
|
1349
|
+
gte = normalizeTimeBound(opts.start, false);
|
|
1320
1350
|
lte = now.toISOString();
|
|
1321
1351
|
} else {
|
|
1322
1352
|
const hours = opts.hours || 168;
|
|
@@ -1325,10 +1355,6 @@ async function run() {
|
|
|
1325
1355
|
lte = now.toISOString();
|
|
1326
1356
|
}
|
|
1327
1357
|
|
|
1328
|
-
// Ensure times end with Z for ES
|
|
1329
|
-
if (!gte.endsWith('Z')) gte += gte.includes('T') ? 'Z' : 'T00:00:00Z';
|
|
1330
|
-
if (!lte.endsWith('Z')) lte += lte.includes('T') ? 'Z' : 'T00:00:00Z';
|
|
1331
|
-
|
|
1332
1358
|
const KIBANA_CFG = { timeout: 60000 };
|
|
1333
1359
|
|
|
1334
1360
|
const fills = await fetchAllFills(KIBANA_CFG, accountId, gte, lte);
|
|
@@ -1358,8 +1384,15 @@ async function run() {
|
|
|
1358
1384
|
}
|
|
1359
1385
|
console.log('');
|
|
1360
1386
|
|
|
1361
|
-
// Override blockchain fee from CLI if provided
|
|
1362
|
-
|
|
1387
|
+
// Override blockchain fee from CLI if provided. Explicit --fee-per-order 0
|
|
1388
|
+
// is valid (free-fee account) and must not be dropped by a falsy check.
|
|
1389
|
+
if (opts.feePerOrder != null) {
|
|
1390
|
+
if (!Number.isFinite(opts.feePerOrder) || opts.feePerOrder < 0) {
|
|
1391
|
+
console.error(`Invalid --fee-per-order: ${opts.feePerOrder}`);
|
|
1392
|
+
process.exit(1);
|
|
1393
|
+
}
|
|
1394
|
+
BLOCKCHAIN_FEE_PER_FILL = opts.feePerOrder;
|
|
1395
|
+
}
|
|
1363
1396
|
|
|
1364
1397
|
// Analyze each pair
|
|
1365
1398
|
const pairMap = new Map<string, TradeFill[]>();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
import fs from 'node:fs';
|
|
@@ -12,7 +13,6 @@ import { loadBotMeta } from '../bot_key_utils.js';
|
|
|
12
13
|
import { resolveSource, listAvailableBots } from '../resolve_source.js';
|
|
13
14
|
import { writeChartFile } from '../chart_utils.js';
|
|
14
15
|
import { PATHS } from '../../modules/paths.js';
|
|
15
|
-
'use strict';
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
const DEFAULT_CHART_DIR = PATHS.ANALYSIS.CHARTS_DIR;
|