dexbot 1.6.12 → 1.6.14

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.
Files changed (213) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/README.md +2 -2
  3. package/analysis/README.md +9 -11
  4. package/analysis/ama_fitting/README.md +5 -3
  5. package/claw/README.md +1 -0
  6. package/claw/docs/AI_BOT_LIBRARY_API.md +3 -1
  7. package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
  8. package/claw/modules/claw_bridge.ts +0 -3
  9. package/claw/modules/claw_catalog.ts +8 -4
  10. package/claw/modules/claw_skill_md.ts +1 -0
  11. package/claw/modules/dexbot_profiles.ts +59 -15
  12. package/claw/modules/types.ts +2 -1
  13. package/claw/package.json +3 -3
  14. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  15. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  16. package/claw/skills/margin-trading/SKILL.md +1 -1
  17. package/claw/skills/margin-trading/references/position-management.md +1 -1
  18. package/claw/tsconfig.json +2 -2
  19. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +1 -14
  20. package/dist/analysis/ama_fitting/fetch_lp_candles.js +51 -41
  21. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -24
  22. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +36 -18
  23. package/dist/analysis/ama_fitting/optimizer_high_resolution.js +18 -66
  24. package/dist/analysis/analyze_args.d.ts +12 -0
  25. package/dist/analysis/analyze_args.js +20 -0
  26. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +1 -16
  27. package/dist/analysis/bot_fitting/backtest_ama_sweep.js +20 -101
  28. package/dist/analysis/bot_fitting/backtest_bot_fitting.js +26 -92
  29. package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
  30. package/dist/analysis/bot_fitting/shared_utils.d.ts +71 -3
  31. package/dist/analysis/bot_fitting/shared_utils.js +124 -8
  32. package/dist/analysis/chart_ui.d.ts +30 -1
  33. package/dist/analysis/chart_ui.js +37 -1
  34. package/dist/analysis/fills_cache.d.ts +3 -23
  35. package/dist/analysis/fills_cache.js +3 -84
  36. package/dist/analysis/fills_source.d.ts +31 -1
  37. package/dist/analysis/fills_source.js +69 -1
  38. package/dist/analysis/grid_correction_check.d.ts +1 -23
  39. package/dist/analysis/grid_correction_check.js +15 -58
  40. package/dist/analysis/math_utils.d.ts +85 -1
  41. package/dist/analysis/math_utils.js +116 -1
  42. package/dist/analysis/price_sources.d.ts +22 -1
  43. package/dist/analysis/price_sources.js +23 -0
  44. package/dist/analysis/resolve_source.js +31 -10
  45. package/dist/analysis/trade_profitability.d.ts +6 -0
  46. package/dist/analysis/trade_profitability.js +23 -97
  47. package/dist/analysis/tradingview/analyze_tradingview.d.ts +1 -17
  48. package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
  49. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +27 -40
  50. package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
  51. package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +22 -80
  52. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +11 -37
  53. package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
  54. package/dist/analysis/worker_pool.d.ts +38 -0
  55. package/dist/analysis/worker_pool.js +67 -0
  56. package/dist/dexbot.js +67 -48
  57. package/dist/market_adapter/ama_signal_runner.js +21 -54
  58. package/dist/market_adapter/candle_utils.d.ts +7 -1
  59. package/dist/market_adapter/candle_utils.js +11 -1
  60. package/dist/market_adapter/cli_args.d.ts +22 -0
  61. package/dist/market_adapter/cli_args.js +30 -0
  62. package/dist/market_adapter/core/config_normalizers.js +11 -6
  63. package/dist/market_adapter/core/kibana_candles.d.ts +3 -1
  64. package/dist/market_adapter/core/kibana_candles.js +3 -2
  65. package/dist/market_adapter/core/market_adapter_service.d.ts +85 -85
  66. package/dist/market_adapter/core/market_adapter_service.js +93 -158
  67. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
  68. package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
  69. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
  70. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
  71. package/dist/market_adapter/inputs/fetch_book_data.js +0 -1
  72. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +63 -107
  73. package/dist/market_adapter/inputs/fetch_lp_data.d.ts +8 -1
  74. package/dist/market_adapter/inputs/fetch_lp_data.js +25 -7
  75. package/dist/market_adapter/inputs/kibana_feed_source.js +4 -26
  76. package/dist/market_adapter/inputs/window_cache.d.ts +4 -72
  77. package/dist/market_adapter/inputs/window_cache.js +52 -177
  78. package/dist/market_adapter/interval_utils.d.ts +11 -1
  79. package/dist/market_adapter/interval_utils.js +16 -1
  80. package/dist/market_adapter/lp_chart_runner.d.ts +3 -0
  81. package/dist/market_adapter/lp_chart_runner.js +37 -19
  82. package/dist/market_adapter/market_adapter.js +27 -72
  83. package/dist/market_adapter/utils/data_discovery.d.ts +45 -1
  84. package/dist/market_adapter/utils/data_discovery.js +220 -27
  85. package/dist/market_adapter/utils/month_shards.d.ts +84 -0
  86. package/dist/market_adapter/utils/month_shards.js +237 -0
  87. package/dist/modules/account_bots.d.ts +8 -6
  88. package/dist/modules/account_bots.js +112 -131
  89. package/dist/modules/account_orders.d.ts +49 -4
  90. package/dist/modules/account_orders.js +114 -49
  91. package/dist/modules/bitshares-native/chain_client.d.ts +1 -1
  92. package/dist/modules/bitshares-native/chain_client.js +14 -13
  93. package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
  94. package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
  95. package/dist/modules/bitshares-native/resolvers.js +22 -25
  96. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
  97. package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
  98. package/dist/modules/bitshares-native/serial/types.js +22 -50
  99. package/dist/modules/bitshares-native/signing_client.d.ts +1 -1
  100. package/dist/modules/bot_defaults.d.ts +18 -3
  101. package/dist/modules/bot_defaults.js +34 -8
  102. package/dist/modules/bot_settings.d.ts +5 -1
  103. package/dist/modules/bot_settings.js +55 -21
  104. package/dist/modules/broadcast_failure.d.ts +2 -1
  105. package/dist/modules/chain_orders.d.ts +1 -1
  106. package/dist/modules/chain_orders.js +51 -96
  107. package/dist/modules/cli_start_onboarding.d.ts +2 -1
  108. package/dist/modules/config.js +6 -1
  109. package/dist/modules/constants.d.ts +14 -6
  110. package/dist/modules/constants.js +32 -6
  111. package/dist/modules/cr_planner.d.ts +1 -1
  112. package/dist/modules/cr_planner.js +1 -5
  113. package/dist/modules/credit_pricing.d.ts +2 -1
  114. package/dist/modules/credit_pricing.js +36 -40
  115. package/dist/modules/credit_runtime.d.ts +7 -0
  116. package/dist/modules/credit_runtime.js +45 -73
  117. package/dist/modules/daemon_node_health.d.ts +4 -3
  118. package/dist/modules/dexbot_class.d.ts +33 -17
  119. package/dist/modules/dexbot_class.js +113 -61
  120. package/dist/modules/dexbot_cow_runtime.d.ts +62 -181
  121. package/dist/modules/dexbot_cow_runtime.js +380 -69
  122. package/dist/modules/dexbot_credential_client.d.ts +1 -23
  123. package/dist/modules/dexbot_credential_client.js +2 -3
  124. package/dist/modules/dexbot_fill_runtime.d.ts +2 -3
  125. package/dist/modules/dexbot_fill_runtime.js +17 -7
  126. package/dist/modules/dexbot_maintenance_runtime.d.ts +36 -81
  127. package/dist/modules/dexbot_maintenance_runtime.js +137 -133
  128. package/dist/modules/dexbot_startup_runtime.d.ts +0 -1
  129. package/dist/modules/dexbot_startup_runtime.js +25 -14
  130. package/dist/modules/dexbot_state_recovery.js +16 -0
  131. package/dist/modules/general_settings.d.ts +1 -1
  132. package/dist/modules/graceful_shutdown.js +17 -11
  133. package/dist/modules/key_store.d.ts +0 -5
  134. package/dist/modules/key_store.js +1 -2
  135. package/dist/modules/lazy_shim.d.ts +11 -0
  136. package/dist/modules/lazy_shim.js +16 -0
  137. package/dist/modules/node_connect_policy.d.ts +3 -2
  138. package/dist/modules/node_failure_ledger.d.ts +6 -5
  139. package/dist/modules/order/accounting.js +11 -11
  140. package/dist/modules/order/export.js +2 -2
  141. package/dist/modules/order/format.d.ts +26 -3
  142. package/dist/modules/order/format.js +33 -3
  143. package/dist/modules/order/genesis_policy.d.ts +4 -4
  144. package/dist/modules/order/genesis_policy.js +6 -3
  145. package/dist/modules/order/grid.d.ts +26 -12
  146. package/dist/modules/order/grid.js +468 -80
  147. package/dist/modules/order/grid_reconcile.d.ts +1 -1
  148. package/dist/modules/order/grid_reconcile.js +5 -5
  149. package/dist/modules/order/grid_reconcile_internal.js +48 -40
  150. package/dist/modules/order/index.d.ts +35 -8
  151. package/dist/modules/order/logger.d.ts +1 -8
  152. package/dist/modules/order/logger.js +2 -11
  153. package/dist/modules/order/manager.d.ts +18 -15
  154. package/dist/modules/order/manager.js +91 -74
  155. package/dist/modules/order/strategy.d.ts +2 -2
  156. package/dist/modules/order/strategy.js +51 -21
  157. package/dist/modules/order/sync_engine.js +4 -0
  158. package/dist/modules/order/utils/math.d.ts +3 -3
  159. package/dist/modules/order/utils/math.js +38 -27
  160. package/dist/modules/order/utils/order.d.ts +58 -58
  161. package/dist/modules/order/utils/order.js +158 -137
  162. package/dist/modules/order/utils/system.d.ts +202 -35
  163. package/dist/modules/order/utils/system.js +409 -31
  164. package/dist/modules/order/utils/validate.js +28 -6
  165. package/dist/modules/order/utils/withPoolRef.d.ts +2 -1
  166. package/dist/modules/paths.js +32 -34
  167. package/dist/modules/runtime_settings.d.ts +3 -5
  168. package/dist/modules/runtime_settings.js +3 -3
  169. package/dist/modules/settings_merge.d.ts +2 -2
  170. package/dist/modules/socket_json_client.d.ts +2 -1
  171. package/dist/modules/types.d.ts +89 -30
  172. package/dist/modules/utils/errors.js +1 -3
  173. package/dist/modules/version_notice.d.ts +11 -10
  174. package/dist/pm2.d.ts +0 -1
  175. package/dist/pm2.js +56 -35
  176. package/dist/scripts/analyze-git.js +2 -15
  177. package/dist/scripts/analyze-orders.d.ts +1 -1
  178. package/dist/scripts/analyze-orders.js +4 -4
  179. package/dist/scripts/chart_command.js +2 -2
  180. package/dist/scripts/check_any.d.ts +4 -0
  181. package/dist/scripts/check_any.js +53 -21
  182. package/dist/scripts/diagnose-pool-history.js +1 -6
  183. package/dist/scripts/divergence-calc.js +6 -6
  184. package/dist/scripts/run-tests.js +0 -1
  185. package/dist/scripts/sync-version.js +0 -10
  186. package/dist/scripts/validate_bots.d.ts +1 -1
  187. package/dist/scripts/validate_bots.js +3 -3
  188. package/dist/unlock.js +7 -2
  189. package/docs/BITSHARES_ONBOARDING.md +8 -12
  190. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -3
  191. package/docs/COW_INVARIANTS.md +6 -6
  192. package/docs/DEXBOT_COMPARISON.md +7 -7
  193. package/docs/EVOLUTION.md +10 -8
  194. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
  195. package/docs/GRID_PRICE_INVARIANT.md +3 -3
  196. package/docs/GRID_RECALCULATION.md +4 -1
  197. package/docs/GRID_RECONCILE.md +4 -4
  198. package/docs/LIFECYCLE.md +11 -11
  199. package/docs/LOGGING.md +14 -0
  200. package/docs/MPA_CREDIT_USAGE.md +1 -1
  201. package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
  202. package/docs/README.md +3 -3
  203. package/docs/WORKFLOW.md +1 -0
  204. package/docs/architecture.md +25 -16
  205. package/docs/developer_guide.md +7 -2
  206. package/market_adapter/README.md +6 -4
  207. package/package.json +6 -9
  208. package/scripts/README.md +43 -38
  209. package/tests/README.md +26 -11
  210. package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
  211. package/dist/scripts/diagnose-kibana-candles.js +0 -82
  212. package/scripts/git-viewer.sh +0 -489
  213. package/scripts/postinstall.js +0 -16
