dexbot 1.6.3 → 1.6.5
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 +78 -2
- package/README.md +23 -19
- package/analysis/README.md +26 -13
- package/analysis/account_resolver.ts +171 -0
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +2 -5
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/analyze_dynamic_weight.ts +9 -3
- package/analysis/bot_usage/discover_bot_accounts.ts +20 -27
- package/analysis/chain_pool.ts +47 -0
- package/analysis/chart_utils.ts +33 -20
- package/analysis/derivative_chart_generator.ts +2 -3
- package/analysis/fills_source.ts +234 -0
- package/analysis/grid_correction_check.ts +38 -251
- package/analysis/trade_profitability.ts +169 -304
- package/analysis/tradingview/README.md +2 -2
- package/analysis/tradingview/analyze_tradingview.ts +5 -0
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +5 -6
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +35 -2
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +84 -13
- package/analysis/trend_detection/kalman_chart_generator.ts +2 -3
- package/analysis/trend_detection/package.json +1 -1
- package/analysis/trend_detection/regime_chart_generator.ts +2 -3
- package/analysis/trend_detection/volatility_chart_generator.ts +2 -3
- package/claw/modules/dexbot_profiles.ts +4 -3
- 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/tests/test_claw_mcp_transport.ts +2 -2
- package/claw/tests/test_dexbot_profiles.ts +18 -1
- package/dist/analysis/account_resolver.d.ts +43 -0
- package/dist/analysis/account_resolver.d.ts.map +1 -0
- package/dist/analysis/account_resolver.js +137 -0
- package/dist/analysis/account_resolver.js.map +1 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +2 -4
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.js +9 -3
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js +20 -28
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -1
- package/dist/analysis/chain_pool.d.ts +10 -0
- package/dist/analysis/chain_pool.d.ts.map +1 -0
- package/dist/analysis/chain_pool.js +47 -0
- package/dist/analysis/chain_pool.js.map +1 -0
- package/dist/analysis/chart_utils.d.ts +14 -1
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +32 -22
- 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 +2 -3
- package/dist/analysis/derivative_chart_generator.js.map +1 -1
- package/dist/analysis/fills_source.d.ts +79 -0
- package/dist/analysis/fills_source.d.ts.map +1 -0
- package/dist/analysis/fills_source.js +186 -0
- package/dist/analysis/fills_source.js.map +1 -0
- package/dist/analysis/grid_correction_check.d.ts +1 -21
- package/dist/analysis/grid_correction_check.d.ts.map +1 -1
- package/dist/analysis/grid_correction_check.js +30 -257
- package/dist/analysis/grid_correction_check.js.map +1 -1
- package/dist/analysis/trade_profitability.d.ts +18 -19
- package/dist/analysis/trade_profitability.d.ts.map +1 -1
- package/dist/analysis/trade_profitability.js +136 -280
- package/dist/analysis/trade_profitability.js.map +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +5 -0
- package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +5 -6
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.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 +84 -13
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +2 -3
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +2 -3
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +2 -3
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +27 -68
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +2 -2
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +15 -12
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/interval_utils.d.ts +1 -1
- package/dist/market_adapter/interval_utils.js +1 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +2 -3
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/modules/account_bots.d.ts +51 -18
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +258 -117
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts +1 -84
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +1 -38
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bot_defaults.d.ts +98 -0
- package/dist/modules/bot_defaults.d.ts.map +1 -0
- package/dist/modules/bot_defaults.js +169 -0
- package/dist/modules/bot_defaults.js.map +1 -0
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +4 -1
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/cli_colors.d.ts +0 -1
- package/dist/modules/cli_colors.d.ts.map +1 -1
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +1 -0
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +11 -2
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +45 -32
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +1 -25
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +1 -1
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +1 -6
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +1 -1
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credential_session_cache.d.ts +1 -5
- package/dist/modules/credential_session_cache.d.ts.map +1 -1
- package/dist/modules/credential_session_cache.js +1 -1
- package/dist/modules/credential_session_cache.js.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts +1 -2
- 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/dexbot_class.d.ts +8 -7
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +9 -8
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +7 -6
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +8 -7
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +1 -17
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +1 -1
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +2 -2
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +24 -8
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +1 -7
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +1 -1
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/launcher/adapter_requirement.d.ts +1 -5
- package/dist/modules/launcher/adapter_requirement.d.ts.map +1 -1
- package/dist/modules/launcher/adapter_requirement.js +2 -2
- package/dist/modules/launcher/adapter_requirement.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +1 -6
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +1 -1
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +1 -3
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/launch_modes.d.ts +17 -2
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
- package/dist/modules/launcher/launch_modes.js +18 -1
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -3
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +1 -5
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +9 -2
- 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 -1
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +40 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +161 -11
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/order/export.d.ts +1 -8
- package/dist/modules/order/export.d.ts.map +1 -1
- package/dist/modules/order/export.js +1 -1
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/grid.d.ts +16 -0
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +75 -103
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts +1 -10
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/manager.d.ts +10 -2
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +20 -8
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +8 -15
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +1 -10
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +1 -1
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +5 -16
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +7 -4
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/process_discovery.d.ts +0 -3
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +1 -1
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +10 -1
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +27 -17
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/utils/chain_logs.d.ts +1 -2
- package/dist/modules/utils/chain_logs.d.ts.map +1 -1
- package/dist/modules/utils/chain_logs.js +1 -1
- package/dist/modules/utils/chain_logs.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +4 -3
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/scripts/analyze-git.js +2 -2
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/chart_command.d.ts +48 -0
- package/dist/scripts/chart_command.d.ts.map +1 -0
- package/dist/scripts/chart_command.js +504 -0
- package/dist/scripts/chart_command.js.map +1 -0
- package/dist/scripts/dw.d.ts +3 -0
- package/dist/scripts/dw.d.ts.map +1 -0
- package/dist/scripts/dw.js +30 -0
- package/dist/scripts/dw.js.map +1 -0
- package/dist/scripts/tv.d.ts +1 -31
- package/dist/scripts/tv.d.ts.map +1 -1
- package/dist/scripts/tv.js +10 -463
- package/dist/scripts/tv.js.map +1 -1
- package/dist/scripts/update.js +145 -93
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/update_dist_freshness.d.ts +46 -0
- package/dist/scripts/update_dist_freshness.d.ts.map +1 -0
- package/dist/scripts/update_dist_freshness.js +115 -0
- package/dist/scripts/update_dist_freshness.js.map +1 -0
- package/dist/unlock.js +1 -1
- package/dist/unlock.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +117 -44
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +10 -207
- package/docs/COW_INVARIANTS.md +16 -10
- package/docs/DEXBOT_COMPARISON.md +3 -3
- package/docs/EVOLUTION.md +76 -30
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +9 -9
- package/docs/GRID_RECALCULATION.md +34 -30
- package/docs/GRID_RECONCILE.md +30 -27
- package/docs/LIFECYCLE.md +12 -11
- package/docs/LOGGING.md +1 -0
- package/docs/README.md +58 -52
- package/docs/WORKFLOW.md +1 -2
- package/docs/architecture.md +21 -32
- package/docs/developer_guide.md +4 -3
- package/market_adapter/README.md +36 -60
- package/modules/README.md +2 -1
- package/package.json +1 -2
- package/scripts/README.md +18 -25
- package/scripts/git-viewer.sh +1 -1
- package/scripts/reset-settings.sh +1 -1
- package/tests/README.md +10 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +0 -15
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +0 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +0 -191
- package/dist/scripts/generate_market_adapter_whitelist.js.map +0 -1
package/docs/architecture.md
CHANGED
|
@@ -59,7 +59,7 @@ graph TB
|
|
|
59
59
|
TARGET[Strategy Engine<br/>calculateTargetGrid<br/>boundary-crawl pivot<br/>partial-fill consolidation, rotation]
|
|
60
60
|
WORKGRID[WorkingGrid - COW copy<br/>all mutations here only<br/>commit to Master on confirmation]
|
|
61
61
|
FILLQUEUE[Fill Queue<br/>AsyncLock + dedup 5-60 min]
|
|
62
|
-
BATCHER[Fixed-Cap Batcher<br/>queue within cap: unified batch<br/>queue above cap: chunk at cap size<br/>
|
|
62
|
+
BATCHER[Fixed-Cap Batcher<br/>queue within cap: unified batch<br/>queue above cap: chunk at cap size<br/>cap = gapSlots + 1]
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
subgraph "OUTPUTS"
|
|
@@ -107,7 +107,7 @@ graph TB
|
|
|
107
107
|
| **Immutability** | Master Grid is frozen; all changes go through a disposable WorkingGrid (Copy-on-Write) |
|
|
108
108
|
| **Single Source of Truth** | Accounting engine owns all fund data; everything reads from it |
|
|
109
109
|
| **Event-driven + Polling** | Fill Events (real-time) and Open-Order polling feed the same queue |
|
|
110
|
-
| **Fixed-Cap Batching** | Deterministic batching with hard cap per broadcast (
|
|
110
|
+
| **Fixed-Cap Batching** | Deterministic batching with hard cap per broadcast (cap = gapSlots + 1 fills) |
|
|
111
111
|
| **Persistence** | Grid snapshot written after every confirmed blockchain commit |
|
|
112
112
|
|
|
113
113
|
---
|
|
@@ -377,13 +377,13 @@ The fill pipeline handles incoming filled orders efficiently through fixed-cap b
|
|
|
377
377
|
↓
|
|
378
378
|
┌─────────────────────────────────────────────────────────────┐
|
|
379
379
|
│ processFilledOrders() - Entry Point │
|
|
380
|
-
│ Use gap-slot batch size for deterministic batching │
|
|
381
|
-
│ Rules: <=gapSlots unified, >gapSlots chunked │
|
|
380
|
+
│ Use gap-slot batch size (gapSlots+1) for deterministic batching │
|
|
381
|
+
│ Rules: <=gapSlots+1 unified, >gapSlots+1 chunked │
|
|
382
382
|
└─────────────────────┬───────────────────────────────────────┘
|
|
383
383
|
↓
|
|
384
384
|
┌─────────────────────────────────────────────────────────────┐
|
|
385
|
-
│ Pop Batch (up to gapSlots) │
|
|
386
|
-
│ Takes N fills from queue head (N = 1..gapSlots) │
|
|
385
|
+
│ Pop Batch (up to gapSlots+1) │
|
|
386
|
+
│ Takes N fills from queue head (N = 1..gapSlots+1) │
|
|
387
387
|
│ Example: pops [fill1, fill2, fill3] for batch processing │
|
|
388
388
|
└─────────────────────┬───────────────────────────────────────┘
|
|
389
389
|
↓
|
|
@@ -418,9 +418,9 @@ The fill pipeline handles incoming filled orders efficiently through fixed-cap b
|
|
|
418
418
|
|
|
419
419
|
### Key Properties
|
|
420
420
|
|
|
421
|
-
- **Gap-Slot Batch Sizing**: Batch size is deterministic, derived from the grid gap-slot count (`DEXBot._getGapSlotBatchSize`)
|
|
422
|
-
- 1..gapSlots awaiting: single unified batch (one rebalance/broadcast cycle)
|
|
423
|
-
- more than gapSlots awaiting: repeated chunks of gapSlots (last chunk may be smaller)
|
|
421
|
+
- **Gap-Slot Batch Sizing**: Batch size is deterministic, derived from the grid gap-slot count + 1 (`DEXBot._getGapSlotBatchSize`)
|
|
422
|
+
- 1..gapSlots+1 awaiting: single unified batch (one rebalance/broadcast cycle)
|
|
423
|
+
- more than gapSlots+1 awaiting: repeated chunks of gapSlots+1 (last chunk may be smaller)
|
|
424
424
|
|
|
425
425
|
- **Single Rebalance Cycle**: All fills in batch processed in ONE rebalance
|
|
426
426
|
- No "split across cycles" delays
|
|
@@ -916,7 +916,7 @@ graph TB
|
|
|
916
916
|
START[Grid Update Triggered] --> CALC[Calculate Ideal Grid<br/>Based on current funds]
|
|
917
917
|
CALC --> RELOAD[Force Reload Persisted Grid<br/>Ensure fresh blockchain state]
|
|
918
918
|
RELOAD --> COMPARE[Compare to Persisted Grid]
|
|
919
|
-
COMPARE --> RMS[Calculate RMS Divergence<br/>
|
|
919
|
+
COMPARE --> RMS[Calculate RMS Divergence<br/>ACTIVE + VIRTUAL orders per side]
|
|
920
920
|
|
|
921
921
|
RMS --> CHECK{RMS > Threshold?}
|
|
922
922
|
CHECK -->|Yes| UPDATE[Update Grid Sizes<br/>Trigger rebalance]
|
|
@@ -1043,28 +1043,17 @@ graph LR
|
|
|
1043
1043
|
|
|
1044
1044
|
The system has been optimized to use a "memory-driven" model for order updates, eliminating redundant blockchain API calls during normal operation.
|
|
1045
1045
|
|
|
1046
|
-
###
|
|
1047
|
-
|
|
1048
|
-
**
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
- **
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
-
|
|
1056
|
-
|
|
1057
|
-
- The bot now trusts its internal state, backed by real-time fill listener, to build transactions
|
|
1058
|
-
|
|
1059
|
-
**3. Refactored `buildUpdateOrderOp()`**
|
|
1060
|
-
- Updated to support optional `cachedOrder` parameter
|
|
1061
|
-
- Allows callers to bypass blockchain queries if they have raw state in memory
|
|
1062
|
-
- Returns `finalInts` along with operation data for local tracking
|
|
1063
|
-
|
|
1064
|
-
**4. Self-Healing Resilience**
|
|
1065
|
-
- Maintains "State Recovery Sync" fallback
|
|
1066
|
-
- If a memory-driven transaction fails, bot catches error and performs a full refresh
|
|
1067
|
-
- Ensures internal ledger stays synchronized with BitShares blockchain
|
|
1046
|
+
### How it works
|
|
1047
|
+
|
|
1048
|
+
- **Raw order cache (`rawOnChain`):** each grid slot stores the exact blockchain order integers
|
|
1049
|
+
(satoshis) — seeded from broadcast arguments on placement, updated in place on partial fills,
|
|
1050
|
+
and refreshed on updates/rotations.
|
|
1051
|
+
- **Chain-free planning:** size updates and rotations build their operations from the cache;
|
|
1052
|
+
only placements and recovery syncs query the blockchain.
|
|
1053
|
+
- **`buildUpdateOrderOp(cachedOrder?)`:** accepts an optional cached order and returns
|
|
1054
|
+
`finalInts` alongside the operation for local tracking.
|
|
1055
|
+
- **Self-healing:** a failed memory-driven transaction triggers a full state-recovery sync so the
|
|
1056
|
+
internal ledger stays consistent with the chain.
|
|
1068
1057
|
|
|
1069
1058
|
### Benefits
|
|
1070
1059
|
- **Faster reaction time**: No waiting for blockchain queries during order updates
|
package/docs/developer_guide.md
CHANGED
|
@@ -79,7 +79,7 @@ A **phantom order** is an order in ACTIVE/PARTIAL state WITHOUT a valid `orderId
|
|
|
79
79
|
|
|
80
80
|
| Term | Meaning |
|
|
81
81
|
|------|---------|
|
|
82
|
-
| **Gap-Slot Batch Fill Processing** | Groups fills using the grid gap-slot count as batch size (`DEXBot._getGapSlotBatchSize`): `<= gapSlots` uses one unified batch; `> gapSlots` chunks at gapSlots
|
|
82
|
+
| **Gap-Slot Batch Fill Processing** | Groups fills using the grid gap-slot count + 1 as batch size (`DEXBot._getGapSlotBatchSize`): `<= gapSlots + 1` uses one unified batch; `> gapSlots + 1` chunks at `gapSlots + 1`. In the documented 29-fill Feb 7 crash scenario, this reduces the estimated divergence window from ~90s to ~24s; see [`FUND_MOVEMENT_AND_ACCOUNTING.md`](FUND_MOVEMENT_AND_ACCOUNTING.md#15-fill-batch-processing--timeline). |
|
|
83
83
|
| **Recovery Retry System** | Count+time-based retry mechanism with periodic reset. Replaces one-shot `_recoveryAttempted` flag. Max 5 attempts per episode with 60s minimum interval between retries. |
|
|
84
84
|
| **Orphan-Fill Deduplication** | Map+TTL-based tracking of stale-cleaned order IDs to prevent double-crediting. Delayed orphan fill events are still blocked by checking `_staleCleanedOrderIds`. |
|
|
85
85
|
|
|
@@ -171,8 +171,8 @@ A **phantom order** is an order in ACTIVE/PARTIAL state WITHOUT a valid `orderId
|
|
|
171
171
|
| **Atomic Check-and-Deduct** | Verify funds + deduct in single operation |
|
|
172
172
|
| **Divergence Detection** | Comparing ideal grid vs. persisted grid |
|
|
173
173
|
| **Invariant Verification** | Checking fund accounting consistency |
|
|
174
|
-
| **Batch Processing** | Grouping multiple fills into a single rebalance cycle instead of one-at-a-time. Gap-slot sizing: `<= gapSlots` unified, otherwise chunked at gapSlots
|
|
175
|
-
| **Gap-Slot Batch Sizing** | Deterministic chunking model with the grid gap-slot count as the per-broadcast bound. Keeps throughput high while avoiding tier-lookup complexity. |
|
|
174
|
+
| **Batch Processing** | Grouping multiple fills into a single rebalance cycle instead of one-at-a-time. Gap-slot sizing: `<= gapSlots + 1` unified, otherwise chunked at `gapSlots + 1`. |
|
|
175
|
+
| **Gap-Slot Batch Sizing** | Deterministic chunking model with the grid gap-slot count + 1 as the per-broadcast bound. Keeps throughput high while avoiding tier-lookup complexity. |
|
|
176
176
|
| **Stale-Order Recovery** | Fast-path recovery for single-operation batches that encounter stale orders on-chain. Executes cleanup without full state sync. |
|
|
177
177
|
| **Orphan-Fill Prevention** | Deduplication mechanism that prevents double-crediting fills from stale-cleaned orders using timestamp-based ID tracking (TTL pruning). |
|
|
178
178
|
|
|
@@ -1559,6 +1559,7 @@ console.log('Locked?', manager.isOrderLocked(order.id));
|
|
|
1559
1559
|
- `modules/node_manager.ts` - Multi-node health checking and failover
|
|
1560
1560
|
- `modules/fund_registry.ts` - Shared-account fund registry with cross-bot invariants
|
|
1561
1561
|
- `modules/settings_merge.ts` - Consolidated settings merge (single source of truth)
|
|
1562
|
+
- `modules/bot_defaults.ts` - Central bot-defaults seeder (draft/entry/runtime-config modes); single source for how `DEFAULT_CONFIG` is applied
|
|
1562
1563
|
- `modules/chain_orders.ts` - Blockchain order operations
|
|
1563
1564
|
- `modules/account_orders.ts` - Account order queries
|
|
1564
1565
|
|
package/market_adapter/README.md
CHANGED
|
@@ -21,13 +21,13 @@ The live signal layer for AMA-priced bots. It reads candles, computes the AMA ce
|
|
|
21
21
|
|
|
22
22
|
| If you want to… | Read this | Key command |
|
|
23
23
|
|-----------------|-----------|-------------|
|
|
24
|
-
| Enable AMA pricing for a bot | [Quick Start](#quick-start) | `dexbot
|
|
24
|
+
| Enable AMA pricing for a bot | [Quick Start](#quick-start) | `dexbot bot` → `6) Adapter` |
|
|
25
25
|
| Change how often the grid rebuilds | [Trigger Threshold](#trigger-threshold) | edit `AMA_DELTA_THRESHOLD_PERCENT` |
|
|
26
|
-
| Tune buy/sell weight bias | [Asymmetric Weight Shift](#asymmetric-weight-shift) |
|
|
27
|
-
| Widen/tighten grid bounds by trend | [Grid Range Scaling](#grid-range-scaling) |
|
|
26
|
+
| Tune buy/sell weight bias | [Asymmetric Weight Shift](#asymmetric-weight-shift) | `6) Adapter` → Weight |
|
|
27
|
+
| Widen/tighten grid bounds by trend | [Grid Range Scaling](#grid-range-scaling) | `6) Adapter` → Range |
|
|
28
28
|
| Override settings for one pair or bot | [Settings and Overrides](#settings-and-overrides) | edit `profiles/market_adapter_settings.json` |
|
|
29
29
|
| Run the adapter standalone or test dry-run | [Live Writes and Dry-Run](#live-writes-and-dry-run) | `node dist/market_adapter/market_adapter.js --dryRun` |
|
|
30
|
-
| Debug a bot not being processed | [Troubleshooting](#troubleshooting) | `
|
|
30
|
+
| Debug a bot not being processed | [Troubleshooting](#troubleshooting) | `6) Adapter` flags |
|
|
31
31
|
| Understand the signal pipeline or module layout | [Technical Reference](#technical-reference) | — |
|
|
32
32
|
|
|
33
33
|
## Big Picture
|
|
@@ -64,47 +64,23 @@ default preset.
|
|
|
64
64
|
|
|
65
65
|
When fetching candles (`pool` or `book`), the adapter requires a full historical window. The oldest `erPeriod` candles are used for an initial SMA (Simple Moving Average) warmup phase to seed the AMA and establish the first Efficiency Ratio (ER) calculation. See [AMA Warmup Window](#ama-warmup-window--why-candle-length-matters) for technical details.
|
|
66
66
|
|
|
67
|
-
### 2.
|
|
67
|
+
### 2. Enable Live Writes
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
in dry-run mode.
|
|
69
|
+
Open the bot editor — `dexbot bot` → `2) Modify bot` → pick the bot →
|
|
70
|
+
`6) Adapter` — and set the three per-bot flags:
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
dynamic-weight, and range-scaling flags can be inspected or adjusted.
|
|
79
|
-
|
|
80
|
-
By default, newly generated entries whitelist AMA pricing only, keeping both
|
|
81
|
-
dynamic weights and range scaling (asymmetric bounds) disabled. To opt newly
|
|
82
|
-
generated entries into dynamic weights:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
dexbot white --dynamic-weight
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
To opt newly generated entries into range scaling:
|
|
72
|
+
| Flag | Whitelist key | Effect |
|
|
73
|
+
|------|---------------|--------|
|
|
74
|
+
| **Price** | `ama` | Allows live `dynamicgrid.json` and recalc-trigger writes. Without it the adapter still computes state, but live output stays in dry-run. |
|
|
75
|
+
| **Weight** | `dynamicWeight` | Opt-in dynamic buy/sell weights. |
|
|
76
|
+
| **Range** | `asymmetricBounds` | Opt-in AMA-slope range scaling. |
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
dexbot white --dynamic-weight --bot <botKey>
|
|
98
|
-
dexbot white --asymmetric-bounds --bot <botKey>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
`--bot` implies overwrite for that key only; without it, `dexbot white` only adds missing bots.
|
|
102
|
-
|
|
103
|
-
Remove stale whitelist entries (bots no longer in `bots.json`):
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
dexbot white --prune
|
|
107
|
-
```
|
|
78
|
+
The flags are stored per bot in `profiles/market_adapter_whitelist.json`;
|
|
79
|
+
re-open the section any time to inspect or change them. Boolean prompts
|
|
80
|
+
accept `y`/`yes`/`true` and `n`/`no`/`false`; Enter keeps the current value.
|
|
81
|
+
Renaming a bot carries its flags to the new key, deleting a bot removes its
|
|
82
|
+
entry, and all-off flags are saved as an explicit `false` entry so the flags
|
|
83
|
+
never silently fall back to defaults.
|
|
108
84
|
|
|
109
85
|
### 3. Start DEXBot2
|
|
110
86
|
|
|
@@ -156,10 +132,8 @@ whitelist gate:
|
|
|
156
132
|
|
|
157
133
|
This is separate from dynamic buy/sell weighting. Both grid-range effects are
|
|
158
134
|
enabled only when `asymmetricBounds: true` is set in
|
|
159
|
-
`profiles/market_adapter_whitelist.json`. Range scaling is opt-in:
|
|
160
|
-
|
|
161
|
-
`dexbot white --asymmetric-bounds` (new bots) or
|
|
162
|
-
`dexbot white --asymmetric-bounds --bot <botKey>` (existing entry).
|
|
135
|
+
`profiles/market_adapter_whitelist.json`. Range scaling is opt-in: enable it
|
|
136
|
+
per bot with `dexbot bot` → `2) Modify bot` → `6) Adapter` → **Range**.
|
|
163
137
|
|
|
164
138
|
Technical formula and tuning details are in
|
|
165
139
|
[Grid Range Scaling Model](#grid-range-scaling-model).
|
|
@@ -334,11 +308,8 @@ Dry-run log lines include `[DRY RUN]` or `[suppressed, dry-run]`.
|
|
|
334
308
|
|
|
335
309
|
| Task | Command |
|
|
336
310
|
|------|---------|
|
|
337
|
-
|
|
|
338
|
-
|
|
|
339
|
-
| Opt new whitelist entries into range scaling | `dexbot white --asymmetric-bounds` |
|
|
340
|
-
| Overwrite existing entry for a specific bot | `dexbot white --dynamic-weight --bot <botKey>` \| `dexbot white --asymmetric-bounds --bot <botKey>` |
|
|
341
|
-
| Prune stale whitelist entries (bots removed from bots.json) | `dexbot white --prune` |
|
|
311
|
+
| Enable/inspect Price, Weight, Range for a bot | `dexbot bot` → `2) Modify bot` → `6) Adapter` |
|
|
312
|
+
| Remove a deleted bot's entry | Automatic — `dexbot bot` → `3) Delete` also drops its whitelist key |
|
|
342
313
|
| Probe public CEX availability | `node dist/market_adapter/inputs/fetch_cex_synthetic_data.js --exchange auto --check-only` |
|
|
343
314
|
| Seed synthetic cross candles | `node dist/market_adapter/inputs/fetch_cex_synthetic_data.js --exchange auto --bot-key <bot-key>` |
|
|
344
315
|
| Run one adapter cycle | `node dist/market_adapter/market_adapter.js --once` |
|
|
@@ -368,7 +339,7 @@ match the bot's eventual `botKey`.
|
|
|
368
339
|
### Bot is not processed
|
|
369
340
|
|
|
370
341
|
- Confirm `gridPrice` is `ama`, `ama1`, `ama2`, `ama3`, or `ama4`.
|
|
371
|
-
-
|
|
342
|
+
- Open `dexbot bot` → `2) Modify bot` → `6) Adapter` and confirm **Price** is `true`.
|
|
372
343
|
- Confirm the expected `botKey` exists in `profiles/market_adapter_whitelist.json`.
|
|
373
344
|
- If `startPrice` is numeric, the adapter will not fetch pool/book candles for that bot. Use `startPrice` only for a fixed anchor in that case; `gridPrice` remains a separate grid setting.
|
|
374
345
|
|
|
@@ -377,7 +348,7 @@ match the bot's eventual `botKey`.
|
|
|
377
348
|
- Check `lastDeltaPercent` vs `thresholdPercent`.
|
|
378
349
|
- Check `staleData` and `staleAgeHours`.
|
|
379
350
|
- **Confirm the bot is whitelisted.** Non-whitelisted bots only log and do not write triggers.
|
|
380
|
-
- Confirm the bot's whitelist entry has `"ama": true
|
|
351
|
+
- Confirm the bot's whitelist entry has `"ama": true` (`dexbot bot` → `6) Adapter` shows it as **Price**).
|
|
381
352
|
- Run `node dist/market_adapter/market_adapter.js --once --deltaPercent <lower-value>` for a one-cycle threshold test.
|
|
382
353
|
|
|
383
354
|
### Trigger fires too often
|
|
@@ -632,7 +603,9 @@ market_adapter/
|
|
|
632
603
|
|
|
633
604
|
### Whitelist Semantics
|
|
634
605
|
|
|
635
|
-
`profiles/market_adapter_whitelist.json` controls live writes
|
|
606
|
+
`profiles/market_adapter_whitelist.json` controls live writes. It is edited
|
|
607
|
+
per bot in the bot editor (`dexbot bot` → `6) Adapter`), which reads and
|
|
608
|
+
writes this same file:
|
|
636
609
|
|
|
637
610
|
```json
|
|
638
611
|
{
|
|
@@ -667,8 +640,11 @@ AMA slope -> live market/start-price offset, capped at half spread
|
|
|
667
640
|
|
|
668
641
|
During a grid rebuild, the bot loads the latest dynamic grid snapshot and uses
|
|
669
642
|
the AMA slope diagnostics to tilt the configured `minPrice` and `maxPrice`
|
|
670
|
-
around the AMA center.
|
|
671
|
-
|
|
643
|
+
around the AMA center. A reciprocal (log-symmetric) tilt scales both bounds by
|
|
644
|
+
the same factor: an uptrend shifts the whole band up by `1 + asymmetry`, a
|
|
645
|
+
downtrend shifts it down by `1 / (1 + asymmetry)`. The trend side therefore
|
|
646
|
+
extends while the opposite side tightens toward the center, while total log
|
|
647
|
+
width (and slot count) is preserved.
|
|
672
648
|
|
|
673
649
|
The same `asymmetricBounds` whitelist also enables `gridPriceOffsetPct`: a
|
|
674
650
|
slope-ratio offset applied only to the live `startPrice` used for initial
|
|
@@ -686,15 +662,15 @@ slopeOffset = slope normalized to the configured dynamic-weight slope cap
|
|
|
686
662
|
asymmetry = min(|slopeOffset| / maxSlopeOffset, 1) × maxAsymmetryFactor
|
|
687
663
|
|
|
688
664
|
Downtrend: minPrice = center / (M × (1 + asymmetry))
|
|
689
|
-
maxPrice = center ×
|
|
665
|
+
maxPrice = (center × M) / (1 + asymmetry)
|
|
690
666
|
|
|
691
667
|
Uptrend: maxPrice = center × (M × (1 + asymmetry))
|
|
692
|
-
minPrice = center /
|
|
668
|
+
minPrice = (center / M) × (1 + asymmetry)
|
|
693
669
|
|
|
694
670
|
Neutral: symmetric bounds (asymmetry = 0)
|
|
695
671
|
```
|
|
696
672
|
|
|
697
|
-
`ASYMMETRIC_BOUNDS_MAX_ASYMMETRY_FACTOR` defaults to `0.
|
|
673
|
+
`ASYMMETRIC_BOUNDS_MAX_ASYMMETRY_FACTOR` defaults to `0.333`; `0` disables the
|
|
698
674
|
tilt. `ASYMMETRIC_BOUNDS_MIN_SCALE_SLOTS` defaults to `10` and sets the minimum
|
|
699
675
|
number of price levels the *tightened* side of a range-scaled grid must keep
|
|
700
676
|
between the grid center and its bound (measured in `incrementPercent` steps);
|
|
@@ -710,7 +686,7 @@ Both are configurable per bot or per market via
|
|
|
710
686
|
{
|
|
711
687
|
"globals": {
|
|
712
688
|
"asymmetricBounds": {
|
|
713
|
-
"maxAsymmetryFactor": 0.
|
|
689
|
+
"maxAsymmetryFactor": 0.333,
|
|
714
690
|
"minScaleSlots": 10
|
|
715
691
|
}
|
|
716
692
|
},
|
package/modules/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Everything below covers bot lifecycle, order management, blockchain connectivity
|
|
|
8
8
|
|
|
9
9
|
If you're new to the codebase, read these files in order (~20 minutes):
|
|
10
10
|
|
|
11
|
-
1. **`constants.ts`** — all tuning parameters and defaults live here; gives you a map of the system's knobs
|
|
11
|
+
1. **`constants.ts`** — all tuning parameters and defaults live here; gives you a map of the system's knobs, and `buildDefaultGeneralSettings()` builds the canonical default `general.settings.json` document (first-run, editor fallback, local-overrides merge all share it)
|
|
12
12
|
2. **`dexbot_class.ts`** — the top-level orchestrator; shows how bot startup, fill processing, and maintenance connect
|
|
13
13
|
3. **`order/manager.ts`** — the central controller for the grid; read the constructor and `_applySafeRebalanceCOW()`
|
|
14
14
|
4. **`order/grid.ts`** — how the geometric grid is generated and sized
|
|
@@ -36,6 +36,7 @@ modules/
|
|
|
36
36
|
├── credential_policy.ts signing policy validation
|
|
37
37
|
├── credential_session_cache.ts encrypted session cache
|
|
38
38
|
├── constants.ts central config and tuning params
|
|
39
|
+
├── bot_defaults.ts bot defaults seeder (draft/entry/runtime-config modes)
|
|
39
40
|
├── config.ts load-time process.env snapshot
|
|
40
41
|
├── env.ts isBrowser/hasProcess detection
|
|
41
42
|
├── runtime.ts process abstraction singleton
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dexbot",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "The first open source trading bot with zero runtime dependencies and a fully adaptive market making strategy.",
|
|
5
5
|
"main": "dist/modules/dexbot_class.js",
|
|
6
6
|
"exports": {
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
"pdev": "bash scripts/pdev.sh",
|
|
84
84
|
"ptest": "bash scripts/ptest.sh",
|
|
85
85
|
"lp:chart": "npm run build && node dist/scripts/generate_lp_chart.js",
|
|
86
|
-
"market-adapter:whitelist": "npm run build && node dist/scripts/generate_market_adapter_whitelist.js",
|
|
87
86
|
"market-adapter:fetch-cex-synthetic": "npm run build && node dist/market_adapter/inputs/fetch_cex_synthetic_data.js",
|
|
88
87
|
"analysis:tradingview": "npm run build && node dist/analysis/tradingview/analyze_tradingview.js",
|
|
89
88
|
"ama:chart:lp-local": "npm run build && node dist/analysis/ama_fitting/generate_unified_comparison_chart.js",
|
package/scripts/README.md
CHANGED
|
@@ -93,29 +93,6 @@ bash scripts/reset-settings.sh
|
|
|
93
93
|
node dist/scripts/validate_bots.js
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
### Market Adapter Whitelist Generation
|
|
97
|
-
**File:** `generate_market_adapter_whitelist.ts`
|
|
98
|
-
**Purpose:** Generate `profiles/market_adapter_whitelist.json` from bots whose `gridPrice` uses AMA mode.
|
|
99
|
-
```bash
|
|
100
|
-
# Add missing AMA bots from profiles/bots.json to profiles/market_adapter_whitelist.json.
|
|
101
|
-
# Existing entries are preserved; new entries enable AMA only and leave dynamicWeight and range scaling disabled.
|
|
102
|
-
dexbot white
|
|
103
|
-
|
|
104
|
-
# Add missing AMA bots with dynamicWeight enabled for newly generated entries
|
|
105
|
-
dexbot white --dynamic-weight
|
|
106
|
-
|
|
107
|
-
# Add missing AMA bots with range scaling (asymmetricBounds) enabled for newly generated entries
|
|
108
|
-
dexbot white --asymmetric-bounds
|
|
109
|
-
|
|
110
|
-
# Overwrite existing entry for a specific bot (implies overwrite for that key only; other bots unchanged)
|
|
111
|
-
dexbot white --dynamic-weight --bot <botKey>
|
|
112
|
-
dexbot white --asymmetric-bounds --bot <botKey>
|
|
113
|
-
|
|
114
|
-
# Remove whitelist entries for bots no longer in profiles/bots.json
|
|
115
|
-
dexbot white --prune
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
|
|
119
96
|
### Grid Divergence Audit
|
|
120
97
|
**File:** `divergence-calc.ts`
|
|
121
98
|
**Purpose:** Measure the "drift" between in-memory grid and disk state using RMS divergence metric.
|
|
@@ -363,7 +340,6 @@ The following scripts allow you to call `dexbot` commands directly from the `scr
|
|
|
363
340
|
### Analysis
|
|
364
341
|
| Command | Purpose |
|
|
365
342
|
|:---|:---|
|
|
366
|
-
| `npm run market-adapter:whitelist` | Generate/update whitelist from AMA-configured bots |
|
|
367
343
|
| `npm run market-adapter:fetch-cex-synthetic` | Fetch CEX synthetic data for market adapter |
|
|
368
344
|
| `npm run analysis:derivatives` | Derivative analysis report |
|
|
369
345
|
| `npm run analysis:tradingview` | TradingView-style chart export |
|
|
@@ -385,8 +361,10 @@ The following scripts allow you to call `dexbot` commands directly from the `scr
|
|
|
385
361
|
|
|
386
362
|
## 📈 CHART GENERATION
|
|
387
363
|
|
|
364
|
+
`dexbot tv` and `dexbot dw` share ONE fetch pipeline ([`chart_command.ts`](chart_command.ts)): identical target resolution, source routing, cached candle chunks, and temp-file handoff — only the renderer registration (`RENDERERS` table) differs.
|
|
365
|
+
|
|
388
366
|
### TradingView (`dexbot tv`)
|
|
389
|
-
**File:** `tv.ts`
|
|
367
|
+
**File:** `tv.ts` (thin entry; shared pipeline: `chart_command.ts`)
|
|
390
368
|
**Purpose:** One-step TradingView-style 1h chart for a bot (with AMA + order overlay), pool, or pair. Fetches candles in monthly Kibana chunks (pool-first with order-book fallback; `--feed` for MPA price-feed history), then renders via `analysis/tradingview/`. Bot charts pick up the order overlay from `profiles/orders/<botKey>.json` automatically.
|
|
391
369
|
**Output:** `analysis/charts/tv_<bot|pool_<id>|<a>_<b>>_1h_<N>m.html` (`_feed` suffix for feed charts)
|
|
392
370
|
```bash
|
|
@@ -399,6 +377,21 @@ dexbot tv TOKENA/TOKENB --month 1 --chart analysis/charts/custom.html
|
|
|
399
377
|
dexbot tv BTS/HONEST.USD --feed --month 1
|
|
400
378
|
```
|
|
401
379
|
|
|
380
|
+
### Dynamic Weight (`dexbot dw`) — advanced
|
|
381
|
+
**File:** `dw.ts` (thin entry; shared pipeline: `chart_command.ts`)
|
|
382
|
+
**Purpose:** Identical one-step pipeline to `dexbot tv` (same targets, `--month`, `--feed/--pool/--book`, same cached monthly candle chunks) — the only difference is the renderer: it writes the dynamic-weight research chart via `analysis/analyze_dynamic_weight.ts` (AMA slope + Kalman blend, Hurst/PE regime gate) instead of a TradingView chart. For weight-tuning research, not general charting.
|
|
383
|
+
**Output:** `analysis/charts/dw_<bot|pool_<id>|<a>_<b>>_1h_<N>m.html` (`_feed` suffix for feed charts)
|
|
384
|
+
```bash
|
|
385
|
+
# Bot chart (default: 3 months)
|
|
386
|
+
dexbot dw <bot>
|
|
387
|
+
# Pool or pair, custom window
|
|
388
|
+
dexbot dw 133 --month 6
|
|
389
|
+
dexbot dw TOKENA/TOKENB --month 1 --chart analysis/charts/custom.html
|
|
390
|
+
# MPA price-feed history instead of market candles (opt-in)
|
|
391
|
+
dexbot dw BTS/HONEST.USD --feed --month 1
|
|
392
|
+
```
|
|
393
|
+
Research knobs (`--alpha`, `--gain`, `--dw`, `--lb`, `--clip`) stay on the analyzer itself — call `node dist/analysis/analyze_dynamic_weight.js` directly for parameter sweeps (see `analysis/README.md`).
|
|
394
|
+
|
|
402
395
|
### LP Chart
|
|
403
396
|
**File:** `generate_lp_chart.ts`
|
|
404
397
|
**Purpose:** Generate the standard uPlot LP chart output.
|
package/scripts/git-viewer.sh
CHANGED
|
@@ -44,7 +44,7 @@ check_dependencies() {
|
|
|
44
44
|
elif command -v dnf &> /dev/null; then
|
|
45
45
|
sudo dnf install -y "${missing_packages[@]}"
|
|
46
46
|
elif command -v pacman &> /dev/null; then
|
|
47
|
-
sudo pacman -
|
|
47
|
+
sudo pacman -Syu --noconfirm "${missing_packages[@]}"
|
|
48
48
|
else
|
|
49
49
|
echo "Warning: Could not detect package manager. Please install manually: ${missing_packages[@]}"
|
|
50
50
|
echo " apt-get: sudo apt-get install ${missing_packages[*]}"
|
|
@@ -108,7 +108,7 @@ if [ "$REMAINING" -eq 0 ]; then
|
|
|
108
108
|
log_info ""
|
|
109
109
|
log_info "Next steps:"
|
|
110
110
|
log_info "- Re-run \`dexbot bot\` to recreate general settings if needed"
|
|
111
|
-
log_info "- Re-
|
|
111
|
+
log_info "- Re-open \`dexbot bot\` → 6) Adapter if your AMA bot set changed"
|
|
112
112
|
log_info "- Re-fit market profiles only if you want custom AMA presets again"
|
|
113
113
|
else
|
|
114
114
|
log_warning "Cleanup incomplete. Remaining settings files: $REMAINING"
|
package/tests/README.md
CHANGED
|
@@ -88,7 +88,7 @@ Interactive tools and performance benchmarks (not part of CI).
|
|
|
88
88
|
|
|
89
89
|
### Edge Cases & Regression
|
|
90
90
|
Tests targeting specific bugs, race conditions, and failure modes.
|
|
91
|
-
*Examples:* `test_critical_bug_fixes.ts`, `test_race_condition_fixes_batch1.ts`, `test_patch17_invariants.ts`, `test_shutdown_reentrancy.ts`, `test_multifill_opposite_partial.ts`
|
|
91
|
+
*Examples:* `test_critical_bug_fixes.ts`, `test_race_condition_fixes_batch1.ts`, `test_patch17_invariants.ts`, `test_shutdown_reentrancy.ts`, `test_multifill_opposite_partial.ts`, `test_correction_queue_staleness.ts`, `test_spread_pure_fund_driven.ts`, `test_sync_lock_id_verification.ts`
|
|
92
92
|
|
|
93
93
|
### Utilities & Helpers
|
|
94
94
|
Shared utility functions, precision handling, chain helpers.
|
|
@@ -120,6 +120,15 @@ Shared utility functions, precision handling, chain helpers.
|
|
|
120
120
|
|
|
121
121
|
**Reference:** [docs/FUND_MOVEMENT_AND_ACCOUNTING.md](../docs/FUND_MOVEMENT_AND_ACCOUNTING.md)
|
|
122
122
|
|
|
123
|
+
### Grid-Price Invariant & Hold Guards
|
|
124
|
+
- Every emitted order's price must equal its slot's genesis level (`priceForSlot(idx, genesis)`); off-grid emissions are blocked, not counted
|
|
125
|
+
- The guard itself plus the live batch wiring, escalation thresholds, and per-order stranded-hold clocks are each pinned and mutation-tested
|
|
126
|
+
- Adoption keeps the slot's own level; `loadGrid` repairs a pre-existing off-grid slot price
|
|
127
|
+
|
|
128
|
+
**Reference:** [docs/GRID_PRICE_INVARIANT.md](../docs/GRID_PRICE_INVARIANT.md)
|
|
129
|
+
|
|
130
|
+
**Examples:** `test_grid_price_invariant_guard.ts`, `test_grid_price_invariant_wiring.ts`, `test_grid_price_slot_invariant.ts`, `test_final_pivot_gate.ts`, `test_hold_and_center_guards.ts`, `test_sync_out_of_grid_defer.ts`
|
|
131
|
+
|
|
123
132
|
---
|
|
124
133
|
|
|
125
134
|
## Documentation References
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare function isAmaGridPrice(value: any): boolean;
|
|
2
|
-
declare function parseOptions(argv: string[]): {
|
|
3
|
-
dynamicWeight: boolean;
|
|
4
|
-
asymmetricBounds: boolean;
|
|
5
|
-
prune: boolean;
|
|
6
|
-
botKeys: string[];
|
|
7
|
-
};
|
|
8
|
-
declare function loadExistingWhitelist(): any;
|
|
9
|
-
declare function buildWhitelist(bots: any, existingWhitelist?: any, options?: ReturnType<typeof parseOptions>): {
|
|
10
|
-
whitelist: {
|
|
11
|
-
[k: string]: any;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export { isAmaGridPrice, parseOptions, loadExistingWhitelist, buildWhitelist };
|
|
15
|
-
//# sourceMappingURL=generate_market_adapter_whitelist.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate_market_adapter_whitelist.d.ts","sourceRoot":"","sources":["../../scripts/generate_market_adapter_whitelist.ts"],"names":[],"mappings":"AAqBA,iBAAS,cAAc,CAAC,KAAK,EAAE,GAAG,WAGjC;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE;;;;;EAmDnC;AAED,iBAAS,qBAAqB,QAwB7B;AAED,iBAAS,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,iBAAiB,GAAE,GAAQ,EAAE,OAAO,GAAE,UAAU,CAAC,OAAO,YAAY,CAA8B;;;;EA6DpI;AAyBD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAA"}
|