dexbot 1.6.1 → 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 +20 -0
- 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/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/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 +7 -3
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +44 -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 +31 -6
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +55 -11
- 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 +28 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +116 -3
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +46 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +187 -5
- 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 +16 -3
- package/dist/modules/dexbot_state_recovery.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 +47 -6
- 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 +39 -4
- package/dist/modules/order/grid_reconcile_internal.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 +60 -14
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +87 -20
- 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 +118 -1
- 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/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/DEXBOT_COMPARISON.md +3 -7
- package/docs/EVOLUTION.md +8 -7
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +4 -9
- 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 +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
|
@@ -115,11 +115,12 @@ Compact, era-level view; per-release commit detail lives in [CHANGELOG.md](../CH
|
|
|
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
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 |
|
|
118
119
|
|
|
119
120
|
---
|
|
120
121
|
|
|
121
122
|
**Report Originally Generated**: February 19, 2026
|
|
122
|
-
**Last Updated**: September
|
|
123
|
-
**Total Commits**: 2,
|
|
124
|
-
**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
|
|
125
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*
|
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
|
@@ -854,7 +854,7 @@ closed 1h candles.
|
|
|
854
854
|
|
|
855
855
|
#### Shared Chunk Cache and Fetch Robustness
|
|
856
856
|
|
|
857
|
-
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.
|
|
858
858
|
|
|
859
859
|
#### AMA Warmup Window — Why Candle Length Matters
|
|
860
860
|
|
package/package.json
CHANGED