@@ -61,15 +61,15 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
61
61
  - Funds drive order sizing/budget allocation only; `syncBoundaryToFunds`/`calculateFundDrivenBoundary` are deleted (1.5.3).
62
62
 
63
63
  - `INV-COW-007` Boundary hold on guard-skipped refills
64
- - When a slot on the plan's refill wire (`collectRefillSlotIds`: the plan's CREATE ids minus reserve-ladder edge ids) was guard-skipped at broadcast (`skippedUpdateSlotIds` ∪ `clampedUpdateSlotIds` ∪ `skippedCreateSlotIds`), `resolveRefillBoundaryHold` keeps the COMMITTED boundary instead of committing the plan's shifted one over the stranded rail hole; the grid still commits.
65
- - Reserve-ladder CREATEs are excluded because reserves are static edge insurance whose fills never crawl — a skipped reserve must not pin geometry.
64
+ - When a slot on the plan's refill wire (`collectRefillSlotIds`: the plan's CREATE ids minus edge-ladder edge ids) was guard-skipped at broadcast (`skippedUpdateSlotIds` ∪ `clampedUpdateSlotIds` ∪ `skippedCreateSlotIds`), `resolveRefillBoundaryHold` keeps the COMMITTED boundary instead of committing the plan's shifted one over the stranded rail hole; the grid still commits.
65
+ - Edge-ladder CREATEs are excluded because reserves are static edge insurance whose fills never crawl — a skipped reserve must not pin geometry.
66
66
  - The hold rides to the commit as `options.boundaryHeld`, which suppresses the pending-crawl clear.
67
67
  - `trackBoundaryHold` counts consecutive hold batches (`manager._consecutiveBoundaryHolds`, cleared on the first clean batch) with a last-hold snapshot (`manager._lastBoundaryHoldInfo`); runs of 3+ escalate visibly. It also records a hold signature (`manager._lastHeldPlanSignature`: committed boundary + guard pivot + `_lastFilledAt` + held wire) so a fill-less re-plan of an unchanged state defers instead of re-broadcasting the identical vetoed plan.
68
68
  - Fill-driven rebalances never sleep on `_broadcastingFlag` inside `_fillProcessingLock`: `performSafeRebalance({deferIfBroadcasting:true})` returns a `deferred` result and the region-end hook schedules one no-fill rebalance (`schedulePostRecoveryRebalance`). This prevents the 20s lock-acquisition-timeout cascade when a broadcast region outlives the 30s `_awaitBroadcastIdle` wait. The stale-flag watchdog (`_clearStaleBroadcastFlag`, 120s) fires the same region-end hook when it hard-clears a leaked flag, so deferred fills are woken even when the region never ends through `stopBroadcasting()`.
69
69
  - A hold run carrying fresh fills (>= `TIMING.BOUNDARY_HOLD_RESYNC_THRESHOLD`) requests a guard-aware structural re-center (`requestStructuralGridResync`, cooldown `TIMING.BOUNDARY_HOLD_RESYNC_COOLDOWN_MS`) instead of holding forever — the heal path when the grid is trailing the market.
70
70
 
71
71
  - `INV-COW-008` Owed fill crawls survive unapplied commits
72
- - `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots, reserve slots, and window members — a window that reaches the grid edge is not a reserve, using the same window exclusion every placement picker and `countLiveReserveOrders` apply.
72
+ - `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots, edge slots, and window members — a window that reaches the grid edge is not an edge order, using the same window exclusion every placement picker and `countLiveEdgeOrders` apply.
73
73
  - `_commitWorkingGrid` clears them only when the plan's boundary was actually applied — a held boundary (`boundaryHeld`), a gate-rejected boundary, and a null boundary all leave them owed.
74
74
  - `consumePendingFillCrawls` applies them onto a restored finite boundary; `applyPersistedPendingCrawls` is the shared startup/recovery wrapper used before sync/reconcile; `_clearPendingFillCrawls` drops them when the boundary is re-anchored (grid rebuild via `initializeGrid`, rejected snapshot via `rejectCorruptedGridSnapshot`, persisted snapshot wipe via `AccountOrders.clearGrid`).
75
75
 
@@ -87,11 +87,11 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
87
87
  - `INV-PROJ-002` Preserve on-chain PARTIAL size in projection
88
88
  - If identity is retained (`keepOrderId=true`) and current state is `PARTIAL`, projected size must preserve current on-chain remaining size.
89
89
  - It must not be overwritten by ideal geometric `targetSize`.
90
- - Exception: a `PARTIAL` with a rotation/size-update action targeting its `orderId` does use `targetSize` (the explicit-UPDATE path at `modules/order/utils/validate.ts:1158`).
90
+ - Exception: a `PARTIAL` with a rotation/size-update action targeting its `orderId` does use `targetSize` (the explicit-UPDATE path at `modules/order/utils/validate.ts:1187`).
91
91
  - Preserve-path size must be normalized to finite, non-negative value.
92
92
 
93
93
  - `INV-PROJ-003` ACTIVE on-chain projection preserves current size (same as PARTIAL)
