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.
Files changed (275) hide show
  1. package/CHANGELOG.md +78 -2
  2. package/README.md +23 -19
  3. package/analysis/README.md +26 -13
  4. package/analysis/account_resolver.ts +171 -0
  5. package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +2 -5
  6. package/analysis/ama_fitting/package.json +1 -1
  7. package/analysis/analyze_dynamic_weight.ts +9 -3
  8. package/analysis/bot_usage/discover_bot_accounts.ts +20 -27
  9. package/analysis/chain_pool.ts +47 -0
  10. package/analysis/chart_utils.ts +33 -20
  11. package/analysis/derivative_chart_generator.ts +2 -3
  12. package/analysis/fills_source.ts +234 -0
  13. package/analysis/grid_correction_check.ts +38 -251
  14. package/analysis/trade_profitability.ts +169 -304
  15. package/analysis/tradingview/README.md +2 -2
  16. package/analysis/tradingview/analyze_tradingview.ts +5 -0
  17. package/analysis/tradingview/tradingview_uplot_chart_generator.ts +5 -6
  18. package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +35 -2
  19. package/analysis/trend_detection/dynamic_weight_chart_generator.ts +84 -13
  20. package/analysis/trend_detection/kalman_chart_generator.ts +2 -3
  21. package/analysis/trend_detection/package.json +1 -1
  22. package/analysis/trend_detection/regime_chart_generator.ts +2 -3
  23. package/analysis/trend_detection/volatility_chart_generator.ts +2 -3
  24. package/claw/modules/dexbot_profiles.ts +4 -3
  25. package/claw/package.json +1 -1
  26. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  27. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  28. package/claw/tests/test_claw_mcp_transport.ts +2 -2
  29. package/claw/tests/test_dexbot_profiles.ts +18 -1
  30. package/dist/analysis/account_resolver.d.ts +43 -0
  31. package/dist/analysis/account_resolver.d.ts.map +1 -0
  32. package/dist/analysis/account_resolver.js +137 -0
  33. package/dist/analysis/account_resolver.js.map +1 -0
  34. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +1 -1
  35. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +2 -4
  36. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
  37. package/dist/analysis/analyze_dynamic_weight.js +9 -3
  38. package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
  39. package/dist/analysis/bot_usage/discover_bot_accounts.js +20 -28
  40. package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -1
  41. package/dist/analysis/chain_pool.d.ts +10 -0
  42. package/dist/analysis/chain_pool.d.ts.map +1 -0
  43. package/dist/analysis/chain_pool.js +47 -0
  44. package/dist/analysis/chain_pool.js.map +1 -0
  45. package/dist/analysis/chart_utils.d.ts +14 -1
  46. package/dist/analysis/chart_utils.d.ts.map +1 -1
  47. package/dist/analysis/chart_utils.js +32 -22
  48. package/dist/analysis/chart_utils.js.map +1 -1
  49. package/dist/analysis/derivative_chart_generator.d.ts.map +1 -1
  50. package/dist/analysis/derivative_chart_generator.js +2 -3
  51. package/dist/analysis/derivative_chart_generator.js.map +1 -1
  52. package/dist/analysis/fills_source.d.ts +79 -0
  53. package/dist/analysis/fills_source.d.ts.map +1 -0
  54. package/dist/analysis/fills_source.js +186 -0
  55. package/dist/analysis/fills_source.js.map +1 -0
  56. package/dist/analysis/grid_correction_check.d.ts +1 -21
  57. package/dist/analysis/grid_correction_check.d.ts.map +1 -1
  58. package/dist/analysis/grid_correction_check.js +30 -257
  59. package/dist/analysis/grid_correction_check.js.map +1 -1
  60. package/dist/analysis/trade_profitability.d.ts +18 -19
  61. package/dist/analysis/trade_profitability.d.ts.map +1 -1
  62. package/dist/analysis/trade_profitability.js +136 -280
  63. package/dist/analysis/trade_profitability.js.map +1 -1
  64. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -1
  65. package/dist/analysis/tradingview/analyze_tradingview.js +5 -0
  66. package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
  67. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
  68. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +5 -6
  69. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
  70. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -1
  71. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +84 -13
  72. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
  73. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -1
  74. package/dist/analysis/trend_detection/kalman_chart_generator.js +2 -3
  75. package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -1
  76. package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -1
  77. package/dist/analysis/trend_detection/regime_chart_generator.js +2 -3
  78. package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -1
  79. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +1 -1
  80. package/dist/analysis/trend_detection/volatility_chart_generator.js +2 -3
  81. package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -1
  82. package/dist/dexbot.d.ts.map +1 -1
  83. package/dist/dexbot.js +27 -68
  84. package/dist/dexbot.js.map +1 -1
  85. package/dist/market_adapter/core/asymmetric_bounds.d.ts +2 -2
  86. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
  87. package/dist/market_adapter/core/asymmetric_bounds.js +15 -12
  88. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  89. package/dist/market_adapter/interval_utils.d.ts +1 -1
  90. package/dist/market_adapter/interval_utils.js +1 -1
  91. package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
  92. package/dist/market_adapter/lp_chart_core.js +2 -3
  93. package/dist/market_adapter/lp_chart_core.js.map +1 -1
  94. package/dist/modules/account_bots.d.ts +51 -18
  95. package/dist/modules/account_bots.d.ts.map +1 -1
  96. package/dist/modules/account_bots.js +258 -117
  97. package/dist/modules/account_bots.js.map +1 -1
  98. package/dist/modules/bitshares-native/serial/operations.d.ts +1 -84
  99. package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
  100. package/dist/modules/bitshares-native/serial/operations.js +1 -38
  101. package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
  102. package/dist/modules/bot_defaults.d.ts +98 -0
  103. package/dist/modules/bot_defaults.d.ts.map +1 -0
  104. package/dist/modules/bot_defaults.js +169 -0
  105. package/dist/modules/bot_defaults.js.map +1 -0
  106. package/dist/modules/bot_settings.d.ts.map +1 -1
  107. package/dist/modules/bot_settings.js +4 -1
  108. package/dist/modules/bot_settings.js.map +1 -1
  109. package/dist/modules/cli_colors.d.ts +0 -1
  110. package/dist/modules/cli_colors.d.ts.map +1 -1
  111. package/dist/modules/config.d.ts +1 -0
  112. package/dist/modules/config.d.ts.map +1 -1
  113. package/dist/modules/config.js +1 -0
  114. package/dist/modules/config.js.map +1 -1
  115. package/dist/modules/constants.d.ts +11 -2
  116. package/dist/modules/constants.d.ts.map +1 -1
  117. package/dist/modules/constants.js +45 -32
  118. package/dist/modules/constants.js.map +1 -1
  119. package/dist/modules/credential_policy.d.ts +1 -25
  120. package/dist/modules/credential_policy.d.ts.map +1 -1
  121. package/dist/modules/credential_policy.js +1 -1
  122. package/dist/modules/credential_policy.js.map +1 -1
  123. package/dist/modules/credential_runtime.d.ts +1 -6
  124. package/dist/modules/credential_runtime.d.ts.map +1 -1
  125. package/dist/modules/credential_runtime.js +1 -1
  126. package/dist/modules/credential_runtime.js.map +1 -1
  127. package/dist/modules/credential_session_cache.d.ts +1 -5
  128. package/dist/modules/credential_session_cache.d.ts.map +1 -1
  129. package/dist/modules/credential_session_cache.js +1 -1
  130. package/dist/modules/credential_session_cache.js.map +1 -1
  131. package/dist/modules/crypto/pure_secp256k1.d.ts +1 -2
  132. package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
  133. package/dist/modules/crypto/pure_secp256k1.js +1 -1
  134. package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
  135. package/dist/modules/dexbot_class.d.ts +8 -7
  136. package/dist/modules/dexbot_class.d.ts.map +1 -1
  137. package/dist/modules/dexbot_class.js +9 -8
  138. package/dist/modules/dexbot_class.js.map +1 -1
  139. package/dist/modules/dexbot_cow_runtime.d.ts +7 -6
  140. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
  141. package/dist/modules/dexbot_cow_runtime.js +8 -7
  142. package/dist/modules/dexbot_cow_runtime.js.map +1 -1
  143. package/dist/modules/dexbot_fill_runtime.d.ts +1 -17
  144. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
  145. package/dist/modules/dexbot_fill_runtime.js +1 -1
  146. package/dist/modules/dexbot_fill_runtime.js.map +1 -1
  147. package/dist/modules/dexbot_maintenance_runtime.d.ts +2 -2
  148. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  149. package/dist/modules/dexbot_maintenance_runtime.js +24 -8
  150. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  151. package/dist/modules/dexbot_state_recovery.d.ts +1 -7
  152. package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
  153. package/dist/modules/dexbot_state_recovery.js +1 -1
  154. package/dist/modules/dexbot_state_recovery.js.map +1 -1
  155. package/dist/modules/launcher/adapter_requirement.d.ts +1 -5
  156. package/dist/modules/launcher/adapter_requirement.d.ts.map +1 -1
  157. package/dist/modules/launcher/adapter_requirement.js +2 -2
  158. package/dist/modules/launcher/adapter_requirement.js.map +1 -1
  159. package/dist/modules/launcher/bot_supervisor.d.ts +1 -6
  160. package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
  161. package/dist/modules/launcher/bot_supervisor.js +1 -1
  162. package/dist/modules/launcher/bot_supervisor.js.map +1 -1
  163. package/dist/modules/launcher/foreign_cred_daemon.d.ts +1 -3
  164. package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
  165. package/dist/modules/launcher/foreign_cred_daemon.js +1 -1
  166. package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
  167. package/dist/modules/launcher/launch_modes.d.ts +17 -2
  168. package/dist/modules/launcher/launch_modes.d.ts.map +1 -1
  169. package/dist/modules/launcher/launch_modes.js +18 -1
  170. package/dist/modules/launcher/launch_modes.js.map +1 -1
  171. package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -3
  172. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
  173. package/dist/modules/launcher/market_adapter_runtime.js +1 -1
  174. package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
  175. package/dist/modules/launcher/monolithic_runtime.d.ts +1 -5
  176. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  177. package/dist/modules/launcher/monolithic_runtime.js +9 -2
  178. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  179. package/dist/modules/launcher/status_reporting.d.ts +1 -2
  180. package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
  181. package/dist/modules/launcher/status_reporting.js +1 -1
  182. package/dist/modules/launcher/status_reporting.js.map +1 -1
  183. package/dist/modules/market_adapter_whitelist.d.ts +40 -1
  184. package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
  185. package/dist/modules/market_adapter_whitelist.js +161 -11
  186. package/dist/modules/market_adapter_whitelist.js.map +1 -1
  187. package/dist/modules/order/export.d.ts +1 -8
  188. package/dist/modules/order/export.d.ts.map +1 -1
  189. package/dist/modules/order/export.js +1 -1
  190. package/dist/modules/order/export.js.map +1 -1
  191. package/dist/modules/order/grid.d.ts +16 -0
  192. package/dist/modules/order/grid.d.ts.map +1 -1
  193. package/dist/modules/order/grid.js +75 -103
  194. package/dist/modules/order/grid.js.map +1 -1
  195. package/dist/modules/order/grid_reconcile_internal.d.ts +1 -10
  196. package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
  197. package/dist/modules/order/grid_reconcile_internal.js +2 -2
  198. package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
  199. package/dist/modules/order/manager.d.ts +10 -2
  200. package/dist/modules/order/manager.d.ts.map +1 -1
  201. package/dist/modules/order/manager.js +20 -8
  202. package/dist/modules/order/manager.js.map +1 -1
  203. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  204. package/dist/modules/order/sync_engine.js +8 -15
  205. package/dist/modules/order/sync_engine.js.map +1 -1
  206. package/dist/modules/order/utils/math.d.ts +1 -10
  207. package/dist/modules/order/utils/math.d.ts.map +1 -1
  208. package/dist/modules/order/utils/math.js +1 -1
  209. package/dist/modules/order/utils/math.js.map +1 -1
  210. package/dist/modules/order/utils/system.d.ts +5 -16
  211. package/dist/modules/order/utils/system.d.ts.map +1 -1
  212. package/dist/modules/order/utils/system.js +7 -4
  213. package/dist/modules/order/utils/system.js.map +1 -1
  214. package/dist/modules/process_discovery.d.ts +0 -3
  215. package/dist/modules/process_discovery.d.ts.map +1 -1
  216. package/dist/modules/process_discovery.js +1 -1
  217. package/dist/modules/process_discovery.js.map +1 -1
  218. package/dist/modules/settings_merge.d.ts +10 -1
  219. package/dist/modules/settings_merge.d.ts.map +1 -1
  220. package/dist/modules/settings_merge.js +27 -17
  221. package/dist/modules/settings_merge.js.map +1 -1
  222. package/dist/modules/utils/chain_logs.d.ts +1 -2
  223. package/dist/modules/utils/chain_logs.d.ts.map +1 -1
  224. package/dist/modules/utils/chain_logs.js +1 -1
  225. package/dist/modules/utils/chain_logs.js.map +1 -1
  226. package/dist/modules/validate_profiles.d.ts.map +1 -1
  227. package/dist/modules/validate_profiles.js +4 -3
  228. package/dist/modules/validate_profiles.js.map +1 -1
  229. package/dist/scripts/analyze-git.js +2 -2
  230. package/dist/scripts/analyze-git.js.map +1 -1
  231. package/dist/scripts/chart_command.d.ts +48 -0
  232. package/dist/scripts/chart_command.d.ts.map +1 -0
  233. package/dist/scripts/chart_command.js +504 -0
  234. package/dist/scripts/chart_command.js.map +1 -0
  235. package/dist/scripts/dw.d.ts +3 -0
  236. package/dist/scripts/dw.d.ts.map +1 -0
  237. package/dist/scripts/dw.js +30 -0
  238. package/dist/scripts/dw.js.map +1 -0
  239. package/dist/scripts/tv.d.ts +1 -31
  240. package/dist/scripts/tv.d.ts.map +1 -1
  241. package/dist/scripts/tv.js +10 -463
  242. package/dist/scripts/tv.js.map +1 -1
  243. package/dist/scripts/update.js +145 -93
  244. package/dist/scripts/update.js.map +1 -1
  245. package/dist/scripts/update_dist_freshness.d.ts +46 -0
  246. package/dist/scripts/update_dist_freshness.d.ts.map +1 -0
  247. package/dist/scripts/update_dist_freshness.js +115 -0
  248. package/dist/scripts/update_dist_freshness.js.map +1 -0
  249. package/dist/unlock.js +1 -1
  250. package/dist/unlock.js.map +1 -1
  251. package/docs/BITSHARES_ONBOARDING.md +117 -44
  252. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +10 -207
  253. package/docs/COW_INVARIANTS.md +16 -10
  254. package/docs/DEXBOT_COMPARISON.md +3 -3
  255. package/docs/EVOLUTION.md +76 -30
  256. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +9 -9
  257. package/docs/GRID_RECALCULATION.md +34 -30
  258. package/docs/GRID_RECONCILE.md +30 -27
  259. package/docs/LIFECYCLE.md +12 -11
  260. package/docs/LOGGING.md +1 -0
  261. package/docs/README.md +58 -52
  262. package/docs/WORKFLOW.md +1 -2
  263. package/docs/architecture.md +21 -32
  264. package/docs/developer_guide.md +4 -3
  265. package/market_adapter/README.md +36 -60
  266. package/modules/README.md +2 -1
  267. package/package.json +1 -2
  268. package/scripts/README.md +18 -25
  269. package/scripts/git-viewer.sh +1 -1
  270. package/scripts/reset-settings.sh +1 -1
  271. package/tests/README.md +10 -1
  272. package/dist/scripts/generate_market_adapter_whitelist.d.ts +0 -15
  273. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +0 -1
  274. package/dist/scripts/generate_market_adapter_whitelist.js +0 -191
  275. package/dist/scripts/generate_market_adapter_whitelist.js.map +0 -1
