dexbot 1.4.19 → 1.4.21
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 +36 -0
- package/README.md +22 -12
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +2 -2
- package/analysis/ama_fitting/calibrate_convergence_er.ts +1 -1
- package/analysis/ama_fitting/optimizer_high_resolution.ts +2 -1
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/analyze_derivatives.ts +4 -2
- package/analysis/analyze_dynamic_weight.ts +3 -1
- package/analysis/analyze_kalman.ts +3 -1
- package/analysis/analyze_regime.ts +3 -1
- package/analysis/analyze_regime_windows.ts +3 -1
- package/analysis/analyze_volatility.ts +2 -2
- package/analysis/bot_fitting/backtest_ama_sweep.ts +2 -1
- package/analysis/bot_fitting/backtest_bot_fitting.ts +17 -12
- package/analysis/bot_fitting/shared_utils.ts +1 -1
- package/analysis/bot_key_utils.ts +1 -5
- package/analysis/bot_usage/kibana_bot_queries.ts +1 -256
- package/analysis/chart_css.ts +1 -1
- package/analysis/chart_utils.ts +24 -0
- package/analysis/derivative_chart_generator.ts +3 -2
- package/analysis/math_utils.ts +1 -8
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +91 -55
- package/analysis/trend_detection/package.json +1 -1
- package/claw/ecosystem.config.cjs +2 -3
- package/claw/examples/claw_profiles_example.ts +4 -1
- package/claw/examples/memu_integration_example.ts +17 -17
- package/claw/modules/chain_actions.ts +51 -54
- package/claw/modules/chain_broadcast.ts +66 -104
- package/claw/modules/claw_bridge.ts +60 -80
- package/claw/modules/claw_catalog.ts +48 -17
- package/claw/modules/claw_infra.ts +1 -5
- package/claw/modules/claw_launcher.ts +47 -49
- package/claw/modules/claw_skill_md.ts +14 -16
- package/claw/modules/credit_runtime_adapter.ts +2 -18
- package/claw/modules/decision_loop.ts +4 -0
- package/claw/modules/dexbot_bridge.ts +1 -1
- package/claw/modules/dexbot_profiles.ts +8 -22
- package/claw/modules/honest_ecosystem.ts +24 -8
- package/claw/modules/launcher_paths.ts +4 -2
- package/claw/modules/liquidity_pools.ts +10 -3
- package/claw/modules/mcp_utils.ts +109 -0
- package/claw/modules/memu_bridge.ts +76 -54
- package/claw/modules/mpa_utils.ts +26 -3
- package/claw/modules/position_discovery.ts +16 -27
- package/claw/modules/position_manager.ts +32 -41
- package/claw/modules/position_manager_watch.ts +3 -2
- package/claw/modules/short_mpa_strategy.ts +1 -9
- package/claw/modules/skill_utils.ts +5 -3
- package/claw/modules/utils.ts +9 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/index.ts +27 -10
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/scripts/claw_bridge.ts +1 -1
- package/claw/scripts/claw_mcp_server.ts +19 -78
- package/claw/scripts/honest_assets_report.ts +19 -84
- package/claw/scripts/memu_mcp_server.ts +57 -155
- package/claw/tests/test_claw_bridge.ts +6 -2
- package/claw/tests/test_claw_mcp_transport.ts +2 -2
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +2 -2
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +1 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +2 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -1
- package/dist/analysis/analyze_derivatives.d.ts.map +1 -1
- package/dist/analysis/analyze_derivatives.js +4 -2
- package/dist/analysis/analyze_derivatives.js.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.js +3 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
- package/dist/analysis/analyze_kalman.js +3 -1
- package/dist/analysis/analyze_kalman.js.map +1 -1
- package/dist/analysis/analyze_regime.js +3 -1
- package/dist/analysis/analyze_regime.js.map +1 -1
- package/dist/analysis/analyze_regime_windows.js +3 -1
- package/dist/analysis/analyze_regime_windows.js.map +1 -1
- package/dist/analysis/analyze_volatility.js +2 -2
- package/dist/analysis/analyze_volatility.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +2 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +18 -13
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts +1 -12
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.js +1 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -1
- package/dist/analysis/bot_key_utils.d.ts +1 -1
- package/dist/analysis/bot_key_utils.d.ts.map +1 -1
- package/dist/analysis/bot_key_utils.js +1 -5
- package/dist/analysis/bot_key_utils.js.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +1 -337
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +1 -241
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -1
- package/dist/analysis/chart_css.d.ts +1 -15
- package/dist/analysis/chart_css.d.ts.map +1 -1
- package/dist/analysis/chart_css.js +1 -1
- package/dist/analysis/chart_css.js.map +1 -1
- package/dist/analysis/chart_utils.d.ts +0 -3
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +25 -0
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/derivative_chart_generator.d.ts.map +1 -1
- package/dist/analysis/derivative_chart_generator.js +3 -2
- package/dist/analysis/derivative_chart_generator.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +3 -5
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +3 -5
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +82 -50
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
- package/dist/bot.js +2 -2
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.js +1 -1
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +20 -17
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +3 -3
- package/dist/market_adapter/core/kibana_client.d.ts +1 -3
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +1 -1
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +1 -2
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +9 -4
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +1 -2
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -2
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +5 -5
- package/dist/market_adapter/inputs/fetch_lp_data.js +5 -5
- package/dist/market_adapter/inputs/kibana_source.d.ts +1 -2
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +1 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +1 -2
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +4 -4
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +2 -1
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/modules/account_bots.d.ts +3 -0
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +156 -46
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +1 -7
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +9 -17
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +2 -14
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +22 -31
- 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.js +2 -2
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +2 -3
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +8 -25
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts +2 -0
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +6 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +0 -1
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +1 -5
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/credential_policy.js +1 -1
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +3 -2
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +0 -7
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +95 -0
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +22 -2
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +5 -2
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +6 -7
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +6 -0
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +2 -3
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +7 -15
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +1 -0
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -2
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +1 -4
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/order/accounting.js +2 -2
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/format.d.ts +0 -8
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +0 -8
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +146 -32
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/logger.js +1 -1
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +1 -13
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +1 -11
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +13 -0
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +75 -2
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.d.ts +0 -5
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
- package/dist/modules/order/processed_fill_store.js +1 -12
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +10 -3
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +80 -1
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +138 -2
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +10 -2
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/paths.d.ts +26 -1
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +39 -6
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/runtime_settings.js +3 -1
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +3 -1
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/storage/browser_adapter.d.ts +8 -3
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
- package/dist/modules/storage/browser_adapter.js +53 -4
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/utils/sanitize_key.d.ts +7 -0
- package/dist/modules/utils/sanitize_key.d.ts.map +1 -0
- package/dist/modules/utils/sanitize_key.js +15 -0
- package/dist/modules/utils/sanitize_key.js.map +1 -0
- package/dist/pm2.js +6 -6
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.js +2 -1
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts +2 -2
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +6 -14
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/runner.js +1 -1
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/update.js +1 -1
- package/dist/scripts/update.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +63 -18
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +5 -14
- package/docs/COW_INVARIANTS.md +4 -4
- package/docs/CREDENTIAL_SECURITY.md +0 -11
- package/docs/DEXBOT_COMPARISON.md +11 -11
- package/docs/EVOLUTION.md +12 -10
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +27 -83
- package/docs/GRID_RECALCULATION.md +1 -13
- package/docs/GRID_RECONCILE.md +24 -24
- package/docs/LIFECYCLE.md +4 -4
- package/docs/LOGGING.md +1 -1
- package/docs/MPA_CREDIT_USAGE.md +3 -3
- package/docs/README.md +2 -2
- package/docs/WORKFLOW.md +2 -2
- package/docs/architecture.md +43 -38
- package/docs/developer_guide.md +16 -18
- package/market_adapter/README.md +0 -2
- package/modules/README.md +2 -1
- package/package.json +2 -3
- package/scripts/README.md +1 -1
- package/scripts/lib/dexbot-paths.sh +20 -11
- package/claw/openclaw.plugin.json +0 -13
- package/dist/market_adapter/merge_lp_data.d.ts +0 -3
- package/dist/market_adapter/merge_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/merge_lp_data.js +0 -125
- package/dist/market_adapter/merge_lp_data.js.map +0 -1
- package/dist/market_adapter/utils/paths.d.ts +0 -3
- package/dist/market_adapter/utils/paths.d.ts.map +0 -1
- package/dist/market_adapter/utils/paths.js +0 -5
- package/dist/market_adapter/utils/paths.js.map +0 -1
|
@@ -33,251 +33,11 @@
|
|
|
33
33
|
* op_object.order — the order ID cancelled
|
|
34
34
|
*/
|
|
35
35
|
import { kibanaSearch } from '../../market_adapter/core/kibana_client.js';
|
|
36
|
-
declare const OP_LIMIT_ORDER_CREATE = 1;
|
|
37
|
-
declare const OP_LIMIT_ORDER_CANCEL = 2;
|
|
38
|
-
declare const OP_FILL_ORDER = 4;
|
|
39
36
|
declare const DEFAULT_CONFIG: {
|
|
40
37
|
timeout: number;
|
|
41
38
|
kibanaUrl: "https://kibana.bitshares.dev";
|
|
42
39
|
apiKey: null;
|
|
43
40
|
};
|
|
44
|
-
/**
|
|
45
|
-
* Time-bucketed count of limit_order_create ops for an account.
|
|
46
|
-
* Optionally filtered to orders selling a specific asset.
|
|
47
|
-
*/
|
|
48
|
-
declare function buildOrderCreateQuery(accountId: string, lookbackHours: number, intervalSeconds?: number, sellAssetId?: string | null): {
|
|
49
|
-
size: number;
|
|
50
|
-
query: {
|
|
51
|
-
bool: {
|
|
52
|
-
filter: ({
|
|
53
|
-
term: {
|
|
54
|
-
operation_type: number;
|
|
55
|
-
'operation_history.op_object.seller.keyword'?: undefined;
|
|
56
|
-
};
|
|
57
|
-
range?: undefined;
|
|
58
|
-
} | {
|
|
59
|
-
term: {
|
|
60
|
-
'operation_history.op_object.seller.keyword': string;
|
|
61
|
-
operation_type?: undefined;
|
|
62
|
-
};
|
|
63
|
-
range?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
range: {
|
|
66
|
-
'block_data.block_time': {
|
|
67
|
-
gte: string;
|
|
68
|
-
lte: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
term?: undefined;
|
|
72
|
-
})[];
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
aggs: {
|
|
76
|
-
by_time: {
|
|
77
|
-
date_histogram: {
|
|
78
|
-
field: string;
|
|
79
|
-
fixed_interval: string;
|
|
80
|
-
min_doc_count: number;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
total: {
|
|
84
|
-
value_count: {
|
|
85
|
-
field: string;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Time-bucketed count of fill_order ops for an account.
|
|
92
|
-
* Optionally filtered to fills where account pays a specific asset.
|
|
93
|
-
*/
|
|
94
|
-
declare function buildFillOrderQuery(accountId: string, lookbackHours: number, intervalSeconds?: number, paysAssetId?: string | null): {
|
|
95
|
-
size: number;
|
|
96
|
-
query: {
|
|
97
|
-
bool: {
|
|
98
|
-
filter: ({
|
|
99
|
-
term: {
|
|
100
|
-
operation_type: number;
|
|
101
|
-
'operation_history.op_object.account_id.keyword'?: undefined;
|
|
102
|
-
};
|
|
103
|
-
range?: undefined;
|
|
104
|
-
} | {
|
|
105
|
-
term: {
|
|
106
|
-
'operation_history.op_object.account_id.keyword': string;
|
|
107
|
-
operation_type?: undefined;
|
|
108
|
-
};
|
|
109
|
-
range?: undefined;
|
|
110
|
-
} | {
|
|
111
|
-
range: {
|
|
112
|
-
'block_data.block_time': {
|
|
113
|
-
gte: string;
|
|
114
|
-
lte: string;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
term?: undefined;
|
|
118
|
-
})[];
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
aggs: {
|
|
122
|
-
by_time: {
|
|
123
|
-
date_histogram: {
|
|
124
|
-
field: string;
|
|
125
|
-
fixed_interval: string;
|
|
126
|
-
min_doc_count: number;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
total: {
|
|
130
|
-
value_count: {
|
|
131
|
-
field: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Time-bucketed count of limit_order_cancel ops for an account.
|
|
138
|
-
*/
|
|
139
|
-
declare function buildOrderCancelQuery(accountId: string, lookbackHours: number, intervalSeconds?: number): {
|
|
140
|
-
size: number;
|
|
141
|
-
query: {
|
|
142
|
-
bool: {
|
|
143
|
-
filter: ({
|
|
144
|
-
term: {
|
|
145
|
-
operation_type: number;
|
|
146
|
-
'operation_history.op_object.fee_paying_account.keyword'?: undefined;
|
|
147
|
-
};
|
|
148
|
-
range?: undefined;
|
|
149
|
-
} | {
|
|
150
|
-
term: {
|
|
151
|
-
'operation_history.op_object.fee_paying_account.keyword': string;
|
|
152
|
-
operation_type?: undefined;
|
|
153
|
-
};
|
|
154
|
-
range?: undefined;
|
|
155
|
-
} | {
|
|
156
|
-
range: {
|
|
157
|
-
'block_data.block_time': {
|
|
158
|
-
gte: string;
|
|
159
|
-
lte: string;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
term?: undefined;
|
|
163
|
-
})[];
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
aggs: {
|
|
167
|
-
by_time: {
|
|
168
|
-
date_histogram: {
|
|
169
|
-
field: string;
|
|
170
|
-
fixed_interval: string;
|
|
171
|
-
min_doc_count: number;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
total: {
|
|
175
|
-
value_count: {
|
|
176
|
-
field: string;
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Daily activity breakdown by operation type for an account.
|
|
183
|
-
* Merges creates (by seller), fills (by account_id), cancels (by fee_paying_account)
|
|
184
|
-
* into one aggregation using a filter per op type.
|
|
185
|
-
*/
|
|
186
|
-
declare function buildDailyActivityQuery(accountId: string, lookbackHours: number): {
|
|
187
|
-
size: number;
|
|
188
|
-
query: {
|
|
189
|
-
bool: {
|
|
190
|
-
filter: {
|
|
191
|
-
range: {
|
|
192
|
-
'block_data.block_time': {
|
|
193
|
-
gte: string;
|
|
194
|
-
lte: string;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
}[];
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
aggs: {
|
|
201
|
-
creates: {
|
|
202
|
-
filter: {
|
|
203
|
-
bool: {
|
|
204
|
-
filter: ({
|
|
205
|
-
term: {
|
|
206
|
-
operation_type: number;
|
|
207
|
-
'operation_history.op_object.seller.keyword'?: undefined;
|
|
208
|
-
};
|
|
209
|
-
} | {
|
|
210
|
-
term: {
|
|
211
|
-
'operation_history.op_object.seller.keyword': string;
|
|
212
|
-
operation_type?: undefined;
|
|
213
|
-
};
|
|
214
|
-
})[];
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
aggs: {
|
|
218
|
-
by_day: {
|
|
219
|
-
date_histogram: {
|
|
220
|
-
field: string;
|
|
221
|
-
fixed_interval: string;
|
|
222
|
-
min_doc_count: number;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
fills: {
|
|
228
|
-
filter: {
|
|
229
|
-
bool: {
|
|
230
|
-
filter: ({
|
|
231
|
-
term: {
|
|
232
|
-
operation_type: number;
|
|
233
|
-
'operation_history.op_object.account_id.keyword'?: undefined;
|
|
234
|
-
};
|
|
235
|
-
} | {
|
|
236
|
-
term: {
|
|
237
|
-
'operation_history.op_object.account_id.keyword': string;
|
|
238
|
-
operation_type?: undefined;
|
|
239
|
-
};
|
|
240
|
-
})[];
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
aggs: {
|
|
244
|
-
by_day: {
|
|
245
|
-
date_histogram: {
|
|
246
|
-
field: string;
|
|
247
|
-
fixed_interval: string;
|
|
248
|
-
min_doc_count: number;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
cancels: {
|
|
254
|
-
filter: {
|
|
255
|
-
bool: {
|
|
256
|
-
filter: ({
|
|
257
|
-
term: {
|
|
258
|
-
operation_type: number;
|
|
259
|
-
'operation_history.op_object.fee_paying_account.keyword'?: undefined;
|
|
260
|
-
};
|
|
261
|
-
} | {
|
|
262
|
-
term: {
|
|
263
|
-
'operation_history.op_object.fee_paying_account.keyword': string;
|
|
264
|
-
operation_type?: undefined;
|
|
265
|
-
};
|
|
266
|
-
})[];
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
aggs: {
|
|
270
|
-
by_day: {
|
|
271
|
-
date_histogram: {
|
|
272
|
-
field: string;
|
|
273
|
-
fixed_interval: string;
|
|
274
|
-
min_doc_count: number;
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
};
|
|
280
|
-
};
|
|
281
41
|
/**
|
|
282
42
|
* Fetch raw limit_order_create documents for grid spacing analysis.
|
|
283
43
|
* Returns the price-relevant fields plus timestamps.
|
|
@@ -322,102 +82,6 @@ declare function buildOrderPriceQuery(accountId: string, lookbackHours: number,
|
|
|
322
82
|
};
|
|
323
83
|
}[];
|
|
324
84
|
};
|
|
325
|
-
/**
|
|
326
|
-
* Fetch raw fill_order documents for fill-price analysis.
|
|
327
|
-
*
|
|
328
|
-
* @param {string} accountId
|
|
329
|
-
* @param {number} lookbackHours
|
|
330
|
-
* @param {string} [paysAssetId]
|
|
331
|
-
* @param {number} [maxResults]
|
|
332
|
-
* @returns {Object} Elasticsearch query object
|
|
333
|
-
*/
|
|
334
|
-
declare function buildFillPriceQuery(accountId: string, lookbackHours: number, paysAssetId?: string | null, maxResults?: number): {
|
|
335
|
-
size: number;
|
|
336
|
-
_source: string[];
|
|
337
|
-
query: {
|
|
338
|
-
bool: {
|
|
339
|
-
filter: ({
|
|
340
|
-
term: {
|
|
341
|
-
operation_type: number;
|
|
342
|
-
'operation_history.op_object.account_id.keyword'?: undefined;
|
|
343
|
-
};
|
|
344
|
-
range?: undefined;
|
|
345
|
-
} | {
|
|
346
|
-
term: {
|
|
347
|
-
'operation_history.op_object.account_id.keyword': string;
|
|
348
|
-
operation_type?: undefined;
|
|
349
|
-
};
|
|
350
|
-
range?: undefined;
|
|
351
|
-
} | {
|
|
352
|
-
range: {
|
|
353
|
-
'block_data.block_time': {
|
|
354
|
-
gte: string;
|
|
355
|
-
lte: string;
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
term?: undefined;
|
|
359
|
-
})[];
|
|
360
|
-
};
|
|
361
|
-
};
|
|
362
|
-
sort: {
|
|
363
|
-
'block_data.block_time': {
|
|
364
|
-
order: string;
|
|
365
|
-
};
|
|
366
|
-
}[];
|
|
367
|
-
};
|
|
368
|
-
/**
|
|
369
|
-
* Discover which asset pairs an account trades by aggregating the sell asset IDs.
|
|
370
|
-
* Returns top asset IDs by order count.
|
|
371
|
-
*/
|
|
372
|
-
declare function buildAssetDiscoveryQuery(accountId: string, lookbackHours: number): {
|
|
373
|
-
size: number;
|
|
374
|
-
query: {
|
|
375
|
-
bool: {
|
|
376
|
-
filter: ({
|
|
377
|
-
term: {
|
|
378
|
-
operation_type: number;
|
|
379
|
-
'operation_history.op_object.seller.keyword'?: undefined;
|
|
380
|
-
};
|
|
381
|
-
range?: undefined;
|
|
382
|
-
} | {
|
|
383
|
-
term: {
|
|
384
|
-
'operation_history.op_object.seller.keyword': string;
|
|
385
|
-
operation_type?: undefined;
|
|
386
|
-
};
|
|
387
|
-
range?: undefined;
|
|
388
|
-
} | {
|
|
389
|
-
range: {
|
|
390
|
-
'block_data.block_time': {
|
|
391
|
-
gte: string;
|
|
392
|
-
lte: string;
|
|
393
|
-
};
|
|
394
|
-
};
|
|
395
|
-
term?: undefined;
|
|
396
|
-
})[];
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
aggs: {
|
|
400
|
-
sell_assets: {
|
|
401
|
-
terms: {
|
|
402
|
-
field: string;
|
|
403
|
-
size: number;
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
recv_assets: {
|
|
407
|
-
terms: {
|
|
408
|
-
field: string;
|
|
409
|
-
size: number;
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
declare function fetchOrderCreate(accountId: string, lookbackHours: number, config?: any, sellAssetId?: string | null, intervalSeconds?: number): Promise<unknown>;
|
|
415
|
-
declare function fetchFillOrder(accountId: string, lookbackHours: number, config?: any, paysAssetId?: string | null, intervalSeconds?: number): Promise<unknown>;
|
|
416
|
-
declare function fetchOrderCancel(accountId: string, lookbackHours: number, config?: any, intervalSeconds?: number): Promise<unknown>;
|
|
417
|
-
declare function fetchOrderPrices(accountId: string, lookbackHours: number, config?: any, sellAssetId?: string | null, maxResults?: number): Promise<unknown>;
|
|
418
|
-
declare function fetchFillPrices(accountId: string, lookbackHours: number, config?: any, paysAssetId?: string | null, maxResults?: number): Promise<unknown>;
|
|
419
|
-
declare function fetchDailyActivity(accountId: string, lookbackHours: number, config?: any): Promise<unknown>;
|
|
420
|
-
declare function fetchAssetDiscovery(accountId: string, lookbackHours: number, config?: any): Promise<unknown>;
|
|
421
85
|
/**
|
|
422
86
|
* Top N accounts by limit_order_create count (seller field).
|
|
423
87
|
* Use this to discover the most active order-placing accounts.
|
|
@@ -527,5 +191,5 @@ declare function buildTopFilledAccountsQuery(lookbackHours: number, topN?: numbe
|
|
|
527
191
|
};
|
|
528
192
|
};
|
|
529
193
|
};
|
|
530
|
-
export {
|
|
194
|
+
export { DEFAULT_CONFIG, kibanaSearch, buildOrderPriceQuery, buildTopSellerAccountsQuery, buildTopCancellerAccountsQuery, buildTopFilledAccountsQuery };
|
|
531
195
|
//# sourceMappingURL=kibana_bot_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kibana_bot_queries.d.ts","sourceRoot":"","sources":["../../../analysis/bot_usage/kibana_bot_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"kibana_bot_queries.d.ts","sourceRoot":"","sources":["../../../analysis/bot_usage/kibana_bot_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,YAAY,EAAiC,MAAM,4CAA4C,CAAC;AASzG,QAAA,MAAM,cAAc;;;;CAGnB,CAAC;AAIF;;;;;;;;;GASG;AACH,iBAAS,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,GAAG,IAAW,EAAE,UAAU,GAAE,MAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBnI;AAID;;;GAGG;AACH,iBAAS,2BAA2B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,EAAE,UAAU,GAAE,MAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBtG;AAED;;GAEG;AACH,iBAAS,8BAA8B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,EAAE,UAAU,GAAE,MAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBxG;AAED;;GAEG;AACH,iBAAS,2BAA2B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,EAAE,QAAQ,GAAE,MAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBnG;AAID,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,CAAA"}
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
* op_object.fee_paying_account — account that cancelled
|
|
33
33
|
* op_object.order — the order ID cancelled
|
|
34
34
|
*/
|
|
35
|
-
import { toIntervalLabel } from '../../market_adapter/interval_utils.js';
|
|
36
35
|
import { kibanaSearch, DEFAULT_CONFIG as BASE_CONFIG } from '../../market_adapter/core/kibana_client.js';
|
|
37
36
|
'use strict';
|
|
38
37
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
@@ -43,154 +42,6 @@ const DEFAULT_CONFIG = {
|
|
|
43
42
|
...BASE_CONFIG,
|
|
44
43
|
timeout: 25000,
|
|
45
44
|
};
|
|
46
|
-
// ─── Aggregation query builders (size:0, for counts & timelines) ───────────────
|
|
47
|
-
/**
|
|
48
|
-
* Time-bucketed count of limit_order_create ops for an account.
|
|
49
|
-
* Optionally filtered to orders selling a specific asset.
|
|
50
|
-
*/
|
|
51
|
-
function buildOrderCreateQuery(accountId, lookbackHours, intervalSeconds = 3600, sellAssetId = null) {
|
|
52
|
-
const filters = [
|
|
53
|
-
{ term: { operation_type: OP_LIMIT_ORDER_CREATE } },
|
|
54
|
-
{ term: { 'operation_history.op_object.seller.keyword': accountId } },
|
|
55
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
56
|
-
];
|
|
57
|
-
if (sellAssetId) {
|
|
58
|
-
filters.push({ term: { 'operation_history.op_object.amount_to_sell.asset_id.keyword': sellAssetId } });
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
size: 0,
|
|
62
|
-
query: { bool: { filter: filters } },
|
|
63
|
-
aggs: {
|
|
64
|
-
by_time: {
|
|
65
|
-
date_histogram: {
|
|
66
|
-
field: 'block_data.block_time',
|
|
67
|
-
fixed_interval: toIntervalLabel(intervalSeconds),
|
|
68
|
-
min_doc_count: 1,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
total: { value_count: { field: 'operation_type' } },
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Time-bucketed count of fill_order ops for an account.
|
|
77
|
-
* Optionally filtered to fills where account pays a specific asset.
|
|
78
|
-
*/
|
|
79
|
-
function buildFillOrderQuery(accountId, lookbackHours, intervalSeconds = 3600, paysAssetId = null) {
|
|
80
|
-
const filters = [
|
|
81
|
-
{ term: { operation_type: OP_FILL_ORDER } },
|
|
82
|
-
{ term: { 'operation_history.op_object.account_id.keyword': accountId } },
|
|
83
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
84
|
-
];
|
|
85
|
-
if (paysAssetId) {
|
|
86
|
-
filters.push({ term: { 'operation_history.op_object.pays.asset_id.keyword': paysAssetId } });
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
size: 0,
|
|
90
|
-
query: { bool: { filter: filters } },
|
|
91
|
-
aggs: {
|
|
92
|
-
by_time: {
|
|
93
|
-
date_histogram: {
|
|
94
|
-
field: 'block_data.block_time',
|
|
95
|
-
fixed_interval: toIntervalLabel(intervalSeconds),
|
|
96
|
-
min_doc_count: 1,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
total: { value_count: { field: 'operation_type' } },
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Time-bucketed count of limit_order_cancel ops for an account.
|
|
105
|
-
*/
|
|
106
|
-
function buildOrderCancelQuery(accountId, lookbackHours, intervalSeconds = 3600) {
|
|
107
|
-
return {
|
|
108
|
-
size: 0,
|
|
109
|
-
query: {
|
|
110
|
-
bool: {
|
|
111
|
-
filter: [
|
|
112
|
-
{ term: { operation_type: OP_LIMIT_ORDER_CANCEL } },
|
|
113
|
-
{ term: { 'operation_history.op_object.fee_paying_account.keyword': accountId } },
|
|
114
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
aggs: {
|
|
119
|
-
by_time: {
|
|
120
|
-
date_histogram: {
|
|
121
|
-
field: 'block_data.block_time',
|
|
122
|
-
fixed_interval: toIntervalLabel(intervalSeconds),
|
|
123
|
-
min_doc_count: 1,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
total: { value_count: { field: 'operation_type' } },
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Daily activity breakdown by operation type for an account.
|
|
132
|
-
* Merges creates (by seller), fills (by account_id), cancels (by fee_paying_account)
|
|
133
|
-
* into one aggregation using a filter per op type.
|
|
134
|
-
*/
|
|
135
|
-
function buildDailyActivityQuery(accountId, lookbackHours) {
|
|
136
|
-
return {
|
|
137
|
-
size: 0,
|
|
138
|
-
query: {
|
|
139
|
-
bool: {
|
|
140
|
-
filter: [
|
|
141
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
aggs: {
|
|
146
|
-
creates: {
|
|
147
|
-
filter: {
|
|
148
|
-
bool: {
|
|
149
|
-
filter: [
|
|
150
|
-
{ term: { operation_type: OP_LIMIT_ORDER_CREATE } },
|
|
151
|
-
{ term: { 'operation_history.op_object.seller.keyword': accountId } },
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
aggs: {
|
|
156
|
-
by_day: {
|
|
157
|
-
date_histogram: { field: 'block_data.block_time', fixed_interval: '1d', min_doc_count: 1 },
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
fills: {
|
|
162
|
-
filter: {
|
|
163
|
-
bool: {
|
|
164
|
-
filter: [
|
|
165
|
-
{ term: { operation_type: OP_FILL_ORDER } },
|
|
166
|
-
{ term: { 'operation_history.op_object.account_id.keyword': accountId } },
|
|
167
|
-
],
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
aggs: {
|
|
171
|
-
by_day: {
|
|
172
|
-
date_histogram: { field: 'block_data.block_time', fixed_interval: '1d', min_doc_count: 1 },
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
cancels: {
|
|
177
|
-
filter: {
|
|
178
|
-
bool: {
|
|
179
|
-
filter: [
|
|
180
|
-
{ term: { operation_type: OP_LIMIT_ORDER_CANCEL } },
|
|
181
|
-
{ term: { 'operation_history.op_object.fee_paying_account.keyword': accountId } },
|
|
182
|
-
],
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
aggs: {
|
|
186
|
-
by_day: {
|
|
187
|
-
date_histogram: { field: 'block_data.block_time', fixed_interval: '1d', min_doc_count: 1 },
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
45
|
// ─── Raw document query builders (size>0, for price/grid analysis) ────────────
|
|
195
46
|
/**
|
|
196
47
|
* Fetch raw limit_order_create documents for grid spacing analysis.
|
|
@@ -223,97 +74,6 @@ function buildOrderPriceQuery(accountId, lookbackHours, sellAssetId = null, maxR
|
|
|
223
74
|
sort: [{ 'block_data.block_time': { order: 'desc' } }],
|
|
224
75
|
};
|
|
225
76
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Fetch raw fill_order documents for fill-price analysis.
|
|
228
|
-
*
|
|
229
|
-
* @param {string} accountId
|
|
230
|
-
* @param {number} lookbackHours
|
|
231
|
-
* @param {string} [paysAssetId]
|
|
232
|
-
* @param {number} [maxResults]
|
|
233
|
-
* @returns {Object} Elasticsearch query object
|
|
234
|
-
*/
|
|
235
|
-
function buildFillPriceQuery(accountId, lookbackHours, paysAssetId = null, maxResults = 500) {
|
|
236
|
-
const filters = [
|
|
237
|
-
{ term: { operation_type: OP_FILL_ORDER } },
|
|
238
|
-
{ term: { 'operation_history.op_object.account_id.keyword': accountId } },
|
|
239
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
240
|
-
];
|
|
241
|
-
if (paysAssetId) {
|
|
242
|
-
filters.push({ term: { 'operation_history.op_object.pays.asset_id.keyword': paysAssetId } });
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
size: maxResults,
|
|
246
|
-
_source: [
|
|
247
|
-
'block_data.block_time',
|
|
248
|
-
'operation_history.op_object.pays',
|
|
249
|
-
'operation_history.op_object.receives',
|
|
250
|
-
'operation_history.op_object.order_id',
|
|
251
|
-
],
|
|
252
|
-
query: { bool: { filter: filters } },
|
|
253
|
-
sort: [{ 'block_data.block_time': { order: 'desc' } }],
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Discover which asset pairs an account trades by aggregating the sell asset IDs.
|
|
258
|
-
* Returns top asset IDs by order count.
|
|
259
|
-
*/
|
|
260
|
-
function buildAssetDiscoveryQuery(accountId, lookbackHours) {
|
|
261
|
-
return {
|
|
262
|
-
size: 0,
|
|
263
|
-
query: {
|
|
264
|
-
bool: {
|
|
265
|
-
filter: [
|
|
266
|
-
{ term: { operation_type: OP_LIMIT_ORDER_CREATE } },
|
|
267
|
-
{ term: { 'operation_history.op_object.seller.keyword': accountId } },
|
|
268
|
-
{ range: { 'block_data.block_time': { gte: `now-${lookbackHours}h`, lte: 'now' } } },
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
aggs: {
|
|
273
|
-
sell_assets: {
|
|
274
|
-
terms: {
|
|
275
|
-
field: 'operation_history.op_object.amount_to_sell.asset_id.keyword',
|
|
276
|
-
size: 10,
|
|
277
|
-
},
|
|
278
|
-
},
|
|
279
|
-
recv_assets: {
|
|
280
|
-
terms: {
|
|
281
|
-
field: 'operation_history.op_object.min_to_receive.asset_id.keyword',
|
|
282
|
-
size: 10,
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
// ─── Fetch helpers ────────────────────────────────────────────────────────────
|
|
289
|
-
async function fetchOrderCreate(accountId, lookbackHours, config = {}, sellAssetId = null, intervalSeconds = 3600) {
|
|
290
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
291
|
-
return kibanaSearch(cfg, buildOrderCreateQuery(accountId, lookbackHours, intervalSeconds, sellAssetId));
|
|
292
|
-
}
|
|
293
|
-
async function fetchFillOrder(accountId, lookbackHours, config = {}, paysAssetId = null, intervalSeconds = 3600) {
|
|
294
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
295
|
-
return kibanaSearch(cfg, buildFillOrderQuery(accountId, lookbackHours, intervalSeconds, paysAssetId));
|
|
296
|
-
}
|
|
297
|
-
async function fetchOrderCancel(accountId, lookbackHours, config = {}, intervalSeconds = 3600) {
|
|
298
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
299
|
-
return kibanaSearch(cfg, buildOrderCancelQuery(accountId, lookbackHours, intervalSeconds));
|
|
300
|
-
}
|
|
301
|
-
async function fetchOrderPrices(accountId, lookbackHours, config = {}, sellAssetId = null, maxResults = 1000) {
|
|
302
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
303
|
-
return kibanaSearch(cfg, buildOrderPriceQuery(accountId, lookbackHours, sellAssetId, maxResults));
|
|
304
|
-
}
|
|
305
|
-
async function fetchFillPrices(accountId, lookbackHours, config = {}, paysAssetId = null, maxResults = 500) {
|
|
306
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
307
|
-
return kibanaSearch(cfg, buildFillPriceQuery(accountId, lookbackHours, paysAssetId, maxResults));
|
|
308
|
-
}
|
|
309
|
-
async function fetchDailyActivity(accountId, lookbackHours, config = {}) {
|
|
310
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
311
|
-
return kibanaSearch(cfg, buildDailyActivityQuery(accountId, lookbackHours));
|
|
312
|
-
}
|
|
313
|
-
async function fetchAssetDiscovery(accountId, lookbackHours, config = {}) {
|
|
314
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
315
|
-
return kibanaSearch(cfg, buildAssetDiscoveryQuery(accountId, lookbackHours));
|
|
316
|
-
}
|
|
317
77
|
// ─── Discovery query builders ─────────────────────────────────────────────────
|
|
318
78
|
/**
|
|
319
79
|
* Top N accounts by limit_order_create count (seller field).
|
|
@@ -395,5 +155,5 @@ function buildTopFilledAccountsQuery(lookbackHours, topN = 100, minFills = 3) {
|
|
|
395
155
|
};
|
|
396
156
|
}
|
|
397
157
|
// ─── Exports ──────────────────────────────────────────────────────────────────
|
|
398
|
-
export {
|
|
158
|
+
export { DEFAULT_CONFIG, kibanaSearch, buildOrderPriceQuery, buildTopSellerAccountsQuery, buildTopCancellerAccountsQuery, buildTopFilledAccountsQuery };
|
|
399
159
|
//# sourceMappingURL=kibana_bot_queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kibana_bot_queries.js","sourceRoot":"","sources":["../../../analysis/bot_usage/kibana_bot_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"kibana_bot_queries.js","sourceRoot":"","sources":["../../../analysis/bot_usage/kibana_bot_queries.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared CSS fragments for uPlot chart generators.
|
|
3
|
-
*
|
|
4
|
-
* All functions return raw CSS strings for interpolation into HTML template
|
|
5
|
-
* literals. Consumers compose these fragments inside their `<style>` blocks.
|
|
6
|
-
*/
|
|
7
|
-
declare function baseResetCSS(): string;
|
|
8
|
-
declare function headerCSS(height?: number): string;
|
|
9
|
-
declare function panelsCSS(headerHeight?: number): string;
|
|
10
|
-
declare function uplotBgCSS(): string;
|
|
11
|
-
declare function dotCSS(): string;
|
|
12
|
-
declare function cursorCSS(): string;
|
|
13
|
-
declare function sectionLabelCSS(): string;
|
|
14
|
-
declare function legendCSS(): string;
|
|
15
1
|
declare function sharedChartCSS(): string;
|
|
16
|
-
export {
|
|
2
|
+
export { sharedChartCSS };
|
|
17
3
|
//# sourceMappingURL=chart_css.d.ts.map
|