dexbot 1.4.15 → 1.4.17
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 +5013 -0
- package/README.md +18 -14
- package/analysis/README.md +468 -0
- package/analysis/ama_fitting/README.md +258 -0
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +151 -0
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +407 -0
- package/analysis/ama_fitting/calibrate_convergence_er.ts +199 -0
- package/analysis/ama_fitting/fetch_lp_candles.ts +187 -0
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +269 -0
- package/analysis/ama_fitting/optimizer_high_resolution.ts +792 -0
- package/analysis/ama_fitting/package.json +12 -0
- package/analysis/analyze_derivatives.ts +318 -0
- package/analysis/analyze_dynamic_weight.ts +219 -0
- package/analysis/analyze_kalman.ts +126 -0
- package/analysis/analyze_regime.ts +156 -0
- package/analysis/analyze_regime_windows.ts +460 -0
- package/analysis/analyze_risk_profile.ts +199 -0
- package/analysis/analyze_trade_heatmap.ts +362 -0
- package/analysis/analyze_volatility.ts +182 -0
- package/analysis/bot_fitting/README.md +124 -0
- package/analysis/bot_fitting/backtest_ama_sweep.ts +816 -0
- package/analysis/bot_fitting/backtest_bot_fitting.ts +421 -0
- package/analysis/bot_fitting/shared_utils.ts +46 -0
- package/analysis/bot_key_utils.ts +154 -0
- package/analysis/bot_usage/discover_bot_accounts.ts +579 -0
- package/analysis/bot_usage/kibana_bot_queries.ts +427 -0
- package/analysis/chart_css.ts +60 -0
- package/analysis/chart_ui.ts +106 -0
- package/{dist/analysis/chart_utils.js → analysis/chart_utils.ts} +21 -13
- package/analysis/derivative_chart_generator.ts +874 -0
- package/analysis/math_utils.ts +60 -0
- package/analysis/price_sources.ts +130 -0
- package/analysis/resolve_source.ts +89 -0
- package/analysis/trade_profitability.ts +1412 -0
- package/analysis/tradingview/README.md +161 -0
- package/analysis/tradingview/analyze_tradingview.ts +160 -0
- package/{dist/analysis/tradingview/tradingview_uplot_chart_generator.js → analysis/tradingview/tradingview_uplot_chart_generator.ts} +40 -36
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +437 -0
- package/analysis/trend_detection/README.md +27 -0
- package/analysis/trend_detection/SIGNAL_DOCUMENTATION.md +403 -0
- package/analysis/trend_detection/derivative_analyzer.ts +1050 -0
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +1376 -0
- package/analysis/trend_detection/hurst_analyzer.ts +7 -0
- package/analysis/trend_detection/kalman_chart_generator.ts +371 -0
- package/analysis/trend_detection/kalman_trend_analyzer.ts +9 -0
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +7 -0
- package/analysis/trend_detection/package.json +23 -0
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +7 -0
- package/analysis/trend_detection/regime_chart_generator.ts +319 -0
- package/analysis/trend_detection/tests/test_kalman_trend.ts +153 -0
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +64 -0
- package/analysis/trend_detection/volatility_chart_generator.ts +655 -0
- package/analysis/tsconfig.json +29 -0
- package/analysis/uplot/index.d.ts +128 -0
- package/analysis/uplot/uPlot.iife.min.js +2 -0
- package/analysis/uplot/uPlot.min.css +1 -0
- package/claw/README.md +4 -0
- package/claw/examples/claw_profiles_example.ts +1 -1
- package/claw/examples/memu_integration_example.ts +1 -1
- package/claw/modules/bitshares_client.ts +47 -7
- package/claw/modules/chain_actions.ts +10 -1
- package/claw/modules/chain_broadcast.ts +4 -5
- package/claw/modules/claw_infra.ts +13 -3
- package/claw/modules/claw_launcher.ts +41 -7
- package/claw/modules/claw_manifest.ts +9 -1
- package/claw/modules/claw_skill_md.ts +34 -13
- package/claw/modules/credit_runtime_adapter.ts +30 -12
- package/claw/modules/decision_loop.ts +10 -2
- package/claw/modules/dexbot_profiles.ts +5 -25
- package/claw/modules/feed_price_source.ts +1 -1
- package/claw/modules/honest_ecosystem.ts +32 -8
- package/claw/modules/kibana_price_source.ts +6 -2
- package/claw/modules/launcher_mode_detector.ts +10 -13
- package/claw/modules/launcher_paths.ts +4 -1
- package/claw/modules/liquidity_pools.ts +2 -2
- package/claw/modules/mcp_utils.ts +46 -5
- package/claw/modules/memu_bridge.ts +17 -1
- package/claw/modules/position_discovery.ts +1 -1
- package/claw/modules/position_health.ts +1 -1
- package/claw/modules/position_manager.ts +39 -13
- package/claw/modules/skill_utils.ts +4 -8
- package/claw/modules/types.ts +20 -1
- package/claw/package.json +1 -1
- 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 +22 -3
- package/claw/scripts/claw_mcp_server.ts +28 -13
- package/claw/scripts/honest_assets_report.ts +3 -1
- package/claw/scripts/memu_mcp_server.ts +15 -4
- package/claw/tests/test_claw_data_flow.ts +4 -2
- package/claw/tests/test_claw_mcp_transport.ts +2 -2
- package/claw/tests/test_claw_regressions.ts +5 -0
- package/claw/tests/test_claw_skill_generation.ts +3 -3
- package/claw/tests/test_nullclaw_tmp_integration.ts +1 -1
- package/claw/tsconfig.json +1 -2
- package/dist/bot.js +1 -1
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.js +8 -8
- package/dist/credential-daemon.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +9 -3
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +1 -2
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +2 -3
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +1 -1
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +3 -2
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +2 -2
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +7 -17
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +8 -1
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +3 -11
- 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/crypto/ecc.browser.d.ts +1 -2
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +19 -58
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts +2 -9
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.js +6 -145
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -17
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -30
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.d.ts +1 -30
- package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +1 -169
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +1 -1
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +7 -7
- 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.d.ts +1 -6
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +2 -11
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.js +1 -1
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.js +1 -1
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +2 -2
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +9 -3
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +7 -23
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/constants.js +1 -1
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.js +3 -3
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +6 -12
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +0 -3
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +5 -27
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +18 -27
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts +4 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.js +1 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
- package/dist/modules/crypto/sync.d.ts +0 -3
- package/dist/modules/crypto/sync.d.ts.map +1 -1
- package/dist/modules/crypto/sync.js +0 -3
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +9 -9
- package/dist/modules/dexbot_class.js +9 -9
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -3
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +4 -9
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +10 -10
- package/dist/modules/dexbot_fill_runtime.js +10 -10
- package/dist/modules/dexbot_maintenance_runtime.d.ts +7 -7
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +16 -15
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/env.d.ts +0 -1
- package/dist/modules/env.d.ts.map +1 -1
- package/dist/modules/env.js +0 -34
- package/dist/modules/env.js.map +1 -1
- package/dist/modules/graceful_shutdown.js +1 -1
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/key_store.js +1 -1
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/credential_daemon.js +3 -3
- package/dist/modules/launcher/credential_daemon.js.map +1 -1
- package/dist/modules/launcher/launch_modes.d.ts +1 -2
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
- package/dist/modules/launcher/launch_modes.js +1 -2
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -2
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +1 -4
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +1 -2
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +3 -17
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts +1 -2
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +1 -14
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -3
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +1 -10
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +4 -3
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/export.d.ts.map +1 -1
- package/dist/modules/order/export.js +4 -3
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +1 -10
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +1 -22
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +19 -19
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +25 -25
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts +1 -83
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +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/manager.d.ts +15 -15
- package/dist/modules/order/manager.js +15 -15
- package/dist/modules/order/processed_fill_store.d.ts +1 -1
- package/dist/modules/order/processed_fill_store.js +1 -1
- package/dist/modules/order/sync_engine.d.ts +4 -4
- package/dist/modules/order/sync_engine.js +4 -4
- package/dist/modules/order/utils/math.d.ts +7 -2
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +10 -3
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.js +3 -3
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +17 -1
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +56 -4
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +3 -3
- package/dist/modules/order/utils/validate.d.ts.map +1 -1
- package/dist/modules/order/utils/validate.js +5 -5
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/utils/withPoolRef.js +1 -1
- package/dist/modules/order/utils/withPoolRef.js.map +1 -1
- package/dist/modules/paths.d.ts +46 -15
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +145 -33
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/runtime.d.ts +1 -0
- package/dist/modules/runtime.d.ts.map +1 -1
- package/dist/modules/runtime_settings.d.ts.map +1 -1
- package/dist/modules/runtime_settings.js +26 -30
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +7 -1
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +10 -6
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/types.d.ts +0 -753
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/types.js +0 -15
- package/dist/modules/types.js.map +1 -1
- package/dist/modules/utils/base58check.js +4 -4
- package/dist/modules/utils/base58check.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts +1 -11
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +1 -1
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.js +3 -3
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/update.d.ts +17 -5
- package/dist/scripts/update.d.ts.map +1 -1
- package/dist/scripts/update.js +420 -172
- package/dist/scripts/update.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +435 -0
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +514 -0
- package/docs/COW_INVARIANTS.md +309 -0
- package/docs/CREDENTIAL_SECURITY.md +450 -0
- package/docs/DEXBOT_COMPARISON.md +922 -0
- package/docs/EVOLUTION.md +210 -0
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +851 -0
- package/docs/GRID_RECALCULATION.md +624 -0
- package/docs/GRID_RECONCILE.md +259 -0
- package/docs/LOGGING.md +318 -0
- package/docs/MPA_CREDIT_USAGE.md +353 -0
- package/docs/README.md +199 -0
- package/docs/WORKFLOW.md +369 -0
- package/docs/architecture.md +1466 -0
- package/docs/developer_guide.md +1929 -0
- package/docs/docker.md +141 -0
- package/market_adapter/README.md +1003 -0
- package/modules/README.md +176 -0
- package/package.json +40 -5
- package/scripts/README.md +55 -32
- package/scripts/bots +18 -0
- package/scripts/clean-dist.js +9 -0
- package/scripts/create-bot-symlinks.sh +3 -3
- package/scripts/dexbot +17 -0
- package/scripts/git-viewer.sh +489 -0
- package/scripts/keys +18 -0
- package/scripts/lib/dexbot-paths.sh +71 -20
- package/scripts/pdev.sh +38 -0
- package/scripts/pm2 +17 -0
- package/scripts/pmain.sh +45 -0
- package/scripts/ptest.sh +26 -0
- package/scripts/repo-stats.html +480 -0
- package/scripts/unlock +17 -0
- package/scripts/update.js +13 -0
- package/tests/README.md +135 -0
- package/claw/data/positions.json +0 -148036
- package/claw/node_modules/.package-lock.json +0 -935
- package/claw/node_modules/@babel/runtime/LICENSE +0 -22
- package/claw/node_modules/@babel/runtime/README.md +0 -19
- package/claw/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/OverloadYield.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/applyDecs.js +0 -236
- package/claw/node_modules/@babel/runtime/helpers/applyDecs2203.js +0 -184
- package/claw/node_modules/@babel/runtime/helpers/applyDecs2203R.js +0 -191
- package/claw/node_modules/@babel/runtime/helpers/applyDecs2301.js +0 -222
- package/claw/node_modules/@babel/runtime/helpers/applyDecs2305.js +0 -133
- package/claw/node_modules/@babel/runtime/helpers/applyDecs2311.js +0 -124
- package/claw/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/assertClassBrand.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -24
- package/claw/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -45
- package/claw/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -26
- package/claw/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/callSuper.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/checkInRHS.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldGet2.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classPrivateFieldSet2.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateGetter.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/classPrivateSetter.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/construct.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/createClass.js +0 -13
- package/claw/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -50
- package/claw/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -19
- package/claw/node_modules/@babel/runtime/helpers/createSuper.js +0 -16
- package/claw/node_modules/@babel/runtime/helpers/decorate.js +0 -250
- package/claw/node_modules/@babel/runtime/helpers/defaults.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/defineAccessor.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/defineProperty.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/dispose.js +0 -28
- package/claw/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/OverloadYield.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -236
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +0 -184
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +0 -191
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +0 -222
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js +0 -133
- package/claw/node_modules/@babel/runtime/helpers/esm/applyDecs2311.js +0 -124
- package/claw/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/assertClassBrand.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -24
- package/claw/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -45
- package/claw/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -26
- package/claw/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/callSuper.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/checkInRHS.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet2.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateGetter.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/classPrivateSetter.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/construct.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -13
- package/claw/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -50
- package/claw/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -19
- package/claw/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -16
- package/claw/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -250
- package/claw/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/defineAccessor.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/dispose.js +0 -28
- package/claw/node_modules/@babel/runtime/helpers/esm/extends.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/get.js +0 -11
- package/claw/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/identity.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/importDeferProxy.js +0 -27
- package/claw/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -14
- package/claw/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -28
- package/claw/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/nullishReceiverError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -14
- package/claw/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -23
- package/claw/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -13
- package/claw/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
- package/claw/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/regenerator.js +0 -89
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorAsync.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorAsyncGen.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorAsyncIterator.js +0 -33
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorDefine.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorKeys.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -77
- package/claw/node_modules/@babel/runtime/helpers/esm/regeneratorValues.js +0 -19
- package/claw/node_modules/@babel/runtime/helpers/esm/set.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/esm/setFunctionName.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/superPropGet.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/superPropSet.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -2
- package/claw/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/esm/toSetter.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/tsRewriteRelativeImportExtensions.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/esm/using.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/esm/usingCtx.js +0 -59
- package/claw/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -56
- package/claw/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -27
- package/claw/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -52
- package/claw/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/extends.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/get.js +0 -11
- package/claw/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/identity.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/importDeferProxy.js +0 -27
- package/claw/node_modules/@babel/runtime/helpers/inherits.js +0 -14
- package/claw/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -5
- package/claw/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/instanceof.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -28
- package/claw/node_modules/@babel/runtime/helpers/jsx.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/nullishReceiverError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/objectSpread.js +0 -14
- package/claw/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -23
- package/claw/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -13
- package/claw/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/regenerator.js +0 -89
- package/claw/node_modules/@babel/runtime/helpers/regeneratorAsync.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +0 -33
- package/claw/node_modules/@babel/runtime/helpers/regeneratorDefine.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/regeneratorKeys.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -77
- package/claw/node_modules/@babel/runtime/helpers/regeneratorValues.js +0 -19
- package/claw/node_modules/@babel/runtime/helpers/set.js +0 -22
- package/claw/node_modules/@babel/runtime/helpers/setFunctionName.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/superPropBase.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/superPropGet.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/superPropSet.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/tdz.js +0 -4
- package/claw/node_modules/@babel/runtime/helpers/temporalRef.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -2
- package/claw/node_modules/@babel/runtime/helpers/toArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -8
- package/claw/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -7
- package/claw/node_modules/@babel/runtime/helpers/toSetter.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/tsRewriteRelativeImportExtensions.js +0 -6
- package/claw/node_modules/@babel/runtime/helpers/typeof.js +0 -10
- package/claw/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -9
- package/claw/node_modules/@babel/runtime/helpers/using.js +0 -12
- package/claw/node_modules/@babel/runtime/helpers/usingCtx.js +0 -59
- package/claw/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -56
- package/claw/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -27
- package/claw/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -52
- package/claw/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -4
- package/claw/node_modules/@babel/runtime/package.json +0 -1107
- package/claw/node_modules/@babel/runtime/regenerator/index.js +0 -15
- package/claw/node_modules/assert/.github/FUNDING.yml +0 -12
- package/claw/node_modules/assert/.github/SECURITY.md +0 -10
- package/claw/node_modules/assert/.travis.yml +0 -30
- package/claw/node_modules/assert/.zuul.yml +0 -13
- package/claw/node_modules/assert/CHANGELOG.md +0 -11
- package/claw/node_modules/assert/LICENSE +0 -18
- package/claw/node_modules/assert/README.md +0 -105
- package/claw/node_modules/assert/assert.js +0 -506
- package/claw/node_modules/assert/package.json +0 -32
- package/claw/node_modules/assert/test.js +0 -360
- package/claw/node_modules/async-limiter/.eslintignore +0 -2
- package/claw/node_modules/async-limiter/.nycrc +0 -10
- package/claw/node_modules/async-limiter/.travis.yml +0 -9
- package/claw/node_modules/async-limiter/LICENSE +0 -8
- package/claw/node_modules/async-limiter/index.js +0 -67
- package/claw/node_modules/async-limiter/package.json +0 -35
- package/claw/node_modules/async-limiter/readme.md +0 -132
- package/claw/node_modules/available-typed-arrays/.eslintrc +0 -5
- package/claw/node_modules/available-typed-arrays/.github/FUNDING.yml +0 -12
- package/claw/node_modules/available-typed-arrays/.nycrc +0 -9
- package/claw/node_modules/available-typed-arrays/CHANGELOG.md +0 -100
- package/claw/node_modules/available-typed-arrays/LICENSE +0 -21
- package/claw/node_modules/available-typed-arrays/README.md +0 -55
- package/claw/node_modules/available-typed-arrays/index.d.ts +0 -8
- package/claw/node_modules/available-typed-arrays/index.js +0 -17
- package/claw/node_modules/available-typed-arrays/package.json +0 -93
- package/claw/node_modules/available-typed-arrays/test/index.js +0 -18
- package/claw/node_modules/available-typed-arrays/tsconfig.json +0 -49
- package/claw/node_modules/base-x/LICENSE.md +0 -22
- package/claw/node_modules/base-x/README.md +0 -67
- package/claw/node_modules/base-x/package.json +0 -49
- package/claw/node_modules/base-x/src/index.d.ts +0 -10
- package/claw/node_modules/base-x/src/index.js +0 -123
- package/claw/node_modules/bigi/CHANGELOG.md +0 -85
- package/claw/node_modules/bigi/LICENSE.md +0 -30
- package/claw/node_modules/bigi/README.md +0 -14
- package/claw/node_modules/bigi/lib/bigi.js +0 -1509
- package/claw/node_modules/bigi/lib/convert.js +0 -91
- package/claw/node_modules/bigi/lib/index.js +0 -6
- package/claw/node_modules/bigi/package.json +0 -55
- package/claw/node_modules/bignumber.js/CHANGELOG.md +0 -222
- package/claw/node_modules/bignumber.js/LICENCE +0 -23
- package/claw/node_modules/bignumber.js/README.md +0 -266
- package/claw/node_modules/bignumber.js/bignumber.d.ts +0 -1797
- package/claw/node_modules/bignumber.js/bignumber.js +0 -2814
- package/claw/node_modules/bignumber.js/bignumber.js.map +0 -1
- package/claw/node_modules/bignumber.js/bignumber.min.js +0 -3
- package/claw/node_modules/bignumber.js/bignumber.mjs +0 -2793
- package/claw/node_modules/bignumber.js/bower.json +0 -36
- package/claw/node_modules/bignumber.js/doc/API.html +0 -2118
- package/claw/node_modules/bignumber.js/package.json +0 -39
- package/claw/node_modules/bs58/CHANGELOG.md +0 -61
- package/claw/node_modules/bs58/README.md +0 -71
- package/claw/node_modules/bs58/index.js +0 -4
- package/claw/node_modules/bs58/package.json +0 -37
- package/claw/node_modules/btsdex/.babelrc +0 -17
- package/claw/node_modules/btsdex/.github/workflows/check-style.yml +0 -16
- package/claw/node_modules/btsdex/LICENSE +0 -21
- package/claw/node_modules/btsdex/README.md +0 -467
- package/claw/node_modules/btsdex/cli.js +0 -165
- package/claw/node_modules/btsdex/lib/account.js +0 -60
- package/claw/node_modules/btsdex/lib/asset.js +0 -78
- package/claw/node_modules/btsdex/lib/bitshares.js +0 -363
- package/claw/node_modules/btsdex/lib/event.js +0 -137
- package/claw/node_modules/btsdex/lib/fees.js +0 -34
- package/claw/node_modules/btsdex/lib/index.js +0 -3
- package/claw/node_modules/btsdex/lib/transaction/TransactionBuilder.js +0 -797
- package/claw/node_modules/btsdex/lib/transaction/index.js +0 -64
- package/claw/node_modules/btsdex/package.json +0 -54
- package/claw/node_modules/btsdex/yarn-error.log +0 -3483
- package/claw/node_modules/btsdex-api/.babelrc +0 -14
- package/claw/node_modules/btsdex-api/README.md +0 -3
- package/claw/node_modules/btsdex-api/lib/apis.js +0 -59
- package/claw/node_modules/btsdex-api/lib/config.js +0 -39
- package/claw/node_modules/btsdex-api/lib/connection.js +0 -188
- package/claw/node_modules/btsdex-api/lib/index.js +0 -86
- package/claw/node_modules/btsdex-api/lib/logger.js +0 -45
- package/claw/node_modules/btsdex-api/lib/servers.js +0 -30
- package/claw/node_modules/btsdex-api/package.json +0 -29
- package/claw/node_modules/btsdex-ecc/.babelrc +0 -13
- package/claw/node_modules/btsdex-ecc/lib/BrainKey.js +0 -15
- package/claw/node_modules/btsdex-ecc/lib/KeyUtils.js +0 -205
- package/claw/node_modules/btsdex-ecc/lib/PrivateKey.js +0 -198
- package/claw/node_modules/btsdex-ecc/lib/PublicKey.js +0 -197
- package/claw/node_modules/btsdex-ecc/lib/address.js +0 -84
- package/claw/node_modules/btsdex-ecc/lib/addressPrefix.js +0 -15
- package/claw/node_modules/btsdex-ecc/lib/aes.js +0 -294
- package/claw/node_modules/btsdex-ecc/lib/ecdsa.js +0 -194
- package/claw/node_modules/btsdex-ecc/lib/ecsignature.js +0 -131
- package/claw/node_modules/btsdex-ecc/lib/enforce_types.js +0 -54
- package/claw/node_modules/btsdex-ecc/lib/hash.js +0 -60
- package/claw/node_modules/btsdex-ecc/lib/index.js +0 -84
- package/claw/node_modules/btsdex-ecc/lib/signature.js +0 -185
- package/claw/node_modules/btsdex-ecc/package.json +0 -37
- package/claw/node_modules/btsdex-serializer/.babelrc +0 -13
- package/claw/node_modules/btsdex-serializer/lib/ChainTypes.js +0 -154
- package/claw/node_modules/btsdex-serializer/lib/FastParser.js +0 -75
- package/claw/node_modules/btsdex-serializer/lib/ObjectId.js +0 -65
- package/claw/node_modules/btsdex-serializer/lib/SerializerValidation.js +0 -377
- package/claw/node_modules/btsdex-serializer/lib/convert.js +0 -54
- package/claw/node_modules/btsdex-serializer/lib/error_with_cause.js +0 -43
- package/claw/node_modules/btsdex-serializer/lib/index.js +0 -72
- package/claw/node_modules/btsdex-serializer/lib/operations.js +0 -1359
- package/claw/node_modules/btsdex-serializer/lib/precision.js +0 -108
- package/claw/node_modules/btsdex-serializer/lib/serializer.js +0 -205
- package/claw/node_modules/btsdex-serializer/lib/template.js +0 -23
- package/claw/node_modules/btsdex-serializer/lib/types.js +0 -1209
- package/claw/node_modules/btsdex-serializer/package-lock.json +0 -238
- package/claw/node_modules/btsdex-serializer/package.json +0 -32
- package/claw/node_modules/bytebuffer/.travis.yml +0 -5
- package/claw/node_modules/bytebuffer/LICENSE +0 -202
- package/claw/node_modules/bytebuffer/README.md +0 -64
- package/claw/node_modules/bytebuffer/bower.json +0 -12
- package/claw/node_modules/bytebuffer/bytebuffer.png +0 -0
- package/claw/node_modules/bytebuffer/dist/README.md +0 -47
- package/claw/node_modules/bytebuffer/dist/bytebuffer-dataview.js +0 -3461
- package/claw/node_modules/bytebuffer/dist/bytebuffer-dataview.min.js +0 -88
- package/claw/node_modules/bytebuffer/dist/bytebuffer-dataview.min.js.gz +0 -0
- package/claw/node_modules/bytebuffer/dist/bytebuffer-dataview.min.map +0 -8
- package/claw/node_modules/bytebuffer/dist/bytebuffer-node.js +0 -3454
- package/claw/node_modules/bytebuffer/dist/bytebuffer.js +0 -3746
- package/claw/node_modules/bytebuffer/dist/bytebuffer.min.js +0 -93
- package/claw/node_modules/bytebuffer/dist/bytebuffer.min.js.gz +0 -0
- package/claw/node_modules/bytebuffer/dist/bytebuffer.min.map +0 -8
- package/claw/node_modules/bytebuffer/donate.png +0 -0
- package/claw/node_modules/bytebuffer/externs/bytebuffer.js +0 -862
- package/claw/node_modules/bytebuffer/externs/minimal-env.js +0 -52
- package/claw/node_modules/bytebuffer/index.js +0 -1
- package/claw/node_modules/bytebuffer/jsdoc.json +0 -13
- package/claw/node_modules/bytebuffer/package.json +0 -51
- package/claw/node_modules/bytebuffer/scripts/build.js +0 -113
- package/claw/node_modules/bytebuffer/src/bower.json +0 -12
- package/claw/node_modules/bytebuffer/src/bytebuffer.js +0 -220
- package/claw/node_modules/bytebuffer/src/encodings/base64.js +0 -88
- package/claw/node_modules/bytebuffer/src/encodings/binary.js +0 -74
- package/claw/node_modules/bytebuffer/src/encodings/debug.js +0 -211
- package/claw/node_modules/bytebuffer/src/encodings/hex.js +0 -75
- package/claw/node_modules/bytebuffer/src/encodings/impl/base64.js +0 -3
- package/claw/node_modules/bytebuffer/src/encodings/impl/binary.js +0 -65
- package/claw/node_modules/bytebuffer/src/encodings/impl/debug.js +0 -3
- package/claw/node_modules/bytebuffer/src/encodings/impl/hex.js +0 -101
- package/claw/node_modules/bytebuffer/src/encodings/impl/utf8.js +0 -126
- package/claw/node_modules/bytebuffer/src/encodings/utf8.js +0 -71
- package/claw/node_modules/bytebuffer/src/helpers.js +0 -143
- package/claw/node_modules/bytebuffer/src/macros.js +0 -222
- package/claw/node_modules/bytebuffer/src/methods/append.js +0 -58
- package/claw/node_modules/bytebuffer/src/methods/assert.js +0 -12
- package/claw/node_modules/bytebuffer/src/methods/capacity.js +0 -8
- package/claw/node_modules/bytebuffer/src/methods/clear.js +0 -13
- package/claw/node_modules/bytebuffer/src/methods/clone.js +0 -34
- package/claw/node_modules/bytebuffer/src/methods/compact.js +0 -49
- package/claw/node_modules/bytebuffer/src/methods/copy.js +0 -73
- package/claw/node_modules/bytebuffer/src/methods/ensureCapacity.js +0 -15
- package/claw/node_modules/bytebuffer/src/methods/fill.js +0 -35
- package/claw/node_modules/bytebuffer/src/methods/flip.js +0 -11
- package/claw/node_modules/bytebuffer/src/methods/mark.js +0 -17
- package/claw/node_modules/bytebuffer/src/methods/order.js +0 -36
- package/claw/node_modules/bytebuffer/src/methods/prepend.js +0 -87
- package/claw/node_modules/bytebuffer/src/methods/printDebug.js +0 -16
- package/claw/node_modules/bytebuffer/src/methods/remaining.js +0 -9
- package/claw/node_modules/bytebuffer/src/methods/reset.js +0 -17
- package/claw/node_modules/bytebuffer/src/methods/resize.js +0 -39
- package/claw/node_modules/bytebuffer/src/methods/reverse.js +0 -25
- package/claw/node_modules/bytebuffer/src/methods/skip.js +0 -19
- package/claw/node_modules/bytebuffer/src/methods/slice.js +0 -18
- package/claw/node_modules/bytebuffer/src/methods/static/accessor.js +0 -13
- package/claw/node_modules/bytebuffer/src/methods/static/allocate.js +0 -14
- package/claw/node_modules/bytebuffer/src/methods/static/concat.js +0 -55
- package/claw/node_modules/bytebuffer/src/methods/static/isByteBuffer.js +0 -9
- package/claw/node_modules/bytebuffer/src/methods/static/type.js +0 -11
- package/claw/node_modules/bytebuffer/src/methods/static/wrap.js +0 -125
- package/claw/node_modules/bytebuffer/src/methods/toBuffer.js +0 -77
- package/claw/node_modules/bytebuffer/src/methods/toString.js +0 -43
- package/claw/node_modules/bytebuffer/src/types/bytes/bitset.js +0 -89
- package/claw/node_modules/bytebuffer/src/types/bytes/bytes.js +0 -34
- package/claw/node_modules/bytebuffer/src/types/floats/float32.js +0 -81
- package/claw/node_modules/bytebuffer/src/types/floats/float64.js +0 -77
- package/claw/node_modules/bytebuffer/src/types/floats/ieee754.js +0 -130
- package/claw/node_modules/bytebuffer/src/types/ints/int16.js +0 -167
- package/claw/node_modules/bytebuffer/src/types/ints/int32.js +0 -125
- package/claw/node_modules/bytebuffer/src/types/ints/int64.js +0 -194
- package/claw/node_modules/bytebuffer/src/types/ints/int8.js +0 -137
- package/claw/node_modules/bytebuffer/src/types/strings/cstring.js +0 -110
- package/claw/node_modules/bytebuffer/src/types/strings/istring.js +0 -81
- package/claw/node_modules/bytebuffer/src/types/strings/utf8string.js +0 -214
- package/claw/node_modules/bytebuffer/src/types/strings/vstring.js +0 -78
- package/claw/node_modules/bytebuffer/src/types/varints/varint32.js +0 -164
- package/claw/node_modules/bytebuffer/src/types/varints/varint64.js +0 -208
- package/claw/node_modules/bytebuffer/src/wrap-node.js +0 -50
- package/claw/node_modules/bytebuffer/src/wrap.js +0 -43
- package/claw/node_modules/bytebuffer/tests/bench.js +0 -99
- package/claw/node_modules/bytebuffer/tests/suite.js +0 -1005
- package/claw/node_modules/call-bind/.eslintignore +0 -1
- package/claw/node_modules/call-bind/.eslintrc +0 -16
- package/claw/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/claw/node_modules/call-bind/.nycrc +0 -9
- package/claw/node_modules/call-bind/CHANGELOG.md +0 -106
- package/claw/node_modules/call-bind/LICENSE +0 -21
- package/claw/node_modules/call-bind/README.md +0 -64
- package/claw/node_modules/call-bind/callBound.js +0 -15
- package/claw/node_modules/call-bind/index.js +0 -24
- package/claw/node_modules/call-bind/package.json +0 -93
- package/claw/node_modules/call-bind/test/callBound.js +0 -54
- package/claw/node_modules/call-bind/test/index.js +0 -74
- package/claw/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
- package/claw/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
- package/claw/node_modules/call-bind-apply-helpers/.nycrc +0 -9
- package/claw/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
- package/claw/node_modules/call-bind-apply-helpers/LICENSE +0 -21
- package/claw/node_modules/call-bind-apply-helpers/README.md +0 -62
- package/claw/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
- package/claw/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
- package/claw/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
- package/claw/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
- package/claw/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
- package/claw/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
- package/claw/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
- package/claw/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
- package/claw/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
- package/claw/node_modules/call-bind-apply-helpers/index.js +0 -15
- package/claw/node_modules/call-bind-apply-helpers/package.json +0 -85
- package/claw/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
- package/claw/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
- package/claw/node_modules/call-bind-apply-helpers/test/index.js +0 -63
- package/claw/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
- package/claw/node_modules/call-bound/.eslintrc +0 -13
- package/claw/node_modules/call-bound/.github/FUNDING.yml +0 -12
- package/claw/node_modules/call-bound/.nycrc +0 -9
- package/claw/node_modules/call-bound/CHANGELOG.md +0 -42
- package/claw/node_modules/call-bound/LICENSE +0 -21
- package/claw/node_modules/call-bound/README.md +0 -53
- package/claw/node_modules/call-bound/index.d.ts +0 -94
- package/claw/node_modules/call-bound/index.js +0 -19
- package/claw/node_modules/call-bound/package.json +0 -99
- package/claw/node_modules/call-bound/test/index.js +0 -61
- package/claw/node_modules/call-bound/tsconfig.json +0 -10
- package/claw/node_modules/cipher-base/.eslintrc +0 -26
- package/claw/node_modules/cipher-base/.github/FUNDING.yml +0 -12
- package/claw/node_modules/cipher-base/CHANGELOG.md +0 -73
- package/claw/node_modules/cipher-base/LICENSE +0 -21
- package/claw/node_modules/cipher-base/README.md +0 -17
- package/claw/node_modules/cipher-base/index.js +0 -103
- package/claw/node_modules/cipher-base/package.json +0 -63
- package/claw/node_modules/cipher-base/test/index.js +0 -221
- package/claw/node_modules/core-util-is/LICENSE +0 -19
- package/claw/node_modules/core-util-is/README.md +0 -3
- package/claw/node_modules/core-util-is/lib/util.js +0 -107
- package/claw/node_modules/core-util-is/package.json +0 -38
- package/claw/node_modules/create-hash/.travis.yml +0 -17
- package/claw/node_modules/create-hash/LICENSE +0 -21
- package/claw/node_modules/create-hash/README.md +0 -19
- package/claw/node_modules/create-hash/browser.js +0 -30
- package/claw/node_modules/create-hash/index.js +0 -1
- package/claw/node_modules/create-hash/md5.js +0 -5
- package/claw/node_modules/create-hash/package.json +0 -39
- package/claw/node_modules/create-hash/test.js +0 -41
- package/claw/node_modules/create-hmac/LICENSE +0 -21
- package/claw/node_modules/create-hmac/README.md +0 -20
- package/claw/node_modules/create-hmac/browser.js +0 -62
- package/claw/node_modules/create-hmac/index.js +0 -1
- package/claw/node_modules/create-hmac/legacy.js +0 -46
- package/claw/node_modules/create-hmac/package.json +0 -45
- package/claw/node_modules/crypto-js/CONTRIBUTING.md +0 -28
- package/claw/node_modules/crypto-js/LICENSE +0 -24
- package/claw/node_modules/crypto-js/README.md +0 -241
- package/claw/node_modules/crypto-js/aes.js +0 -232
- package/claw/node_modules/crypto-js/bower.json +0 -35
- package/claw/node_modules/crypto-js/cipher-core.js +0 -880
- package/claw/node_modules/crypto-js/core.js +0 -760
- package/claw/node_modules/crypto-js/crypto-js.js +0 -5988
- package/claw/node_modules/crypto-js/docs/QuickStartGuide.wiki +0 -470
- package/claw/node_modules/crypto-js/enc-base64.js +0 -135
- package/claw/node_modules/crypto-js/enc-hex.js +0 -18
- package/claw/node_modules/crypto-js/enc-latin1.js +0 -18
- package/claw/node_modules/crypto-js/enc-utf16.js +0 -149
- package/claw/node_modules/crypto-js/enc-utf8.js +0 -18
- package/claw/node_modules/crypto-js/evpkdf.js +0 -132
- package/claw/node_modules/crypto-js/format-hex.js +0 -66
- package/claw/node_modules/crypto-js/format-openssl.js +0 -18
- package/claw/node_modules/crypto-js/hmac-md5.js +0 -18
- package/claw/node_modules/crypto-js/hmac-ripemd160.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha1.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha224.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha256.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha3.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha384.js +0 -18
- package/claw/node_modules/crypto-js/hmac-sha512.js +0 -18
- package/claw/node_modules/crypto-js/hmac.js +0 -143
- package/claw/node_modules/crypto-js/index.js +0 -18
- package/claw/node_modules/crypto-js/lib-typedarrays.js +0 -76
- package/claw/node_modules/crypto-js/md5.js +0 -268
- package/claw/node_modules/crypto-js/mode-cfb.js +0 -78
- package/claw/node_modules/crypto-js/mode-ctr-gladman.js +0 -116
- package/claw/node_modules/crypto-js/mode-ctr.js +0 -58
- package/claw/node_modules/crypto-js/mode-ecb.js +0 -40
- package/claw/node_modules/crypto-js/mode-ofb.js +0 -54
- package/claw/node_modules/crypto-js/package.json +0 -38
- package/claw/node_modules/crypto-js/pad-ansix923.js +0 -49
- package/claw/node_modules/crypto-js/pad-iso10126.js +0 -44
- package/claw/node_modules/crypto-js/pad-iso97971.js +0 -40
- package/claw/node_modules/crypto-js/pad-nopadding.js +0 -30
- package/claw/node_modules/crypto-js/pad-pkcs7.js +0 -18
- package/claw/node_modules/crypto-js/pad-zeropadding.js +0 -45
- package/claw/node_modules/crypto-js/pbkdf2.js +0 -145
- package/claw/node_modules/crypto-js/rabbit-legacy.js +0 -190
- package/claw/node_modules/crypto-js/rabbit.js +0 -192
- package/claw/node_modules/crypto-js/rc4.js +0 -139
- package/claw/node_modules/crypto-js/ripemd160.js +0 -267
- package/claw/node_modules/crypto-js/sha1.js +0 -150
- package/claw/node_modules/crypto-js/sha224.js +0 -80
- package/claw/node_modules/crypto-js/sha256.js +0 -199
- package/claw/node_modules/crypto-js/sha3.js +0 -323
- package/claw/node_modules/crypto-js/sha384.js +0 -83
- package/claw/node_modules/crypto-js/sha512.js +0 -323
- package/claw/node_modules/crypto-js/tripledes.js +0 -770
- package/claw/node_modules/crypto-js/x64-core.js +0 -304
- package/claw/node_modules/deep-equal/.editorconfig +0 -20
- package/claw/node_modules/deep-equal/.eslintrc +0 -28
- package/claw/node_modules/deep-equal/.nycrc +0 -17
- package/claw/node_modules/deep-equal/.travis.yml +0 -12
- package/claw/node_modules/deep-equal/CHANGELOG.md +0 -320
- package/claw/node_modules/deep-equal/LICENSE +0 -21
- package/claw/node_modules/deep-equal/assert.js +0 -3
- package/claw/node_modules/deep-equal/example/cmp.js +0 -11
- package/claw/node_modules/deep-equal/index.js +0 -112
- package/claw/node_modules/deep-equal/lib/is_arguments.js +0 -1
- package/claw/node_modules/deep-equal/lib/keys.js +0 -1
- package/claw/node_modules/deep-equal/package.json +0 -109
- package/claw/node_modules/deep-equal/readme.markdown +0 -73
- package/claw/node_modules/deep-equal/test/_tape.js +0 -42
- package/claw/node_modules/deep-equal/test/cmp.js +0 -1343
- package/claw/node_modules/define-data-property/.eslintrc +0 -24
- package/claw/node_modules/define-data-property/.github/FUNDING.yml +0 -12
- package/claw/node_modules/define-data-property/.nycrc +0 -13
- package/claw/node_modules/define-data-property/CHANGELOG.md +0 -70
- package/claw/node_modules/define-data-property/LICENSE +0 -21
- package/claw/node_modules/define-data-property/README.md +0 -67
- package/claw/node_modules/define-data-property/index.d.ts +0 -12
- package/claw/node_modules/define-data-property/index.js +0 -56
- package/claw/node_modules/define-data-property/package.json +0 -106
- package/claw/node_modules/define-data-property/test/index.js +0 -392
- package/claw/node_modules/define-data-property/tsconfig.json +0 -59
- package/claw/node_modules/define-properties/.editorconfig +0 -13
- package/claw/node_modules/define-properties/.eslintrc +0 -19
- package/claw/node_modules/define-properties/.github/FUNDING.yml +0 -12
- package/claw/node_modules/define-properties/.nycrc +0 -9
- package/claw/node_modules/define-properties/CHANGELOG.md +0 -91
- package/claw/node_modules/define-properties/LICENSE +0 -21
- package/claw/node_modules/define-properties/README.md +0 -84
- package/claw/node_modules/define-properties/index.js +0 -47
- package/claw/node_modules/define-properties/package.json +0 -88
- package/claw/node_modules/dunder-proto/.eslintrc +0 -5
- package/claw/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
- package/claw/node_modules/dunder-proto/.nycrc +0 -13
- package/claw/node_modules/dunder-proto/CHANGELOG.md +0 -24
- package/claw/node_modules/dunder-proto/LICENSE +0 -21
- package/claw/node_modules/dunder-proto/README.md +0 -54
- package/claw/node_modules/dunder-proto/get.d.ts +0 -5
- package/claw/node_modules/dunder-proto/get.js +0 -30
- package/claw/node_modules/dunder-proto/package.json +0 -76
- package/claw/node_modules/dunder-proto/set.d.ts +0 -5
- package/claw/node_modules/dunder-proto/set.js +0 -35
- package/claw/node_modules/dunder-proto/test/get.js +0 -34
- package/claw/node_modules/dunder-proto/test/index.js +0 -4
- package/claw/node_modules/dunder-proto/test/set.js +0 -50
- package/claw/node_modules/dunder-proto/tsconfig.json +0 -9
- package/claw/node_modules/ecurve/.min-wd +0 -7
- package/claw/node_modules/ecurve/.travis.yml +0 -14
- package/claw/node_modules/ecurve/CHANGELOG.md +0 -154
- package/claw/node_modules/ecurve/README.md +0 -11
- package/claw/node_modules/ecurve/lib/curve.js +0 -77
- package/claw/node_modules/ecurve/lib/curves.json +0 -65
- package/claw/node_modules/ecurve/lib/index.js +0 -10
- package/claw/node_modules/ecurve/lib/names.js +0 -21
- package/claw/node_modules/ecurve/lib/point.js +0 -244
- package/claw/node_modules/ecurve/package.json +0 -32
- package/claw/node_modules/es-define-property/.eslintrc +0 -13
- package/claw/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/claw/node_modules/es-define-property/.nycrc +0 -9
- package/claw/node_modules/es-define-property/CHANGELOG.md +0 -29
- package/claw/node_modules/es-define-property/LICENSE +0 -21
- package/claw/node_modules/es-define-property/README.md +0 -49
- package/claw/node_modules/es-define-property/index.d.ts +0 -3
- package/claw/node_modules/es-define-property/index.js +0 -14
- package/claw/node_modules/es-define-property/package.json +0 -81
- package/claw/node_modules/es-define-property/test/index.js +0 -56
- package/claw/node_modules/es-define-property/tsconfig.json +0 -10
- package/claw/node_modules/es-errors/.eslintrc +0 -5
- package/claw/node_modules/es-errors/.github/FUNDING.yml +0 -12
- package/claw/node_modules/es-errors/CHANGELOG.md +0 -40
- package/claw/node_modules/es-errors/LICENSE +0 -21
- package/claw/node_modules/es-errors/README.md +0 -55
- package/claw/node_modules/es-errors/eval.d.ts +0 -3
- package/claw/node_modules/es-errors/eval.js +0 -4
- package/claw/node_modules/es-errors/index.d.ts +0 -3
- package/claw/node_modules/es-errors/index.js +0 -4
- package/claw/node_modules/es-errors/package.json +0 -80
- package/claw/node_modules/es-errors/range.d.ts +0 -3
- package/claw/node_modules/es-errors/range.js +0 -4
- package/claw/node_modules/es-errors/ref.d.ts +0 -3
- package/claw/node_modules/es-errors/ref.js +0 -4
- package/claw/node_modules/es-errors/syntax.d.ts +0 -3
- package/claw/node_modules/es-errors/syntax.js +0 -4
- package/claw/node_modules/es-errors/test/index.js +0 -19
- package/claw/node_modules/es-errors/tsconfig.json +0 -49
- package/claw/node_modules/es-errors/type.d.ts +0 -3
- package/claw/node_modules/es-errors/type.js +0 -4
- package/claw/node_modules/es-errors/uri.d.ts +0 -3
- package/claw/node_modules/es-errors/uri.js +0 -4
- package/claw/node_modules/es-object-atoms/.eslintrc +0 -16
- package/claw/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
- package/claw/node_modules/es-object-atoms/CHANGELOG.md +0 -37
- package/claw/node_modules/es-object-atoms/LICENSE +0 -21
- package/claw/node_modules/es-object-atoms/README.md +0 -63
- package/claw/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
- package/claw/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
- package/claw/node_modules/es-object-atoms/ToObject.d.ts +0 -7
- package/claw/node_modules/es-object-atoms/ToObject.js +0 -10
- package/claw/node_modules/es-object-atoms/index.d.ts +0 -3
- package/claw/node_modules/es-object-atoms/index.js +0 -4
- package/claw/node_modules/es-object-atoms/isObject.d.ts +0 -3
- package/claw/node_modules/es-object-atoms/isObject.js +0 -6
- package/claw/node_modules/es-object-atoms/package.json +0 -80
- package/claw/node_modules/es-object-atoms/test/index.js +0 -38
- package/claw/node_modules/es-object-atoms/tsconfig.json +0 -6
- package/claw/node_modules/for-each/.editorconfig +0 -20
- package/claw/node_modules/for-each/.eslintrc +0 -30
- package/claw/node_modules/for-each/.github/FUNDING.yml +0 -12
- package/claw/node_modules/for-each/.github/SECURITY.md +0 -3
- package/claw/node_modules/for-each/.nycrc +0 -8
- package/claw/node_modules/for-each/CHANGELOG.md +0 -107
- package/claw/node_modules/for-each/LICENSE +0 -22
- package/claw/node_modules/for-each/README.md +0 -39
- package/claw/node_modules/for-each/index.d.ts +0 -35
- package/claw/node_modules/for-each/index.js +0 -69
- package/claw/node_modules/for-each/package.json +0 -76
- package/claw/node_modules/for-each/test/test.js +0 -224
- package/claw/node_modules/for-each/tsconfig.json +0 -8
- package/claw/node_modules/function-bind/.eslintrc +0 -21
- package/claw/node_modules/function-bind/.github/FUNDING.yml +0 -12
- package/claw/node_modules/function-bind/.github/SECURITY.md +0 -3
- package/claw/node_modules/function-bind/.nycrc +0 -13
- package/claw/node_modules/function-bind/CHANGELOG.md +0 -136
- package/claw/node_modules/function-bind/LICENSE +0 -20
- package/claw/node_modules/function-bind/README.md +0 -46
- package/claw/node_modules/function-bind/implementation.js +0 -84
- package/claw/node_modules/function-bind/index.js +0 -5
- package/claw/node_modules/function-bind/package.json +0 -87
- package/claw/node_modules/function-bind/test/.eslintrc +0 -9
- package/claw/node_modules/function-bind/test/index.js +0 -252
- package/claw/node_modules/functions-have-names/.editorconfig +0 -20
- package/claw/node_modules/functions-have-names/.eslintrc +0 -19
- package/claw/node_modules/functions-have-names/.github/FUNDING.yml +0 -12
- package/claw/node_modules/functions-have-names/.nycrc +0 -9
- package/claw/node_modules/functions-have-names/CHANGELOG.md +0 -89
- package/claw/node_modules/functions-have-names/LICENSE +0 -21
- package/claw/node_modules/functions-have-names/README.md +0 -40
- package/claw/node_modules/functions-have-names/index.js +0 -31
- package/claw/node_modules/functions-have-names/package.json +0 -55
- package/claw/node_modules/functions-have-names/test/index.js +0 -65
- package/claw/node_modules/get-intrinsic/.eslintrc +0 -42
- package/claw/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/claw/node_modules/get-intrinsic/.nycrc +0 -9
- package/claw/node_modules/get-intrinsic/CHANGELOG.md +0 -186
- package/claw/node_modules/get-intrinsic/LICENSE +0 -21
- package/claw/node_modules/get-intrinsic/README.md +0 -71
- package/claw/node_modules/get-intrinsic/index.js +0 -378
- package/claw/node_modules/get-intrinsic/package.json +0 -97
- package/claw/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/claw/node_modules/get-proto/.eslintrc +0 -10
- package/claw/node_modules/get-proto/.github/FUNDING.yml +0 -12
- package/claw/node_modules/get-proto/.nycrc +0 -9
- package/claw/node_modules/get-proto/CHANGELOG.md +0 -21
- package/claw/node_modules/get-proto/LICENSE +0 -21
- package/claw/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
- package/claw/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
- package/claw/node_modules/get-proto/README.md +0 -50
- package/claw/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
- package/claw/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
- package/claw/node_modules/get-proto/index.d.ts +0 -5
- package/claw/node_modules/get-proto/index.js +0 -27
- package/claw/node_modules/get-proto/package.json +0 -81
- package/claw/node_modules/get-proto/test/index.js +0 -68
- package/claw/node_modules/get-proto/tsconfig.json +0 -9
- package/claw/node_modules/gopd/.eslintrc +0 -16
- package/claw/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/claw/node_modules/gopd/CHANGELOG.md +0 -45
- package/claw/node_modules/gopd/LICENSE +0 -21
- package/claw/node_modules/gopd/README.md +0 -40
- package/claw/node_modules/gopd/gOPD.d.ts +0 -1
- package/claw/node_modules/gopd/gOPD.js +0 -4
- package/claw/node_modules/gopd/index.d.ts +0 -5
- package/claw/node_modules/gopd/index.js +0 -15
- package/claw/node_modules/gopd/package.json +0 -77
- package/claw/node_modules/gopd/test/index.js +0 -36
- package/claw/node_modules/gopd/tsconfig.json +0 -9
- package/claw/node_modules/has-property-descriptors/.eslintrc +0 -13
- package/claw/node_modules/has-property-descriptors/.github/FUNDING.yml +0 -12
- package/claw/node_modules/has-property-descriptors/.nycrc +0 -9
- package/claw/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
- package/claw/node_modules/has-property-descriptors/LICENSE +0 -21
- package/claw/node_modules/has-property-descriptors/README.md +0 -43
- package/claw/node_modules/has-property-descriptors/index.js +0 -22
- package/claw/node_modules/has-property-descriptors/package.json +0 -77
- package/claw/node_modules/has-property-descriptors/test/index.js +0 -57
- package/claw/node_modules/has-symbols/.eslintrc +0 -11
- package/claw/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/claw/node_modules/has-symbols/.nycrc +0 -9
- package/claw/node_modules/has-symbols/CHANGELOG.md +0 -91
- package/claw/node_modules/has-symbols/LICENSE +0 -21
- package/claw/node_modules/has-symbols/README.md +0 -46
- package/claw/node_modules/has-symbols/index.d.ts +0 -3
- package/claw/node_modules/has-symbols/index.js +0 -14
- package/claw/node_modules/has-symbols/package.json +0 -111
- package/claw/node_modules/has-symbols/shams.d.ts +0 -3
- package/claw/node_modules/has-symbols/shams.js +0 -45
- package/claw/node_modules/has-symbols/test/index.js +0 -22
- package/claw/node_modules/has-symbols/test/shams/core-js.js +0 -29
- package/claw/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
- package/claw/node_modules/has-symbols/test/tests.js +0 -58
- package/claw/node_modules/has-symbols/tsconfig.json +0 -10
- package/claw/node_modules/has-tostringtag/.eslintrc +0 -5
- package/claw/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
- package/claw/node_modules/has-tostringtag/.nycrc +0 -13
- package/claw/node_modules/has-tostringtag/CHANGELOG.md +0 -42
- package/claw/node_modules/has-tostringtag/LICENSE +0 -21
- package/claw/node_modules/has-tostringtag/README.md +0 -46
- package/claw/node_modules/has-tostringtag/index.d.ts +0 -3
- package/claw/node_modules/has-tostringtag/index.js +0 -8
- package/claw/node_modules/has-tostringtag/package.json +0 -108
- package/claw/node_modules/has-tostringtag/shams.d.ts +0 -3
- package/claw/node_modules/has-tostringtag/shams.js +0 -8
- package/claw/node_modules/has-tostringtag/test/index.js +0 -21
- package/claw/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
- package/claw/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
- package/claw/node_modules/has-tostringtag/test/tests.js +0 -15
- package/claw/node_modules/has-tostringtag/tsconfig.json +0 -49
- package/claw/node_modules/hash-base/.github/FUNDING.yml +0 -12
- package/claw/node_modules/hash-base/CHANGELOG.md +0 -166
- package/claw/node_modules/hash-base/LICENSE +0 -21
- package/claw/node_modules/hash-base/README.md +0 -48
- package/claw/node_modules/hash-base/index.js +0 -109
- package/claw/node_modules/hash-base/package.json +0 -64
- package/claw/node_modules/hash-base/to-buffer.js +0 -20
- package/claw/node_modules/hasown/.eslintrc +0 -5
- package/claw/node_modules/hasown/.github/FUNDING.yml +0 -12
- package/claw/node_modules/hasown/.nycrc +0 -13
- package/claw/node_modules/hasown/CHANGELOG.md +0 -40
- package/claw/node_modules/hasown/LICENSE +0 -21
- package/claw/node_modules/hasown/README.md +0 -40
- package/claw/node_modules/hasown/index.d.ts +0 -3
- package/claw/node_modules/hasown/index.js +0 -8
- package/claw/node_modules/hasown/package.json +0 -92
- package/claw/node_modules/hasown/tsconfig.json +0 -6
- package/claw/node_modules/inherits/LICENSE +0 -16
- package/claw/node_modules/inherits/README.md +0 -42
- package/claw/node_modules/inherits/inherits.js +0 -9
- package/claw/node_modules/inherits/inherits_browser.js +0 -27
- package/claw/node_modules/inherits/package.json +0 -29
- package/claw/node_modules/is-arguments/.editorconfig +0 -20
- package/claw/node_modules/is-arguments/.eslintrc +0 -9
- package/claw/node_modules/is-arguments/.github/FUNDING.yml +0 -12
- package/claw/node_modules/is-arguments/.nycrc +0 -9
- package/claw/node_modules/is-arguments/CHANGELOG.md +0 -201
- package/claw/node_modules/is-arguments/LICENSE +0 -20
- package/claw/node_modules/is-arguments/README.md +0 -47
- package/claw/node_modules/is-arguments/index.d.ts +0 -6
- package/claw/node_modules/is-arguments/index.js +0 -44
- package/claw/node_modules/is-arguments/package.json +0 -105
- package/claw/node_modules/is-arguments/test/index.js +0 -47
- package/claw/node_modules/is-arguments/tsconfig.json +0 -9
- package/claw/node_modules/is-callable/.editorconfig +0 -31
- package/claw/node_modules/is-callable/.eslintrc +0 -10
- package/claw/node_modules/is-callable/.github/FUNDING.yml +0 -12
- package/claw/node_modules/is-callable/.nycrc +0 -9
- package/claw/node_modules/is-callable/CHANGELOG.md +0 -158
- package/claw/node_modules/is-callable/LICENSE +0 -22
- package/claw/node_modules/is-callable/README.md +0 -83
- package/claw/node_modules/is-callable/index.js +0 -101
- package/claw/node_modules/is-callable/package.json +0 -106
- package/claw/node_modules/is-callable/test/index.js +0 -244
- package/claw/node_modules/is-date-object/.editorconfig +0 -20
- package/claw/node_modules/is-date-object/.eslintrc +0 -9
- package/claw/node_modules/is-date-object/.github/FUNDING.yml +0 -12
- package/claw/node_modules/is-date-object/.nycrc +0 -10
- package/claw/node_modules/is-date-object/CHANGELOG.md +0 -134
- package/claw/node_modules/is-date-object/LICENSE +0 -22
- package/claw/node_modules/is-date-object/README.md +0 -52
- package/claw/node_modules/is-date-object/index.d.ts +0 -3
- package/claw/node_modules/is-date-object/index.js +0 -27
- package/claw/node_modules/is-date-object/package.json +0 -99
- package/claw/node_modules/is-date-object/test/index.js +0 -38
- package/claw/node_modules/is-date-object/tsconfig.json +0 -6
- package/claw/node_modules/is-regex/.editorconfig +0 -23
- package/claw/node_modules/is-regex/.eslintrc +0 -10
- package/claw/node_modules/is-regex/.nycrc +0 -10
- package/claw/node_modules/is-regex/CHANGELOG.md +0 -233
- package/claw/node_modules/is-regex/LICENSE +0 -20
- package/claw/node_modules/is-regex/README.md +0 -52
- package/claw/node_modules/is-regex/index.d.ts +0 -3
- package/claw/node_modules/is-regex/index.js +0 -69
- package/claw/node_modules/is-regex/package.json +0 -104
- package/claw/node_modules/is-regex/test/index.js +0 -121
- package/claw/node_modules/is-regex/tsconfig.json +0 -9
- package/claw/node_modules/is-typed-array/.editorconfig +0 -20
- package/claw/node_modules/is-typed-array/.eslintrc +0 -13
- package/claw/node_modules/is-typed-array/.github/FUNDING.yml +0 -12
- package/claw/node_modules/is-typed-array/.nycrc +0 -9
- package/claw/node_modules/is-typed-array/CHANGELOG.md +0 -166
- package/claw/node_modules/is-typed-array/LICENSE +0 -22
- package/claw/node_modules/is-typed-array/README.md +0 -70
- package/claw/node_modules/is-typed-array/index.d.ts +0 -9
- package/claw/node_modules/is-typed-array/index.js +0 -8
- package/claw/node_modules/is-typed-array/package.json +0 -129
- package/claw/node_modules/is-typed-array/test/index.js +0 -111
- package/claw/node_modules/is-typed-array/tsconfig.json +0 -6
- package/claw/node_modules/isarray/.travis.yml +0 -4
- package/claw/node_modules/isarray/Makefile +0 -6
- package/claw/node_modules/isarray/README.md +0 -60
- package/claw/node_modules/isarray/component.json +0 -19
- package/claw/node_modules/isarray/index.js +0 -5
- package/claw/node_modules/isarray/package.json +0 -45
- package/claw/node_modules/isarray/test.js +0 -20
- package/claw/node_modules/isomorphic-ws/LICENSE +0 -21
- package/claw/node_modules/isomorphic-ws/README.md +0 -58
- package/claw/node_modules/isomorphic-ws/browser.js +0 -17
- package/claw/node_modules/isomorphic-ws/index.d.ts +0 -8
- package/claw/node_modules/isomorphic-ws/node.js +0 -3
- package/claw/node_modules/isomorphic-ws/package.json +0 -34
- package/claw/node_modules/long/.travis.yml +0 -5
- package/claw/node_modules/long/LICENSE +0 -202
- package/claw/node_modules/long/README.md +0 -513
- package/claw/node_modules/long/bower.json +0 -9
- package/claw/node_modules/long/dist/README.md +0 -16
- package/claw/node_modules/long/dist/long.js +0 -1209
- package/claw/node_modules/long/dist/long.min.js +0 -20
- package/claw/node_modules/long/dist/long.min.js.gz +0 -0
- package/claw/node_modules/long/dist/long.min.map +0 -8
- package/claw/node_modules/long/doco/INDEX.md +0 -6
- package/claw/node_modules/long/doco/Long.md +0 -473
- package/claw/node_modules/long/donate.png +0 -0
- package/claw/node_modules/long/externs/long.js +0 -416
- package/claw/node_modules/long/index.js +0 -1
- package/claw/node_modules/long/jsdoc.json +0 -13
- package/claw/node_modules/long/long.png +0 -0
- package/claw/node_modules/long/package.json +0 -33
- package/claw/node_modules/long/scripts/build.js +0 -28
- package/claw/node_modules/long/src/bower.json +0 -9
- package/claw/node_modules/long/src/long.js +0 -1172
- package/claw/node_modules/long/src/wrap.js +0 -38
- package/claw/node_modules/long/tests/goog.math.long.js +0 -807
- package/claw/node_modules/long/tests/suite.js +0 -195
- package/claw/node_modules/lzma/.travis.yml +0 -9
- package/claw/node_modules/lzma/LICENSE +0 -20
- package/claw/node_modules/lzma/THANKS +0 -7
- package/claw/node_modules/lzma/bin/lzma.js +0 -362
- package/claw/node_modules/lzma/index.js +0 -19
- package/claw/node_modules/lzma/package.json +0 -30
- package/claw/node_modules/lzma/readme.md +0 -149
- package/claw/node_modules/lzma/src/lzma-c-min.js +0 -1
- package/claw/node_modules/lzma/src/lzma-c.js +0 -2021
- package/claw/node_modules/lzma/src/lzma-d-min.js +0 -1
- package/claw/node_modules/lzma/src/lzma-d.js +0 -878
- package/claw/node_modules/lzma/src/lzma-min.js +0 -2
- package/claw/node_modules/lzma/src/lzma.js +0 -153
- package/claw/node_modules/lzma/src/lzma_worker-min.js +0 -2
- package/claw/node_modules/lzma/src/lzma_worker.js +0 -2668
- package/claw/node_modules/math-intrinsics/.eslintrc +0 -16
- package/claw/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
- package/claw/node_modules/math-intrinsics/CHANGELOG.md +0 -24
- package/claw/node_modules/math-intrinsics/LICENSE +0 -21
- package/claw/node_modules/math-intrinsics/README.md +0 -50
- package/claw/node_modules/math-intrinsics/abs.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/abs.js +0 -4
- package/claw/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
- package/claw/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
- package/claw/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/constants/maxValue.js +0 -5
- package/claw/node_modules/math-intrinsics/floor.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/floor.js +0 -4
- package/claw/node_modules/math-intrinsics/isFinite.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/isFinite.js +0 -12
- package/claw/node_modules/math-intrinsics/isInteger.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/isInteger.js +0 -16
- package/claw/node_modules/math-intrinsics/isNaN.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/isNaN.js +0 -6
- package/claw/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/isNegativeZero.js +0 -6
- package/claw/node_modules/math-intrinsics/max.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/max.js +0 -4
- package/claw/node_modules/math-intrinsics/min.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/min.js +0 -4
- package/claw/node_modules/math-intrinsics/mod.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/mod.js +0 -9
- package/claw/node_modules/math-intrinsics/package.json +0 -86
- package/claw/node_modules/math-intrinsics/pow.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/pow.js +0 -4
- package/claw/node_modules/math-intrinsics/round.d.ts +0 -1
- package/claw/node_modules/math-intrinsics/round.js +0 -4
- package/claw/node_modules/math-intrinsics/sign.d.ts +0 -3
- package/claw/node_modules/math-intrinsics/sign.js +0 -11
- package/claw/node_modules/math-intrinsics/test/index.js +0 -192
- package/claw/node_modules/math-intrinsics/tsconfig.json +0 -3
- package/claw/node_modules/md5.js/LICENSE +0 -21
- package/claw/node_modules/md5.js/README.md +0 -29
- package/claw/node_modules/md5.js/index.js +0 -146
- package/claw/node_modules/md5.js/package.json +0 -38
- package/claw/node_modules/object-is/.eslintrc +0 -5
- package/claw/node_modules/object-is/.nycrc +0 -9
- package/claw/node_modules/object-is/CHANGELOG.md +0 -175
- package/claw/node_modules/object-is/LICENSE +0 -20
- package/claw/node_modules/object-is/README.md +0 -60
- package/claw/node_modules/object-is/auto.js +0 -3
- package/claw/node_modules/object-is/implementation.js +0 -19
- package/claw/node_modules/object-is/index.js +0 -18
- package/claw/node_modules/object-is/package.json +0 -96
- package/claw/node_modules/object-is/polyfill.js +0 -7
- package/claw/node_modules/object-is/shim.js +0 -14
- package/claw/node_modules/object-is/test/implementation.js +0 -12
- package/claw/node_modules/object-is/test/index.js +0 -12
- package/claw/node_modules/object-is/test/shimmed.js +0 -28
- package/claw/node_modules/object-is/test/tests.js +0 -57
- package/claw/node_modules/object-keys/.editorconfig +0 -13
- package/claw/node_modules/object-keys/.eslintrc +0 -17
- package/claw/node_modules/object-keys/.travis.yml +0 -277
- package/claw/node_modules/object-keys/CHANGELOG.md +0 -232
- package/claw/node_modules/object-keys/LICENSE +0 -21
- package/claw/node_modules/object-keys/README.md +0 -76
- package/claw/node_modules/object-keys/implementation.js +0 -122
- package/claw/node_modules/object-keys/index.js +0 -32
- package/claw/node_modules/object-keys/isArguments.js +0 -17
- package/claw/node_modules/object-keys/package.json +0 -88
- package/claw/node_modules/object-keys/test/index.js +0 -5
- package/claw/node_modules/object.assign/.editorconfig +0 -20
- package/claw/node_modules/object.assign/.eslintrc +0 -28
- package/claw/node_modules/object.assign/.github/FUNDING.yml +0 -12
- package/claw/node_modules/object.assign/.nycrc +0 -9
- package/claw/node_modules/object.assign/CHANGELOG.md +0 -246
- package/claw/node_modules/object.assign/LICENSE +0 -21
- package/claw/node_modules/object.assign/README.md +0 -136
- package/claw/node_modules/object.assign/auto.js +0 -3
- package/claw/node_modules/object.assign/dist/browser.js +0 -1304
- package/claw/node_modules/object.assign/hasSymbols.js +0 -43
- package/claw/node_modules/object.assign/implementation.js +0 -46
- package/claw/node_modules/object.assign/index.js +0 -22
- package/claw/node_modules/object.assign/package.json +0 -96
- package/claw/node_modules/object.assign/polyfill.js +0 -55
- package/claw/node_modules/object.assign/shim.js +0 -14
- package/claw/node_modules/object.assign/test/implementation.js +0 -19
- package/claw/node_modules/object.assign/test/index.js +0 -17
- package/claw/node_modules/object.assign/test/native.js +0 -49
- package/claw/node_modules/object.assign/test/ses-compat.js +0 -12
- package/claw/node_modules/object.assign/test/shimmed.js +0 -52
- package/claw/node_modules/object.assign/test/tests.js +0 -232
- package/claw/node_modules/possible-typed-array-names/.eslintrc +0 -5
- package/claw/node_modules/possible-typed-array-names/.github/FUNDING.yml +0 -12
- package/claw/node_modules/possible-typed-array-names/CHANGELOG.md +0 -29
- package/claw/node_modules/possible-typed-array-names/LICENSE +0 -21
- package/claw/node_modules/possible-typed-array-names/README.md +0 -50
- package/claw/node_modules/possible-typed-array-names/index.d.ts +0 -16
- package/claw/node_modules/possible-typed-array-names/index.js +0 -17
- package/claw/node_modules/possible-typed-array-names/package.json +0 -84
- package/claw/node_modules/possible-typed-array-names/test/index.js +0 -19
- package/claw/node_modules/possible-typed-array-names/tsconfig.json +0 -9
- package/claw/node_modules/process-nextick-args/index.js +0 -45
- package/claw/node_modules/process-nextick-args/license.md +0 -19
- package/claw/node_modules/process-nextick-args/package.json +0 -25
- package/claw/node_modules/process-nextick-args/readme.md +0 -18
- package/claw/node_modules/readable-stream/.travis.yml +0 -34
- package/claw/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/claw/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/claw/node_modules/readable-stream/LICENSE +0 -47
- package/claw/node_modules/readable-stream/README.md +0 -58
- package/claw/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/claw/node_modules/readable-stream/duplex-browser.js +0 -1
- package/claw/node_modules/readable-stream/duplex.js +0 -1
- package/claw/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- package/claw/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- package/claw/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- package/claw/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- package/claw/node_modules/readable-stream/lib/_stream_writable.js +0 -685
- package/claw/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
- package/claw/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
- package/claw/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/claw/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/claw/node_modules/readable-stream/node_modules/safe-buffer/LICENSE +0 -21
- package/claw/node_modules/readable-stream/node_modules/safe-buffer/README.md +0 -584
- package/claw/node_modules/readable-stream/node_modules/safe-buffer/index.d.ts +0 -187
- package/claw/node_modules/readable-stream/node_modules/safe-buffer/index.js +0 -62
- package/claw/node_modules/readable-stream/node_modules/safe-buffer/package.json +0 -37
- package/claw/node_modules/readable-stream/package.json +0 -52
- package/claw/node_modules/readable-stream/passthrough.js +0 -1
- package/claw/node_modules/readable-stream/readable-browser.js +0 -7
- package/claw/node_modules/readable-stream/readable.js +0 -19
- package/claw/node_modules/readable-stream/transform.js +0 -1
- package/claw/node_modules/readable-stream/writable-browser.js +0 -1
- package/claw/node_modules/readable-stream/writable.js +0 -8
- package/claw/node_modules/regexp.prototype.flags/.editorconfig +0 -13
- package/claw/node_modules/regexp.prototype.flags/.eslintrc +0 -20
- package/claw/node_modules/regexp.prototype.flags/.nycrc +0 -9
- package/claw/node_modules/regexp.prototype.flags/CHANGELOG.md +0 -249
- package/claw/node_modules/regexp.prototype.flags/LICENSE +0 -22
- package/claw/node_modules/regexp.prototype.flags/README.md +0 -55
- package/claw/node_modules/regexp.prototype.flags/auto.js +0 -3
- package/claw/node_modules/regexp.prototype.flags/implementation.js +0 -39
- package/claw/node_modules/regexp.prototype.flags/index.js +0 -18
- package/claw/node_modules/regexp.prototype.flags/package.json +0 -105
- package/claw/node_modules/regexp.prototype.flags/polyfill.js +0 -39
- package/claw/node_modules/regexp.prototype.flags/shim.js +0 -26
- package/claw/node_modules/regexp.prototype.flags/test/builtin.js +0 -46
- package/claw/node_modules/regexp.prototype.flags/test/implementation.js +0 -20
- package/claw/node_modules/regexp.prototype.flags/test/index.js +0 -17
- package/claw/node_modules/regexp.prototype.flags/test/shimmed.js +0 -48
- package/claw/node_modules/regexp.prototype.flags/test/tests.js +0 -143
- package/claw/node_modules/ripemd160/.github/FUNDING.yml +0 -12
- package/claw/node_modules/ripemd160/CHANGELOG.md +0 -109
- package/claw/node_modules/ripemd160/LICENSE +0 -21
- package/claw/node_modules/ripemd160/README.md +0 -27
- package/claw/node_modules/ripemd160/index.js +0 -167
- package/claw/node_modules/ripemd160/package.json +0 -64
- package/claw/node_modules/safe-buffer/LICENSE +0 -21
- package/claw/node_modules/safe-buffer/README.md +0 -584
- package/claw/node_modules/safe-buffer/index.d.ts +0 -187
- package/claw/node_modules/safe-buffer/index.js +0 -65
- package/claw/node_modules/safe-buffer/package.json +0 -51
- package/claw/node_modules/secure-random/CHANGELOG.md +0 -51
- package/claw/node_modules/secure-random/Makefile +0 -8
- package/claw/node_modules/secure-random/README.md +0 -133
- package/claw/node_modules/secure-random/lib/secure-random.js +0 -83
- package/claw/node_modules/secure-random/package.json +0 -45
- package/claw/node_modules/set-function-length/.eslintrc +0 -27
- package/claw/node_modules/set-function-length/.github/FUNDING.yml +0 -12
- package/claw/node_modules/set-function-length/.nycrc +0 -13
- package/claw/node_modules/set-function-length/CHANGELOG.md +0 -70
- package/claw/node_modules/set-function-length/LICENSE +0 -21
- package/claw/node_modules/set-function-length/README.md +0 -56
- package/claw/node_modules/set-function-length/env.d.ts +0 -9
- package/claw/node_modules/set-function-length/env.js +0 -25
- package/claw/node_modules/set-function-length/index.d.ts +0 -7
- package/claw/node_modules/set-function-length/index.js +0 -42
- package/claw/node_modules/set-function-length/package.json +0 -102
- package/claw/node_modules/set-function-length/tsconfig.json +0 -9
- package/claw/node_modules/set-function-name/.eslintrc +0 -21
- package/claw/node_modules/set-function-name/.github/FUNDING.yml +0 -12
- package/claw/node_modules/set-function-name/CHANGELOG.md +0 -48
- package/claw/node_modules/set-function-name/LICENSE +0 -21
- package/claw/node_modules/set-function-name/README.md +0 -61
- package/claw/node_modules/set-function-name/index.d.ts +0 -5
- package/claw/node_modules/set-function-name/index.js +0 -23
- package/claw/node_modules/set-function-name/package.json +0 -99
- package/claw/node_modules/set-function-name/tsconfig.json +0 -59
- package/claw/node_modules/sha.js/.eslintrc +0 -76
- package/claw/node_modules/sha.js/CHANGELOG.md +0 -423
- package/claw/node_modules/sha.js/LICENSE +0 -49
- package/claw/node_modules/sha.js/README.md +0 -44
- package/claw/node_modules/sha.js/bin.js +0 -44
- package/claw/node_modules/sha.js/hash.js +0 -84
- package/claw/node_modules/sha.js/index.js +0 -19
- package/claw/node_modules/sha.js/package.json +0 -58
- package/claw/node_modules/sha.js/sha.js +0 -104
- package/claw/node_modules/sha.js/sha1.js +0 -109
- package/claw/node_modules/sha.js/sha224.js +0 -55
- package/claw/node_modules/sha.js/sha256.js +0 -189
- package/claw/node_modules/sha.js/sha384.js +0 -59
- package/claw/node_modules/sha.js/sha512.js +0 -382
- package/claw/node_modules/sha.js/test/hash.js +0 -80
- package/claw/node_modules/sha.js/test/test.js +0 -138
- package/claw/node_modules/sha.js/test/vectors.js +0 -72
- package/claw/node_modules/string_decoder/.travis.yml +0 -50
- package/claw/node_modules/string_decoder/LICENSE +0 -48
- package/claw/node_modules/string_decoder/README.md +0 -47
- package/claw/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/claw/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +0 -21
- package/claw/node_modules/string_decoder/node_modules/safe-buffer/README.md +0 -584
- package/claw/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +0 -187
- package/claw/node_modules/string_decoder/node_modules/safe-buffer/index.js +0 -62
- package/claw/node_modules/string_decoder/node_modules/safe-buffer/package.json +0 -37
- package/claw/node_modules/string_decoder/package.json +0 -31
- package/claw/node_modules/to-buffer/.github/FUNDING.yml +0 -12
- package/claw/node_modules/to-buffer/CHANGELOG.md +0 -81
- package/claw/node_modules/to-buffer/LICENSE +0 -21
- package/claw/node_modules/to-buffer/README.md +0 -44
- package/claw/node_modules/to-buffer/index.js +0 -109
- package/claw/node_modules/to-buffer/node_modules/isarray/LICENSE +0 -21
- package/claw/node_modules/to-buffer/node_modules/isarray/README.md +0 -38
- package/claw/node_modules/to-buffer/node_modules/isarray/index.js +0 -5
- package/claw/node_modules/to-buffer/node_modules/isarray/package.json +0 -48
- package/claw/node_modules/to-buffer/package.json +0 -62
- package/claw/node_modules/typed-array-buffer/.eslintrc +0 -13
- package/claw/node_modules/typed-array-buffer/.github/FUNDING.yml +0 -12
- package/claw/node_modules/typed-array-buffer/.nycrc +0 -13
- package/claw/node_modules/typed-array-buffer/CHANGELOG.md +0 -50
- package/claw/node_modules/typed-array-buffer/LICENSE +0 -21
- package/claw/node_modules/typed-array-buffer/README.md +0 -42
- package/claw/node_modules/typed-array-buffer/index.d.ts +0 -9
- package/claw/node_modules/typed-array-buffer/index.js +0 -19
- package/claw/node_modules/typed-array-buffer/package.json +0 -82
- package/claw/node_modules/typed-array-buffer/test/index.js +0 -23
- package/claw/node_modules/typed-array-buffer/tsconfig.json +0 -9
- package/claw/node_modules/util/LICENSE +0 -18
- package/claw/node_modules/util/README.md +0 -15
- package/claw/node_modules/util/node_modules/inherits/LICENSE +0 -16
- package/claw/node_modules/util/node_modules/inherits/README.md +0 -42
- package/claw/node_modules/util/node_modules/inherits/inherits.js +0 -7
- package/claw/node_modules/util/node_modules/inherits/inherits_browser.js +0 -23
- package/claw/node_modules/util/node_modules/inherits/package.json +0 -29
- package/claw/node_modules/util/package.json +0 -35
- package/claw/node_modules/util/support/isBuffer.js +0 -3
- package/claw/node_modules/util/support/isBufferBrowser.js +0 -6
- package/claw/node_modules/util/util.js +0 -586
- package/claw/node_modules/util-deprecate/History.md +0 -16
- package/claw/node_modules/util-deprecate/LICENSE +0 -24
- package/claw/node_modules/util-deprecate/README.md +0 -53
- package/claw/node_modules/util-deprecate/browser.js +0 -67
- package/claw/node_modules/util-deprecate/node.js +0 -6
- package/claw/node_modules/util-deprecate/package.json +0 -27
- package/claw/node_modules/which-typed-array/.editorconfig +0 -20
- package/claw/node_modules/which-typed-array/.eslintrc +0 -10
- package/claw/node_modules/which-typed-array/.github/FUNDING.yml +0 -12
- package/claw/node_modules/which-typed-array/.nycrc +0 -13
- package/claw/node_modules/which-typed-array/CHANGELOG.md +0 -269
- package/claw/node_modules/which-typed-array/LICENSE +0 -22
- package/claw/node_modules/which-typed-array/README.md +0 -70
- package/claw/node_modules/which-typed-array/index.d.ts +0 -66
- package/claw/node_modules/which-typed-array/index.js +0 -122
- package/claw/node_modules/which-typed-array/package.json +0 -130
- package/claw/node_modules/which-typed-array/test/index.js +0 -105
- package/claw/node_modules/which-typed-array/tsconfig.json +0 -9
- package/claw/node_modules/ws/LICENSE +0 -21
- package/claw/node_modules/ws/README.md +0 -449
- package/claw/node_modules/ws/browser.js +0 -8
- package/claw/node_modules/ws/index.js +0 -9
- package/claw/node_modules/ws/lib/buffer-util.js +0 -144
- package/claw/node_modules/ws/lib/constants.js +0 -10
- package/claw/node_modules/ws/lib/event-target.js +0 -170
- package/claw/node_modules/ws/lib/extension.js +0 -222
- package/claw/node_modules/ws/lib/permessage-deflate.js +0 -502
- package/claw/node_modules/ws/lib/receiver.js +0 -492
- package/claw/node_modules/ws/lib/sender.js +0 -358
- package/claw/node_modules/ws/lib/validation.js +0 -30
- package/claw/node_modules/ws/lib/websocket-server.js +0 -415
- package/claw/node_modules/ws/lib/websocket.js +0 -895
- package/claw/node_modules/ws/package.json +0 -45
- package/dist/analysis/chart_utils.d.ts +0 -27
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/math_utils.d.ts +0 -22
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js +0 -43
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +0 -5
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/modules/logger.d.ts +0 -4
- package/dist/modules/logger.d.ts.map +0 -1
- package/dist/modules/logger.js +0 -5
- package/dist/modules/logger.js.map +0 -1
- package/dist/modules/utils/math_utils.d.ts +0 -3
- package/dist/modules/utils/math_utils.d.ts.map +0 -1
- package/dist/modules/utils/math_utils.js +0 -3
- package/dist/modules/utils/math_utils.js.map +0 -1
|
@@ -0,0 +1,1412 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import * as KC from '../market_adapter/core/kibana_client.js';
|
|
7
|
+
import * as C from '../modules/constants.js';
|
|
8
|
+
|
|
9
|
+
const { kibanaSearch, DEFAULT_CONFIG: BASE_CONFIG } = KC;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* TRADE PROFITABILITY ANALYZER
|
|
13
|
+
*
|
|
14
|
+
* Fetches fill_order operations for a BitShares account from Kibana
|
|
15
|
+
* within a specified time range, then analyzes profitability using
|
|
16
|
+
* FIFO or sequential (LIFO) inventory tracking per asset pair.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --start 2025-01-01 --end 2025-06-01
|
|
20
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 720
|
|
21
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --start 2025-01-01T00:00:00Z --end 2025-06-01T00:00:00Z
|
|
22
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 168 --asset 1.3.113
|
|
23
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 168 --csv trades.csv
|
|
24
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 168 --json results.json
|
|
25
|
+
* tsx analysis/trade_profitability.ts "account-name" --lookup
|
|
26
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 168 --trades
|
|
27
|
+
* tsx analysis/trade_profitability.ts 1.2.3 --hours 168 --match-mode fifo
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
const OP_FILL_ORDER = 4;
|
|
33
|
+
const BTS_ID = '1.3.0';
|
|
34
|
+
let BLOCKCHAIN_FEE_PER_FILL = 0.09652; // BTS — flat blockchain operation fee (not market fee); override with --fee-per-order
|
|
35
|
+
|
|
36
|
+
interface AssetInfo {
|
|
37
|
+
symbol: string;
|
|
38
|
+
precision: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const ASSETS: Record<string, AssetInfo> = {
|
|
42
|
+
'1.3.0': { symbol: 'BTS', precision: 5 },
|
|
43
|
+
'1.3.118': { symbol: 'GBP', precision: 4 },
|
|
44
|
+
'1.3.119': { symbol: 'JPY', precision: 2 },
|
|
45
|
+
'1.3.120': { symbol: 'EUR', precision: 4 },
|
|
46
|
+
'1.3.1325': { symbol: 'RUBLE', precision: 5 },
|
|
47
|
+
'1.3.2512': { symbol: 'EVRAZ', precision: 4 },
|
|
48
|
+
'1.3.3291': { symbol: 'TWENTIX', precision: 5 },
|
|
49
|
+
'1.3.4099': { symbol: 'XBTSX.STH', precision: 6 },
|
|
50
|
+
'1.3.4156': { symbol: 'XBTSX.DOGE', precision: 5 },
|
|
51
|
+
'1.3.4157': { symbol: 'XBTSX.BTC', precision: 8 },
|
|
52
|
+
'1.3.4159': { symbol: 'XBTSX.LTC', precision: 8 },
|
|
53
|
+
'1.3.4176': { symbol: 'XBTSX.DASH', precision: 8 },
|
|
54
|
+
'1.3.4274': { symbol: 'XBTSX.BCH', precision: 8 },
|
|
55
|
+
'1.3.4760': { symbol: 'XBTSX.ETH', precision: 7 },
|
|
56
|
+
'1.3.5537': { symbol: 'IOB.XRP', precision: 4 },
|
|
57
|
+
'1.3.5541': { symbol: 'XBTSX.BNB', precision: 7 },
|
|
58
|
+
'1.3.5589': { symbol: 'XBTSX.USDT', precision: 6 },
|
|
59
|
+
'1.3.5641': { symbol: 'HONEST.CNY', precision: 4 },
|
|
60
|
+
'1.3.5649': { symbol: 'HONEST.USD', precision: 4 },
|
|
61
|
+
'1.3.5650': { symbol: 'HONEST.BTC', precision: 8 },
|
|
62
|
+
'1.3.5659': { symbol: 'HONEST.ETH', precision: 6 },
|
|
63
|
+
'1.3.5870': { symbol: 'XBTSX.FIL', precision: 6 },
|
|
64
|
+
'1.3.5887': { symbol: 'XBTSX.RUB', precision: 4 },
|
|
65
|
+
'1.3.5902': { symbol: 'XBTSX.USDC', precision: 6 },
|
|
66
|
+
'1.3.6013': { symbol: 'XBTSX.HIVE', precision: 6 },
|
|
67
|
+
'1.3.6124': { symbol: 'XBTSX.AVAX', precision: 6 },
|
|
68
|
+
'1.3.6139': { symbol: 'XBTSX.XAUT', precision: 6 },
|
|
69
|
+
'1.3.6166': { symbol: 'XBTSX.MATIC', precision: 5 },
|
|
70
|
+
'1.3.6241': { symbol: 'XBTSX.ETC', precision: 7 },
|
|
71
|
+
'1.3.6268': { symbol: 'BTWTY.EOS', precision: 4 },
|
|
72
|
+
'1.3.6301': { symbol: 'HONEST.MONEY', precision: 8 },
|
|
73
|
+
'1.3.6304': { symbol: 'HONEST.ADA', precision: 8 },
|
|
74
|
+
'1.3.6305': { symbol: 'HONEST.DOT', precision: 8 },
|
|
75
|
+
'1.3.6309': { symbol: 'HONEST.ATOM', precision: 8 },
|
|
76
|
+
'1.3.6311': { symbol: 'HONEST.ALGO', precision: 8 },
|
|
77
|
+
'1.3.6312': { symbol: 'HONEST.FIL', precision: 8 },
|
|
78
|
+
'1.3.6313': { symbol: 'HONEST.EOS', precision: 8 },
|
|
79
|
+
'1.3.6315': { symbol: 'HONEST.EUR', precision: 4 },
|
|
80
|
+
'1.3.6316': { symbol: 'HONEST.GBP', precision: 4 },
|
|
81
|
+
'1.3.6317': { symbol: 'HONEST.JPY', precision: 4 },
|
|
82
|
+
'1.3.6444': { symbol: 'IOB.XLM', precision: 4 },
|
|
83
|
+
'1.3.6573': { symbol: 'XBTSX.DAI', precision: 6 },
|
|
84
|
+
'1.3.6620': { symbol: 'XBTSX.A', precision: 6 },
|
|
85
|
+
'1.3.6627': { symbol: 'XBTSX.LINK', precision: 6 },
|
|
86
|
+
};
|
|
87
|
+
const resolvedPrecisions: Record<string, number> = {};
|
|
88
|
+
|
|
89
|
+
function assetSymbol(id: string): string {
|
|
90
|
+
return ASSETS[id]?.symbol ?? id;
|
|
91
|
+
}
|
|
92
|
+
function assetPrec(id: string): number | undefined {
|
|
93
|
+
return ASSETS[id]?.precision ?? resolvedPrecisions[id];
|
|
94
|
+
}
|
|
95
|
+
function getPrec(id: string): number | undefined {
|
|
96
|
+
return assetPrec(id);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function toReal(amount: number, assetId: string): number {
|
|
100
|
+
const p = getPrec(assetId);
|
|
101
|
+
if (p === undefined) return NaN;
|
|
102
|
+
return amount / Math.pow(10, p);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
interface AssetAmount {
|
|
108
|
+
amount: number;
|
|
109
|
+
asset_id: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface FillRecord {
|
|
113
|
+
time: string;
|
|
114
|
+
blockNum: number;
|
|
115
|
+
opNum: number;
|
|
116
|
+
orderId: string;
|
|
117
|
+
accountId: string;
|
|
118
|
+
pays: AssetAmount;
|
|
119
|
+
receives: AssetAmount;
|
|
120
|
+
fee: AssetAmount;
|
|
121
|
+
isMaker: boolean;
|
|
122
|
+
sort: any[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface TradeFill {
|
|
126
|
+
time: string;
|
|
127
|
+
orderId: string;
|
|
128
|
+
direction: 'buy' | 'sell';
|
|
129
|
+
baseAsset: string;
|
|
130
|
+
quoteAsset: string;
|
|
131
|
+
baseAmount: number;
|
|
132
|
+
quoteAmount: number;
|
|
133
|
+
price: number;
|
|
134
|
+
isMaker: boolean;
|
|
135
|
+
sequence: number;
|
|
136
|
+
marketFeeReal: number;
|
|
137
|
+
marketFeeAsset: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface InventoryLot {
|
|
141
|
+
amount: number;
|
|
142
|
+
grossPrice: number;
|
|
143
|
+
effPrice: number;
|
|
144
|
+
time: string;
|
|
145
|
+
entryOrderId: string;
|
|
146
|
+
entryIsMaker: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface RealizedPnl {
|
|
150
|
+
sellPrice: number;
|
|
151
|
+
buyPrice: number;
|
|
152
|
+
amount: number;
|
|
153
|
+
pnl: number;
|
|
154
|
+
pnlPct: number;
|
|
155
|
+
effPrice: number;
|
|
156
|
+
marketFeeEntry: number;
|
|
157
|
+
marketFeeExit: number;
|
|
158
|
+
feeBts: number;
|
|
159
|
+
pnlNet: number;
|
|
160
|
+
pnlNetPct: number;
|
|
161
|
+
entryTime: string;
|
|
162
|
+
exitTime: string;
|
|
163
|
+
entryOrderId: string;
|
|
164
|
+
exitOrderId: string;
|
|
165
|
+
entryIsMaker: boolean;
|
|
166
|
+
exitIsMaker: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface PairAnalysis {
|
|
170
|
+
baseAsset: string;
|
|
171
|
+
quoteAsset: string;
|
|
172
|
+
buys: TradeFill[];
|
|
173
|
+
sells: TradeFill[];
|
|
174
|
+
realizedPnls: RealizedPnl[];
|
|
175
|
+
totalBuyBase: number;
|
|
176
|
+
totalSellBase: number;
|
|
177
|
+
totalBuyQuote: number;
|
|
178
|
+
totalSellQuote: number;
|
|
179
|
+
unmatchedSellBase: number;
|
|
180
|
+
totalRealizedPnl: number;
|
|
181
|
+
totalMarketFees: number;
|
|
182
|
+
totalBlockchainFees: number;
|
|
183
|
+
totalRealizedPnlNet: number;
|
|
184
|
+
netPosition: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ─── CLI ──────────────────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
function printHelp() {
|
|
190
|
+
console.log(`\
|
|
191
|
+
Usage: tsx analysis/trade_profitability.ts <accountId> [options]
|
|
192
|
+
|
|
193
|
+
Analyzes filled orders for a BitShares account, computing realized PnL
|
|
194
|
+
via FIFO or sequential (LIFO) inventory tracking.
|
|
195
|
+
|
|
196
|
+
Arguments:
|
|
197
|
+
accountId BitShares account ID (1.2.x) or name (with --lookup)
|
|
198
|
+
|
|
199
|
+
Options:
|
|
200
|
+
--start <iso> Start time (ISO 8601, e.g. 2025-01-01 or 2025-01-01T00:00:00Z)
|
|
201
|
+
--end <iso> End time (ISO 8601)
|
|
202
|
+
--hours <n> Lookback hours from now (alternative to --start/--end)
|
|
203
|
+
--asset <assetId> Filter to one base asset (e.g. 1.3.113 for bitUSD)
|
|
204
|
+
--lookup Resolve account name to ID via BitShares node
|
|
205
|
+
--node <url> BitShares node URL (default: first healthy from built-in pool)
|
|
206
|
+
--csv <file> Export trade list as CSV
|
|
207
|
+
--json <file> Export full analysis as JSON
|
|
208
|
+
--trades Show per-order PnL detail (hidden by default)
|
|
209
|
+
--match-mode <mode> Matching mode: sequential (default, LIFO) or fifo
|
|
210
|
+
--fee-per-order <bts> Blockchain fee per limit_order_create op in BTS (default: 0.09652)
|
|
211
|
+
--verbose Print extra debug info
|
|
212
|
+
--help, -h Show this help
|
|
213
|
+
|
|
214
|
+
Examples:
|
|
215
|
+
tsx analysis/trade_profitability.ts 1.2.123456 --hours 720
|
|
216
|
+
tsx analysis/trade_profitability.ts 1.2.123456 --start 2025-01-01 --end 2025-06-01
|
|
217
|
+
tsx analysis/trade_profitability.ts "my-bot-account" --lookup --hours 168
|
|
218
|
+
tsx analysis/trade_profitability.ts 1.2.123456 --hours 720 --asset 1.3.113 --csv trades.csv
|
|
219
|
+
tsx analysis/trade_profitability.ts 1.2.123456 --hours 720 --match-mode sequential`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function parseArgs() {
|
|
223
|
+
const args = process.argv.slice(2);
|
|
224
|
+
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
225
|
+
printHelp();
|
|
226
|
+
process.exit(0);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const opts: any = {
|
|
230
|
+
accountId: args[0],
|
|
231
|
+
hours: null,
|
|
232
|
+
start: null,
|
|
233
|
+
end: null,
|
|
234
|
+
asset: null,
|
|
235
|
+
lookup: false,
|
|
236
|
+
node: C.NODE_MANAGEMENT.DEFAULT_NODES[0],
|
|
237
|
+
csv: null,
|
|
238
|
+
json: null,
|
|
239
|
+
matchMode: 'sequential',
|
|
240
|
+
showPnlDetail: false,
|
|
241
|
+
verbose: false,
|
|
242
|
+
feePerOrder: BLOCKCHAIN_FEE_PER_FILL,
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
for (let i = 1; i < args.length; i++) {
|
|
246
|
+
switch (args[i]) {
|
|
247
|
+
case '--hours': opts.hours = parseInt(args[++i], 10); break;
|
|
248
|
+
case '--start': opts.start = args[++i]; break;
|
|
249
|
+
case '--end': opts.end = args[++i]; break;
|
|
250
|
+
case '--asset': opts.asset = args[++i]; break;
|
|
251
|
+
case '--lookup': opts.lookup = true; break;
|
|
252
|
+
case '--node': opts.node = args[++i]; break;
|
|
253
|
+
case '--csv': opts.csv = args[++i]; break;
|
|
254
|
+
case '--json': opts.json = args[++i]; break;
|
|
255
|
+
case '--trades': opts.showPnlDetail = true; break;
|
|
256
|
+
case '--fee-per-order': opts.feePerOrder = parseFloat(args[++i]); break;
|
|
257
|
+
case '--match-mode': {
|
|
258
|
+
const m = args[++i];
|
|
259
|
+
if (m !== 'sequential' && m !== 'fifo') {
|
|
260
|
+
console.error(`Invalid --match-mode: ${m} (expected: sequential | fifo)`);
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
opts.matchMode = m;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
case '--verbose': opts.verbose = true; break;
|
|
267
|
+
default:
|
|
268
|
+
console.error(`Unknown option: ${args[i]}`);
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!opts.hours && !opts.start) {
|
|
274
|
+
opts.hours = 168; // default: 7 days
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return opts;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ─── Account name resolution ─────────────────────────────────────────────────
|
|
281
|
+
|
|
282
|
+
async function resolveAccountId(name: string, nodeUrl: string): Promise<string | null> {
|
|
283
|
+
const { createReadOnlyClient } = await import('../modules/bitshares-native/index.js');
|
|
284
|
+
const client = createReadOnlyClient({ nodes: [nodeUrl] });
|
|
285
|
+
// Suppress transport INFO logs during ephemeral connection:
|
|
286
|
+
// bitshares-native transport logger (new Logger('Transport')) writes
|
|
287
|
+
// "[timestamp] [INFO] [Transport] ..." — silence by raising log level.
|
|
288
|
+
const prevLevel = process.env.LOG_LEVEL;
|
|
289
|
+
process.env.LOG_LEVEL = 'warn';
|
|
290
|
+
try {
|
|
291
|
+
await client.connect();
|
|
292
|
+
const accounts = await client.db('lookup_account_names', [[name]]);
|
|
293
|
+
if (Array.isArray(accounts) && accounts[0]?.id) {
|
|
294
|
+
return accounts[0].id;
|
|
295
|
+
}
|
|
296
|
+
return null;
|
|
297
|
+
} catch (e: any) {
|
|
298
|
+
console.warn(` [warn] Account resolution failed: ${e.message}`);
|
|
299
|
+
return null;
|
|
300
|
+
} finally {
|
|
301
|
+
try { client.disconnect(); } catch (_) {}
|
|
302
|
+
process.env.LOG_LEVEL = prevLevel;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// ─── On-chain asset precision resolution ────────────────────────────────────
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Collects all unique non-BTS asset IDs from fills, resolves unknown
|
|
310
|
+
* precisions from the blockchain, and populates the runtime cache.
|
|
311
|
+
*/
|
|
312
|
+
async function resolveAssetPrecisions(fills: FillRecord[], nodeUrl: string | null): Promise<void> {
|
|
313
|
+
const unknownIds = new Set<string>();
|
|
314
|
+
for (const f of fills) {
|
|
315
|
+
for (const id of [f.pays.asset_id, f.receives.asset_id, f.fee.asset_id]) {
|
|
316
|
+
if (id !== BTS_ID && !(id in ASSETS) && !(id in resolvedPrecisions)) {
|
|
317
|
+
unknownIds.add(id);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (unknownIds.size === 0 || !nodeUrl) return;
|
|
322
|
+
|
|
323
|
+
const ids = [...unknownIds];
|
|
324
|
+
console.log(` Resolving ${ids.length} unknown asset(s) from blockchain...`);
|
|
325
|
+
|
|
326
|
+
const { createReadOnlyClient } = await import('../modules/bitshares-native/index.js');
|
|
327
|
+
const client = createReadOnlyClient({ nodes: [nodeUrl] });
|
|
328
|
+
try {
|
|
329
|
+
await client.connect();
|
|
330
|
+
const assets = await client.db('get_assets', [ids]);
|
|
331
|
+
if (Array.isArray(assets)) {
|
|
332
|
+
for (const asset of assets) {
|
|
333
|
+
if (asset?.id && asset.precision != null) {
|
|
334
|
+
resolvedPrecisions[asset.id] = asset.precision;
|
|
335
|
+
console.log(` ${asset.id} → ${asset.symbol || '?'} (precision ${asset.precision})`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const missing = ids.filter(id => !(id in resolvedPrecisions));
|
|
340
|
+
if (missing.length > 0) {
|
|
341
|
+
console.warn(` [warn] ${missing.length} asset(s) not found on chain: ${missing.join(', ')}. Fills referencing them will be skipped.`);
|
|
342
|
+
}
|
|
343
|
+
} catch (e: any) {
|
|
344
|
+
console.warn(` [warn] Asset resolution failed: ${e.message}. Fills with unknown assets will be skipped.`);
|
|
345
|
+
} finally {
|
|
346
|
+
try { client.disconnect(); } catch (_) {}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ─── Kibana Query ────────────────────────────────────────────────────────────
|
|
351
|
+
|
|
352
|
+
function buildFillQuery(accountId: string, gte: string, lte: string, size: number) {
|
|
353
|
+
return {
|
|
354
|
+
size,
|
|
355
|
+
track_total_hits: false,
|
|
356
|
+
_source: [
|
|
357
|
+
'block_data.block_time',
|
|
358
|
+
'block_data.block_num',
|
|
359
|
+
'operation_id_num',
|
|
360
|
+
'operation_history.op_object.pays',
|
|
361
|
+
'operation_history.op_object.receives',
|
|
362
|
+
'operation_history.op_object.fee',
|
|
363
|
+
'operation_history.op_object.order_id',
|
|
364
|
+
'operation_history.op_object.account_id',
|
|
365
|
+
'operation_history.op_object.is_maker',
|
|
366
|
+
],
|
|
367
|
+
query: {
|
|
368
|
+
bool: {
|
|
369
|
+
filter: [
|
|
370
|
+
{ term: { operation_type: OP_FILL_ORDER } },
|
|
371
|
+
{ term: { 'operation_history.op_object.account_id.keyword': accountId } },
|
|
372
|
+
{ range: { 'block_data.block_time': { gte, lte } } },
|
|
373
|
+
],
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
sort: [
|
|
377
|
+
{ 'block_data.block_time': { order: 'asc' } },
|
|
378
|
+
{ operation_id_num: { order: 'asc' } },
|
|
379
|
+
],
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
async function fetchAllFills(config: any, accountId: string, gte: string, lte: string): Promise<FillRecord[]> {
|
|
384
|
+
const pageSize = 10000;
|
|
385
|
+
const fills: FillRecord[] = [];
|
|
386
|
+
let searchAfter: any[] | null = null;
|
|
387
|
+
const cfg = { ...BASE_CONFIG, timeout: 60000, ...config };
|
|
388
|
+
|
|
389
|
+
while (true) {
|
|
390
|
+
const query = buildFillQuery(accountId, gte, lte, pageSize);
|
|
391
|
+
if (searchAfter) (query as any).search_after = searchAfter;
|
|
392
|
+
|
|
393
|
+
const result: any = await kibanaSearch(cfg, query);
|
|
394
|
+
const hits = result?.hits?.hits ?? [];
|
|
395
|
+
if (!hits.length) break;
|
|
396
|
+
|
|
397
|
+
for (const hit of hits) {
|
|
398
|
+
const src = hit?._source;
|
|
399
|
+
const op = src?.operation_history?.op_object;
|
|
400
|
+
if (!op || !op.pays || !op.receives) continue;
|
|
401
|
+
|
|
402
|
+
fills.push({
|
|
403
|
+
time: src.block_data?.block_time ?? '',
|
|
404
|
+
blockNum: src.block_data?.block_num ?? 0,
|
|
405
|
+
opNum: Number(src.operation_id_num ?? 0),
|
|
406
|
+
orderId: op.order_id ?? '',
|
|
407
|
+
accountId: op.account_id ?? '',
|
|
408
|
+
pays: { amount: Number(op.pays.amount ?? 0), asset_id: op.pays.asset_id ?? '' },
|
|
409
|
+
receives: { amount: Number(op.receives.amount ?? 0), asset_id: op.receives.asset_id ?? '' },
|
|
410
|
+
fee: { amount: Number(op.fee?.amount ?? 0), asset_id: op.fee?.asset_id ?? '' },
|
|
411
|
+
isMaker: op.is_maker ?? false,
|
|
412
|
+
sort: hit.sort,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (hits.length < pageSize) break;
|
|
417
|
+
searchAfter = hits[hits.length - 1].sort;
|
|
418
|
+
if (!Array.isArray(searchAfter)) break;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return fills;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ─── Fill Classification ─────────────────────────────────────────────────────
|
|
425
|
+
|
|
426
|
+
function classifyFills(fills: FillRecord[], filterAsset: string | null): { trades: TradeFill[]; pairs: Set<string> } {
|
|
427
|
+
const trades: TradeFill[] = [];
|
|
428
|
+
const pairs = new Set<string>();
|
|
429
|
+
let skipped = 0;
|
|
430
|
+
|
|
431
|
+
for (const f of fills) {
|
|
432
|
+
const pAsset = f.pays.asset_id;
|
|
433
|
+
const rAsset = f.receives.asset_id;
|
|
434
|
+
let direction: 'buy' | 'sell';
|
|
435
|
+
let baseAsset: string;
|
|
436
|
+
let quoteAsset: string;
|
|
437
|
+
let baseAmount: number;
|
|
438
|
+
let quoteAmount: number;
|
|
439
|
+
let price: number;
|
|
440
|
+
let marketFeeReal: number;
|
|
441
|
+
let marketFeeAsset: string;
|
|
442
|
+
|
|
443
|
+
const feePrec = getPrec(f.fee.asset_id);
|
|
444
|
+
if (feePrec === undefined || isNaN(f.fee.amount)) { skipped++; continue; }
|
|
445
|
+
const feeReal = f.fee.amount / Math.pow(10, feePrec);
|
|
446
|
+
|
|
447
|
+
if (pAsset === BTS_ID && rAsset !== BTS_ID) {
|
|
448
|
+
direction = 'buy';
|
|
449
|
+
baseAsset = rAsset;
|
|
450
|
+
quoteAsset = BTS_ID;
|
|
451
|
+
baseAmount = toReal(f.receives.amount, rAsset);
|
|
452
|
+
quoteAmount = toReal(f.pays.amount, BTS_ID);
|
|
453
|
+
if (isNaN(baseAmount) || isNaN(quoteAmount)) { skipped++; continue; }
|
|
454
|
+
price = quoteAmount / baseAmount;
|
|
455
|
+
marketFeeReal = feeReal;
|
|
456
|
+
marketFeeAsset = f.fee.asset_id;
|
|
457
|
+
} else if (rAsset === BTS_ID && pAsset !== BTS_ID) {
|
|
458
|
+
direction = 'sell';
|
|
459
|
+
baseAsset = pAsset;
|
|
460
|
+
quoteAsset = BTS_ID;
|
|
461
|
+
baseAmount = toReal(f.pays.amount, pAsset);
|
|
462
|
+
quoteAmount = toReal(f.receives.amount, BTS_ID);
|
|
463
|
+
if (isNaN(baseAmount) || isNaN(quoteAmount)) { skipped++; continue; }
|
|
464
|
+
price = quoteAmount / baseAmount;
|
|
465
|
+
marketFeeReal = feeReal;
|
|
466
|
+
marketFeeAsset = f.fee.asset_id;
|
|
467
|
+
} else {
|
|
468
|
+
// Non-BTS cross-pair: use consistent ordering (lower asset ID = base)
|
|
469
|
+
const baseForCheck = pAsset < rAsset ? pAsset : rAsset;
|
|
470
|
+
const quoteForCheck = pAsset < rAsset ? rAsset : pAsset;
|
|
471
|
+
// Skip if either asset precision is unknown
|
|
472
|
+
if (getPrec(baseForCheck) === undefined || getPrec(quoteForCheck) === undefined) { skipped++; continue; }
|
|
473
|
+
const isSell = pAsset < rAsset;
|
|
474
|
+
direction = isSell ? 'sell' : 'buy';
|
|
475
|
+
baseAsset = isSell ? pAsset : rAsset;
|
|
476
|
+
quoteAsset = isSell ? rAsset : pAsset;
|
|
477
|
+
baseAmount = toReal(isSell ? f.pays.amount : f.receives.amount, baseAsset);
|
|
478
|
+
quoteAmount = toReal(isSell ? f.receives.amount : f.pays.amount, quoteAsset);
|
|
479
|
+
if (isNaN(baseAmount) || isNaN(quoteAmount)) { skipped++; continue; }
|
|
480
|
+
price = quoteAmount / baseAmount;
|
|
481
|
+
marketFeeReal = feeReal;
|
|
482
|
+
marketFeeAsset = f.fee.asset_id;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (filterAsset && baseAsset !== filterAsset) continue;
|
|
486
|
+
|
|
487
|
+
// Validate market fee asset: fee is always deducted from receives
|
|
488
|
+
// (base for buys, quote for sells). Warn if unexpected.
|
|
489
|
+
if (marketFeeReal > 0 && marketFeeAsset !== '' && marketFeeAsset !== rAsset) {
|
|
490
|
+
console.warn(` [warn] Fill ${f.orderId}: fee asset ${marketFeeAsset} ≠ receives asset ${rAsset}. Market fee PnL may be incorrect.`);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const pairKey = `${baseAsset}:${quoteAsset}`;
|
|
494
|
+
pairs.add(pairKey);
|
|
495
|
+
|
|
496
|
+
trades.push({
|
|
497
|
+
time: f.time,
|
|
498
|
+
orderId: f.orderId,
|
|
499
|
+
direction,
|
|
500
|
+
baseAsset,
|
|
501
|
+
quoteAsset,
|
|
502
|
+
baseAmount,
|
|
503
|
+
quoteAmount,
|
|
504
|
+
price,
|
|
505
|
+
isMaker: f.isMaker,
|
|
506
|
+
sequence: f.blockNum * 1e6 + f.opNum,
|
|
507
|
+
marketFeeReal,
|
|
508
|
+
marketFeeAsset,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (skipped > 0) {
|
|
513
|
+
console.warn(` [warn] ${skipped} fill(s) skipped due to unknown asset precision.`);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return { trades, pairs };
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// ─── PnL Calculation (FIFO / Sequential) ─────────────────────────────────────
|
|
520
|
+
|
|
521
|
+
function analyzePair(trades: TradeFill[], matchMode: 'fifo' | 'sequential' = 'sequential'): PairAnalysis {
|
|
522
|
+
const buys = trades.filter(t => t.direction === 'buy').sort((a, b) => a.sequence - b.sequence);
|
|
523
|
+
const sells = trades.filter(t => t.direction === 'sell').sort((a, b) => a.sequence - b.sequence);
|
|
524
|
+
|
|
525
|
+
const totalBuyBase = buys.reduce((s, t) => s + t.baseAmount, 0);
|
|
526
|
+
const totalSellBase = sells.reduce((s, t) => s + t.baseAmount, 0);
|
|
527
|
+
const totalBuyQuote = buys.reduce((s, t) => s + t.quoteAmount, 0);
|
|
528
|
+
const totalSellQuote = sells.reduce((s, t) => s + t.quoteAmount, 0);
|
|
529
|
+
|
|
530
|
+
// Merge all trades chronologically.
|
|
531
|
+
// FIFO: buys add to queue, sells consume oldest lots (queue front).
|
|
532
|
+
// Sequential: buys add to queue, sells consume newest lots (queue back / LIFO).
|
|
533
|
+
const all = [...trades].sort((a, b) => a.sequence - b.sequence);
|
|
534
|
+
const inventory: InventoryLot[] = [];
|
|
535
|
+
const realizedPnls: RealizedPnl[] = [];
|
|
536
|
+
let unmatchedSellBase = 0;
|
|
537
|
+
|
|
538
|
+
for (const trade of all) {
|
|
539
|
+
const grossPrice = trade.price;
|
|
540
|
+
|
|
541
|
+
if (trade.direction === 'buy') {
|
|
542
|
+
// Enter lot with net amount (gross receives minus market fee on receives)
|
|
543
|
+
const lotAmount = trade.baseAmount - trade.marketFeeReal;
|
|
544
|
+
if (lotAmount < 1e-12) continue;
|
|
545
|
+
const lotEffPrice = trade.quoteAmount / lotAmount;
|
|
546
|
+
inventory.push({
|
|
547
|
+
amount: lotAmount,
|
|
548
|
+
grossPrice: grossPrice,
|
|
549
|
+
effPrice: lotEffPrice,
|
|
550
|
+
time: trade.time,
|
|
551
|
+
entryOrderId: trade.orderId,
|
|
552
|
+
entryIsMaker: trade.isMaker,
|
|
553
|
+
});
|
|
554
|
+
} else {
|
|
555
|
+
let remaining = trade.baseAmount;
|
|
556
|
+
|
|
557
|
+
while (remaining > 0.00000001 && inventory.length > 0) {
|
|
558
|
+
const lotIndex = matchMode === 'sequential' ? inventory.length - 1 : 0;
|
|
559
|
+
const lot = inventory[lotIndex];
|
|
560
|
+
const matched = Math.min(remaining, lot.amount);
|
|
561
|
+
|
|
562
|
+
// Gross PnL using gross prices (before market fee deduction)
|
|
563
|
+
const grossPnl = (grossPrice - lot.grossPrice) * matched;
|
|
564
|
+
const grossPnlPct = lot.grossPrice > 0 ? ((grossPrice - lot.grossPrice) / lot.grossPrice) * 100 : 0;
|
|
565
|
+
|
|
566
|
+
realizedPnls.push({
|
|
567
|
+
sellPrice: grossPrice,
|
|
568
|
+
buyPrice: lot.grossPrice,
|
|
569
|
+
amount: matched,
|
|
570
|
+
pnl: grossPnl,
|
|
571
|
+
pnlPct: grossPnlPct,
|
|
572
|
+
effPrice: lot.effPrice,
|
|
573
|
+
marketFeeEntry: 0,
|
|
574
|
+
marketFeeExit: 0,
|
|
575
|
+
feeBts: 0,
|
|
576
|
+
pnlNet: grossPnl,
|
|
577
|
+
pnlNetPct: grossPnlPct,
|
|
578
|
+
entryTime: lot.time,
|
|
579
|
+
exitTime: trade.time,
|
|
580
|
+
entryOrderId: lot.entryOrderId,
|
|
581
|
+
exitOrderId: trade.orderId,
|
|
582
|
+
entryIsMaker: lot.entryIsMaker,
|
|
583
|
+
exitIsMaker: trade.isMaker,
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
lot.amount -= matched;
|
|
587
|
+
remaining -= matched;
|
|
588
|
+
|
|
589
|
+
if (lot.amount < 0.00000001) {
|
|
590
|
+
if (matchMode === 'sequential') {
|
|
591
|
+
inventory.pop();
|
|
592
|
+
} else {
|
|
593
|
+
inventory.shift();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (remaining > 0.00000001) {
|
|
599
|
+
unmatchedSellBase += remaining;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// ─── Market fee allocation (aggregated per order) ──────────────────────
|
|
605
|
+
// A limit order may be filled across multiple fill_order_operations with
|
|
606
|
+
// the same orderId. Aggregate all fills' market fees per order, then
|
|
607
|
+
// allocate pro-rata using the fill's net acquired amount as denominator.
|
|
608
|
+
// (Market fee is paid on acquisition; the portion tied to unsold inventory
|
|
609
|
+
// is not yet realised.)
|
|
610
|
+
const entryOrderFees = new Map<string, { feeInQuote: number; totalAcquired: number }>();
|
|
611
|
+
const exitOrderFees = new Map<string, { feeInQuote: number; totalDisposed: number }>();
|
|
612
|
+
|
|
613
|
+
for (const t of buys) {
|
|
614
|
+
const e = entryOrderFees.get(t.orderId) || { feeInQuote: 0, totalAcquired: 0 };
|
|
615
|
+
if (t.marketFeeReal > 0) {
|
|
616
|
+
// Buy-side fee is in base → convert to quote using effective price
|
|
617
|
+
const netBase = t.baseAmount - t.marketFeeReal;
|
|
618
|
+
e.feeInQuote += netBase > 0 ? t.marketFeeReal * (t.quoteAmount / netBase) : 0;
|
|
619
|
+
}
|
|
620
|
+
e.totalAcquired += t.baseAmount - t.marketFeeReal;
|
|
621
|
+
entryOrderFees.set(t.orderId, e);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
for (const t of sells) {
|
|
625
|
+
const e = exitOrderFees.get(t.orderId) || { feeInQuote: 0, totalDisposed: 0 };
|
|
626
|
+
if (t.marketFeeReal > 0)
|
|
627
|
+
e.feeInQuote += t.marketFeeReal; // Sell-side fee is already in quote
|
|
628
|
+
e.totalDisposed += t.baseAmount;
|
|
629
|
+
exitOrderFees.set(t.orderId, e);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
for (const r of realizedPnls) {
|
|
633
|
+
const eObj = entryOrderFees.get(r.entryOrderId);
|
|
634
|
+
if (eObj && eObj.totalAcquired > 0)
|
|
635
|
+
r.marketFeeEntry = eObj.feeInQuote * (r.amount / eObj.totalAcquired);
|
|
636
|
+
|
|
637
|
+
const xObj = exitOrderFees.get(r.exitOrderId);
|
|
638
|
+
if (xObj && xObj.totalDisposed > 0)
|
|
639
|
+
r.marketFeeExit = xObj.feeInQuote * (r.amount / xObj.totalDisposed);
|
|
640
|
+
|
|
641
|
+
r.pnlNet = r.pnl - r.marketFeeEntry - r.marketFeeExit;
|
|
642
|
+
r.pnlNetPct = r.buyPrice > 0 ? (r.pnlNet / (r.buyPrice * r.amount)) * 100 : 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// ─── Blockchain fee allocation ─────────────────────────────────────────
|
|
646
|
+
const buyOrderIds = new Set(buys.map(t => t.orderId));
|
|
647
|
+
const sellOrderIds = new Set(sells.map(t => t.orderId));
|
|
648
|
+
const entryTotalMatched = new Map<string, number>();
|
|
649
|
+
const exitTotalMatched = new Map<string, number>();
|
|
650
|
+
for (const r of realizedPnls) {
|
|
651
|
+
entryTotalMatched.set(r.entryOrderId, (entryTotalMatched.get(r.entryOrderId) || 0) + r.amount);
|
|
652
|
+
exitTotalMatched.set(r.exitOrderId, (exitTotalMatched.get(r.exitOrderId) || 0) + r.amount);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
const totalBlockchainFees = (buyOrderIds.size + sellOrderIds.size) * BLOCKCHAIN_FEE_PER_FILL;
|
|
656
|
+
for (const r of realizedPnls) {
|
|
657
|
+
const eTotal = entryTotalMatched.get(r.entryOrderId) || 1;
|
|
658
|
+
const xTotal = exitTotalMatched.get(r.exitOrderId) || 1;
|
|
659
|
+
r.feeBts = BLOCKCHAIN_FEE_PER_FILL * (r.amount / eTotal) + BLOCKCHAIN_FEE_PER_FILL * (r.amount / xTotal);
|
|
660
|
+
r.pnlNet -= r.feeBts;
|
|
661
|
+
const costBasis = r.effPrice * r.amount;
|
|
662
|
+
r.pnlNetPct = costBasis > 0 ? (r.pnlNet / costBasis) * 100 : 0;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
const totalBuyBaseNet = buys.reduce((s, t) => s + t.baseAmount - t.marketFeeReal, 0);
|
|
666
|
+
const totalRealizedPnl = realizedPnls.reduce((s, r) => s + r.pnl, 0);
|
|
667
|
+
const totalMarketFees = realizedPnls.reduce((s, r) => s + r.marketFeeEntry + r.marketFeeExit, 0);
|
|
668
|
+
const totalRealizedPnlNet = realizedPnls.reduce((s, r) => s + r.pnlNet, 0);
|
|
669
|
+
const netPosition = totalBuyBaseNet - totalSellBase;
|
|
670
|
+
const baseAsset = trades[0]?.baseAsset ?? '';
|
|
671
|
+
const quoteAsset = trades[0]?.quoteAsset ?? '';
|
|
672
|
+
|
|
673
|
+
return {
|
|
674
|
+
baseAsset,
|
|
675
|
+
quoteAsset,
|
|
676
|
+
buys,
|
|
677
|
+
sells,
|
|
678
|
+
realizedPnls,
|
|
679
|
+
totalBuyBase,
|
|
680
|
+
totalSellBase,
|
|
681
|
+
totalBuyQuote,
|
|
682
|
+
totalSellQuote,
|
|
683
|
+
unmatchedSellBase,
|
|
684
|
+
totalRealizedPnl,
|
|
685
|
+
totalMarketFees,
|
|
686
|
+
totalBlockchainFees,
|
|
687
|
+
totalRealizedPnlNet,
|
|
688
|
+
netPosition,
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// ─── Output Helpers ──────────────────────────────────────────────────────────
|
|
693
|
+
|
|
694
|
+
function fmt(n: number, decimals = 4): string {
|
|
695
|
+
if (!Number.isFinite(n)) return 'NaN';
|
|
696
|
+
return n.toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
function fmtPct(n: number): string {
|
|
700
|
+
if (!Number.isFinite(n)) return 'NaN%';
|
|
701
|
+
return (n >= 0 ? '+' : '') + n.toFixed(2) + '%';
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function fmtAsset(id: string): string {
|
|
705
|
+
return assetSymbol(id);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function printSummary(pairs: PairAnalysis[], _accountId: string, _start: string, _end: string, _matchMode: 'fifo' | 'sequential' = 'sequential') {
|
|
709
|
+
console.log('');
|
|
710
|
+
|
|
711
|
+
for (const pair of pairs) {
|
|
712
|
+
const pairLabel = `${fmtAsset(pair.baseAsset)}/${fmtAsset(pair.quoteAsset)}`;
|
|
713
|
+
const totalBought = pair.totalBuyBase;
|
|
714
|
+
const totalSold = pair.totalSellBase;
|
|
715
|
+
const avgBuy = pair.totalBuyBase > 0 ? pair.totalBuyQuote / pair.totalBuyBase : 0;
|
|
716
|
+
const avgSell = pair.totalSellBase > 0 ? pair.totalSellQuote / pair.totalSellBase : 0;
|
|
717
|
+
|
|
718
|
+
console.log(` ── ${pairLabel}`);
|
|
719
|
+
console.log(` Buys: ${fmt(totalBought, 4)} @ ${fmt(avgBuy, 6)} = ${fmt(pair.totalBuyQuote, 4)} ${fmtAsset(pair.quoteAsset)}`);
|
|
720
|
+
console.log(` Sells: ${fmt(totalSold, 4)} @ ${fmt(avgSell, 6)} = ${fmt(pair.totalSellQuote, 4)} ${fmtAsset(pair.quoteAsset)}`);
|
|
721
|
+
console.log(` Net traded: ${fmt(pair.netPosition, 4)} ${fmtAsset(pair.baseAsset)} (window flow)`);
|
|
722
|
+
console.log(` Trades: ${pair.realizedPnls.length} matched lots, ${pair.buys.length} buys, ${pair.sells.length} sells`);
|
|
723
|
+
if (pair.unmatchedSellBase > 0.0001) {
|
|
724
|
+
console.log(` Unmatched: ${fmt(pair.unmatchedSellBase, 4)} ${fmtAsset(pair.baseAsset)} (sold without prior buy in window — expected if inventory predates window)`);
|
|
725
|
+
}
|
|
726
|
+
console.log(` Gross PnL: ${fmtAsset(pair.quoteAsset)} ${fmt(pair.totalRealizedPnl, 4)}`);
|
|
727
|
+
const mktFee = pair.totalMarketFees;
|
|
728
|
+
const blkFee = pair.totalBlockchainFees;
|
|
729
|
+
if (mktFee > 0.0001) {
|
|
730
|
+
console.log(` Market fees: ${fmtAsset(pair.quoteAsset)} ${fmt(-mktFee, 4)}`);
|
|
731
|
+
}
|
|
732
|
+
if (blkFee > 0.0001) {
|
|
733
|
+
console.log(` Blockchain: BTS ${fmt(-blkFee, 4)}`);
|
|
734
|
+
}
|
|
735
|
+
console.log(` Net PnL: ${fmtAsset(pair.quoteAsset)} ${fmt(pair.totalRealizedPnlNet, 4)}`);
|
|
736
|
+
if (pair.quoteAsset !== BTS_ID) {
|
|
737
|
+
console.log(` ⚠ Non-BTS quote — PnL is in ${fmtAsset(pair.quoteAsset)}, not BTS`);
|
|
738
|
+
}
|
|
739
|
+
console.log('');
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// Grand totals grouped by quote asset
|
|
743
|
+
const quoteGroups = new Map<string, PairAnalysis[]>();
|
|
744
|
+
for (const p of pairs) {
|
|
745
|
+
const q = p.quoteAsset;
|
|
746
|
+
if (!quoteGroups.has(q)) quoteGroups.set(q, []);
|
|
747
|
+
quoteGroups.get(q)!.push(p);
|
|
748
|
+
}
|
|
749
|
+
if (pairs.length > 1 && quoteGroups.size > 0) {
|
|
750
|
+
for (const [quoteAsset, group] of quoteGroups) {
|
|
751
|
+
const groupPnl = group.reduce((s, p) => s + p.totalRealizedPnl, 0);
|
|
752
|
+
const groupMktFees = group.reduce((s, p) => s + p.totalMarketFees, 0);
|
|
753
|
+
const groupBlkFees = group.reduce((s, p) => s + p.totalBlockchainFees, 0);
|
|
754
|
+
const groupNet = group.reduce((s, p) => s + p.totalRealizedPnlNet, 0);
|
|
755
|
+
const groupVol = group.reduce((s, p) => s + p.totalBuyQuote + p.totalSellQuote, 0);
|
|
756
|
+
const qSymbol = fmtAsset(quoteAsset);
|
|
757
|
+
console.log(` ── TOTAL (${qSymbol}) — ${group.length} pair(s)`);
|
|
758
|
+
console.log(` Gross PnL: ${fmtAsset(quoteAsset)} ${fmt(groupPnl, 4)}`);
|
|
759
|
+
if (groupMktFees > 0.0001) {
|
|
760
|
+
console.log(` Market fees: ${fmtAsset(quoteAsset)} ${fmt(-groupMktFees, 4)}`);
|
|
761
|
+
}
|
|
762
|
+
if (groupBlkFees > 0.0001) {
|
|
763
|
+
console.log(` Blockchain: BTS ${fmt(-groupBlkFees, 4)}`);
|
|
764
|
+
}
|
|
765
|
+
console.log(` Net PnL: ${fmtAsset(quoteAsset)} ${fmt(groupNet, 4)}`);
|
|
766
|
+
console.log(` Volume: ${fmt(groupVol, 4)} ${qSymbol}`);
|
|
767
|
+
console.log('');
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
console.log(` Note: PnL uses gross prices. Net PnL deducts market fees (charged by`);
|
|
771
|
+
console.log(` asset issuer on receives, both issuer and network portions) and`);
|
|
772
|
+
console.log(` blockchain operation fees (BTS per limit_order_create). Market`);
|
|
773
|
+
console.log(` fees are converted to quote asset. Buy lots are entered at net`);
|
|
774
|
+
console.log(` receives (gross minus buy-side market fee) so inventory matching`);
|
|
775
|
+
console.log(` reflects what the account actually held. If inventory predates the`);
|
|
776
|
+
console.log(` window or crosses asset pairs, the matched lots may not reflect`);
|
|
777
|
+
console.log(` true trade economics.`);
|
|
778
|
+
console.log('');
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function printPnlDetail(pairs: PairAnalysis[]) {
|
|
782
|
+
for (const pair of pairs) {
|
|
783
|
+
if (pair.realizedPnls.length === 0) continue;
|
|
784
|
+
|
|
785
|
+
const pairLabel = `${fmtAsset(pair.baseAsset)}/${fmtAsset(pair.quoteAsset)}`;
|
|
786
|
+
console.log('');
|
|
787
|
+
console.log(` ── ${pairLabel} — Realized PnL Detail`);
|
|
788
|
+
console.log('');
|
|
789
|
+
|
|
790
|
+
const hdr = ' # Buy Price EffBuy Sell Price Amount PnL PnL% MktFee OpFeeBTS Net PnL Net% Legs Entry Time Exit Time';
|
|
791
|
+
console.log(hdr);
|
|
792
|
+
console.log(' ' + '─'.repeat(hdr.length - 1));
|
|
793
|
+
|
|
794
|
+
for (let i = 0; i < pair.realizedPnls.length; i++) {
|
|
795
|
+
const r = pair.realizedPnls[i];
|
|
796
|
+
const idx = String(i + 1).padStart(2);
|
|
797
|
+
const bp = fmt(r.buyPrice, 8).padStart(11);
|
|
798
|
+
const ep = fmt(r.effPrice, 8).padStart(11);
|
|
799
|
+
const sp = fmt(r.sellPrice, 8).padStart(11);
|
|
800
|
+
const amt = fmt(r.amount, 4).padStart(9);
|
|
801
|
+
const pnlStr = fmt(r.pnl, 6).padStart(9);
|
|
802
|
+
const pctStr = fmtPct(r.pnlPct).padStart(8);
|
|
803
|
+
const mktFeeStr = fmt(r.marketFeeEntry + r.marketFeeExit, 4).padStart(8);
|
|
804
|
+
const feeStr = fmt(r.feeBts, 4).padStart(8);
|
|
805
|
+
const netStr = fmt(r.pnlNet, 6).padStart(10);
|
|
806
|
+
const netPctStr = fmtPct(r.pnlNetPct).padStart(8);
|
|
807
|
+
const mk = (r.entryIsMaker ? 'M' : 'T') + '/' + (r.exitIsMaker ? 'M' : 'T') + ' ';
|
|
808
|
+
const et = (r.entryTime || '').slice(0, 22).padEnd(22);
|
|
809
|
+
const xt = (r.exitTime || '').slice(0, 22).padEnd(22);
|
|
810
|
+
console.log(` ${idx} ${bp} ${ep} ${sp} ${amt} ${pnlStr} ${pctStr} ${mktFeeStr} ${feeStr} ${netStr} ${netPctStr} ${mk} ${et} ${xt}`);
|
|
811
|
+
}
|
|
812
|
+
console.log('');
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// ─── Performance Metrics ──────────────────────────────────────────────────────
|
|
817
|
+
|
|
818
|
+
interface TradingMetrics {
|
|
819
|
+
totalLots: number;
|
|
820
|
+
winRate: number;
|
|
821
|
+
profitFactor: number;
|
|
822
|
+
avgWin: number;
|
|
823
|
+
avgLoss: number;
|
|
824
|
+
avgWinLossRatio: number;
|
|
825
|
+
expectancyBts: number;
|
|
826
|
+
expectancyPct: number;
|
|
827
|
+
expectancyR: number;
|
|
828
|
+
netExpectancyBts: number;
|
|
829
|
+
dailyPnlRatio: number;
|
|
830
|
+
dailyDownsideRatio: number;
|
|
831
|
+
maxConsecWins: number;
|
|
832
|
+
maxConsecLosses: number;
|
|
833
|
+
avgHoldHours: number;
|
|
834
|
+
limitOrderRatio: number;
|
|
835
|
+
bestTradePct: number;
|
|
836
|
+
worstTradePct: number;
|
|
837
|
+
mddPct: number;
|
|
838
|
+
mddHadStablePeak: boolean;
|
|
839
|
+
isOngoingRecovery: boolean;
|
|
840
|
+
currentDrawdownDays: number;
|
|
841
|
+
medianPnlPct: number;
|
|
842
|
+
p25PnlPct: number;
|
|
843
|
+
p75PnlPct: number;
|
|
844
|
+
|
|
845
|
+
feeDragPct: number;
|
|
846
|
+
maxRecoveryDays: number;
|
|
847
|
+
sellOrdersFilled: number;
|
|
848
|
+
fillsPerOrderMean: number;
|
|
849
|
+
fillsPerOrderMedian: number;
|
|
850
|
+
fillsPerOrderMax: number;
|
|
851
|
+
oneShotOrderRatio: number;
|
|
852
|
+
fillsPerDay: number;
|
|
853
|
+
avgVolumePerDay: number;
|
|
854
|
+
medianR: number;
|
|
855
|
+
pctRGreater1: number;
|
|
856
|
+
pctRGreater2: number;
|
|
857
|
+
pctRLessNeg1: number;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function percentile(sorted: number[], p: number): number {
|
|
861
|
+
const n = sorted.length;
|
|
862
|
+
if (n === 0) return 0;
|
|
863
|
+
if (n === 1) return sorted[0];
|
|
864
|
+
const k = (p / 100) * (n - 1);
|
|
865
|
+
const f = Math.floor(k);
|
|
866
|
+
const c = Math.ceil(k);
|
|
867
|
+
if (f === c) return sorted[f];
|
|
868
|
+
return sorted[f] * (c - k) + sorted[c] * (k - f);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function computeMetrics(pair: PairAnalysis): TradingMetrics {
|
|
872
|
+
const pnls = pair.realizedPnls;
|
|
873
|
+
const total = pnls.length;
|
|
874
|
+
if (total === 0) {
|
|
875
|
+
return {
|
|
876
|
+
totalLots: 0, winRate: 0, profitFactor: 0,
|
|
877
|
+
avgWin: 0, avgLoss: 0, avgWinLossRatio: 0,
|
|
878
|
+
expectancyBts: 0, expectancyPct: 0, expectancyR: 0,
|
|
879
|
+
netExpectancyBts: 0,
|
|
880
|
+
dailyPnlRatio: 0, dailyDownsideRatio: 0,
|
|
881
|
+
maxConsecWins: 0, maxConsecLosses: 0,
|
|
882
|
+
avgHoldHours: 0, limitOrderRatio: 0,
|
|
883
|
+
bestTradePct: 0, worstTradePct: 0,
|
|
884
|
+
mddPct: 0,
|
|
885
|
+
mddHadStablePeak: false,
|
|
886
|
+
isOngoingRecovery: false,
|
|
887
|
+
currentDrawdownDays: 0,
|
|
888
|
+
medianPnlPct: 0, p25PnlPct: 0, p75PnlPct: 0,
|
|
889
|
+
feeDragPct: 0, maxRecoveryDays: 0,
|
|
890
|
+
medianR: 0, pctRGreater1: 0, pctRGreater2: 0, pctRLessNeg1: 0,
|
|
891
|
+
sellOrdersFilled: 0, fillsPerOrderMean: 0, fillsPerOrderMedian: 0,
|
|
892
|
+
fillsPerOrderMax: 0, oneShotOrderRatio: 0, fillsPerDay: 0, avgVolumePerDay: 0,
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
const wins = pnls.filter(r => r.pnl > 0);
|
|
897
|
+
const losses = pnls.filter(r => r.pnl < 0);
|
|
898
|
+
const winRate = wins.length / total;
|
|
899
|
+
const makerEntryCount = pnls.filter(r => r.entryIsMaker).length;
|
|
900
|
+
const makerExitCount = pnls.filter(r => r.exitIsMaker).length;
|
|
901
|
+
const totalMakerLegs = makerEntryCount + makerExitCount;
|
|
902
|
+
|
|
903
|
+
const grossProfit = wins.reduce((s, r) => s + r.pnl, 0);
|
|
904
|
+
const grossLoss = Math.abs(losses.reduce((s, r) => s + r.pnl, 0));
|
|
905
|
+
const profitFactor = grossLoss > 0 ? grossProfit / grossLoss : grossProfit > 0 ? Infinity : 0;
|
|
906
|
+
const totalFeeDrag = pair.totalMarketFees + pair.totalBlockchainFees;
|
|
907
|
+
const feeDragPct = grossProfit > 0 ? (totalFeeDrag / grossProfit) * 100 : 0;
|
|
908
|
+
|
|
909
|
+
const avgWin = wins.length > 0 ? grossProfit / wins.length : 0;
|
|
910
|
+
const avgLoss = losses.length > 0 ? losses.reduce((s, r) => s + r.pnl, 0) / losses.length : 0;
|
|
911
|
+
|
|
912
|
+
const avgWinPct = wins.length > 0 ? wins.reduce((s, r) => s + r.pnlPct, 0) / wins.length : 0;
|
|
913
|
+
const avgLossPct = losses.length > 0 ? losses.reduce((s, r) => s + r.pnlPct, 0) / losses.length : 0;
|
|
914
|
+
|
|
915
|
+
const avgWinLossRatio = avgLoss !== 0 ? avgWin / Math.abs(avgLoss) : avgWin > 0 ? Infinity : 0;
|
|
916
|
+
|
|
917
|
+
const expectancyBts = (winRate * avgWin) + ((1 - winRate) * avgLoss);
|
|
918
|
+
const expectancyPct = (winRate * avgWinPct) + ((1 - winRate) * avgLossPct);
|
|
919
|
+
const rMultiple = Math.abs(avgLoss);
|
|
920
|
+
const expectancyR = rMultiple > 0
|
|
921
|
+
? winRate * (avgWin / rMultiple) - (1 - winRate)
|
|
922
|
+
: Infinity;
|
|
923
|
+
|
|
924
|
+
const netExpectancyBts = pair.totalRealizedPnlNet / total;
|
|
925
|
+
|
|
926
|
+
// Daily-binned net PnL for mean/std ratio (dimensionful — not a Sharpe ratio)
|
|
927
|
+
const dayBuckets: Record<string, number> = {};
|
|
928
|
+
for (const r of pnls) {
|
|
929
|
+
const day = r.exitTime.slice(0, 10);
|
|
930
|
+
dayBuckets[day] = (dayBuckets[day] || 0) + r.pnlNet;
|
|
931
|
+
}
|
|
932
|
+
const dailyRets = Object.values(dayBuckets);
|
|
933
|
+
const nDays = dailyRets.length;
|
|
934
|
+
|
|
935
|
+
const meanDailyRet = nDays > 0 ? dailyRets.reduce((s, v) => s + v, 0) / nDays : 0;
|
|
936
|
+
const dailyVar = nDays > 0
|
|
937
|
+
? dailyRets.reduce((s, v) => s + (v - meanDailyRet) ** 2, 0) / nDays
|
|
938
|
+
: 0;
|
|
939
|
+
const dailyStd = Math.sqrt(dailyVar);
|
|
940
|
+
const annFactor = Math.sqrt(365);
|
|
941
|
+
const dailyPnlRatio = dailyStd > 0 ? (meanDailyRet / dailyStd) * annFactor : 0;
|
|
942
|
+
|
|
943
|
+
// Downside deviation uses only negative returns; same N denominator
|
|
944
|
+
const downsideVar = nDays > 0
|
|
945
|
+
? dailyRets.reduce((s, v) => s + (v < 0 ? v * v : 0), 0) / nDays
|
|
946
|
+
: 0;
|
|
947
|
+
const downsideStd = Math.sqrt(downsideVar);
|
|
948
|
+
const dailyDownsideRatio = downsideStd > 0 ? (meanDailyRet / downsideStd) * annFactor : 0;
|
|
949
|
+
|
|
950
|
+
// Fills-per-order distribution (grouped by sell order)
|
|
951
|
+
const fillCounts: number[] = [];
|
|
952
|
+
const orderMap = new Map<string, number>();
|
|
953
|
+
for (const r of pnls) {
|
|
954
|
+
orderMap.set(r.exitOrderId, (orderMap.get(r.exitOrderId) || 0) + 1);
|
|
955
|
+
}
|
|
956
|
+
for (const c of orderMap.values()) fillCounts.push(c);
|
|
957
|
+
const sellOrdersFilled = orderMap.size;
|
|
958
|
+
const fillsPerOrderMean = sellOrdersFilled > 0
|
|
959
|
+
? fillCounts.reduce((s, v) => s + v, 0) / sellOrdersFilled
|
|
960
|
+
: 0;
|
|
961
|
+
const fillsPerOrderMax = sellOrdersFilled > 0
|
|
962
|
+
? fillCounts.reduce((a, b) => Math.max(a, b), 0)
|
|
963
|
+
: 0;
|
|
964
|
+
const sortedCounts = [...fillCounts].sort((a, b) => a - b);
|
|
965
|
+
const fillsPerOrderMedian = sellOrdersFilled > 0 ? percentile(sortedCounts, 50) : 0;
|
|
966
|
+
const oneShotOrderRatio = sellOrdersFilled > 0
|
|
967
|
+
? fillCounts.filter(c => c === 1).length / sellOrdersFilled
|
|
968
|
+
: 0;
|
|
969
|
+
const fillsPerDay = nDays > 0 ? total / nDays : 0;
|
|
970
|
+
const avgVolumePerDay = nDays > 0 ? (pair.totalBuyQuote + pair.totalSellQuote) / nDays : 0;
|
|
971
|
+
|
|
972
|
+
// Avg hold duration
|
|
973
|
+
let totalHours = 0;
|
|
974
|
+
let hourCount = 0;
|
|
975
|
+
for (const r of pnls) {
|
|
976
|
+
const entry = new Date(r.entryTime).getTime();
|
|
977
|
+
const exit = new Date(r.exitTime).getTime();
|
|
978
|
+
if (!isNaN(entry) && !isNaN(exit) && exit > entry) {
|
|
979
|
+
totalHours += (exit - entry) / 3600000;
|
|
980
|
+
hourCount++;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const avgHoldHours = hourCount > 0 ? totalHours / hourCount : 0;
|
|
984
|
+
|
|
985
|
+
// Max consecutive wins / losses (aggregated by exit order)
|
|
986
|
+
const orderPnls = new Map<string, { pnl: number; time: string }>();
|
|
987
|
+
for (const r of pnls) {
|
|
988
|
+
const existing = orderPnls.get(r.exitOrderId);
|
|
989
|
+
if (existing) {
|
|
990
|
+
existing.pnl += r.pnl;
|
|
991
|
+
} else {
|
|
992
|
+
orderPnls.set(r.exitOrderId, { pnl: r.pnl, time: r.exitTime });
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
const orderResults = [...orderPnls.values()].sort((a, b) =>
|
|
996
|
+
new Date(a.time).getTime() - new Date(b.time).getTime()
|
|
997
|
+
);
|
|
998
|
+
let consecW = 0, consecL = 0;
|
|
999
|
+
let maxW = 0, maxL = 0;
|
|
1000
|
+
for (const { pnl } of orderResults) {
|
|
1001
|
+
if (pnl > 0) { consecW++; consecL = 0; maxW = Math.max(maxW, consecW); }
|
|
1002
|
+
else if (pnl < 0) { consecL++; consecW = 0; maxL = Math.max(maxL, consecL); }
|
|
1003
|
+
else { consecW = 0; consecL = 0; }
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// ─── Max Drawdown + Recovery Time ───────────────────────────────────
|
|
1007
|
+
const STABILITY_TRADES = 3;
|
|
1008
|
+
const MIN_TRADES_FOR_PEAK = 10; // backstop for monotonic equity curves
|
|
1009
|
+
const chronological = [...pnls].sort((a, b) =>
|
|
1010
|
+
new Date(a.exitTime).getTime() - new Date(b.exitTime).getTime()
|
|
1011
|
+
);
|
|
1012
|
+
let equity = 0, peak = 0, mddPct = 0;
|
|
1013
|
+
let maxRecoveryDays = 0;
|
|
1014
|
+
let isOngoingRecovery = false;
|
|
1015
|
+
let currentDrawdownDays = 0;
|
|
1016
|
+
let drawdownStartTime = 0;
|
|
1017
|
+
let troughTime = 0;
|
|
1018
|
+
let currentTroughEquity = Infinity;
|
|
1019
|
+
let hadStablePeak = false;
|
|
1020
|
+
let tradesSincePeakSet = 0;
|
|
1021
|
+
let hasPrePeakEquity = false;
|
|
1022
|
+
let prePeakMinEquity = 0;
|
|
1023
|
+
let totalTradesProcessed = 0;
|
|
1024
|
+
|
|
1025
|
+
for (const r of chronological) {
|
|
1026
|
+
totalTradesProcessed++;
|
|
1027
|
+
equity += r.pnlNet;
|
|
1028
|
+
if (equity > peak) {
|
|
1029
|
+
if (troughTime > 0 && hadStablePeak) {
|
|
1030
|
+
const recoveryDays = (new Date(r.exitTime).getTime() - troughTime) / 86400000;
|
|
1031
|
+
if (recoveryDays > maxRecoveryDays) maxRecoveryDays = recoveryDays;
|
|
1032
|
+
}
|
|
1033
|
+
peak = equity;
|
|
1034
|
+
tradesSincePeakSet = 0;
|
|
1035
|
+
currentTroughEquity = Infinity;
|
|
1036
|
+
troughTime = 0;
|
|
1037
|
+
drawdownStartTime = 0;
|
|
1038
|
+
} else {
|
|
1039
|
+
tradesSincePeakSet++;
|
|
1040
|
+
if (tradesSincePeakSet >= STABILITY_TRADES) {
|
|
1041
|
+
hadStablePeak = true;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
if (!hadStablePeak && totalTradesProcessed >= MIN_TRADES_FOR_PEAK) {
|
|
1045
|
+
hadStablePeak = true;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (hadStablePeak && equity < peak && peak > 0) {
|
|
1049
|
+
if (drawdownStartTime === 0) drawdownStartTime = new Date(r.exitTime).getTime();
|
|
1050
|
+
if (equity < currentTroughEquity) {
|
|
1051
|
+
currentTroughEquity = equity;
|
|
1052
|
+
troughTime = new Date(r.exitTime).getTime();
|
|
1053
|
+
}
|
|
1054
|
+
const dd = (equity - peak) / peak;
|
|
1055
|
+
if (dd < mddPct) mddPct = dd;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
if (peak > 0 && !hadStablePeak) {
|
|
1059
|
+
if (!hasPrePeakEquity || equity < prePeakMinEquity) {
|
|
1060
|
+
prePeakMinEquity = equity;
|
|
1061
|
+
hasPrePeakEquity = true;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
if (drawdownStartTime > 0 && hadStablePeak) {
|
|
1067
|
+
const lastTime = new Date(chronological[chronological.length - 1].exitTime).getTime();
|
|
1068
|
+
currentDrawdownDays = (lastTime - drawdownStartTime) / 86400000;
|
|
1069
|
+
isOngoingRecovery = true;
|
|
1070
|
+
if (currentDrawdownDays > maxRecoveryDays) {
|
|
1071
|
+
maxRecoveryDays = currentDrawdownDays;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
if (hadStablePeak) {
|
|
1076
|
+
mddPct *= 100;
|
|
1077
|
+
} else {
|
|
1078
|
+
mddPct = hasPrePeakEquity ? prePeakMinEquity : 0;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// Payoff distribution stats
|
|
1082
|
+
const pnlPcts = [...pnls.map(r => r.pnlPct)].sort((a, b) => a - b);
|
|
1083
|
+
const medianPnlPct = percentile(pnlPcts, 50);
|
|
1084
|
+
const p25PnlPct = percentile(pnlPcts, 25);
|
|
1085
|
+
const p75PnlPct = percentile(pnlPcts, 75);
|
|
1086
|
+
const absAvgLoss = Math.abs(avgLoss);
|
|
1087
|
+
let rValues: number[] = [];
|
|
1088
|
+
if (absAvgLoss > 0) {
|
|
1089
|
+
rValues = pnls.map(r => r.pnl / absAvgLoss).sort((a, b) => a - b);
|
|
1090
|
+
}
|
|
1091
|
+
const medianR = rValues.length > 0 ? percentile(rValues, 50) : 0;
|
|
1092
|
+
const pctRGreater1 = rValues.length > 0 ? rValues.filter(r => r > 1).length / rValues.length : 0;
|
|
1093
|
+
const pctRGreater2 = rValues.length > 0 ? rValues.filter(r => r > 2).length / rValues.length : 0;
|
|
1094
|
+
const pctRLessNeg1 = rValues.length > 0 ? rValues.filter(r => r < -1).length / rValues.length : 0;
|
|
1095
|
+
|
|
1096
|
+
const bestTradePct = pnlPcts.length > 0 ? pnlPcts[pnlPcts.length - 1] : 0;
|
|
1097
|
+
const worstTradePct = pnlPcts.length > 0 ? pnlPcts[0] : 0;
|
|
1098
|
+
|
|
1099
|
+
return {
|
|
1100
|
+
totalLots: total,
|
|
1101
|
+
winRate,
|
|
1102
|
+
profitFactor,
|
|
1103
|
+
avgWin,
|
|
1104
|
+
avgLoss,
|
|
1105
|
+
avgWinLossRatio,
|
|
1106
|
+
expectancyBts,
|
|
1107
|
+
expectancyPct,
|
|
1108
|
+
expectancyR,
|
|
1109
|
+
netExpectancyBts,
|
|
1110
|
+
dailyPnlRatio,
|
|
1111
|
+
dailyDownsideRatio,
|
|
1112
|
+
feeDragPct,
|
|
1113
|
+
maxConsecWins: maxW,
|
|
1114
|
+
maxConsecLosses: maxL,
|
|
1115
|
+
avgHoldHours,
|
|
1116
|
+
limitOrderRatio: total > 0 ? totalMakerLegs / (total * 2) : 0,
|
|
1117
|
+
bestTradePct,
|
|
1118
|
+
worstTradePct,
|
|
1119
|
+
mddPct,
|
|
1120
|
+
mddHadStablePeak: hadStablePeak,
|
|
1121
|
+
isOngoingRecovery,
|
|
1122
|
+
currentDrawdownDays,
|
|
1123
|
+
maxRecoveryDays,
|
|
1124
|
+
medianPnlPct,
|
|
1125
|
+
p25PnlPct,
|
|
1126
|
+
p75PnlPct,
|
|
1127
|
+
medianR,
|
|
1128
|
+
pctRGreater1,
|
|
1129
|
+
pctRGreater2,
|
|
1130
|
+
pctRLessNeg1,
|
|
1131
|
+
sellOrdersFilled,
|
|
1132
|
+
fillsPerOrderMean,
|
|
1133
|
+
fillsPerOrderMedian,
|
|
1134
|
+
fillsPerOrderMax,
|
|
1135
|
+
oneShotOrderRatio,
|
|
1136
|
+
fillsPerDay,
|
|
1137
|
+
avgVolumePerDay,
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
function printMetrics(pairs: PairAnalysis[]) {
|
|
1142
|
+
for (const pair of pairs) {
|
|
1143
|
+
if (pair.realizedPnls.length === 0) continue;
|
|
1144
|
+
|
|
1145
|
+
const m = computeMetrics(pair);
|
|
1146
|
+
const pairLabel = `${fmtAsset(pair.baseAsset)}/${fmtAsset(pair.quoteAsset)}`;
|
|
1147
|
+
|
|
1148
|
+
console.log('');
|
|
1149
|
+
console.log(` ── ${pairLabel} — Performance Metrics`);
|
|
1150
|
+
console.log('');
|
|
1151
|
+
// Edge
|
|
1152
|
+
console.log(` Win Rate: ${(m.winRate * 100).toFixed(1)}%`);
|
|
1153
|
+
console.log(` Profit Factor: ${m.profitFactor === Infinity ? '∞' : m.profitFactor.toFixed(2)}`);
|
|
1154
|
+
const mktFeeStr = pair.totalMarketFees > 0.0001 ? ` (market ${fmt(pair.totalMarketFees, 4)})` : '';
|
|
1155
|
+
const blkFeeStr = pair.totalBlockchainFees > 0.0001 ? ` (op ${fmt(pair.totalBlockchainFees, 4)} BTS)` : '';
|
|
1156
|
+
console.log(` Fee Drag: ${m.feeDragPct > 0 ? m.feeDragPct.toFixed(2) + '% of gross profit' + mktFeeStr + blkFeeStr : '—'}`);
|
|
1157
|
+
console.log(` Avg Win / Avg Loss: ${m.avgWinLossRatio === Infinity ? '∞' : m.avgWinLossRatio.toFixed(2)}`);
|
|
1158
|
+
const qSymbol = fmtAsset(pair.quoteAsset);
|
|
1159
|
+
console.log(` Expectancy (gross): ${fmt(m.expectancyBts, 4)} ${qSymbol} (${fmtPct(m.expectancyPct)}) per trade`);
|
|
1160
|
+
const rDisplay = m.expectancyR === Infinity ? '∞' : m.expectancyR.toFixed(3) + 'R';
|
|
1161
|
+
console.log(` Expectancy (R): ${rDisplay}`);
|
|
1162
|
+
console.log(` Expectancy (net): ${fmt(m.netExpectancyBts, 4)} ${qSymbol} per trade`);
|
|
1163
|
+
console.log('');
|
|
1164
|
+
// Edge quality
|
|
1165
|
+
console.log(` Median R: ${m.medianR.toFixed(2)}`);
|
|
1166
|
+
console.log(` Trades > 1R / > 2R: ${(m.pctRGreater1 * 100).toFixed(1)}% / ${(m.pctRGreater2 * 100).toFixed(1)}%`);
|
|
1167
|
+
console.log(` Trades < -1R: ${(m.pctRLessNeg1 * 100).toFixed(1)}%`);
|
|
1168
|
+
console.log('');
|
|
1169
|
+
// PnL distribution
|
|
1170
|
+
console.log(` Median PnL: ${fmtPct(m.medianPnlPct)}`);
|
|
1171
|
+
console.log(` P25 / P75: ${fmtPct(m.p25PnlPct)} / ${fmtPct(m.p75PnlPct)}`);
|
|
1172
|
+
console.log(` Best / Worst Trade: ${fmtPct(m.bestTradePct)} / ${fmtPct(m.worstTradePct)}`);
|
|
1173
|
+
console.log('');
|
|
1174
|
+
// Risk-adjusted (dimensionful — based on absolute daily PnL, not % returns)
|
|
1175
|
+
console.log(` Sharpe (ann): ${m.dailyPnlRatio.toFixed(2)}`);
|
|
1176
|
+
console.log(` Sortino (ann): ${m.dailyDownsideRatio.toFixed(2)}`);
|
|
1177
|
+
console.log('');
|
|
1178
|
+
// Tail risk
|
|
1179
|
+
if (m.mddHadStablePeak) {
|
|
1180
|
+
console.log(` Max Drawdown: ${fmtPct(m.mddPct)}`);
|
|
1181
|
+
} else {
|
|
1182
|
+
console.log(` Min Equity: ${fmt(m.mddPct, 4)} ${fmtAsset(pair.quoteAsset)}`);
|
|
1183
|
+
}
|
|
1184
|
+
const recLabel = m.maxRecoveryDays > 0 ? m.maxRecoveryDays.toFixed(1) + ' days' + (m.isOngoingRecovery ? ' (ongoing)' : '') : '—';
|
|
1185
|
+
console.log(` Max Recovery Time: ${recLabel}`);
|
|
1186
|
+
if (m.currentDrawdownDays > 0) {
|
|
1187
|
+
console.log(` Current Drawdown: ${m.currentDrawdownDays.toFixed(1)} days (active)`);
|
|
1188
|
+
}
|
|
1189
|
+
console.log('');
|
|
1190
|
+
// Behavioral
|
|
1191
|
+
console.log(` Max Consecutive W/L: ${m.maxConsecWins} / ${m.maxConsecLosses}`);
|
|
1192
|
+
const holdDisplay = m.avgHoldHours > 0 ? m.avgHoldHours.toFixed(1) : '—';
|
|
1193
|
+
console.log(` Avg hold time: ${holdDisplay} hours`);
|
|
1194
|
+
console.log(` Maker / Taker: ${(m.limitOrderRatio * 100).toFixed(1)}% / ${((1 - m.limitOrderRatio) * 100).toFixed(1)}%`);
|
|
1195
|
+
console.log('');
|
|
1196
|
+
// Activity
|
|
1197
|
+
console.log(` Sell orders filled: ${m.sellOrdersFilled}`);
|
|
1198
|
+
console.log(` Partial fills/order: ${m.fillsPerOrderMean.toFixed(2)} mean, ${m.fillsPerOrderMedian.toFixed(1)} med, ${m.fillsPerOrderMax} max`);
|
|
1199
|
+
console.log(` One-shot orders: ${(m.oneShotOrderRatio * 100).toFixed(0)}%`);
|
|
1200
|
+
console.log(` Fills/day: ${m.fillsPerDay.toFixed(2)}`);
|
|
1201
|
+
console.log(` Avg vol/day: ${fmt(m.avgVolumePerDay, 2)} ${fmtAsset(pair.quoteAsset)}`);
|
|
1202
|
+
console.log('');
|
|
1203
|
+
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
// Grand totals grouped by quote asset
|
|
1207
|
+
const quoteGroups = new Map<string, PairAnalysis[]>();
|
|
1208
|
+
for (const p of pairs) {
|
|
1209
|
+
const q = p.quoteAsset;
|
|
1210
|
+
if (!quoteGroups.has(q)) quoteGroups.set(q, []);
|
|
1211
|
+
quoteGroups.get(q)!.push(p);
|
|
1212
|
+
}
|
|
1213
|
+
if (pairs.length > 1 && quoteGroups.size > 0) {
|
|
1214
|
+
for (const [quoteAsset, group] of quoteGroups) {
|
|
1215
|
+
const totalLots = group.reduce((s, p) => s + p.realizedPnls.length, 0);
|
|
1216
|
+
const totalNet = group.reduce((s, p) => s + p.totalRealizedPnlNet, 0);
|
|
1217
|
+
const totalMktFees = group.reduce((s, p) => s + p.totalMarketFees, 0);
|
|
1218
|
+
const totalBlkFees = group.reduce((s, p) => s + p.totalBlockchainFees, 0);
|
|
1219
|
+
const qSymbol = fmtAsset(quoteAsset);
|
|
1220
|
+
console.log(` ── TOTAL (${qSymbol}) — ${group.length} pair(s)`);
|
|
1221
|
+
console.log(` Lots: ${totalLots}`);
|
|
1222
|
+
const feeParts: string[] = [];
|
|
1223
|
+
if (totalMktFees > 0.0001) feeParts.push(`market ${fmt(totalMktFees, 4)} ${qSymbol}`);
|
|
1224
|
+
if (totalBlkFees > 0.0001) feeParts.push(`op ${fmt(totalBlkFees, 4)} BTS`);
|
|
1225
|
+
const feeSuffix = feeParts.length > 0 ? ` (${feeParts.join(', ')})` : '';
|
|
1226
|
+
console.log(` Net PnL: ${fmtAsset(quoteAsset)} ${fmt(totalNet, 4)}${feeSuffix}`);
|
|
1227
|
+
console.log('');
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// ─── CSV Export ──────────────────────────────────────────────────────────────
|
|
1233
|
+
|
|
1234
|
+
function exportCsv(pairs: PairAnalysis[], filePath: string) {
|
|
1235
|
+
const esc = (v: any) => { const s = String(v); return /[,"\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s; };
|
|
1236
|
+
const lines = ['time,orderId,direction,baseAsset,quoteAsset,baseAmount,quoteAmount,price,isMaker,marketFeeReal,marketFeeAsset'];
|
|
1237
|
+
|
|
1238
|
+
for (const pair of pairs) {
|
|
1239
|
+
for (const t of [...pair.buys, ...pair.sells].sort((a, b) => a.sequence - b.sequence)) {
|
|
1240
|
+
lines.push([
|
|
1241
|
+
esc(t.time),
|
|
1242
|
+
esc(t.orderId),
|
|
1243
|
+
esc(t.direction),
|
|
1244
|
+
esc(t.baseAsset),
|
|
1245
|
+
esc(t.quoteAsset),
|
|
1246
|
+
t.baseAmount,
|
|
1247
|
+
t.quoteAmount,
|
|
1248
|
+
t.price,
|
|
1249
|
+
t.isMaker ? '1' : '0',
|
|
1250
|
+
t.marketFeeReal,
|
|
1251
|
+
esc(t.marketFeeAsset),
|
|
1252
|
+
].join(','));
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
fs.writeFileSync(filePath, lines.join('\n'), 'utf-8');
|
|
1257
|
+
console.log(` Trades exported to ${filePath}`);
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// ─── JSON Export ─────────────────────────────────────────────────────────────
|
|
1261
|
+
|
|
1262
|
+
function exportJson(accountId: string, start: string, end: string, pairs: PairAnalysis[], filePath: string) {
|
|
1263
|
+
const data = {
|
|
1264
|
+
accountId,
|
|
1265
|
+
period: { start, end },
|
|
1266
|
+
pairs: pairs.map(p => ({
|
|
1267
|
+
baseAsset: p.baseAsset,
|
|
1268
|
+
quoteAsset: p.quoteAsset,
|
|
1269
|
+
summary: {
|
|
1270
|
+
totalBuyBase: p.totalBuyBase,
|
|
1271
|
+
totalSellBase: p.totalSellBase,
|
|
1272
|
+
totalBuyQuote: p.totalBuyQuote,
|
|
1273
|
+
totalSellQuote: p.totalSellQuote,
|
|
1274
|
+
netPosition: p.netPosition,
|
|
1275
|
+
totalRealizedPnl: p.totalRealizedPnl,
|
|
1276
|
+
totalMarketFees: p.totalMarketFees,
|
|
1277
|
+
totalBlockchainFees: p.totalBlockchainFees,
|
|
1278
|
+
totalRealizedPnlNet: p.totalRealizedPnlNet,
|
|
1279
|
+
},
|
|
1280
|
+
realizedPnls: p.realizedPnls.map(r => ({
|
|
1281
|
+
...r,
|
|
1282
|
+
marketFeeEntry: r.marketFeeEntry,
|
|
1283
|
+
marketFeeExit: r.marketFeeExit,
|
|
1284
|
+
feeBts: r.feeBts,
|
|
1285
|
+
pnlNet: r.pnlNet,
|
|
1286
|
+
pnlNetPct: r.pnlNetPct,
|
|
1287
|
+
})),
|
|
1288
|
+
totalBuys: p.buys.length,
|
|
1289
|
+
totalSells: p.sells.length,
|
|
1290
|
+
})),
|
|
1291
|
+
};
|
|
1292
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf-8');
|
|
1293
|
+
console.log(` Full analysis exported to ${filePath}`);
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
// ─── Main ────────────────────────────────────────────────────────────────────
|
|
1297
|
+
|
|
1298
|
+
async function run() {
|
|
1299
|
+
const opts = parseArgs();
|
|
1300
|
+
let accountId = opts.accountId;
|
|
1301
|
+
|
|
1302
|
+
if (opts.lookup) {
|
|
1303
|
+
const resolved = await resolveAccountId(accountId, opts.node);
|
|
1304
|
+
if (!resolved) {
|
|
1305
|
+
console.error(` Could not resolve "${accountId}" to an account ID`);
|
|
1306
|
+
process.exit(1);
|
|
1307
|
+
}
|
|
1308
|
+
accountId = resolved;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// Build time range
|
|
1312
|
+
const now = new Date();
|
|
1313
|
+
let gte: string, lte: string;
|
|
1314
|
+
|
|
1315
|
+
if (opts.start && opts.end) {
|
|
1316
|
+
gte = opts.start;
|
|
1317
|
+
lte = opts.end;
|
|
1318
|
+
} else if (opts.start) {
|
|
1319
|
+
gte = opts.start;
|
|
1320
|
+
lte = now.toISOString();
|
|
1321
|
+
} else {
|
|
1322
|
+
const hours = opts.hours || 168;
|
|
1323
|
+
const start = new Date(now.getTime() - hours * 3600 * 1000);
|
|
1324
|
+
gte = start.toISOString();
|
|
1325
|
+
lte = now.toISOString();
|
|
1326
|
+
}
|
|
1327
|
+
|
|
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
|
+
const KIBANA_CFG = { timeout: 60000 };
|
|
1333
|
+
|
|
1334
|
+
const fills = await fetchAllFills(KIBANA_CFG, accountId, gte, lte);
|
|
1335
|
+
|
|
1336
|
+
if (fills.length === 0) {
|
|
1337
|
+
console.log(' No fills found in the specified time range.');
|
|
1338
|
+
process.exit(0);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
// Resolve unknown asset precisions from blockchain
|
|
1342
|
+
await resolveAssetPrecisions(fills, opts.node);
|
|
1343
|
+
|
|
1344
|
+
// Classify fills
|
|
1345
|
+
const { trades, pairs } = classifyFills(fills, opts.asset);
|
|
1346
|
+
|
|
1347
|
+
if (trades.length === 0) {
|
|
1348
|
+
console.log(' No trades could be classified (check asset filter or time range).');
|
|
1349
|
+
process.exit(0);
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
console.log(`Account: ${accountId}`);
|
|
1353
|
+
console.log(`Period: ${gte.slice(0, 10)} → ${lte.slice(0, 10)}`);
|
|
1354
|
+
console.log(`Pairs: ${pairs.size}, ${trades.length} classified trades`);
|
|
1355
|
+
const hasCrossPair = [...pairs].some(p => p.split(':')[1] !== BTS_ID);
|
|
1356
|
+
if (hasCrossPair) {
|
|
1357
|
+
console.log(` Note: cross-pair trades (non-BTS quote) are included but PnL is in the pair's quote asset.`);
|
|
1358
|
+
}
|
|
1359
|
+
console.log('');
|
|
1360
|
+
|
|
1361
|
+
// Override blockchain fee from CLI if provided
|
|
1362
|
+
if (opts.feePerOrder) BLOCKCHAIN_FEE_PER_FILL = opts.feePerOrder;
|
|
1363
|
+
|
|
1364
|
+
// Analyze each pair
|
|
1365
|
+
const pairMap = new Map<string, TradeFill[]>();
|
|
1366
|
+
for (const t of trades) {
|
|
1367
|
+
const pairKey = `${t.baseAsset}:${t.quoteAsset}`;
|
|
1368
|
+
if (!pairMap.has(pairKey)) pairMap.set(pairKey, []);
|
|
1369
|
+
pairMap.get(pairKey)!.push(t);
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
const analyses: PairAnalysis[] = [];
|
|
1373
|
+
for (const [key, pairTrades] of pairMap) {
|
|
1374
|
+
const analysis = analyzePair(pairTrades, opts.matchMode);
|
|
1375
|
+
analyses.push(analysis);
|
|
1376
|
+
|
|
1377
|
+
if (opts.verbose) {
|
|
1378
|
+
const [base, quote] = key.split(':');
|
|
1379
|
+
console.log(` ${fmtAsset(base)}/${fmtAsset(quote)}: ${pairTrades.filter(t => t.direction === 'buy').length} buys, ${pairTrades.filter(t => t.direction === 'sell').length} sells, ${analysis.realizedPnls.length} matched lots`);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
// Sort pairs by volume (total quote)
|
|
1384
|
+
analyses.sort((a, b) => (b.totalBuyQuote + b.totalSellQuote) - (a.totalBuyQuote + a.totalSellQuote));
|
|
1385
|
+
|
|
1386
|
+
// Output: summaries → grand total → per-match detail
|
|
1387
|
+
printSummary(analyses, accountId, gte, lte, opts.matchMode);
|
|
1388
|
+
|
|
1389
|
+
if (opts.showPnlDetail) {
|
|
1390
|
+
printPnlDetail(analyses);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
printMetrics(analyses);
|
|
1394
|
+
|
|
1395
|
+
if (opts.csv) {
|
|
1396
|
+
exportCsv(analyses, opts.csv);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
if (opts.json) {
|
|
1400
|
+
exportJson(accountId, gte, lte, analyses, opts.json);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
export { analyzePair, classifyFills, computeMetrics, TradeFill, FillRecord, RealizedPnl, PairAnalysis, TradingMetrics };
|
|
1405
|
+
|
|
1406
|
+
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
1407
|
+
run().then(() => process.exit(0)).catch(e => {
|
|
1408
|
+
console.error('\n[fatal]', e.message);
|
|
1409
|
+
if (process.env.DEBUG) console.error(e.stack);
|
|
1410
|
+
process.exit(1);
|
|
1411
|
+
});
|
|
1412
|
+
}
|