94
- - If identity is retained and state is `ACTIVE`, projection preserves current on-chain size via the same `shouldPreserveSize` path as `PARTIAL` (`validate.ts:1158`).
94
+ - If identity is retained and state is `ACTIVE`, projection preserves current on-chain size via the same `shouldPreserveSize` path as `PARTIAL` (`validate.ts:1187`).
95
95
  - An explicit UPDATE action targeting the `orderId` is required to apply `targetSize`.
96
96
 
97
97
  - `INV-ID-001` Order identity retention rule
@@ -191,7 +191,7 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
191
191
  - `INV-GRID-001` One-to-one order mapping
192
192
  - One grid slot = at most one on-chain order. No two chain orders may map to the same grid slot.
193
193
  - Sync engine tracks `matchedGridOrderIds` through both sync passes and skips already-matched slots.
194
- - Surplus orders (matched count above the per-side `activeOrders` + `reserveOrders` targets) are flagged for cancellation.
194
+ - Surplus orders (matched count above the per-side `coreOrders` + `edgeOrders` targets) are flagged for cancellation.
195
195
 
196
196
  - `INV-GRID-002` One order per price level
197
197
  - The active grid must have at most one on-chain order per (type, price) pair.
@@ -1,7 +1,7 @@
1
1
  # DEXBot vs DEXBot2 — Detailed Comparison Report
2
2
 
3
3
  > **Date:** 2026-09-02 *(metrics refreshed against local source trees)*
4
- > **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.12).
4
+ > **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.14).
5
5
  > **Audience:** Developers, contributors, and operators evaluating or migrating between the two projects.
6
6
 
7
7
  ---
@@ -36,7 +36,7 @@
36
36
 
37
37
  | Attribute | DEXBot (original) | DEXBot2 |
38
38
  |---|---|---|
39
- | **Release Track** | 1.0.0 | v1.6.12 |
39
+ | **Release Track** | 1.0.0 | v1.6.14 |
40
40
  | **Language** | Python 3.6+ | TypeScript 5.x |
41
41
  | **Status** | Released 1.0.0, unmaintained | Active development |
42
42
  | **Last Repo Activity** | May 23, 2020 | 2026-09-02 |
@@ -347,7 +347,7 @@ workers:
347
347
  "targetSpreadPercent": 4,
348
348
  "weightDistribution": { "sell": 1, "buy": 1 },
349
349
  "botFunds": { "sell": "100%", "buy": "100%" },
350
- "activeOrders": { "sell": 5, "buy": 5 },
350
+ "coreOrders": { "sell": 5, "buy": 5 },
351
351
  "poolRef": "1.19.133" // optional: pin a specific pool for price derivation
352
352
  }