@@ -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/>default cap: 4]
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 (default 4 fills) |
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/>For PARTIAL orders only]
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
- ### Key Changes
1047
-
1048
- **1. Raw Order Cache (`rawOnChain`)**
1049
- - Grid slots now store exact blockchain order representations (integers/satoshis) in a `rawOnChain` cache
1050
- - **Birth**: Cache populated immediately after successful order placement using broadcasted arguments
1051
- - **Partial Fills**: Cache updated in-place via integer subtraction (subtracting filled satoshis from `for_sale`)
1052
- - **Updates/Rotations**: Cache refreshed with adjusted integers returned by build process
1053
-
1054
- **2. Eliminated Redundant API Calls**
1055
- - Removed all `readOpenOrders()` calls from `_buildSizeUpdateOps()` and `_buildRotationOps()`
1056
- - Removed `computeVirtualOpenOrders()` logic that was redundantly fetching entire account state
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
@@ -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. 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). |
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
 
@@ -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 white` |
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) | whitelist `dynamicWeight: true` |
27
- | Widen/tighten grid bounds by trend | [Grid Range Scaling](#grid-range-scaling) | whitelist `asymmetricBounds: true` |
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) | `dexbot white` |
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. Whitelist Live Writes
67
+ ### 2. Enable Live Writes
68
68
 
69
- Generate the whitelist from AMA-enabled bots. Without a whitelist entry, the
70
- adapter still computes state, but live grid snapshots and recalc triggers stay
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
- ```bash
74
- dexbot white
75
- ```
76
-
77
- This writes `profiles/market_adapter_whitelist.json`, where each bot's AMA,
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
- ```bash
91
- dexbot white --asymmetric-bounds
92
- ```
93
-
94
- To overwrite an existing entry (existing entries are otherwise preserved):
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: `dexbot white`
160
- generates AMA-only entries by default, so enable it with
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
- | Generate whitelist | `dexbot white` |
338
- | Opt new whitelist entries into dynamic weights | `dexbot white --dynamic-weight` |
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
- - Regenerate the whitelist with `dexbot white`.
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. An uptrend widens the upper bound and tightens the lower
671
- bound; a downtrend widens the lower bound and tightens the upper bound.
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 × (M × (1 - asymmetry))
665
+ maxPrice = (center × M) / (1 + asymmetry)
690
666
 
691
667
  Uptrend: maxPrice = center × (M × (1 + asymmetry))
692
- minPrice = center / (M × (1 - asymmetry))
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.35`; `0` disables the
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.35,
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",
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.
@@ -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 -S --noconfirm "${missing_packages[@]}"
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-run \`npm run market-adapter:whitelist\` if your AMA bot set changed"
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"}