You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: bump to v1.1.5 — AMA refit, oversized-deal splitter, doc sync
Two post-v1.1.4 changes packaged as a minor release plus a doc-sync
pass that closes stale references left behind when the splitter landed.
## Feat: AMA refit
Files: `modules/constants.ts`, `analysis/ama_fitting/optimizer_high_resolution.ts`
- Refit on 3yr pool 133 1h data (2023-07 → 2026-07) with per-AMA λ
weights (0.0031/0.0025/0.00185/0.0013) and SMA-warmup-aligned
optimizer.
- Slow periods: AMA1 73.3→62.1, AMA2 80.6→71.7, AMA3 88.7→82.7,
AMA4 102.4→95.5. Default slow range narrowed 40-160→35-140.
- New `--fixEr` / `--fixFast` CLI flags fix ER=781 / Fast=5.2 and
search Slow only. Stale references in market_adapter/README.md,
TradingView README, and two test fixtures updated.
## Feat: maxBorrowAmountPerOperation + oversized-deal splitter
Files: `modules/types.ts`, `modules/bot_settings.ts`,
`modules/credit_runtime.ts`, `modules/cr_planner.ts`,
`tests/test_credit_runtime.ts`
- New per-op borrow cap on `LendingEntryBase`; rejected at
`buildCreditOfferAcceptOperation` and clamped in the MPA planner.
- `_splitOversizedCreditDeals` runs as Phase 0 of credit maintenance:
splits deals whose debt exceeds the cap into equal pieces via atomic
repay+reborrow with 6s spacing, capped at
`TIMING.CREDIT_DEAL_SPLIT_MAX_PIECES=48` per cycle. `_splitInFlight`
concurrency guard prevents runMaintenance / runCreditWatchdog overlap.
- 6 new tests cover per-op rejection, offer-selection capping, correct
split arithmetic, within-limit skip, no-limit skip, error-pattern match.
## Fix: Split settle-delay resolves from TIMING constant
File: `modules/credit_runtime.ts`
- `_doSplitOversizedCreditDeals` now reads `BLOCKCHAIN_SETTLE_DELAY_MS`
from the imported `TIMING` constant, consistent with
`dexbot_maintenance_runtime.ts`. Per-bot `bots.json` overrides for
this field are no longer honoured for split pacing.
## Docs: Stale MPA/credit references closed
Files: `docs/MPA_CREDIT_USAGE.md`, `docs/developer_guide.md`
- Added `maxBorrowAmountPerOperation` to the Field Reference, the
Amount Cap Semantics table, and the "Which section do I need?"
quick-ref table.
- New "Oversized Credit Deal Splitter" subsection documents Phase 0
behavior, `CREDIT_DEAL_SPLIT_MAX_PIECES`, `_splitInFlight`, the
`min_deal_amount` guard, and shutdown abort.
- Runtime Timing now lists `CREDIT_DEAL_SPLIT_MAX_PIECES` and
`BLOCKCHAIN_SETTLE_DELAY_MS`. Related Files adds `cr_planner.ts` and
`types.ts` (`LendingEntryBase`).
- developer_guide.md Key Rules extended to mention the per-op cap with
splitter.
## Version sync
Files: `package.json`, `package-lock.json`, `claw/package.json`,
`claw/runtimes/openclaw-plugin/package.json`,
`claw/runtimes/openclaw-plugin/openclaw.plugin.json`,
`analysis/ama_fitting/package.json`,
`claw/tests/test_claw_mcp_transport.ts`
- Version bumped 1.1.4 → 1.1.5 across all 7 manifests. `version:check`
clean.
## Testing Notes
- `npm run version:check` — all manifests in sync
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,21 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+
## [1.1.5] - 2026-07-14 - AMA Refit, Oversized Credit Deal Splitter & Per-op Borrow Cap
6
+
7
+
### 2026-07-14
8
+
9
+
-**Feat**: AMA refit on 3yr pool 133 1h data (2023-07 → 2026-07) with per-AMA λ weights (0.0031/0.0025/0.00185/0.0013) and SMA-warmup-aligned optimizer. Slow periods updated AMA1 73.3→62.1, AMA2 80.6→71.7, AMA3 88.7→82.7, AMA4 102.4→95.5. Default slow range narrowed 40-160→35-140. New `--fixEr` / `--fixFast` CLI flags fix ER=781 / Fast=5.2 and search Slow only. CLI validation adds `--ama1Cap`–`--ama4Weight` properties, removing 8 `(out as any)` casts. Stale references updated in market_adapter/README.md, TradingView README, and two test fixtures (`analysis/ama_fitting/optimizer_high_resolution.ts`, `modules/constants.ts`, `market_adapter/README.md`, `analysis/tradingview/README.md`, `tests/test_market_adapter_log_format.ts`, `tests/test_market_adapter_logic.ts`).
10
+
-**Feat**: add `maxBorrowAmountPerOperation` config field and `_splitOversizedCreditDeals` — when a credit deal exceeds `maxBorrowAmountPerOperation`, maintenance splits it into equal pieces via repay+reborrow cycles with 6s spacing. Planner clamps debtDelta by per-op cap on top of the total `maxBorrowAmount` ceiling. `min_deal_amount` guard skips deals where any piece would be below the offer's minimum deal size. `MAX_PIECES_PER_CYCLE=48` (new `TIMING.CREDIT_DEAL_SPLIT_MAX_PIECES`) prevents unbounded cycles. `_splitInFlight` concurrency guard prevents `runMaintenance` / `runCreditWatchdog` collisions. 6 new tests cover per-op rejection, offer-selection capping, correct split arithmetic, within-limit skip, no-limit skip, and error-pattern match (`modules/types.ts`, `modules/bot_settings.ts`, `modules/credit_runtime.ts`, `modules/cr_planner.ts`, `tests/test_credit_runtime.ts`).
11
+
-**Fix**: settle-delay resolution for credit splits now reads from the `TIMING` constant instead of `bot.config.TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` — consistent with `dexbot_maintenance_runtime.ts`. Any per-bot `TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` override in `bots.json` is no longer honoured for split pacing (`modules/credit_runtime.ts`).
-**Fix**: correct AMA4 slowPeriod from 107.4 to 102.4 — aligns AMA4 with the same λ=0.0025 refit applied to AMA1-3 in v1.1.3. Fixes stale slowPeriod references in market_adapter/README.md, test fixtures, and TradingView chart generator (`modules/constants.ts`, `market_adapter/README.md`, `tests/test_market_adapter_log_format.ts`, `tests/test_market_adapter_logic.ts`, `analysis/tradingview/tradingview_uplot_chart_generator.ts`).
10
18
-**Feat**: narrow optimizer slow search range from 50-200 to 40-160 — focuses the geometric grid on the range where fitted winners consistently land, reducing wasted evaluations at uncompetitive extremes (`analysis/ama_fitting/optimizer_high_resolution.ts`).
11
19
-**Docs**: sync v1.1.3 release notes with amaS% retune (0.085→0.08), update DYNAMIC_WEIGHT_RESEARCH.md knob table, correct EVOLUTION.md commit count for v1.1.3 (2→4) and summary to include the amaS% retune (`CHANGELOG.md`, `analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md`, `docs/EVOLUTION.md`).
12
-
-**Feat**: add `maxBorrowAmountPerOperation` config field and `_splitOversizedCreditDeals` — when a credit deal exceeds `maxBorrowAmountPerOperation`, maintenance splits it into equal pieces via repay+reborrow cycles with 6s spacing (`modules/types.ts`, `modules/bot_settings.ts`, `modules/credit_runtime.ts`, `modules/cr_planner.ts`).
13
-
-**Fix**: settle-delay resolution for credit splits now reads from the `TIMING` constant instead of `bot.config.TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` — consistent with `dexbot_maintenance_runtime.ts`. Any per-bot `TIMING.BLOCKCHAIN_SETTLE_DELAY_MS` override in `bots.json` is no longer honoured for split pacing (`modules/credit_runtime.ts`).
Copy file name to clipboardExpand all lines: docs/DEXBOT_COMPARISON.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# DEXBot vs DEXBot2 — Detailed Comparison Report
2
2
3
3
> **Date:** 2026-07-11 *(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.1.4).
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.1.5).
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.1.4|
39
+
|**Release Track**| 1.0.0 | v1.1.5|
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-07-10 |
@@ -782,7 +782,7 @@ Where:
782
782
783
783
| Metric | DEXBot | DEXBot2 |
784
784
|---|---|---|
785
-
| **Release Track** | 1.0.0 | v1.1.4 |
785
+
| **Release Track** | 1.0.0 | v1.1.5 |
786
786
| **Active Since** | ~2018 | December 2025 |
787
787
| **Last Commit** | May 23, 2020 | 2026-07-10 |
788
788
| **Total Commits** | 2281 | 1713 at current HEAD |
Copy file name to clipboardExpand all lines: docs/EVOLUTION.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -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.1.4 stable release.
5
+
DEXBot2 is a sophisticated decentralized exchange trading bot for the BitShares blockchain. This report documents the complete evolution of the project from its inception in December 2025 through the current 1.1.5 stable release.
6
6
7
7
### Key Milestones
8
8
-**Project Inception**: December 2, 2025
9
-
-**Growth Phase**: 1,724+ commits over ~7 active months
9
+
-**Growth Phase**: 1,738+ commits over ~7 active months
10
10
-**Code Maturity**: Evolution from basic utilities to a ~58,000+ LoC intelligent TypeScript system
11
11
-**Stability**: Progression from manual testing to a suite of 200+ automated test files
12
-
-**Releases**: 52 release entries (v0.1.0 to v1.1.4)
12
+
-**Releases**: 53 release entries (v0.1.0 to v1.1.5)
@@ -92,6 +93,7 @@ Add `debtPolicy` to a bot entry in `profiles/bots.json`:
92
93
|-------|------|----------|-------------|
93
94
|`outputWeight`|`number`| No | Output weight for this asset. Controls the proportion of debt value across lending items (not collateral). Defaults to `1`. See **Collateral Distribution** below. |
94
95
|`maxBorrowAmount`|`number`| No |**Fixed** total debt ceiling. Must be a positive number (not a percentage). |
96
+
|`maxBorrowAmountPerOperation`|`number`| No |**Per-operation borrow cap**. Any single credit-offer accept operation whose borrow amount exceeds this is rejected. For MPA, the planner clamps each `debtDelta` by this cap on top of `maxBorrowAmount`. When set, oversized credit deals are split into equal pieces via repay+reborrow cycles during maintenance (see [Credit Offer Maintenance](#credit-offer-maintenance)). Must be a positive number. |
95
97
|`maxCollateralAmount`|`number \| percentage string`| No | Total collateral ceiling. Use a number for an absolute collateral amount, e.g. `5000`, or a percentage string of total available collateral, e.g. `"80%"`. |
96
98
|`minCollateralIncreaseThreshold`|`number \| percentage string`| No | Minimum unused collateral allocation before increasing debt. Use a number for an absolute collateral amount, e.g. `25`, or a percentage string of assigned collateral budget, e.g. `"5%"`. `0` means no minimum. |
97
99
|`maxCollateralRatio`|`number`| No\*| Behavior differs by type: MPA — hard CR ceiling above which debt is increased first; creditOffer — maximum effective ratio when accepting offers. **Required** for `creditOffer`. |
@@ -171,13 +173,17 @@ Timing defaults live in `modules/constants.ts`:
171
173
{
172
174
"TIMING": {
173
175
"CREDIT_DEAL_CHECK_INTERVAL_MIN": 60,
174
-
"CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS": 12
176
+
"CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS": 12,
177
+
"CREDIT_DEAL_SPLIT_MAX_PIECES": 48,
178
+
"BLOCKCHAIN_SETTLE_DELAY_MS": 6000
175
179
}
176
180
}
177
181
```
178
182
179
183
-`CREDIT_DEAL_CHECK_INTERVAL_MIN`: how often the credit watchdog runs. Set to `0` or negative to disable.
180
184
-`CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS`: how far before `latest_repay_time` the bot proactively repays and reborrows.
185
+
-`CREDIT_DEAL_SPLIT_MAX_PIECES`: hard cap on pieces per `_splitOversizedCreditDeals` cycle (default 48; ~4.8min at 6s/piece). Prevents one maintenance run from exceeding the watchdog interval.
186
+
-`BLOCKCHAIN_SETTLE_DELAY_MS`: pause between split pieces (default 6000ms). Resolved from the `TIMING` constant — per-bot `bots.json` overrides for this field are **not** honoured for split pacing.
181
187
182
188
## MPA Maintenance
183
189
@@ -196,19 +202,35 @@ For each `type: "mpa"` lending item:
196
202
197
203
For each `type: "creditOffer"` lending item, the runtime:
198
204
205
+
-**Phase 0 — Split oversized deals**: if `maxBorrowAmountPerOperation` is set, scans existing credit deals and splits any whose debt exceeds the per-op cap into equal pieces via repay+reborrow cycles (see [Oversized Credit Deal Splitter](#oversized-credit-deal-splitter)). This keeps each individual deal below the per-op cap and makes future renewals easier with less liquidity per operation.
199
206
- Discovers active credit deals on-chain.
200
207
- Validates deals against the per-item policy (`maxCollateralRatio`, `maxFeeRatePerDay`, `allowedOfferIds`, `disallowedDealIds`, etc.).
201
-
- Gates increases on unused assigned collateral. If the collateral shortfall is at least `minCollateralIncreaseThreshold`, it accepts an additional credit deal from the cheapest acceptable offer; the selected offer's price derives the borrow amount, capped by `maxBorrowAmount`. A borrow-cap-capped increase is skipped if the actual collateral used would fall below `minCollateralIncreaseThreshold`.
208
+
- Gates increases on unused assigned collateral. If the collateral shortfall is at least `minCollateralIncreaseThreshold`, it accepts an additional credit deal from the cheapest acceptable offer; the selected offer's price derives the borrow amount, capped by `maxBorrowAmount` and, when set, `maxBorrowAmountPerOperation`. A borrow-cap-capped increase is skipped if the actual collateral used would fall below `minCollateralIncreaseThreshold`.
202
209
- Proactively repays deals nearing expiration (within `CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS`) and reborrows when `autoReborrow` is enabled.
203
210
- Ensures `auto_repay` on-chain matches the policy's `autoRepay` setting, updating local state after each successful broadcast.
204
211
212
+
### Oversized Credit Deal Splitter
213
+
214
+
When `maxBorrowAmountPerOperation` is set, each credit-maintenance cycle runs `_splitOversizedCreditDeals` as Phase 0. The splitter:
- Splits each oversized deal into `ceil(debt / maxPerOp)` equal pieces via atomic repay+reborrow transactions. Total debt across the new deals is preserved; only deal granularity changes.
218
+
- Skips a deal if any piece would fall below the offer's `min_deal_amount` (the offer is cached for the runtime lifetime, so on-chain `min_deal_amount` changes mid-split are not re-read).
219
+
- Pauses `BLOCKCHAIN_SETTLE_DELAY_MS` between pieces; aborts on shutdown.
220
+
- Stops once `CREDIT_DEAL_SPLIT_MAX_PIECES` pieces have been emitted in the current cycle. Remaining oversized deals are deferred to the next maintenance cycle.
221
+
- Uses an in-process `_splitInFlight` guard so `runMaintenance` and `runCreditWatchdog` cannot start overlapping splits.
222
+
223
+
The split pieces are normal credit deals — they appear in `profiles/credit_runtime/<botKey>.json` alongside other deals and are subject to the usual renewal, `auto_repay`, and collateral-switching flows.
0 commit comments