353
353
  ```
@@ -776,13 +776,13 @@ Where:
776
776
 
777
777
  | Metric | DEXBot | DEXBot2 |
778
778
  |---|---|---|
779
- | **Release Track** | 1.0.0 | v1.6.12 |
779
+ | **Release Track** | 1.0.0 | v1.6.14 |
780
780
  | **Active Since** | ~2018 | December 2025 |
781
- | **Last Commit** | May 23, 2020 | 2026-10-08 |
782
- | **Total Commits** | 2281 | 2,350 (current HEAD, v1.6.12 line) |
781
+ | **Last Commit** | May 23, 2020 | 2026-10-10 |
782
+ | **Total Commits** | 2281 | 2,390 (current HEAD, v1.6.14 line) |
783
783
  | **Lines of Code** | ~10,846 Python LOC in `dexbot/` | Large TypeScript runtime + adapter + Claw + analysis + tests |
784
784
  | **Source Files** | 72 Python files in `dexbot/` | ~656 TS files across the repo |
785
- | **Test Files** | 16 Python test files | 330 `test_*.ts` files (313 `tests/` + 17 `claw/tests/`, auto-discovered via `globSync`) |
785
+ | **Test Files** | 16 Python test files | 324 `test_*.ts` files (307 `tests/` + 17 `claw/tests/`, auto-discovered via `globSync`) |
786
786
  | **Documentation** | Sphinx docs + README | 60+ Markdown docs plus Claw skills/references |
787
787
  | **Strategies** | 3 + plugins | 1 |
788
788
  | **Max Concurrent Bots** | Many (one process) | Many (one monolithic process by default; per-bot via `--isolated`/PM2) |
package/docs/EVOLUTION.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## Executive Summary
4
4
 
5
- DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.6.12 release.
5
+ DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.6.14 release.
6
6
 
7
7
  ### Key Milestones
8
8
  - **Project Inception**: December 2, 2025
9
- - **Growth Phase**: 2,350 commits over ~9 active months
9
+ - **Growth Phase**: 2,390 commits over ~9 active months
10
10
  - **Code Maturity**: Evolution from basic utilities to a ~100,000+ LoC intelligent TypeScript system
11
- - **Stability**: Progression from manual testing to a suite of 313 automated test files
12
- - **Releases**: 144 version entries in the changelog (v0.1.0 to v1.6.12)
11
+ - **Stability**: Progression from manual testing to a suite of 307 automated test files
12
+ - **Releases**: 146 version entries in the changelog (v0.1.0 to v1.6.14)
13
13
 
14
14
  > **Post-1.0.0 "why":** the thematic story behind the hardening releases — root cause, recurring
15
15
  > bug families, and lessons — lives in
@@ -149,7 +149,7 @@ Evolved from a basic README to a comprehensive framework (50+ docs entries, 80%+
149
149
 
150
150
  ## Version History
151
151
 
152
- Compact, era-level view; commit counts are `git rev-list --count <tag>..<tag>` over the current history (2026-10-08), so the column sums to 2,243 — the 107 commits up to and including the `v0.1.0` tag are not attributed to an era (2,243 + 107 = 2,350). Per-release detail lives in [CHANGELOG.md](../CHANGELOG.md); the thematic post-1.0.0 story in [ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md](ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md).
152
+ Compact, era-level view; commit counts are `git rev-list --count <tag>..<tag>` over the current history (2026-10-12). The 107 commits up to and including the `v0.1.0` tag are not attributed to an era, so the current totals are 2,283 (`v0.1.0..HEAD`) and 2,390 (`HEAD`); the `v1.4.x` era rows overlap slightly because `v1.4.13` is not an ancestor of `v1.4.25` in the current history. Per-release detail lives in [CHANGELOG.md](../CHANGELOG.md); the thematic post-1.0.0 story in [ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md](ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md).
153
153
 
154
154
  | Era | Commits | Theme |
155
155
  |-----|--------:|-------|
@@ -170,11 +170,13 @@ Compact, era-level view; commit counts are `git rev-list --count <tag>..<tag>` o
170
170
  | v1.6.9 → v1.6.10 | 7 | Huber-robust AMA slope, asset-pair uppercase canonicalization, TradingView indicator ownership (auto opt-in, span bounds) and chart-view preservation |
171
171
  | v1.6.10 → v1.6.11 | 6 | AMA-slope 3-bar persistence gate + 16h Huber lookback, EMA-smoothing removal, PnL HTML report + month-shard fill cache, five order-engine/lifecycle safety fixes |
172
172
  | v1.6.11 → v1.6.12 | 27 | Explicit-`any` elimination + ratchet, shared ECC core & Firefox-safe pure-JS scrypt, worker-drain and fresh-placement cancel-grace safety fixes, funded spread correction, partial credit renewal, update install-layout classifier, AMA persistence-override fixes, test-suite speedup, dynamic-weight knob retune |
173
+ | v1.6.12 → v1.6.13 | 21 | Spread-stall cause reporting + chain sync on every stall, resync-cascade guards (uncertain broadcast / suspended persistence), month-shard candle cache, dedup & dead-code purge, npm 12 install & PM2 fixes |
174
+ | v1.6.13 → v1.6.14 | 17 | Last-fill guard + live market floor for spread correction, committed-size drift resize, COW pre-broadcast guards & P2 counters, fail-closed unknown geometry, order-key rename, worker-thread test runner |
173
175
 
174
176
  ---
175
177
 
176
178
  **Report Originally Generated**: February 19, 2026
177
- **Last Updated**: October 8, 2026
178
- **Total Commits**: 2,350
179
- **Date Range**: December 2, 2025 – October 8, 2026
179
+ **Last Updated**: October 12, 2026
180
+ **Total Commits**: 2,390
181
+ **Date Range**: December 2, 2025 – October 12, 2026
180
182
  **Repository**: DEXBot2 (BitShares DEX Trading Bot)
@@ -52,7 +52,7 @@ funds.allocated → _getSizingContext() (budget for spread correction)
52
52
  **Key points:**
53
53
  - `botFunds` percentage applies to **total** capital (free + locked in orders), not just free. A bot at `"50%"` gets half of everything, not half of what's currently idle.
54
54
  - `funds.allocated` is the ceiling for each side. Existing orders already consume part of it; the remaining free portion is available for new placements.
55
- - The downstream `applyBotFundsAllocation()` (`manager.ts:1277`) also caps `funds.available` to `<= allocated` as a safety net, but the primary budget chokepoint is `getSideBudget` / `_getSizingContext` reading `allocated` directly (v1.2.6).
55
+ - The downstream `applyBotFundsAllocation()` (`manager.ts:1296`) also caps `funds.available` to `<= allocated` as a safety net, but the primary budget chokepoint is `getSideBudget` / `_getSizingContext` reading `allocated` directly (v1.2.6).
56
56
 
57
57
  ---
58
58
 
@@ -112,7 +112,7 @@ See [developer_guide.md#order-state-helper-functions](developer_guide.md#order-s
112
112
 
113
113
  #### Gap-Slot Batch Fill Processing
114
114
 
115
- **Mechanism**: Fill events arrive via `modules/dexbot_fill_runtime.ts` (the fill-runtime module), which pushes them into `bot._incomingFillQueue` (declared in `modules/dexbot_class.ts`). The drain loop in `dexbot_fill_runtime.ts` then chunks the queue into capped batches and calls `modules/order/manager.ts::processFilledOrders` (line 1438) once per chunk to run the full rebalance pipeline.
115
+ **Mechanism**: Fill events arrive via `modules/dexbot_fill_runtime.ts` (the fill-runtime module), which pushes them into `bot._incomingFillQueue` (declared in `modules/dexbot_class.ts`). The drain loop in `dexbot_fill_runtime.ts` then chunks the queue into capped batches and calls `modules/order/manager.ts::processFilledOrders` (line 1811) once per chunk to run the full rebalance pipeline.
116
116
 
117
117
  **Batch Sizing Algorithm**: Batch size is derived from the grid gap-slot count + 1 (`DEXBot._getGapSlotBatchSize`): a queue depth at or below gapSlots+1 is processed as one unified batch; deeper queues are chunked into repeated batches of gapSlots+1 (the last chunk may be smaller). The same gapSlots+1 size caps order operations per broadcast transaction (oversized op batches are split into sequential broadcasts).
118
118
 
@@ -123,7 +123,7 @@ See [developer_guide.md#order-state-helper-functions](developer_guide.md#order-s
123
123
  **Per-Batch Execution**:
124
124
 
125
125
  1. **Peek & Pop**: Check `_incomingFillQueue`, pop up to N fills (batch size)
126
- 2. **Replay-safe Accounting Pass**: Each fill is accounted individually via `processFillAccounting(fillOp, fillKey)` with replay-safe dedup (`applyReplaySafeFillAccounting`, `dexbot_fill_runtime.ts:305`)
126
+ 2. **Replay-safe Accounting Pass**: Each fill is accounted individually via `processFillAccounting(fillOp, fillKey)` with replay-safe dedup (`applyReplaySafeFillAccounting`, `dexbot_fill_runtime.ts:303`)
127
127
  - Proceeds credited directly to `chainFree` (via `adjustTotalBalance`)
128
128
  - Same-order fill batching (sync_engine Phase 6 cumulative transition) aggregates multiple fill transitions on one order before a single rebalance
129
129
  - All proceeds immediately available to next rebalance cycle (not split across cycles)
@@ -137,7 +137,7 @@ See [developer_guide.md#order-state-helper-functions](developer_guide.md#order-s
137
137
 
138
138
  **Result**: 29 fills now processed in ~8 broadcasts (~24s) instead of 29 broadcasts (~90s).
139
139
 
140
- **Residual Dust Cancellation** (post-1.4.12): After a sub-dust fill leaves a residual order on chain (e.g. the quote-side value truncates to 0 on `bitshares-core` `maybe_cull_small_order`), the fill runtime explicitly cancels those residuals via `cancelResidualOrders()` (`dexbot_fill_runtime.ts:193`, `[RESIDUAL]` tag) so a leftover of ≥1 base unit cannot be re-adopted into a grid slot by maintenance.
140
+ **Residual Dust Cancellation** (post-1.4.12): After a sub-dust fill leaves a residual order on chain (e.g. the quote-side value truncates to 0 on `bitshares-core` `maybe_cull_small_order`), the fill runtime explicitly cancels those residuals via `cancelResidualOrders()` (`dexbot_fill_runtime.ts:191`, `[RESIDUAL]` tag) so a leftover of ≥1 base unit cannot be re-adopted into a grid slot by maintenance.
141
141
 
142
142
  #### Grid Regeneration Trigger (Available Funds Ratio — bidirectional)
143
143
 
@@ -156,6 +156,8 @@ SHRINK: overAlloc = (gridTracked - allocatedCapital) / allocatedCapital * 100
156
156
 
157
157
  Deliberately no per-side chain-total-drop leg: a normal fill moves value across sides (pays one asset, receives the other — see `processFillAccounting`), so one side's total routinely drops ≥3% on ordinary fills, and the fill pipeline already re-sizes from the post-fill budget.
158
158
 
159
+ **Committed-Size Drift leg**: the available-funds ratio above is measured as `chainFree − virtual`. The fill/rotation sizing pipeline re-derives VIRTUAL slot sizes from the live budget, so an external deposit (or withdrawal) is folded into the virtual reservation on the first rotation after it lands — `chainFree` and `virtual` move together, the ratio stays pinned at the unallocated remainder, and the on-chain (ACTIVE/PARTIAL) orders can stay at their pre-deposit sizes with no trigger. The committed-drift leg (folded into `checkAndUpdateGridIfNeeded`, exposed drift-only as `checkCommittedSizeDrift`) closes that gap: it computes the geometric ideal for each side from the current budget and compares it against the sizes actually committed on-chain (replaying the resize path's free-balance growth cap). A side whose committed orders would change by ≥ `GRID_REGENERATION_PERCENTAGE` of its **committed size** is flagged on the same ratio leg, so the full side is resized rather than only the fill-generated replacement orders. The denominator is the committed total, not the whole allocation: the on-chain window is a small slice of the plan (the far rail holds most of it), so an allocation-relative fraction would understate a genuine full-side undersize.
160
+
159
161
  **How It Works (grow)**:
160
162
  1. Fill occurs → proceeds added to `chainFree`
161
163
  2. `calculateAvailableFundsValue()` computes true spending power (chainFree minus reservations)
@@ -525,7 +527,7 @@ BitShares charges fees for `limit_order_create` and `limit_order_cancel`.
525
527
 
526
528
  - **Reservation** (`BTS_RESERVATION_MULTIPLIER` in `constants.ts::FEE_PARAMETERS`):
527
529
  $$Reserve = N_{active} \times BTS\_RESERVATION\_MULTIPLIER$$
528
- *(Default: 5× per order — covers create, rotate (cancel+place), update, and cancel over the order's lifetime. $N_{active}$ counts window orders plus the `reserveOrders` edge ladder — reserves rest live on-chain and pay fees like window orders)*
530
+ *(Default: 5× per order — covers create, rotate (cancel+place), update, and cancel over the order's lifetime. $N_{active}$ counts window orders plus the `edgeOrders` edge ladder — reserves rest live on-chain and pay fees like window orders)*
529
531
 
530
532
  - **Settlement (`deductBtsFees`):**
531
533
  1. Check `Funds.btsFeesOwed`.
@@ -801,4 +803,4 @@ To prevent "Time-of-Check to Time-of-Use" errors:
801
803
  **TOCTOU protection in `processFillAccounting`.** `_buildBtsDeferredRefundAdjustment` reads `btsFeeState` from `mgr.orders` while the order lock is held — the lock is acquired before accounting runs, and the POST-RESET and BOOTSTRAP tracked-fill accounting paths follow the same locking pattern.
802
804
 
803
805
  ---
804
- *Technical Reference for DEXBot2 v1.6.12 release*
806
+ *Technical Reference for DEXBot2 v1.6.14 release*
@@ -1,7 +1,7 @@
1
1
  # The Grid-Price Invariant
2
2
 
3
3
  Status: **implemented; the emission check is BLOCKING**
4
- Last code-reviewed against the v1.6.7 release baseline `d4e0ce0b` (2026-09-26).
4
+ Last code-reviewed against the v1.6.13 release baseline `1a1ae60c` (2026-10-11).
5
5
 
6
6
  ## The invariant
7
7
 
@@ -413,7 +413,7 @@ is divergence telemetry built on `calculateGridSideDivergenceMetric`.
413
413
  **A grid with no price ladder is not a degraded grid — it is an undefined one.**
414
414
  Every consumer of the invariant reads `priceForSlot(idx, genesis)`, and each one
415
415
  silently degrades without it: nearest-slot adoption, `computeOutOfToleranceDriftTag`,
416
- the materialize descriptor-price fallback, `resolveLiveReserveEdgeAnchorPrice`
416
+ the materialize descriptor-price fallback, `resolveLiveEdgeAnchorPrice`
417
417
  tiers 3/4, and the `isSlotInRail` fail-open. That degradation is the tolerance
418
418
  matcher, which is exactly the path on which an off-grid price becomes grid
419
419
  evidence. So the ladder is treated as a **required** part of a snapshot, not a
@@ -489,7 +489,7 @@ degrade *into*:
489
489
  | correction-queue staleness matched by tolerance | `priceSlotEqual` against the slot's own level, and a ladder-less entry is dropped |
490
490
  | `computeOutOfToleranceDriftTag` + `price-drift-orphan` auto-cancel (`PRICE_DRIFT_TOLERANCE_MULTIPLIER`) | removed — an off-grid order is HELD (`out-of-grid-deferred`) and resolved structurally, never cancelled off a fuzzy price diff |
491
491
  | `findMatchingGridOrderByOpenOrder` | removed (its last production caller was the pass-2 legacy block; the cancelOrder linkage matches by `orderId`) |
492
- | `resolveLiveReserveEdgeAnchorPrice` tiers 2/3 (live slot extreme, config bound) | ladder extreme only; a ladder-less manager returns `null` (the live resolver no longer computes a config bound — consumers that want one, e.g. `reserveEdgeIdSet`, resolve it themselves) |
492
+ | `resolveLiveEdgeAnchorPrice` tiers 2/3 (live slot extreme, config bound) | ladder extreme only; a ladder-less manager returns `null` (the live resolver no longer computes a config bound — consumers that want one, e.g. `edgeOrderIdSet`, resolve it themselves) |
493
493
  | materialize descriptor-price fallback for a `slot-N` id | kept only for an unparseable id; a `slot-N` id with no ladder logs `error` and requests a structural resync |
494
494
 
495
495
  **E2 is fail-closed.** `syncFromOpenOrders` calls `_assertGenesisInvariant`
@@ -457,16 +457,19 @@ GRID_LIMITS: {
457
457
  **Parameters:**
458
458
  - `GRID_REGENERATION_PERCENTAGE`: Bidirectional threshold for size recalculation (default: `3%`)
459
459
  - Grow: free funds accumulate to ≥3% of allocated capital (e.g. availableFunds ≥ 60 BTS on a 2000 BTS grid)
460
+ - Grow (committed drift): the on-chain (ACTIVE/PARTIAL) orders lag their geometric ideal by ≥3% of the committed size — catches an external deposit that the fill/rotation pipeline already folded into `virtual`, which blinds the `availableFunds = chainFree − virtual` ratio
460
461
  - Shrink: grid-tracked size (ACTIVE + PARTIAL + VIRTUAL) exceeds allocation by ≥3% (external fund removal resizes affected orders down; per-side chain totals are not used — fills move value across sides)
462
+ - Shrink (committed drift): the on-chain orders exceed their geometric ideal by ≥3% of the committed size (external withdrawal)
461
463
 
462
464
  ### How It Works
463
465
 
464
466
  1. **OrderManager** tracks available funds per side (BUY and SELL separately)
465
467
  2. Allocated capital = number of active orders × size per order
466
- 3. When `availableFunds / allocatedCapital × 100 >= GRID_REGENERATION_PERCENTAGE`:
468
+ 3. When `availableFunds / allocatedCapital × 100 >= GRID_REGENERATION_PERCENTAGE`, OR the committed-drift leg flags the side (on-chain orders ≥threshold off their geometric ideal):
467
469
  - Triggers `Grid.recalculateGrid()` on that side only
468
470
  - Recalculates order sizes to incorporate freed capital
469
471
  - Maintains asymmetric fills (BUY fills don't trigger SELL resize)
472
+ - The committed-drift leg is what keeps a deposit that was absorbed into the VIRTUAL reservation from silently leaving the on-chain side un-resized
470
473
  4. After the resize, available funds are re-allocated into active orders
471
474
  5. Mirror (shrink): when `(gridTracked - allocated) / allocated × 100 >= threshold` (external fund removal), the same path resizes affected orders down
472
475
 
@@ -26,7 +26,7 @@ Phase 1 does all reasoning in memory under `_gridLock` (fast); Phases 2 and 3 ex
26
26
 
27
27
  Phase 2 and 3 both respect the `dryRun` flag: when true, no on-chain mutations are attempted — plans are logged but not executed.
28
28
 
29
- `targetCount` (per side, `targetSell`/`targetBuy`) is sourced from bot config (`activeOrders` window plus `reserveOrders` edge ladder) and determines how many live orders each side should maintain. The internal `planOnly` flag controls whether `_reconcileStartupSide` records plans for Phase 2 or executes inline — Phase 1 always calls with `planOnly=true`.
29
+ `targetCount` (per side, `targetSell`/`targetBuy`) is sourced from bot config (`coreOrders` window plus `edgeOrders` edge ladder) and determines how many live orders each side should maintain. The internal `planOnly` flag controls whether `_reconcileStartupSide` records plans for Phase 2 or executes inline — Phase 1 always calls with `planOnly=true`.
30
30
 
31
31
  ```
