dexbot 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +5 -4
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +19 -5
- package/analysis/trend_detection/package.json +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/tests/test_claw_mcp_transport.ts +2 -2
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +19 -5
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/dexbot.js +1 -1
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +2 -2
- package/dist/market_adapter/inputs/fetch_book_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +22 -3
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +15 -15
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js +2 -2
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +1 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +54 -8
- package/dist/market_adapter/inputs/window_cache.d.ts.map +1 -1
- package/dist/market_adapter/inputs/window_cache.js +328 -87
- package/dist/market_adapter/inputs/window_cache.js.map +1 -1
- package/dist/modules/account_bots.js +2 -2
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +18 -4
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +10 -0
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/constants.d.ts +12 -3
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +66 -20
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +24 -6
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +34 -6
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +94 -17
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +57 -6
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +474 -38
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +53 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +277 -9
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +69 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +277 -7
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +6 -1
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +32 -4
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +1 -1
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/order/grid.d.ts +3 -1
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +93 -16
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +73 -7
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/logger.js +1 -1
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/manager.d.ts +14 -1
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +54 -2
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +183 -10
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +65 -15
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +93 -22
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +51 -1
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +122 -2
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/utils/errors.d.ts +22 -0
- package/dist/modules/utils/errors.d.ts.map +1 -1
- package/dist/modules/utils/errors.js +30 -0
- package/dist/modules/utils/errors.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +3 -2
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +14 -6
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/DEXBOT_COMPARISON.md +3 -7
- package/docs/EVOLUTION.md +9 -7
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +4 -9
- package/docs/GRID_RECALCULATION.md +8 -7
- package/docs/LIFECYCLE.md +2 -2
- package/docs/README.md +9 -1
- package/docs/architecture.md +7 -7
- package/docs/developer_guide.md +4 -4
- package/market_adapter/README.md +14 -11
- package/package.json +1 -1
- package/scripts/README.md +4 -4
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
|
@@ -1 +1 @@
|
|
|
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;;;;;
|
|
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"}
|
|
@@ -22,6 +22,7 @@ function isAmaGridPrice(value) {
|
|
|
22
22
|
function parseOptions(argv) {
|
|
23
23
|
const dynamicWeightEnabled = argv.includes('--dynamic-weight=true') || argv.includes('--dynamic-weight') || argv.includes('--with-dynamic-weight');
|
|
24
24
|
const dynamicWeightDisabled = argv.includes('--dynamic-weight=false') || argv.includes('--no-dynamic-weight');
|
|
25
|
+
const asymmetricBoundsEnabled = argv.includes('--asymmetric-bounds=true') || argv.includes('--asymmetric-bounds') || argv.includes('--with-asymmetric-bounds');
|
|
25
26
|
const asymmetricBoundsDisabled = argv.includes('--asymmetric-bounds=false') || argv.includes('--no-asymmetric-bounds');
|
|
26
27
|
const pruneEnabled = argv.includes('--prune');
|
|
27
28
|
const botKeys = [];
|
|
@@ -72,7 +73,7 @@ function parseOptions(argv) {
|
|
|
72
73
|
}
|
|
73
74
|
return {
|
|
74
75
|
dynamicWeight: dynamicWeightEnabled && !dynamicWeightDisabled,
|
|
75
|
-
asymmetricBounds: !asymmetricBoundsDisabled,
|
|
76
|
+
asymmetricBounds: asymmetricBoundsEnabled && !asymmetricBoundsDisabled,
|
|
76
77
|
prune: pruneEnabled,
|
|
77
78
|
botKeys,
|
|
78
79
|
};
|
|
@@ -93,7 +94,7 @@ function loadExistingWhitelist() {
|
|
|
93
94
|
if (Array.isArray(raw)) {
|
|
94
95
|
for (const botKey of raw) {
|
|
95
96
|
if (botKey)
|
|
96
|
-
entries[String(botKey)] = { ama: true, dynamicWeight:
|
|
97
|
+
entries[String(botKey)] = { ama: true, dynamicWeight: false, asymmetricBounds: false };
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
else if (raw && typeof raw === 'object') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate_market_adapter_whitelist.js","sourceRoot":"","sources":["../../scripts/generate_market_adapter_whitelist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACzG,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,YAAY,CAAC;AAGb,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC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,SAAS,QAAQ,IAAI,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;AAC1G,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7E,IAAI,EAAE,CAAC;AACX,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -296,10 +296,17 @@ See the "Recommended Bot Setup" section of the
|
|
|
296
296
|
|
|
297
297
|
### Editing a running bot
|
|
298
298
|
|
|
299
|
-
You can re-run `dexbot bot` and save while the bot runs
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
You can re-run `dexbot bot` and save while the bot runs:
|
|
300
|
+
|
|
301
|
+
- **Live automatically (~1 min, no reload needed)** — order counts,
|
|
302
|
+
reserves, funds, and weights. The bot picks these up on its own.
|
|
303
|
+
- **Grid geometry** — run `dexbot reset <bot>` (or `dexbot reload` to
|
|
304
|
+
reload everything at once).
|
|
305
|
+
- **Market/account changes** — run `dexbot reload` (reloads the runtime
|
|
306
|
+
without logging you out; a full `restart` also works).
|
|
307
|
+
|
|
308
|
+
The editor prints exactly which group your save falls into every time it
|
|
309
|
+
saves, so you always know whether anything else is needed.
|
|
303
310
|
|
|
304
311
|
### Activate the market adapter
|
|
305
312
|
|
|
@@ -310,8 +317,9 @@ dexbot white
|
|
|
310
317
|
```
|
|
311
318
|
|
|
312
319
|
This writes `profiles/market_adapter_whitelist.json` for your AMA bot so it
|
|
313
|
-
writes live grid files and recalc triggers.
|
|
314
|
-
|
|
320
|
+
writes live grid files and recalc triggers. New entries enable AMA pricing only;
|
|
321
|
+
range scaling stays disabled unless you opt in with `dexbot white --asymmetric-bounds`.
|
|
322
|
+
DEXBot2 starts/stops the adapter automatically when active AMA bots exist.
|
|
315
323
|
|
|
316
324
|
---
|
|
317
325
|
|
|
@@ -482,7 +482,7 @@ Stale-Plan & Stack Discipline Tests (v1.4.8):
|
|
|
482
482
|
- `COW_PERFORMANCE.MAX_REBALANCE_PLANNING_MS` — planning-phase duration above which a slow-plan warning is logged (100ms).
|
|
483
483
|
- `COW_PERFORMANCE.GRID_MEMORY_WARNING` — working grid size (bytes) that triggers a memory warning (5,000).
|
|
484
484
|
- `COW_PERFORMANCE.WORKING_GRID_BYTES_PER_ORDER` — estimated memory per order (500 bytes).
|
|
485
|
-
- `COW_PERFORMANCE.MAX_OPS_PER_BROADCAST` —
|
|
485
|
+
- `COW_PERFORMANCE.MAX_OPS_PER_BROADCAST` — *removed*; the per-broadcast operation cap is now derived from the grid gap-slot count (`DEXBot._getGapSlotBatchSize`); larger batches are split into sequential broadcasts.
|
|
486
486
|
|
|
487
487
|
### Pipeline Timing
|
|
488
488
|
- `PIPELINE_TIMING.RECOVERY_DECAY_FALLBACK_MS` — recovery decay fallback (180 seconds).
|
|
@@ -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.
|
|
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.2).
|
|
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.
|
|
39
|
+
| **Release Track** | 1.0.0 | v1.6.2 |
|
|
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 |
|
|
@@ -674,14 +674,10 @@ Where:
|
|
|
674
674
|
| `docs/COW_INVARIANTS.md` | Non-negotiable COW behavioral invariants |
|
|
675
675
|
| `docs/CREDENTIAL_SECURITY.md` | Credential daemon, key policy, and security model |
|
|
676
676
|
| `docs/MPA_CREDIT_USAGE.md` | Credit runtime and MPA usage guidance |
|
|
677
|
-
| `docs/BROWSER_COMPAT_PLAN.md` | Browser-safe surface plan and Node/browser split |
|
|
678
|
-
| `docs/PLAN_MIN_BTS_VALUE.md` | Minimum BTS value / dust handling planning |
|
|
679
677
|
| `claw/docs/AI_BOT_LIBRARY_API.md` | Claw API boundary and responsibility split |
|
|
680
678
|
| `claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md` | Grid tuning reference |
|
|
681
679
|
| `claw/docs/POSITION_HEALTH.md` | Position health monitoring guide |
|
|
682
680
|
| `claw/docs/RUNTIME_COMPARISON.md` | Claw runtime comparison |
|
|
683
|
-
| ~~`docs/TYPESCRIPT_MIGRATION_ANALYSIS.md`~~ | ~~Removed — migration complete~~ |
|
|
684
|
-
| `docs/crash_report_jan_mar_2026.md` | Production incident analysis |
|
|
685
681
|
| `docs/docker.md` | Docker deployment guide |
|
|
686
682
|
| `docs/README.md` | Docs index |
|
|
687
683
|
| `AGENTS.md` | AI development context |
|
|
@@ -780,7 +776,7 @@ Where:
|
|
|
780
776
|
|
|
781
777
|
| Metric | DEXBot | DEXBot2 |
|
|
782
778
|
|---|---|---|
|
|
783
|
-
| **Release Track** | 1.0.0 | v1.6.
|
|
779
|
+
| **Release Track** | 1.0.0 | v1.6.2 |
|
|
784
780
|
| **Active Since** | ~2018 | December 2025 |
|
|
785
781
|
| **Last Commit** | May 23, 2020 | 2026-09-02 |
|
|
786
782
|
| **Total Commits** | 2281 | 2,125 (v1.4.25) |
|
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.
|
|
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.2 stable release.
|
|
6
6
|
|
|
7
7
|
### Key Milestones
|
|
8
8
|
- **Project Inception**: December 2, 2025
|
|
9
|
-
- **Growth Phase**: 2,
|
|
9
|
+
- **Growth Phase**: 2,223 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
|
|
12
|
-
- **Releases**:
|
|
11
|
+
- **Stability**: Progression from manual testing to a suite of 284 automated test files
|
|
12
|
+
- **Releases**: 106 release entries (v0.1.0 to v1.6.2)
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -114,11 +114,13 @@ Compact, era-level view; per-release commit detail lives in [CHANGELOG.md](../CH
|
|
|
114
114
|
| v1.5.1 → v1.5.2 | 10 | Sync rejection handling across pass-1/pass-2 adoption, crossing-guard candidate sharing, empty-read confirmation, broadcast-price CREATE validation, stamped gap-evacuation re-proof, credit whole-account display + expiry, offline export fill-block derivation |
|
|
115
115
|
| v1.5.2 → v1.5.3 | 6 | Boundary ownership hardening (fund-driven sync removal, guard-skipped refill hold), COW broadcast/reconcile dedup, TradingView bot-grid range highlight, createOrder unknown-id materialize-or-error, curve-comparison docs |
|
|
116
116
|
| v1.5.3 → v1.6.0 | 37 | Node-failure strike ledger and broadcast-deferred fill rebalancing, trust-chain free-balance heal with deferred-drain tolerance, bidirectional grid-regeneration trigger, TradingView order overlay and chart pref namespacing, credit short-offer id display, live-config pickup (issue #27), reserve ladder anchored at resolved bounds + live-grid rail edges with single-source ordering and exact-size activation, owed-crawl persistence across refused broadcasts/restarts + hold-aware reload-safe lifecycle, fill-anchored boundary recovery + poisoned persisted-boundary erase, startup rail gate + static-center crawl fold, all `*-deferred` holds non-blocking + hold metrics surfaced, opt-in MPA price-feed charts + range-aware shared candle cache, range-band span parity on grid-less charts, orange range zone widened to 1.40x, docs reserve-ladder sweep, reserve-deficit targeted-sync trigger with window-exclusion counting, matched-surplus startup excess planning, shelf-order guards across reserve classification/placement/startup cancels/size recalc (issue #27 follow-ups), unified Kibana candle cache on runCachedWindows with fetch retry budgets, genuine-coverage LP window reuse, feed volume/AMA timeframe alignment, TradingView monthly candles/stat badges/rigid pan/volume toggle/feed affordance, credit full offer id + empty-pair Curr. CR hiding, live-config onboarding note |
|
|
117
|
+
| v1.6.0 → v1.6.1 | 3 | Never-run-stale hardening (level-triggered deferred-fill retry, stale-totals fill parking, out-of-spread watchdog, region-end fan-out, one-sided spread honesty), whitelist range-scaling opt-in defaults, live-save vs reset vs reload docs + power-law paper restructure |
|
|
118
|
+
| v1.6.1 → v1.6.2 | 6 | Grid-price invariant + resync escalation, gap-slot batch sizing, shard candle cache + chart fixes, recovery stranding tolerance, fill-counter hygiene, dead-node prune + trace single-sourcing, obsolete-doc removal |
|
|
117
119
|
|
|
118
120
|
---
|
|
119
121
|
|
|
120
122
|
**Report Originally Generated**: February 19, 2026
|
|
121
|
-
**Last Updated**: September
|
|
122
|
-
**Total Commits**: 2,
|
|
123
|
-
**Date Range**: December 2, 2025 – September
|
|
123
|
+
**Last Updated**: September 14, 2026
|
|
124
|
+
**Total Commits**: 2,223
|
|
125
|
+
**Date Range**: December 2, 2025 – September 14, 2026
|
|
124
126
|
**Repository**: DEXBot2 (BitShares DEX Trading Bot)
|
|
@@ -110,18 +110,13 @@ See [developer_guide.md#order-state-helper-functions](developer_guide.md#order-s
|
|
|
110
110
|
|
|
111
111
|
### 1.5 Fill Batch Processing & Timeline
|
|
112
112
|
|
|
113
|
-
####
|
|
113
|
+
#### Gap-Slot Batch Fill Processing
|
|
114
114
|
|
|
115
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.
|
|
116
116
|
|
|
117
|
-
**Batch Sizing Algorithm**:
|
|
117
|
+
**Batch Sizing Algorithm**: Batch size is derived from the grid gap-slot count (`DEXBot._getGapSlotBatchSize`): a queue depth at or below gapSlots is processed as one unified batch; deeper queues are chunked into repeated batches of gapSlots (the last chunk may be smaller). The same gap-slot size caps order operations per broadcast transaction (oversized op batches are split into sequential broadcasts).
|
|
118
118
|
|
|
119
|
-
**Configuration
|
|
120
|
-
```javascript
|
|
121
|
-
FILL_PROCESSING: {
|
|
122
|
-
MAX_FILL_BATCH_SIZE: 4 // Hard cap on batch size
|
|
123
|
-
}
|
|
124
|
-
```
|
|
119
|
+
**Configuration**: no fixed constant — both `FILL_PROCESSING.MAX_FILL_BATCH_SIZE` and `COW_PERFORMANCE.MAX_OPS_PER_BROADCAST` were removed; batch sizing follows the grid gap-slot count.
|
|
125
120
|
|
|
126
121
|
#### Fill Batch Processing Timeline
|
|
127
122
|
|
|
@@ -806,4 +801,4 @@ To prevent "Time-of-Check to Time-of-Use" errors:
|
|
|
806
801
|
**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.
|
|
807
802
|
|
|
808
803
|
---
|
|
809
|
-
*Technical Reference for DEXBot2 v1.6.
|
|
804
|
+
*Technical Reference for DEXBot2 v1.6.2 release*
|
|
@@ -259,26 +259,27 @@ need a reset to move to the new asymmetric range and offset placement price.
|
|
|
259
259
|
|
|
260
260
|
### Configuration
|
|
261
261
|
|
|
262
|
-
Range scaling is enabled by whitelist:
|
|
262
|
+
Range scaling is enabled by the whitelist's `asymmetricBounds: true` flag.
|
|
263
|
+
Generate or update the AMA whitelist with:
|
|
263
264
|
|
|
264
265
|
```bash
|
|
265
266
|
dexbot white
|
|
266
267
|
```
|
|
267
268
|
|
|
268
269
|
This writes `profiles/market_adapter_whitelist.json`. The default generation
|
|
269
|
-
enables AMA live writes
|
|
270
|
-
|
|
270
|
+
enables AMA live writes for new AMA bots, while leaving dynamic weights and
|
|
271
|
+
range scaling disabled.
|
|
271
272
|
|
|
272
|
-
To
|
|
273
|
+
To opt new AMA entries into range scaling:
|
|
273
274
|
|
|
274
275
|
```bash
|
|
275
|
-
dexbot white --
|
|
276
|
+
dexbot white --asymmetric-bounds
|
|
276
277
|
```
|
|
277
278
|
|
|
278
|
-
To overwrite
|
|
279
|
+
To overwrite one existing bot (otherwise preserved):
|
|
279
280
|
|
|
280
281
|
```bash
|
|
281
|
-
dexbot white --
|
|
282
|
+
dexbot white --asymmetric-bounds --bot <botKey>
|
|
282
283
|
```
|
|
283
284
|
|
|
284
285
|
The snapshot fields involved are:
|
package/docs/LIFECYCLE.md
CHANGED
|
@@ -105,7 +105,7 @@ sequenceDiagram
|
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
Why it matters:
|
|
108
|
-
- **
|
|
108
|
+
- **Gap-slot batching** (batch size = grid gap-slot count, `DEXBot._getGapSlotBatchSize`) keeps bursts
|
|
109
109
|
deterministic — see `docs/architecture.md` §"Fill Processing Pipeline".
|
|
110
110
|
- **Single rebalance cycle**: all fills in a batch share one broadcast, so proceeds
|
|
111
111
|
are immediately available for replacement sizing (no split-across-cycles delay).
|
|
@@ -179,7 +179,7 @@ enforced*, not compiler-enforced — learn them or you will introduce fund bugs.
|
|
|
179
179
|
| **Fund SSOT** | `Accounting` owns every fund number. Nothing else computes available funds. | `docs/architecture.md` §"Fund Flow Architecture" |
|
|
180
180
|
| **Replay-safe fills** | A fill is credited exactly once via processed-fill keys; retries are idempotent. | `modules/dexbot_fill_runtime.ts` |
|
|
181
181
|
| **Single broadcast per cycle** | One `updateOrdersOnChainBatch` per rebalance — never scatter writes. | `docs/architecture.md` §"Fill Processing Pipeline" |
|
|
182
|
-
| **Browser/Node split** | Heavy runtime is Node-only; never import it from a browser bundle. | `AGENTS.md` "Browser-Safe Surface", `
|
|
182
|
+
| **Browser/Node split** | Heavy runtime is Node-only; never import it from a browser bundle. | `AGENTS.md` "Browser-Safe Surface", `package.json` "browser" field |
|
|
183
183
|
| **Lock ordering** | Fill drain and maintenance must not run a rebalance concurrently. | `docs/developer_guide.md` §"Startup Sequence & Lock Ordering" |
|
|
184
184
|
|
|
185
185
|
---
|
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.
|
|
5
|
+
**Version context:** v1.6.2 (released).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -162,6 +162,14 @@ This directory contains the comprehensive technical documentation for the DEXBot
|
|
|
162
162
|
- **Test mapping**: Links each invariant to regression tests
|
|
163
163
|
- **Review checklist**: Quick-use verification for COW/accounting changes
|
|
164
164
|
|
|
165
|
+
### 📐 [Grid-Price Invariant](GRID_PRICE_INVARIANT.md)
|
|
166
|
+
*Why a slot's emitted price must equal its genesis level — and how that failed.*
|
|
167
|
+
- **The invariant**: `order.price === priceForSlot(idx, genesis)`, and why range guards cannot substitute for it
|
|
168
|
+
- **Failure mechanism**: Chain price overwriting slot identity, pre-broadcast substitution, untrusted fill-guard pivot
|
|
169
|
+
- **Enforcement**: The six emission sites, the blocking rejection of off-grid emissions, and the fail-open policy on unjudgeable inputs
|
|
170
|
+
- **Out-of-bounds policy**: Hold and surface; refill in-grid slots at their genesis price
|
|
171
|
+
- **Status**: What is landed, what remains open, and why the removed 5% sanity gate must not be naively re-landed
|
|
172
|
+
|
|
165
173
|
### 🧪 [Test Suite](../tests/README.md)
|
|
166
174
|
*Test organization, categories, and key architectural patterns tested.*
|
|
167
175
|
- **Test Layout**: Directory structure, helpers, and quick-start commands
|
package/docs/architecture.md
CHANGED
|
@@ -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
|
|
381
|
-
│
|
|
380
|
+
│ Use gap-slot batch size for deterministic batching │
|
|
381
|
+
│ Rules: <=gapSlots unified, >gapSlots chunked │
|
|
382
382
|
└─────────────────────┬───────────────────────────────────────┘
|
|
383
383
|
↓
|
|
384
384
|
┌─────────────────────────────────────────────────────────────┐
|
|
385
|
-
│ Pop Batch (up to
|
|
386
|
-
│
|
|
385
|
+
│ Pop Batch (up to gapSlots) │
|
|
386
|
+
│ Takes N fills from queue head (N = 1..gapSlots) │
|
|
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
|
-
- **
|
|
422
|
-
- 1..
|
|
423
|
-
-
|
|
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)
|
|
424
424
|
|
|
425
425
|
- **Single Rebalance Cycle**: All fills in batch processed in ONE rebalance
|
|
426
426
|
- No "split across cycles" delays
|
package/docs/developer_guide.md
CHANGED
|
@@ -39,7 +39,7 @@ Follow this path through the codebase:
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
**Additional Resources**:
|
|
42
|
-
- `modules/constants.ts::FILL_PROCESSING` -
|
|
42
|
+
- `modules/constants.ts::FILL_PROCESSING` - Fill-event handling configuration (batch sizing is gap-slot derived, see `DEXBot._getGapSlotBatchSize`)
|
|
43
43
|
- `modules/constants.ts::PIPELINE_TIMING` - Recovery configuration (RECOVERY_RETRY_INTERVAL_MS, MAX_RECOVERY_ATTEMPTS)
|
|
44
44
|
- `modules/constants.ts::MARKET_ADAPTER` - AMA, dynamic weight, and regime detection defaults
|
|
45
45
|
- `modules/constants.ts::REGIME_TABLE` - Hurst/PE regime signal-strength table
|
|
@@ -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
|
-
| **
|
|
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). |
|
|
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.
|
|
175
|
-
| **
|
|
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. |
|
|
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
|
|
package/market_adapter/README.md
CHANGED
|
@@ -77,25 +77,25 @@ dexbot white
|
|
|
77
77
|
This writes `profiles/market_adapter_whitelist.json`, where each bot's AMA,
|
|
78
78
|
dynamic-weight, and range-scaling flags can be inspected or adjusted.
|
|
79
79
|
|
|
80
|
-
By default, newly generated entries whitelist AMA pricing
|
|
81
|
-
|
|
82
|
-
weights:
|
|
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
83
|
|
|
84
84
|
```bash
|
|
85
85
|
dexbot white --dynamic-weight
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
To
|
|
88
|
+
To opt newly generated entries into range scaling:
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
dexbot white --
|
|
91
|
+
dexbot white --asymmetric-bounds
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
To overwrite an existing entry (existing entries are otherwise preserved):
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
dexbot white --dynamic-weight --bot <botKey>
|
|
98
|
-
dexbot white --
|
|
98
|
+
dexbot white --asymmetric-bounds --bot <botKey>
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
`--bot` implies overwrite for that key only; without it, `dexbot white` only adds missing bots.
|
|
@@ -156,7 +156,10 @@ whitelist gate:
|
|
|
156
156
|
|
|
157
157
|
This is separate from dynamic buy/sell weighting. Both grid-range effects are
|
|
158
158
|
enabled only when `asymmetricBounds: true` is set in
|
|
159
|
-
`profiles/market_adapter_whitelist.json`.
|
|
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).
|
|
160
163
|
|
|
161
164
|
Technical formula and tuning details are in
|
|
162
165
|
[Grid Range Scaling Model](#grid-range-scaling-model).
|
|
@@ -333,8 +336,8 @@ Dry-run log lines include `[DRY RUN]` or `[suppressed, dry-run]`.
|
|
|
333
336
|
|------|---------|
|
|
334
337
|
| Generate whitelist | `dexbot white` |
|
|
335
338
|
| Opt new whitelist entries into dynamic weights | `dexbot white --dynamic-weight` |
|
|
336
|
-
|
|
|
337
|
-
| Overwrite existing entry for a specific bot | `dexbot white --dynamic-weight --bot <botKey>` |
|
|
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>` |
|
|
338
341
|
| Prune stale whitelist entries (bots removed from bots.json) | `dexbot white --prune` |
|
|
339
342
|
| Probe public CEX availability | `node dist/market_adapter/inputs/fetch_cex_synthetic_data.js --exchange auto --check-only` |
|
|
340
343
|
| Seed synthetic cross candles | `node dist/market_adapter/inputs/fetch_cex_synthetic_data.js --exchange auto --bot-key <bot-key>` |
|
|
@@ -637,7 +640,7 @@ market_adapter/
|
|
|
637
640
|
"<botKey>": {
|
|
638
641
|
"ama": true,
|
|
639
642
|
"dynamicWeight": false,
|
|
640
|
-
"asymmetricBounds":
|
|
643
|
+
"asymmetricBounds": false
|
|
641
644
|
}
|
|
642
645
|
}
|
|
643
646
|
}
|
|
@@ -851,7 +854,7 @@ closed 1h candles.
|
|
|
851
854
|
|
|
852
855
|
#### Shared Chunk Cache and Fetch Robustness
|
|
853
856
|
|
|
854
|
-
Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`):
|
|
857
|
+
Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`): candles live in fixed calendar-month shards (`<base>.shard_YYYY-MM.json`, UTC) whose names never shift, so a run loads only the shards overlapping its requested range, queries only genuinely missing buckets plus a bounded 48h tail refresh, and rewrites only shards that gained buckets or query coverage — pure-reuse runs perform zero writes and zero deletes. Shard metas record the ranges actually queried (`meta.queriedRanges`, monotonically unioned). A missing range is pruned only when recorded query coverage genuinely covers it — the absence of local buckets alone never certifies history as empty. Partial windows merge into the run output but are never persisted. Legacy run-relative `*.chunk_*` files are still read: overlapping ones are absorbed into the shards (buckets + coverage) and retired once every bucket provably lives in a shard, while disjoint ones are never loaded and never deleted — narrow runs cannot wipe older history by construction. Every range fetch runs through `fetchRangeWithRetry` (per-range attempts + linear backoff + abort-signal timeout; the LP path keeps a 4-attempt budget), one-shot Kibana queries retry transient errors (3 attempts), paged fetchers cap at `kibanaMaxPages` (500), and bidirectional fetches tolerate a one-direction failure.
|
|
855
858
|
|
|
856
859
|
#### AMA Warmup Window — Why Candle Length Matters
|
|
857
860
|
|
package/package.json
CHANGED
package/scripts/README.md
CHANGED
|
@@ -98,18 +98,18 @@ node dist/scripts/validate_bots.js
|
|
|
98
98
|
**Purpose:** Generate `profiles/market_adapter_whitelist.json` from bots whose `gridPrice` uses AMA mode.
|
|
99
99
|
```bash
|
|
100
100
|
# Add missing AMA bots from profiles/bots.json to profiles/market_adapter_whitelist.json.
|
|
101
|
-
# Existing entries are preserved; new entries enable AMA
|
|
101
|
+
# Existing entries are preserved; new entries enable AMA only and leave dynamicWeight and range scaling disabled.
|
|
102
102
|
dexbot white
|
|
103
103
|
|
|
104
104
|
# Add missing AMA bots with dynamicWeight enabled for newly generated entries
|
|
105
105
|
dexbot white --dynamic-weight
|
|
106
106
|
|
|
107
|
-
# Add missing AMA bots with asymmetricBounds
|
|
108
|
-
dexbot white --
|
|
107
|
+
# Add missing AMA bots with range scaling (asymmetricBounds) enabled for newly generated entries
|
|
108
|
+
dexbot white --asymmetric-bounds
|
|
109
109
|
|
|
110
110
|
# Overwrite existing entry for a specific bot (implies overwrite for that key only; other bots unchanged)
|
|
111
111
|
dexbot white --dynamic-weight --bot <botKey>
|
|
112
|
-
dexbot white --
|
|
112
|
+
dexbot white --asymmetric-bounds --bot <botKey>
|
|
113
113
|
|
|
114
114
|
# Remove whitelist entries for bots no longer in profiles/bots.json
|
|
115
115
|
dexbot white --prune
|