32
32
  Grid generated
@@ -93,7 +93,7 @@ Phase 2 and 3 both respect the `dryRun` flag: when true, no on-chain mutations a
93
93
  - Match sorted unmatched chain orders to virtual slots → `plannedUpdates`
94
94
  - Detect grid-edge lock and plan a largest-order cancel
95
95
  - Plan creates for remaining slots
96
- - Plan excess cancellations (guarded by `matchedOnGrid > 0`): orphans first, then **matched surplus** (`chainCount - targetCount`, reserve edge slots last) — the matched-excess selection is shared by the planOnly and execute branches so planning can never drift from execution; planOnly omits `releaseUntrackedFunds` for matched slots (their funds are tracked on the grid slot)
96
+ - Plan excess cancellations (guarded by `matchedOnGrid > 0`): orphans first, then **matched surplus** (`chainCount - targetCount`, edge slots last) — the matched-excess selection is shared by the planOnly and execute branches so planning can never drift from execution; planOnly omits `releaseUntrackedFunds` for matched slots (their funds are tracked on the grid slot)
97
97
  - Fork-kept **shelf orders** (live non-slot-N ids below the rail, e.g. `deep-*`) are never cancel candidates or reserve members — see [Shelf Orders](#shelf-orders-fork-kept-manual-orders)
98
98
  - **Vacated-rail refill**: each PROCEEDING update whose vacated price exactly matches (`priceSlotEqual`) an empty, sized, in-rail slot of the same side queues a refill CREATE in the same plan (`source startupVacatedRailRefill`) — skipped updates, ghost prices (lattice moved), in-band slots, and already-desired slots never refill; refill targets require VIRTUAL state with no `orderId`
99
99
 
@@ -213,7 +213,7 @@ Reconcile's role in the defense-in-depth: during Phase 1, any ACTIVE/PARTIAL ord
213
213
 
214
214
  Live on-chain orders with non-slot-N ids below the rail (e.g. `deep-*` manuals kept across a fork) are **shelf orders**: they sit outside the grid contract and must survive every startup path untouched. Three gates enforce this (all no-ops on grids that only mint slot-N ids):
215
215
 
216
- - **Reserve classification/placement** (`order.ts`, `grid_reconcile_internal.ts`, `manager.ts`): `reserveEdgeIdSet`, the Tier-2 live-anchor scan, `_pickEdgeReserveSlots`, and `pickEdgeReserves` all gate to `parseSlotIndex(id) !== null`, so a shelf can never count as the reserve edge (which would mask a real reserve deficit) nor be activated as a reserve it would never be counted as. The live-reserve count additionally excludes window members via `liveWindowIdSet`, so an edge-reaching window cannot masquerade as dedicated reserves.
216
+ - **Reserve classification/placement** (`order.ts`, `grid_reconcile_internal.ts`, `manager.ts`): `edgeOrderIdSet`, the Tier-2 live-anchor scan, `_pickEdgeSlots`, and `pickEdgeSlots` all gate to `parseSlotIndex(id) !== null`, so a shelf can never count as the edge (which would mask a real edge deficit) nor be activated as an edge order it would never be counted as. The live-edge count additionally excludes window members via `liveWindowIdSet`, so an edge-reaching window cannot masquerade as dedicated edge orders.
217
217
  - **Startup excess cancels** (`grid_reconcile_internal.ts`): the matched-excess selection filters to slot-N ids in both planOnly and execute branches — the cheapest-first sort would otherwise wipe the shelf on the next boot.
218
218
  - **Geometric size recalc** (`grid.ts`): `_recalculateGridOrderSizesFromBlockchain` skips non-slot-N slots in the per-slot loop, so divergence-triggered resizing never overwrites manual shelf sizes on-chain (the shelf stays in the budget denominator, so allocation math is unchanged).
219
219
 
@@ -286,7 +286,7 @@ Commit `e64db685` replaced 6 single-value boolean state fields with refcounts/st
286
286
  | `tests/test_race_condition_fixes_batch1.ts` | ABBA deadlock (RC-1B) |
287
287
  | `tests/test_async_lock_force_release.ts` | Nested multi-lock re-entrancy |
288
288
  | `tests/test_targeted_drift_reconcile.ts` | Active-order shortfall triggers sync |
289
- | `tests/test_reserve_orders.ts` | Reserve startup coverage: fully-placed matched-surplus cancels, orphan+matched ordering, at-target silence, plan/execute parity, shelf-order survival, reserve-deficit trigger (`buy reserves 0/2`) with filled/disabled/empty-budget silence, window-exclusion counting |
289
+ | `tests/test_edge_orders.ts` | Reserve startup coverage: fully-placed matched-surplus cancels, orphan+matched ordering, at-target silence, plan/execute parity, shelf-order survival, reserve-deficit trigger (`buy reserves 0/2`) with filled/disabled/empty-budget silence, window-exclusion counting |
290
290
  | `tests/repro_phantom_orders.ts` | Phantom order prevention |
291
291
 
292
292
  ---
package/docs/LIFECYCLE.md CHANGED
@@ -90,7 +90,7 @@ sequenceDiagram
90
90
  participant CO as chain_orders (broadcast)
91
91
  participant STORE as Storage
92
92
 
93
- CH->>Q: enqueue fill(s) (dexbot_fill_runtime.ts:458)
93
+ CH->>Q: enqueue fill(s) (dexbot_fill_runtime.ts:466)
94
94
  FR->>FR: drain queue -> _processFillsWithBatching
95
95
  FR->>OM: processFilledOrders() (manager.ts)
96
96
  OM->>AC: processFillAccounting() (single call, batch)
@@ -134,10 +134,10 @@ sequenceDiagram
134
134
  participant STORE as Storage
135
135
 
136
136
  MA->>CL: AMA center snapshot updated
137
- CL->>CL: _performPeriodicGridChecks() (dexbot_class.ts:1685)
138
- CL->>RT: performPeriodicGridChecks() (dexbot_maintenance_runtime.ts:1645)
139
- RT->>RT: runGridMaintenance(bot,'periodic') (dexbot_maintenance_runtime.ts:2944)
140
- RT->>RT: executeMaintenanceLogic() (dexbot_maintenance_runtime.ts:2443)
137
+ CL->>CL: _performPeriodicGridChecks() (dexbot_class.ts:1720)
138
+ CL->>RT: performPeriodicGridChecks() (dexbot_maintenance_runtime.ts:1677)
139
+ RT->>RT: runGridMaintenance(bot,'periodic') (dexbot_maintenance_runtime.ts:2953)
140
+ RT->>RT: executeMaintenanceLogic() (dexbot_maintenance_runtime.ts:2462)
141
141
  RT->>AC: recalculate funds from balances
142
142
  RT->>GD: promote AMA center -> grid center
143
143
  RT->>GD: recalculateGrid() (grid.ts)
@@ -157,13 +157,13 @@ The AMA signal stack (AMA/Kalman/Hurst/PE) is *research-tuned* in `analysis/` an
157
157
  the parameters.
158
158
 
159
159
  > Note: `runMaintenance()` is a **different** subsystem — the credit/MPA debt
160
- > runtime (`modules/credit_runtime.ts:3468`, reached via
161
- > `_runCreditRuntimeMaintenance` at `dexbot_class.ts:1802`). The grid maintenance
160
+ > runtime (`modules/credit_runtime.ts:3441`, reached via
161
+ > `_runCreditRuntimeMaintenance` at `dexbot_class.ts:1837`). The grid maintenance
162
162
  > chain above is the one that matters for order/price upkeep.
163
163
 
164
- References: `modules/dexbot_class.ts:1685` (`_performPeriodicGridChecks`) →
165
- `modules/dexbot_maintenance_runtime.ts:1645` (`performPeriodicGridChecks`) →
166
- `:2944` (`runGridMaintenance`) → `:2443` (`executeMaintenanceLogic`),
164
+ References: `modules/dexbot_class.ts:1720` (`_performPeriodicGridChecks`) →
165
+ `modules/dexbot_maintenance_runtime.ts:1677` (`performPeriodicGridChecks`) →
166
+ `:2953` (`runGridMaintenance`) → `:2462` (`executeMaintenanceLogic`),
167
167
  `docs/GRID_RECALCULATION.md`, `docs/GRID_RECONCILE.md`.
168
168
 
169
169
  ---
@@ -192,7 +192,7 @@ enforced*, not compiler-enforced — learn them or you will introduce fund bugs.
192
192
  | How a fill becomes orders | `modules/dexbot_fill_runtime.ts` → `modules/order/manager.ts` |
193
193
  | Grid math / recalculation | `modules/order/grid.ts`, `docs/GRID_RECALCULATION.md` |
194
194
  | Funds & accounting | `modules/order/accounting.ts`, `docs/FUND_MOVEMENT_AND_ACCOUNTING.md` |
195
- | Periodic loop & AMA hook | `modules/dexbot_maintenance_runtime.ts`, `modules/dexbot_class.ts:1685` |
195
+ | Periodic loop & AMA hook | `modules/dexbot_maintenance_runtime.ts`, `modules/dexbot_class.ts:1720` |
196
196
  | Market signal source | `market_adapter/market_adapter.ts`, `analysis/README.md` |
197
197
  | Startup & orchestration | `modules/dexbot_class.ts`, `docs/developer_guide.md` §"Startup Sequence" |
198
198
  | Why COW exists | `docs/architecture.md` §"Copy-on-Write (COW) Grid Pattern", `docs/COW_INVARIANTS.md` |
package/docs/LOGGING.md CHANGED
@@ -255,6 +255,9 @@ Prefix tags used in log messages to help operators identify event types. To find
255
255
  | `[GAP-EVAC]` | `order/utils/validate.ts`, `order/manager.ts`, `dexbot_startup_runtime.ts`, `dexbot_state_recovery.ts` | Stuck in-band (gap-band) order streak warnings, cancel-only evacuation teeth, persisted-streak restore counts |
256
256
  | `[GRID-TYPE-CORRECT]` | `order/grid.ts` | One-time backfill retype of legacy empty slots to rail-typed holes on load |
257
257
  | `[LAST-FILL-GUARD]` | `dexbot_cow_runtime.ts` | Last-fill-guard blocks plus gap-evacuation bypass allows/stale-stamp downgrades |
258
+ | `[RESTAMP-BUY]` | `dexbot_cow_runtime.ts` | BUY emitted at/above the last filled BUY pivot (guard bypass / unjudgeable pivot), counted not blocked (P2) |
259
+ | `[COW-GAP-BAND]` | `dexbot_cow_runtime.ts` | SHADOW: non-spread-correction placement inside the plan gap band, counted not blocked (Mode C(a)) |
260
+ | `[BOUNDARY-DRIFT]` | `order/strategy.ts` | Derived boundary jumped more than the active window in one plan (P2) |
258
261
  | `[TRANSPORT]` | `bitshares-native/transport.ts` | WebSocket keep-alive and reconnect |
259
262
 
260
263
  ## 1.4.8 Markers
@@ -281,6 +284,17 @@ New/updated operator-visible messages added by the uncertain-broadcast and COW h
281
284
  | `⚠ <node>… FAILED attempt N/3 (fill channel unrecoverable for <account>: …)` | **Node strike recorded.** Emitted only after N forced reconnects failed to clear the channel, i.e. the node itself is suspect. A forced reconnect on its own never costs a node a strike — a session-level wedge that clears on the first cycle leaves the strike ledger untouched. Three of these blacklist the node for 24h |
282
285
  | `Forcing reconnect on <node> (<reason>)` | Transport-level forced reconnect (stale api_id escalation or fill-channel watchdog); the node is reported failed so the reconnect prefers another node |
283
286
 
287
+ ### P2 observability + Mode C (2026-10-11)
288
+
289
+ Counter-only signals (none gate placement) surfaced through `getMetrics()`: `refusedCommitCount`, `orphanFillCreditedCount`, `restampBuyAboveAnchorCount`, `boundaryDriftExceedsWindowCount`, `gapBandPlacementShadowCount`.
290
+
291
+ | Message | Meaning |
292
+ |---------|---------|
293
+ | `[COW] Rejecting UPDATE batch pre-broadcast: N target(s) missing on chain (...); grid/chain existence divergence — structural resync required` | Mode C(b): a tracked UPDATE target is gone on chain; the batch aborts cleanly (`UPDATE_TARGET_MISSING`) instead of letting `limit_order_update` abort a chunk mid-broadcast. Followed by a structural resync request |
294
+ | `[RESTAMP-BUY] BUY emitted at ... at/above the last filled BUY ...` | A BUY at/above the last filled BUY pivot got past the LAST-FILL-GUARD (bypass or unjudgeable pivot). Counted, not blocked; warned once per batch |
295
+ | `[COW-GAP-BAND] shadow: N non-spread-correction placement(s) inside the plan's gap band (...)` | Mode C(a) shadow: an in-gap rail placement that is not spread correction / gap evacuation. Counted, never blocked; warned once per batch |
296
+ | `[BOUNDARY-DRIFT] committed boundary X -> planned Y (drift N slots) exceeds active window W; boundary is detached from the market anchor (observability only)` | A single plan moved the boundary more than the active window (absolute recovery anchor or geometry fault). Counted; rate-limited warn |
297
+
284
298
  ---
285
299
 
286
300
  ## Fill History Scan Profiling
@@ -139,7 +139,7 @@ Set `creditOnly: true` on a bot entry to run only the credit runtime — no grid
139
139
  "preferredAccount": "my-account", "debtPolicy": { "lending": [...] } }
140
140
  ```
141
141
 
142
- No trading fields (`assetA`, `assetB`, `startPrice`, `incrementPercent`, `activeOrders`, `reserveOrders`, `botFunds`) are needed.
142
+ No trading fields (`assetA`, `assetB`, `startPrice`, `incrementPercent`, `coreOrders`, `edgeOrders`, `botFunds`) are needed.
143
143
 
144
144
  ```bash
145
145
  dexbot start credit # Background daemon — runs only the credit worker
@@ -72,10 +72,10 @@ local state.
72
72
  | **Infinite loops** | grid-bloat → resync → bloat; plan→skip→restore holes; `NO_FEASIBLE_BOUNDARY` freeze | Cooldowns, grace windows, minimal cancel ladders |
73
73
  | **Silent hangs** | Retries that depended on a future event that never came | Level-triggered scheduling with time-based watchdogs |
74
74
  | **Stale queues** | Queued price corrections replayed onto a resynced grid, reverting good placements | Pre-broadcast validation against the live slot |
75
- | **Shelf / reserve orders** | Non-grid orders poisoning every "orders on grid" counter (issue #27) | Slot-N gating across all counters |
75
+ | **Shelf / edge orders** | Non-grid orders poisoning every "orders on grid" counter (issue #27) | Slot-N gating across all counters |
76
76
 
77
77
  Families **not** detailed in Part II: silent hangs and stale correction queues are covered in
78
- `CHANGELOG.md` (v1.6.1 and v1.6.3 respectively); shelf/reserve orders in issue #27 and the v1.6.x
78
+ `CHANGELOG.md` (v1.6.1 and v1.6.3 respectively); shelf/edge orders in issue #27 and the v1.6.x
79
79
  notes; the grid-price invariant has its own doc — [GRID_PRICE_INVARIANT.md](GRID_PRICE_INVARIANT.md).
80
80
 
81
81
  ### R3. Meta-patterns (the actual "madness")
@@ -295,7 +295,7 @@ Debug line: `[BOUNDARY] boundary=123 sellStart=128 spread=4 anchorProjected=138
295
295
  **#7 Sync-lock/maintenance observability — LANDED.**
296
296
  Throttle `Structural resync defer` to first/last per cap window (was 120/30s); log/retry `[MAINT] n/m failed` with orderId/reason.
297
297
 
298
- **Mode C hardening — OPEN.** (a) COW pre-broadcast gap-band reject; (b) order-existence check off slot→orderId map. Note: the GAP-P1 same-batch cancel that covered commit-time in-gap placement was reverted `e2898e51`; **P3 gate removed `e7231534`** — commit-time in-gap placement is currently covered by `LAST-FILL-GUARD` + adoption (no chain-evidence veto).
298
+ **Mode C hardening — PARTIAL (2026-10-11).** (b) **LANDED** pre-broadcast UPDATE-target existence check off the slot→orderId map: `runPreBroadcastGuards` re-reads every UPDATE action's `orderId` via `chainOrders.batchReadOrders` and refuses the whole batch (`UPDATE_TARGET_MISSING`) + requests a structural resync when a tracked target is gone on chain, instead of letting a `limit_order_update` abort the chunk mid-broadcast. Fails open on a non-Map/errored read (chain rejection remains the backstop), and re-verifies each candidate missing id with a single `readSingleOrder` before declaring it gone so a node lagging behind a just-created order does not false-refuse. **Residual risk (accepted, safe direction):** if that second read also lags/returns null, the batch is refused — a skipped cycle + structural resync, never a half-applied grid. Unexplained `UPDATE_TARGET_MISSING` churn on a slow node is this mechanism. (No dedicated counter on this path, consistent with the other uncounted pre-broadcast refusals; it shows up in error logs.) (a) **SHADOW ONLY** gap-band placement check: non-spread-correction CREATE/UPDATE destinations inside the plan's gap band are counted (`_metrics.gapBandPlacementShadowCount`) and warned, never blocked — enforcement is deliberately withheld because spread correction legitimately places INTO the band and a hard reject would re-open the reverted P1/e2898e51 regression class. Note: the GAP-P1 same-batch cancel that covered commit-time in-gap placement was reverted `e2898e51`; **P3 gate removed `e7231534`** — commit-time in-gap placement is currently covered by `LAST-FILL-GUARD` + adoption (no chain-evidence veto).
299
299
 
300
300
  #### 2.7 Relation to PRICE_FIRST draft
301
301
 
@@ -355,7 +355,15 @@ order of escalation forever — HOLD-010) and **not** from
355
355
  `_lastUnmatchedChainOrdersAt` — the latter refreshes on every observing sync
356
356
  and would make an age gate unfirable (HOLD-007).
357
357
 
358
- Still open: drift logging/alert >active window, re-stamp BUY above anchor metric, refused-commit and orphan-fill counters. Deferred-hold observability is no longer open — the `[HOLD]` summary now names side/price/size/reason/off-grid distance and slow-re-warns on an unchanged hold (`modules/dexbot_maintenance_runtime.ts`, `docs/GRID_PRICE_INVARIANT.md`).
358
+ Still open: none of the listed counters — all four landed 2026-10-11 (see below). Deferred-hold observability is no longer open — the `[HOLD]` summary now names side/price/size/reason/off-grid distance and slow-re-warns on an unchanged hold (`modules/dexbot_maintenance_runtime.ts`, `docs/GRID_PRICE_INVARIANT.md`).
359
+
360
+ P2 additions (2026-10-11, counter-only — none gated behavior):
361
+ - `refusedCommitCount` — incremented once in `recoverRefusedCommit` (the single funnel for all refused/uncertain commit paths), and only for genuine refusals: the poll-confirmed **success** path also routes through this funnel (adoption + fee deduction) and passes `refusedCommit: false`, so it is not counted.
362
+ - `orphanFillCreditedCount` — incremented in `applyReplaySafeOrphanFillAccounting` on an `applied` result (a real proceeds credit; not `duplicate`/`error`/`missing_key`).
363
+ - `restampBuyAboveAnchorCount` — `recordRestampBuyAboveAnchor` counts a BUY emitted at/above the last filled BUY pivot (guard bypass or unjudgeable pivot), warned once per batch; it never blocks.
364
+ - `boundaryDriftExceedsWindowCount` — `calculateTargetGrid` counts a derived boundary that jumps more than the active window in one plan (the detached-boundary signal the removed ANCHOR-DIVERGENCE telemetry used to carry), rate-limited warn.
365
+ - `gapBandPlacementShadowCount` — the Mode C(a) shadow above.
366
+ All five surface through `getMetrics()`; four via the existing `...bot._metrics` spread, and `boundaryDriftExceedsWindowCount` via an explicit overlay of `manager._metrics` (`getMetrics()`), because `calculateTargetGrid` writes it on the manager's metrics object and has no bot reference.
359
367
 
360
368
  #### 3.4 Key code references (from source table)
361
369
 
package/docs/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This directory contains the comprehensive technical documentation for the DEXBot2 trading bot. It is designed to guide developers from high-level architecture down to the nuances of fund accounting and state management.
4
4
 
5
- **Version context:** v1.6.12 (released).
5
+ **Version context:** v1.6.14 (released).
6
6
 
7
7
  ---
8
8
 
@@ -45,7 +45,7 @@ This directory contains the comprehensive technical documentation for the DEXBot
45
45
  - **API Boundary**: Responsibility split between the AI decision layer and the DEXBot2 execution substrate ([AI_BOT_LIBRARY_API.md](../claw/docs/AI_BOT_LIBRARY_API.md))
46
46
  - **Tuning Reference**: Practical grid-tuning baselines ([DEXBOT2_TUNING_CHEAT_SHEET.md](../claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md))
47
47
  - **Position Management**: Short-position tracking, position health monitoring (3-zone CR model), and shared CR planning via `cr_planner.ts`
48
- - **Skills**: Presentation-only, concept-reference, and launcher-orchestration skill packs for bitshares-guide, margin-trading, launcher-ops, and shared references
48
+ - **Skills**: Presentation-only, concept-reference, and launcher-orchestration skill packs for bitshares-guide, margin-trading, launcher-ops, memu-memory, trend-detection, and shared references
49
49
 
50
50
  ## Operational & Security
51
51
 
@@ -58,7 +58,7 @@ This directory contains the comprehensive technical documentation for the DEXBot
58
58
 
59
59
  ### 📊 [Grid Recalculation](GRID_RECALCULATION.md)
60
60
  *When and why the grid resets.*
61
- - **Reset Sources**: Market-adapter bootstrap, AMA delta, AMA-slope range reset, RMS divergence correction, and fund regeneration
61
+ - **Reset Sources**: Market-adapter bootstrap, AMA delta, AMA-slope range reset, RMS divergence correction, and available-funds resize
62
62
  - **Configuration**: Per-source thresholds, whitelist requirements, and defaults
63
63
  - **Trigger Execution**: How `profiles/recalculate.<botKey>.trigger` is consumed under the fill-processing lock
64
64
 
package/docs/WORKFLOW.md CHANGED
@@ -255,6 +255,7 @@ the canonical name is preferred in scripts and docs.
255
255
  | `dexbot tv <target>` | — | TradingView 1h chart for `<bot|pool-id|AssetA/AssetB>` over `--month N` (default 3) |
256
256
  | `dexbot dw <target>` | — | Dynamic-weight research chart: same targets/flags as `tv` |
257
257
  | `dexbot pnl <account>` | — | HTML PnL report for a bot/account over `--month N`, optional `--pair BASE/QUOTE` filter |
258
+ | `dexbot git` | — | Analyze repository git history and write an added/deleted-lines HTML chart (`repo-stats.html`; source checkouts only) |
258
259
  | `dexbot status` | `stat`, `stats` | Unified runtime health — daemon, adapter, bots |
259
260
  | `dexbot start` | `unlock` | Run credential daemon + bot (equivalent to running the `unlock` runtime, `dist/unlock.js`) |
260
261
  | `dexbot stop` | `stp`, `stopall` | Stop the monolithic runtime (unlock mode) |
@@ -476,16 +476,25 @@ The correction path is fund-only and never manufactures budget by shrinking a re
476
476
 
477
477
  ```
478
478
  1. Detect that the live window is wider than targetSpreadPercent.
479
- 2. Select up to `outOfSpread` eligible holes in safe window/gap order.
480
- 3. If the funded edge holds a non-dust PARTIAL, optionally top it up, but only
481
- when `ideal - current` is positive and free funds can cover the increase.
482
- 4. Create replacements from free available/chainFree funds; contiguous gap-slot
483
- promotion may extend the window while preserving MIN_SPREAD_ORDERS and the
484
- opposite placed rail.
485
- 5. If free funds cannot cover every target, place/top up the affordable prefix,
486
- stop without shrinking inventory, and log the fund-constrained remainder.
487
- 6. If neither side has free funds, skip correction and let the maintenance
488
- runtime refresh balances and open orders rather than recycle stale inventory.
479
+ 2. Select up to `outOfSpread` spread-tightening empty slots (below the lowest
480
+ live sell / above the highest live buy), ordered window-contiguous first, with
481
+ a market-nearest fallback when the rail has no live order.
482
+ 3. Create those slots from free available/chainFree funds only. A resting PARTIAL
483
+ is never a correction target: a top-up grows an order at its current price, so
484
+ it cannot move bestBuy/bestSell and cannot narrow the spread.
485
+ 4. Contiguous gap-slot promotion may extend the window while preserving
486
+ MIN_SPREAD_ORDERS and the opposite placed rail.
487
+ 5. If free funds cannot cover every target, place the affordable prefix, stop
488
+ without shrinking inventory, and log the fund-constrained remainder.
489
+ 6. If neither side places an effective order, `checkSpreadCondition` reports a
490
+ `stall` cause (`no-free-funds` / `unfunded` / `no-candidates` /
491
+ `batch-not-executed` / `apply-error`). Every cause arms the targeted
492
+ balances + open-orders refresh: the local snapshot the check reasoned over
493
+ may be stale (`no-candidates` can mean a missed fill left an ACTIVE slot
494
+ occupying the window edge, so no tightening slot appears to exist), and only
495
+ a chain sync can tell a stale snapshot from structural geometry. The
496
+ out-of-spread staleness watchdog remains the backstop if the sync heals
497
+ nothing. No resting order is ever recycled.
489
498
  ```
490
499
 
491
500
  Detected dust partials never enter this path: `cancelDustOrders()` cancels them
@@ -611,12 +620,12 @@ mgr.outOfSpread = 3; // three slots beyond the target spread
611
620
  ### Calculation
612
621
 
613
622
  ```javascript
614
- // Calculate how many steps beyond target
615
- const currentSpreadSteps = calculateCurrentSpreadGap();
616
- const targetSpreadSteps = calculateTargetSpread();
617
- const outOfSpreadDistance = Math.max(0, currentSpreadSteps - targetSpreadSteps);
618
-
619
- mgr.outOfSpread = outOfSpreadDistance; // 0 = in spread, 3+ = out
623
+ // Requested extra slots, derived from the live spread vs the target tolerance:
624
+ // calculateCurrentSpread(mgr) -> shouldFlagOutOfSpread(...) returns the slot count.
625
+ mgr.outOfSpread = shouldFlagOutOfSpread(
626
+ calculateCurrentSpread(mgr), nominalSpread, toleranceSteps, buyCount, sellCount, incrementPercent
627
+ );
628
+ // 0 = in spread, 3+ = out
620
629
  ```
621
630
 
622
631
  ---
@@ -141,7 +141,7 @@ A **phantom order** is an order in ACTIVE/PARTIAL state WITHOUT a valid `orderId
141
141
  | **Crawl Candidate** | Furthest active order eligible for rotation |
142
142
  | **Shortage** | Empty slot in the active window that needs an order |
143
143
  | **Surplus** | Order outside the active window that can be rotated |
144
- | **Hard Surplus** | Order beyond the configured window + reserve (`activeOrders` + `reserveOrders`) count |
144
+ | **Hard Surplus** | Order beyond the configured window + reserve (`coreOrders` + `edgeOrders`) count |
145
145
  | **Reserve** | Edge-pinned live order outside the active window (buys at grid floor, sells at grid ceiling); never moves the boundary |
146
146
  | **Dust** | Partial order < 5% of ideal size |
147
147
  | **Dust Cancel** | Immediate on-chain cancel of dust partials on detection (no delay, no timer). Slot freed for a fresh counter-order. |
@@ -779,9 +779,14 @@ createOrderGrid(config)
779
779
  // Initialize with blockchain balances
780
780
  initializeGrid(manager)
781
781
 
782
- // Detect divergence and trigger updates
782
+ // Complete fund trigger: available-funds ratio + over-allocation + the
783
+ // on-chain committed-drift leg (closes the virtual-reservation blind spot)
783
784
  checkAndUpdateGridIfNeeded(manager)
784
785
 
786
+ // Drift-only async accessor (refreshes funds first); its core is folded into
787
+ // checkAndUpdateGridIfNeeded above
788
+ checkCommittedSizeDrift(manager)
789
+
785
790
  // Compare ideal vs. persisted grid
786
791
  compareGrids(calculatedGrid, persistedGrid, manager)
787
792
  ```
@@ -581,7 +581,7 @@ market_adapter/
581
581
  |-- market_adapter.ts main adapter daemon
582
582
  |-- ama_signal_runner.ts one-cycle JSON signal CLI
583
583
  |-- candle_utils.ts candle transforms, gap detection, pruning
584
- |-- interval_utils.ts shared interval label helpers
584
+ |-- interval_utils.ts shared interval label + chain-time helpers
585
585
  |-- lp_chart_core.ts chart HTML renderer
586
586
  |-- lp_chart_strategy_loader.ts AMA strategy/profile resolver for charts
587
587
  |-- lp_chart_runner.ts LP chart orchestration
@@ -592,7 +592,7 @@ market_adapter/
592
592
  | |-- market_adapter_service.ts full signal pipeline service
593
593
  | |-- config_normalizers.ts shared config normalization
594
594
  | |-- kibana_client.ts low-level Kibana/ES query client
595
- | |-- kibana_candles.ts LP pool candle fetch engine
595
+ | |-- kibana_candles.ts generic Kibana candle fetch engine (LP/book/feed)
596
596
  | |-- kibana_market_candles.ts book candle fetch and transform
597
597
  | |-- signals/
598
598
  | | |-- hurst_analyzer.ts Hurst Exponent analysis
@@ -614,14 +614,16 @@ market_adapter/
614
614
  | |-- fetch_book_data.ts order-book candle exporter
615
615
  | |-- kibana_feed_source.ts MPA feed candle source
616
616
  | |-- window_cache.ts shared month-shard candle cache
617
- | `-- fetch_cex_synthetic_data.ts public CEX synthetic-candle seed importer
617
+ | |-- fetch_cex_synthetic_data.ts public CEX synthetic-candle seed importer
618
+ | `-- cex_candle_parsing.ts CEX OHLC row layouts and parsing
618
619
  |-- utils/
619
620
  | |-- chain.ts blockchain query helpers
620
621
  | |-- adapter_client.ts inter-process credential daemon client
621
622
  | |-- native_history.ts native BitShares market history fetch
622
623
  | |-- file_lock.ts single-instance file lock
623
624
  | |-- file_json_cache.ts write-through JSON read cache
624
- | |-- data_discovery.ts data directory auto-discovery
625
+ | |-- month_shards.ts calendar-month shard naming + coverage-span primitives (shared by candle and fills caches)
626
+ | |-- data_discovery.ts data directory auto-discovery + shard-family assembly
625
627
  | |-- atomic_write.ts atomic file write utility
626
628
  | |-- dynamic_grid_snapshot.ts dynamic grid snapshot helpers
627
629
  |-- data/ runtime candle caches and exports