dexbot 1.6.14 → 1.6.16
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 +60 -4
- package/README.md +4 -4
- package/analysis/README.md +6 -6
- package/analysis/tradingview/README.md +2 -1
- package/claw/README.md +7 -7
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +3 -2
- package/claw/modules/chain_queries.ts +3 -3
- 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/dist/analysis/ama_fitting/fetch_lp_candles.js +8 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +50 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +33 -7
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +8 -6
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +8 -10
- package/dist/analysis/bot_key_utils.js +9 -7
- package/dist/analysis/chart_utils.d.ts +9 -2
- package/dist/analysis/chart_utils.js +51 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +2 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +99 -11
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +57 -4
- package/dist/analysis/trend_detection/kalman_chart_generator.js +1 -0
- package/dist/analysis/trend_detection/regime_chart_generator.js +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +1 -0
- package/dist/dexbot.js +112 -141
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +26 -11
- package/dist/market_adapter/inputs/fetch_book_data.js +36 -12
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +6 -0
- package/dist/market_adapter/inputs/fetch_lp_data.js +65 -19
- package/dist/market_adapter/inputs/kibana_feed_source.js +45 -12
- package/dist/market_adapter/inputs/window_cache.d.ts +14 -1
- package/dist/market_adapter/inputs/window_cache.js +53 -17
- package/dist/market_adapter/lp_chart_core.js +1 -0
- package/dist/market_adapter/utils/chain.js +4 -3
- package/dist/market_adapter/utils/pair_orientation.d.ts +60 -0
- package/dist/market_adapter/utils/pair_orientation.js +142 -0
- package/dist/modules/account_bots.d.ts +40 -3
- package/dist/modules/account_bots.js +80 -37
- package/dist/modules/account_orders.d.ts +4 -1
- package/dist/modules/account_orders.js +4 -1
- package/dist/modules/bitshares-native/resolvers.js +3 -3
- package/dist/modules/bitshares-native/subscriptions.js +1 -1
- package/dist/modules/bitshares_client.d.ts +12 -10
- package/dist/modules/bitshares_client.js +12 -10
- package/dist/modules/bot_defaults.d.ts +13 -2
- package/dist/modules/bot_defaults.js +31 -2
- package/dist/modules/bot_settings.js +6 -3
- package/dist/modules/chain_keys.d.ts +5 -1
- package/dist/modules/chain_keys.js +5 -1
- package/dist/modules/chain_orders.d.ts +6 -2
- package/dist/modules/chain_orders.js +6 -2
- package/dist/modules/constants.d.ts +11 -0
- package/dist/modules/constants.js +31 -1
- package/dist/modules/credit_runtime.d.ts +35 -5
- package/dist/modules/credit_runtime.js +219 -38
- package/dist/modules/dexbot_class.d.ts +22 -2
- package/dist/modules/dexbot_class.js +61 -21
- package/dist/modules/dexbot_cow_runtime.js +19 -18
- package/dist/modules/dexbot_fill_runtime.d.ts +1 -1
- package/dist/modules/dexbot_fill_runtime.js +4 -7
- package/dist/modules/dexbot_maintenance_runtime.d.ts +7 -2
- package/dist/modules/dexbot_maintenance_runtime.js +52 -7
- package/dist/modules/dexbot_startup_runtime.js +3 -2
- package/dist/modules/dexbot_state_recovery.js +1 -1
- package/dist/modules/graceful_shutdown.d.ts +6 -2
- package/dist/modules/graceful_shutdown.js +6 -2
- package/dist/modules/launcher/bot_supervisor.js +4 -0
- package/dist/modules/launcher/launch_modes.js +6 -3
- package/dist/modules/launcher/monolithic_runtime.d.ts +39 -1
- package/dist/modules/launcher/monolithic_runtime.js +60 -1
- package/dist/modules/launcher/runtime_mode.d.ts +79 -0
- package/dist/modules/launcher/runtime_mode.js +223 -0
- package/dist/modules/market_adapter_whitelist.d.ts +8 -0
- package/dist/modules/market_adapter_whitelist.js +8 -0
- package/dist/modules/order/accounting.d.ts +15 -1
- package/dist/modules/order/accounting.js +15 -1
- package/dist/modules/order/async_lock.d.ts +9 -3
- package/dist/modules/order/async_lock.js +9 -3
- package/dist/modules/order/export.d.ts +0 -5
- package/dist/modules/order/export.js +2 -7
- package/dist/modules/order/format.d.ts +6 -4
- package/dist/modules/order/format.js +6 -4
- package/dist/modules/order/grid.d.ts +147 -19
- package/dist/modules/order/grid.js +321 -68
- package/dist/modules/order/grid_reconcile.js +4 -3
- package/dist/modules/order/grid_reconcile_internal.js +13 -18
- package/dist/modules/order/index.d.ts +4 -2
- package/dist/modules/order/index.js +1 -1
- package/dist/modules/order/logger_state.d.ts +1 -1
- package/dist/modules/order/logger_state.js +1 -1
- package/dist/modules/order/manager.d.ts +1 -0
- package/dist/modules/order/manager.js +5 -14
- package/dist/modules/order/sync_engine.d.ts +26 -11
- package/dist/modules/order/sync_engine.js +44 -20
- package/dist/modules/order/utils/math.d.ts +157 -47
- package/dist/modules/order/utils/math.js +236 -78
- package/dist/modules/order/utils/order.d.ts +64 -20
- package/dist/modules/order/utils/order.js +80 -24
- package/dist/modules/order/utils/system.d.ts +41 -11
- package/dist/modules/order/utils/system.js +43 -13
- package/dist/modules/order/utils/validate.d.ts +6 -3
- package/dist/modules/order/utils/validate.js +53 -60
- package/dist/modules/types.d.ts +7 -0
- package/dist/modules/utils/asset_symbols.d.ts +5 -5
- package/dist/modules/utils/asset_symbols.js +5 -5
- package/dist/modules/utils/errors.d.ts +2 -1
- package/dist/modules/utils/errors.js +2 -1
- package/dist/scripts/analyze-credit.js +44 -27
- package/dist/scripts/diagnose-pool-history.js +35 -30
- package/dist/scripts/pnl.js +1 -1
- package/dist/scripts/rich_list.d.ts +50 -0
- package/dist/scripts/rich_list.js +469 -0
- package/dist/scripts/run-tests.js +80 -4
- package/dist/unlock.d.ts +2 -1
- package/dist/unlock.js +53 -21
- package/docs/BITSHARES_ONBOARDING.md +7 -0
- package/docs/COW_INVARIANTS.md +7 -1
- package/docs/DEXBOT_COMPARISON.md +6 -6
- package/docs/EVOLUTION.md +11 -9
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +3 -3
- package/docs/GRID_RECALCULATION.md +18 -6
- package/docs/LIFECYCLE.md +8 -8
- package/docs/LOGGING.md +16 -1
- package/docs/MPA_CREDIT_USAGE.md +10 -5
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +163 -13
- package/docs/README.md +1 -1
- package/docs/WORKFLOW.md +6 -5
- package/docs/architecture.md +56 -2
- package/docs/developer_guide.md +5 -1
- package/market_adapter/README.md +14 -7
- package/modules/README.md +1 -1
- package/package.json +4 -1
- package/scripts/README.md +59 -32
- package/tests/README.md +40 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.6.16] - 2026-10-18 - Monolithic Per-Bot Control Routing, Candle-Cache Orientation Sharing, Chart Redraw Performance, Adapter Whitelist Sync, `dexbot rich` Symbol Canonicalization
|
|
6
|
+
|
|
7
|
+
### 2026-10-18
|
|
8
|
+
|
|
9
|
+
- **Fix(launcher)**: make per-bot control work under the monolithic runtime — `dexbot reload|restart|stop <bot>` skipped the monolithic branch (guarded by `!target`) and fell through to the isolated supervisor socket, which does not exist in that mode, so the command failed with a misleading "No supervisor socket found" while the runtime was up; `status <bot>` silently dropped the target and `delete <bot>` tore down the whole isolated supervisor. Every control now goes through one pure resolver, `resolveControlRouting` (`modules/launcher/monolithic_runtime.ts`): whole-runtime forms canonicalize to `*-all`/`delete`, a bot target passes through to the isolated supervisor, a live monolithic runtime folds it into the whole-runtime action with a notice (validating the name first so a typo cannot reload every bot), `delete <bot>` is rejected and `status <bot>` is validated then ignored, and the supervisor's `delete` refuses a bot target as defence in depth. Runtime detection is centralized in the new `modules/launcher/runtime_mode.ts` (monolithic → isolated → pm2 → none), shared by `dexbot status` and the new mode-aware `dexbot help` so the two cannot disagree; a `pm2.pid` fast path keeps the help/typo path free of a pm2 probe. Behavioral note: unknown bot names are now rejected on folded paths, while the isolated pass-through still lets the supervisor validate. Covered by `tests/test_control_routing.ts`, `tests/test_runtime_mode.ts` and `tests/test_unlock_control_output.ts`.
|
|
10
|
+
|
|
11
|
+
- **Fix(account_bots)**: keep the adapter whitelist in sync on rename and copy — renaming a bot without touching menu 6 never armed the adapter commit hook (the gate was staged/new/copy), so the whitelist entry stayed under the old key and the renamed bot silently reverted to all-off defaults. The positional `baseIndex` inference is replaced by an explicit `BotEditorMode` (`'new'|'modify'|'copy'`) with the commit plan resolved up front, and the I/O-free `resolveAdapterCommitPlan`/`sameAdapterFlags` helpers are extracted so copy/rename semantics are unit-tested, including a regression that a copy never moves (and so never deletes) the source entry. The generic `setWhitelistFlags` overwrites an occupied key while `renameWhitelistEntry` refuses one, because the setter is used by new/modify/copy where claiming a stale entry is expected, whereas a move deletes the source and must not clobber a live occupant. Behavioral impact: modify-renames now move the whitelist entry and copies duplicate the source flags without touching it.
|
|
12
|
+
|
|
13
|
+
- **Refactor(account_bots)**: collapse save output into one green line — the adapter-flag commit hook logged its own green success line before `main()` logged "Added bot ...", so a single save produced two status lines. `commitAdapter` now returns a status (`'saved'`/`'unchanged'`/`'failed'`) instead of printing on success, and the adapter note is folded into the Add/Copy status lines. Copy semantics are fixed in the same hook: `promptBotData` runs for copies with `baseIndex !== index`, but the hook treated the new key like a rename and moved (deleting) the source bot's whitelist entry; the rename is now gated on `baseIndex === index`, comparisons and writes use `newKey` for copies, and a copy commits even without a menu-6 edit so the flags the editor showed are duplicated. Modify keeps its multi-line guidance and only appends "Adapter flags saved." when a write happened.
|
|
14
|
+
|
|
15
|
+
- **Feat(cache)**: share the candle cache across pair orientations — the LP, order-book and feed candle caches keyed on the typed asset order, so a pair and its inverse were two unrelated cache families holding reciprocal data and each re-queried Kibana independently. All three now store under one canonical orientation (lower asset id is leg A) and translate at the cache boundary, so querying one side reuses the other's shards. New `market_adapter/utils/pair_orientation.ts` holds the single definition of canonical ordering, the pair folder slug, same/swapped asset matching, the legacy sibling path and candle inversion (volume approximated as base × close, matching the TV chart's inverse view); `window_cache` gains a generic inverse-shard fallback that reads an absent canonical month from the opposite-orientation family, transforms and folds it back on flush, so an existing inverse cache is migrated instead of re-fetched. LP/book/feed fetchers canonicalize storage and fetch then invert the result back to the requested orientation, and the whole-history exporters rebuild the requested orientation from canonical shards. Behavioral impact: existing inverse-orientation folders are reused once and migrated; inverse volume remains a documented approximation; no runtime bot candle path is affected. Covered by `tests/test_candle_cache_inverse_sharing.ts`.
|
|
16
|
+
|
|
17
|
+
- **Fix(profiles)**: match and write market profiles orientation-insensitively — with the candle cache now canonical, a profile fitted from an assembled data file can be keyed on either side of the pair, yet `resolveAmaConfig` and the TradingView chart's `findMarketProfile` still required the bot's typed order and silently fell back to builtin AMA defaults, while the optimizer could accumulate one entry per orientation. Both lookups now accept either order, and the optimizer writes the canonical pair/key and replaces a same-pair entry in either orientation rather than duplicating it, leaving the lookup tolerance as a safety net for old entries. Covered by `tests/test_market_profile_orientation.ts`.
|
|
18
|
+
|
|
19
|
+
- **Fix(chart)**: prevent a log-axis hang and clip per-bar draw hooks to the viewport — uPlot 1.6.32's built-in log-scale splits generator can loop forever on a narrow price range (its tick step is reassigned to an intermediate value missing from the nice-number cache, so rounding collapses it to 0 and the tick array grows until "Invalid array length"/OOM); scroll-wheel zooming the dynamic-weight chart triggered this and blocked the tab for tens of seconds. A shared `logAxisSplits` replaces it on every `distr: 3` price axis (dynamic-weight, volatility, regime, kalman, derivative, lp) and only emits 1/2/5 × 10^d values inside `[min, max]`, yielding no ticks for invalid/empty ranges instead of hanging. `makePctFillHook` is clipped to the visible bar window via the shared `visibleBarRange`/`VIEWPORT_CLIP_SCRIPT`, and signal-background segments that cannot intersect the viewport are culled; runs reaching the last real bar still extend to the right edge. Zoomed-in redraws drop ~37–74% while full-range and future-padding renders stay pixel-identical. Behavioral impact: log price axes now show 1/2/5 × 10^d gridlines instead of uPlot's default (including 2.5). Covered by `tests/test_chart_log_axis_splits.ts`.
|
|
20
|
+
|
|
21
|
+
- **Fix(chart)**: clip the TradingView range-band hook to visible bars — `drawRangeBand` walked every bar on every redraw (`for i < xs.length`), calling `valToPos` four times per bar and building polylines for the whole series, so zooming in cost the same as the full-range view and on large generated charts (tens of thousands of candles) enabling the Range band roughly doubled redraw work. It now walks `u.series[0].idxs` (padded one bar each side so segments crossing the viewport edge stay connected), matching the sibling `drawSimBand`/`drawSimResets` hooks; full-range output is unchanged while per-redraw canvas work scales with the viewport (measured on a ~26k-bar page in Firefox: band `ctx.lineTo` drops from ~152,800 at full range to ~1,800 when zoomed to 300 bars, ~1.2%). Verified by the new Playwright suite.
|
|
22
|
+
|
|
23
|
+
- **Feat(tradingview)**: move the volume controls beside the pair switcher — the Volume toggle and base/quote unit badge move from the right-hand toolbar group to the leftmost group, immediately before the pair orientation switcher, since volume units derive from the orientation and the dependency should be visible rather than hidden at the far end of the row. Markup only: element IDs and handlers are unchanged, so volume visibility, unit switching and persisted chart state are unaffected.
|
|
24
|
+
|
|
25
|
+
- **Test(chart)**: add a Firefox Playwright suite for generated chart pages — the generated pages are canvas-heavy draw hooks that only run in a browser, so the Node runner cannot exercise them. `tests/playwright/tv_chart_perf.spec.mjs` loads a real exported page and asserts it loads without console/page errors with uPlot initialized, that range-band redraw cost scales with the visible window (counting `CanvasRenderingContext2D.lineTo` band-on vs band-off, deterministic, no wall-clock timing), and that the band still spans the plot when zoomed in (pixel diff with a pinned y-range). The uPlot interception is generic and `TV_CHART_HTML=<path>` runs the load check against any already-generated page (TV-only assertions skip without a Range toggle), a missing/stale `dist/` is reported instead of silently testing old code, and Playwright stays out of the dependency tree (`npm run test:playwright` resolves a global install via `NODE_PATH`).
|
|
26
|
+
|
|
27
|
+
- **Fix(rich)**: canonicalize asset symbols before chain lookup — `dexbot rich` passed CLI symbols straight into the case-sensitive `lookup_asset_symbols`, so any lowercase symbol resolved to null and the command reported "asset not found" even though the asset exists, while every other chain-facing caller already ran symbols through `modules/utils/asset_symbols`. `lookupSymbols` now normalizes so both the initial lookup and the legacy `bit*` alias retry reach the chain uppercase, request/alias reporting keeps the caller's original spelling, and `main()` is guarded so tests can import it without opening a websocket. Also corrects the stale "nodes accept lowercase lookups" comments that caused the gap. Behavioral impact: `dexbot rich <asset>` resolves symbols case-insensitively (asset object ids unchanged). Covered by `tests/test_rich_list_symbol_normalization.ts`.
|
|
28
|
+
|
|
29
|
+
- **Docs**: fix stale references in analysis comments and the market-adapter module map (bot-fitting/backtest and bot-key AMA comments now cite symbols instead of drifted `file.ts:NN` ranges, a stray drifted spread-gap comment is dropped, and `cli_args.ts`/`utils/pair_orientation.ts` are added to the documented layout); reconcile per-module headers, export inventories, TOCs and JSDoc with the current code across `constants`, `chain_keys`, `graceful_shutdown`, `bitshares_client`, `account_bots`, `account_orders`, `chain_orders`, `order/*`, `utils/errors` and `dexbot_class` (dangling moved-file references removed); and sync the linked docs with current defaults and code references (`LIFECYCLE`, `COW_INVARIANTS`, `FUND_MOVEMENT` line links; the real AMA resolution order in `GRID_RECALCULATION`; fitted built-in preset values in the market-adapter README; the shipped `weightDistribution` default in the tuning cheat sheet; superseded plan sources marked deleted in the order-engine retrospective). Docs/comments only; `npx tsc --noEmit` clean.
|
|
30
|
+
|
|
31
|
+
## [1.6.15] - 2026-10-16 - Spread-Correction Resilience, Credit Renewal Free-Collateral Top-Up, Price-vs-Amount Level Identity, TradingView Chart Fixes & Data-Age Badge, `dexbot rich`, Parallel Test Runner
|
|
32
|
+
|
|
33
|
+
### 2026-10-16
|
|
34
|
+
|
|
35
|
+
- **Fix(order)**: keep grid level identity price-based, not amount-based — a bot on a low-precision quote asset (precision 4) placed only one of 20 sells and collapsed its outside→center pairing, because `priceSlotEqual(price, price, assetPrecision)` rounded a PRICE through an asset AMOUNT precision: 0.000318 and 0.000343 both round to 3, so every adjacent level looked like the same level and every CREATE after the first was rejected as a collision. The overloaded helper is replaced by three explicit identities: `pricesOnSameLevel` (chain-representable tolerance, min across both types, now clamped to half a grid step so a dust-inflated tolerance cannot merge adjacent levels) for any chain-derived price, exact `sameGridPrice` for grid-vs-grid, and genesis-aware `sameGridLevel` (falls back to `sameGridPrice` out of rail). Every production call site is repointed, `isChainPriceOutOfGrid` excuses only genuine float dust at the rail edge (capped chain tolerance) instead of a whole below-rail dip-protection band, and the test-only `findPriceCollision` is deleted. Covered by `tests/test_price_collision_guard.ts`, `tests/test_sync_out_of_grid_defer.ts` and `tests/test_validate_create_target_slots.ts`.
|
|
36
|
+
|
|
37
|
+
- **Fix(order)**: harden spread correction against concurrent plan invalidation — a plan invalidated between planning and commit (a concurrent fill rebalance advanced the master version or took the destination slot) was refused fail-closed, and an out-of-spread grid cannot self-heal because it produces no fill to re-plan, so the bot stayed stale. `checkSpreadCondition` now holds the refcounted broadcast region across the whole plan/broadcast/retry loop (released in `finally`); `getOccupiedCorrectionSlots`/`resolveOccupiedCorrection` re-derive or withhold a plan whose CREATE destination was taken; a transient refusal triggers a bounded `replanSpreadCorrectionFromFreshMaster` (`TIMING.SPREAD_CORRECTION_MAX_ATTEMPTS`, default 2); `trackOutOfSpreadStaleness` tolerates transient refusals up to `TIMING.SPREAD_STALE_TRANSIENT_GRACE` before escalating to a re-center; and opt-in backlog coalescing (`fillProcessing.COALESCE_BACKLOG_REPLAY`, default off) is added. New P0 counters (`spreadCorrectionRefusedCount`, per-cause `spreadCorrectionRefusalCauses`, `spreadCorrectionRetryCount`) surface via `getMetrics()`, and the uncertain-broadcast adopt-or-defer invariant is recorded (INV-COW-010). Covered by `tests/test_spread_correction_resilience.ts` plus a settings-merge override contract.
|
|
38
|
+
|
|
39
|
+
- **Feat(credit)**: top up renewals from free collateral — a renewal previously capped the reborrow at the collateral released by the repay, so it scaled the principal down when the offer's collateral price moved even while idle collateral of the same asset was held. `useFreeCollateral` (default true, per lending item) adds the borrower's free balance of the collateral asset to the renewal budget, bounded by the position's `assignedCollateralBudget`; the accept builder treats an explicit collateral amount as a floor and tops it up to what the borrow requires while the borrow stays clamped to the budget. Deferred reborrows re-read the live free balance and position budget per retry, and the free-balance read is skipped when the released collateral already backs the reborrow. `useFreeCollateral: false` opts back into the released-only ceiling. Behavioral caveat: a renewal can now lock idle collateral, including an asset also used by the grid. Covered by new credit-runtime stages for top-up, opt-out, budget cap, switch-flow and replay refresh.
|
|
40
|
+
|
|
41
|
+
- **Feat(credit)**: report Avar. CR per borrowed credit — the single Avar. CR line value-weighted every priced deal together, so unrelated debt assets (e.g. a BTS borrow and an MPA borrow) were blended into one figure that matched neither obligation. Priced support rows are now grouped by debt asset with one value-weighted average per group, ordered by borrowed amount (largest exposure first); collateral legs within a borrowed credit still join on one line. The unused global `avgCr` is dropped (the blank-line guard simplifies to `supportedRows.length > 0`). Display-only change to `scripts/analyze-credit.ts`.
|
|
42
|
+
|
|
43
|
+
- **Fix(config)**: exclude legacy order-key aliases from the draft seed — pre-rename `activeOrders`/`reserveOrders` keys survive in `DEFAULT_CONFIG` of settings files written before the `coreOrders`/`edgeOrders` rename, and `mergeSettings` propagates them into the loaded defaults, failing the parity guard on an unclassified key. Both aliases are added to `DRAFT_EXCLUDED_KEYS` while `migrateLegacyOrderKeys` still migrates them away, so older files pass without hiding genuinely new keys.
|
|
44
|
+
|
|
45
|
+
- **Feat(cli)**: add a per-asset rich list (`dexbot rich`) — a read-only utility printing top holders of one or more assets via the chain `asset_api` (`get_asset_holders`), exposed as `dexbot rich <asset...> [--top N] [--json|--csv]` with a `richlist` npm script. It connects only to nodes that expose `asset_api` to anonymous logins, clamps `--top` to the node's advertised `api_limit_get_asset_holders`, and retries unresolved legacy `bit*` MPA names with the prefix stripped. Source-checkout-only and intentionally not advertised in the root README.
|
|
46
|
+
|
|
47
|
+
- **Fix(scripts)**: make the pool-history diagnostic fail fast and exit cleanly — `--pool` is validated against the `1.19.N` object-ID shape up front (clear message, exit 1) instead of issuing doomed RPCs that surfaced an opaque remote `uint64_t` parse error; the two invalid account-history tests are replaced by a real `get_liquidity_pool_history_by_sequence` pagination test; and `process.exit(0)` after disconnect stops the native transport's reconnect timers from hanging the script.
|
|
48
|
+
|
|
49
|
+
- **Feat(ui)**: TradingView exporter fixes and a live data-age badge — restore the accidentally dropped `1h` timeframe (aggregation stays keyed by seconds, so the `seconds >= baseIntervalSeconds` guard disables it on coarser bases); resolve the default timeframe from `payload.defaultTimeframe` in the page script (the generation-time identifier threw `ReferenceError` and drew nothing); sort candles by bucket time once at the entry point (three consumers assume ascending order) with a warn on an actual reorder; drop the noisy `· volume · uPlot` subtitle tail; and embed the newest-candle freshness anchor plus `intervalSeconds` so a readout beside the title recomputes the age every minute, fully offline (green under 24h, amber 1-7 days, red over a week). Also brighten the dynamic-weight research-panel labels and add a 16-knob factory reset button that reuses `applyParams()`.
|
|
50
|
+
|
|
51
|
+
- **Fix(bot)**: return to the Actions menu after saving a new bot — the New bot flow looped back into `promptBotData` after a successful save, immediately opening another blank Bot Editor that read as a duplicate window and hid the fact the previous bot was saved. Only the success path changes; Cancel/Esc and invalid-input paths already exited the loop.
|
|
52
|
+
|
|
53
|
+
- **Fix(order)**: treat empty-string boundary/gap as unknown geometry in the last `''`-blind guards — the earlier null/`''` hardening missed three sibling guards, so a `''` boundary could pass as finite boundary 0. `sync_engine.ts` orphan adoption now defers with `boundary-unknown-deferred`, `order.ts consumePendingFillCrawls` drops owed crawls with `null-boundary`, `validate.ts optimizeRebalanceActions` yields NaN instead of stamping a bogus boundary-0 gap-evacuation bypass, and `math.ts getSellStartIdx`/`resolveGapSlots` move the absent-aware contract into the shared helper (a genuine boundary 0 is preserved). Defense-in-depth on currently unreachable paths; covered by EVAC-021/023 and PEND-007b.
|
|
54
|
+
|
|
55
|
+
- **Perf(tests)**: cut suite wall time ~4x with a parallel runner and deterministic waits — `run-tests.ts` defaults to `min(cores, 4)` parallel files (`DEXBOT_TEST_CONCURRENCY=1` restores sequential) and preloads the ESM loader hooks for `esmMockEntry`-only and single-stage files so they no longer re-exec a second node process; fixed sleeps/busy-loops become condition-driven waits across the COW, native-subscription, fill-lifecycle, account-totals, bot-supervisor and position-manager suites; and two test-only seams default to the existing production values. A follow-up consolidates shared-mock stages into grouped units and trims the heaviest deterministic sweeps (Huber scratch-array reuse verified bit-identical, coarser entropy stride, shorter tracker prefix-parity series). Production numeric output is unchanged: 313 passed / 0 failed / 14 skipped live in ~11.4s (from ~45s sequential).
|
|
56
|
+
|
|
57
|
+
- **Chore**: replace live bot/account identifiers with placeholders in source comments, test fixtures and CHANGELOG entries (`<bot>`, `<account-name>`, synthetic `1.2.12345`, `BITSHARES_TEST_ACCOUNT*` env overrides) so no live identifier ships. Comment/string-only.
|
|
58
|
+
|
|
59
|
+
- **Docs**: highlight collapsible `<details>` summaries with `<mark>` across the sub-READMEs; add the §9 order-engine retrospective addendum for the v1.6.4→v1.6.14 arc (uncertain-broadcast and suspended-persistence deferral, fail-closed unknown geometry, pre-broadcast UPDATE-target guard) with the commit ledger and four new invariants; and record the spread-correction resilience contract across `architecture.md`, `LOGGING.md`, `COW_INVARIANTS.md` (INV-COW-010), the developer guide, `modules/README.md` and `tests/README.md`.
|
|
60
|
+
|
|
5
61
|
## [1.6.14] - 2026-10-12 - Spread-Correction Last-Fill Guard & Live Market Floor, Committed-Size Drift Resize, COW Pre-Broadcast Guards & P2 Counters, Fail-Closed Unknown Geometry, Order-Key Rename
|
|
6
62
|
|
|
7
63
|
### 2026-10-12
|
|
@@ -635,7 +691,7 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
635
691
|
- **Chore(browser-boundary)**: align the browser-safe surface with reality — `package.json` browser-map exclusions added for `modules/runtime_settings.js`, all five Node-bound `bitshares-native` entry files (`transport`, `signing_client`, `subscriptions`, `tx/builder`, `tx/tx_cache`) and `market_adapter/utils/chain.js` (top-level `createRequire(import.meta.url)`); AGENTS.md Node-only list extended with the same files so convention docs match the bundler config (`package.json`, `AGENTS.md`).
|
|
636
692
|
- **Refactor(dead-code)**: remove unreferenced symbols surfaced by the audit — `constants.ts` prunes the ECC mirror block, unused timing/network constants (`SUBSCRIPTION_SILENT_THRESHOLD_MS`, `STARTUP_CONNECT_TIMEOUT_MS`, `MAX_TRANSACTION_SIZE`, `MAX_TIME_UNTIL_EXPIRATION`, `PERCENT_1`) and the supervisor `MAX_MEMORY_MB` fallback, and aligns OBJECT_TYPES with the BitShares enum (`CUSTOM_AUTHORITY` 17 … `CREDIT_DEAL` 22) adding the credit-offer/deal object types used by credit flows; `cr_planner.ts` drops the legacy CR-formula exports (`planCrAdjustment`, collateral/debt target helpers) while keeping `calculateCollateralRatio` internal; `credit_runtime.ts` removes the test-only `openCreditPosition`/`getCollateralOffsets` wrappers (renewOnly coverage retargeted to `buildCreditOfferAcceptOperation`); `key_store.ts` removes the unused `DirectKeyStore`; `crypto/index.ts` drops dead pure-primitive re-exports; `dexbot_fill_runtime.ts` collapses tautological FILL_PROCESSING.MODE comparisons (history processing unconditional, open-orders fallback gated solely on `requiresOpenOrdersSync`); `bots_file_lock.ts` fixes the writeJsonFileAtomic doc drift (`modules/constants.ts`, `modules/cr_planner.ts`, `modules/credit_runtime.ts`, `modules/key_store.ts`, `modules/crypto/index.ts`, `modules/dexbot_fill_runtime.ts`, `modules/bots_file_lock.ts`).
|
|
637
693
|
- **Test**: add regression coverage for the trickier audit fixes — `test_to_finite_number_null.ts` locks the nullable-read semantics, `test_credential_policy_layer_merge.ts` covers per-op allowedOps merging plus `__proto__` rejection, settings-merge tests cover EXPERT GRID_COMPARISON preservation and scalar-override immunity plus deep-merge `__proto__` pollution rejection at nested levels, and the fill-batch suite asserts a deferred fill restores the exact pre-call `_fillBatchInFlight` count so concurrent batches cannot zero each other's guard; fixtures updated for the removed `getSizingContext` wrapper and the signal-based abort path (`tests/test_to_finite_number_null.ts`, `tests/test_credential_policy_layer_merge.ts`, `tests/test_settings_merge.ts`, `tests/test_sync_fill_history_batch.ts`, `tests/*`).
|
|
638
|
-
- **Tune**: raise the AMA slope ceiling default 0.085 → 0.09 and narrow the research slider floor 0.04 → 0.06 — de-sensitizes the AMA trend channel by ~5.6% (factor 0.85/0.9) so grid range-scaling asymmetry, grid price offset, and buy/sell weight tilt react proportionally weaker to the same slope magnitude; applied asymmetry at the current
|
|
694
|
+
- **Tune**: raise the AMA slope ceiling default 0.085 → 0.09 and narrow the research slider floor 0.04 → 0.06 — de-sensitizes the AMA trend channel by ~5.6% (factor 0.85/0.9) so grid range-scaling asymmetry, grid price offset, and buy/sell weight tilt react proportionally weaker to the same slope magnitude; applied asymmetry at the current <market-pair> slope drops ~21.25% → ~20.1% and the AMA-slope grid-reset trigger threshold rises 0.0068 → 0.0072 %/bar; behavior unchanged at |slopePct| ≥ 0.09 (identical saturation cap), research chart paste payloads with amaS% in [0.04, 0.06) clamp up to 0.06 (`modules/constants.ts`, `analysis/trend_detection/dynamic_weight_chart_generator.ts`, `analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md`).
|
|
639
695
|
- **Fix(market-adapter)**: harden locking, signal math, and input tools from a full module review — Hurst buffer cap window+2 → window+1 so the newest candle is always included with shared `classifyHurst()` and a `HURST_STRENGTH_NORMALIZER` strength scale; ATR re-warms per chain segment so a bad candle no longer leaks pre-break values across the gap; dynamic-weight/slope dead-band boundaries inclusive on both sides with exact-zero slopes staying NEUTRAL at the default `neutralZonePct` of 0; permutation entropy validates m/delay/window against `PE_ANALYZER_LIMITS` at construction instead of running degenerate configs silently; Kalman filter defaults unified through a single `_initState()` with beams returned as a copy and null-safe displacement; a malformed custom regimeTable throws at construction instead of producing silent NaN multipliers. File locks gain an ownership token (fresh UUID per holder written into every payload; release only unlinks when the token still matches) so a stolen lock can no longer be deleted by its previous holder, including pid collisions across containers sharing a mounted volume — legacy token-less payloads stay releasable; partial acquisitions clean up their orphaned lock file instead of locking out later contenders, heartbeat derives as clamp(staleMs/2, 1s..30s) so it always fires inside the staleness window, and the holder heuristic recognizes dexbot-embedded adapters while anchoring entrypoint names to argv/path boundaries so unrelated scripts such as robot.js no longer match. Service wiring clamps clipPercentile to (0,100] at the read point, normalizes volatility exponent/scaleX to their effective ranges at the single configured point, derives amaSlopeGated/amaChannelContribution diagnostics from the canonical Kalman-disabled weight series so diagnostics agree with finalOffset whenever gating is active, records `triggerSuppressedReason=stale_candle_data` for stale-but-new cycles, and config normalizers treat null/empty as unset before `Number()` coercion so explicit JSON null no longer means "disabled". Input tools: fetch_lp_data completes the interval map (30m..7d) with loud validation instead of parsing "30m" as 30 seconds, adds linear retry backoff and honest range labels in --start/--end mode; fetch_cex_synthetic_data fixes the dead HTX endpoint (/market/history/kline), honors exchange page caps via `CEX_PAGE_LIMIT_CAPS`, corrects MEXC intervals (6h/12h/1W), rejects zero-price leg candles, and handles --help before bot resolution. Constants: new keys centralized (`FILE_LOCK_HEARTBEAT_MIN/MAX_MS`, `LP_FETCH_RETRY_BACKOFF_BASE_MS`, `CEX_PAGE_LIMIT_CAPS`, `PE_ANALYZER_LIMITS`, `HURST_STRENGTH_NORMALIZER`, `DYNAMIC_WEIGHT_KALMAN_WARMUP_BARS_DEFAULT`, `DYNAMIC_WEIGHT_KALMAN_BEAM_COUNT_DEFAULT`, `DYNAMIC_WEIGHT_VOLATILITY_EXPONENT/SCALE_X_MIN/MAX`), sourceRetries default 3 → 4; misc: kibana_client releases redirect bodies, data_discovery skips unreadable entries and dangling symlinks, asymmetric_bounds/collateral_manager share previously duplicated math, analysis/bot_key_utils delegates to the production createBotKey so unnamed bots resolve identical keys, vestigial exports removed, and 'use strict' hoisted above imports across ~90 files where it sat as a no-op (`market_adapter/**`, `modules/constants.ts`, `analysis/bot_key_utils.ts`).
|
|
640
696
|
|
|
641
697
|
### 2026-08-25
|
|
@@ -691,7 +747,7 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
691
747
|
|
|
692
748
|
- **Feat(cow)**: enforce a per-broadcast operation cap — a single COW rebalance can expand one fill batch into many more order operations (4 fills → 12 creates + 4 updates = 16 ops), so `FILL_PROCESSING.MAX_FILL_BATCH_SIZE` is a weak proxy for on-chain transaction size. `COW_PERFORMANCE.MAX_OPS_PER_BROADCAST` (default 4) now caps operations per broadcast; oversized batches are split into sequential transactions via `executeChunkedWithRetryOnUncertain`, restoring the original "N fills per broadcast" intent at the op level. An uncertain chunk failure continues broadcasting the remaining chunks (no order dropped); a definitively rejected chunk aborts the rest; the first failure is rethrown enriched with `partialOnChainState`, `chunksTotal`/`chunksFailed`/`chunksAborted`, and `broadcastedOperationCount`. Configurable via the runtime settings override chain (`runtimeCowPerformance`/`marketCowPerformance`/`botCowPerformance`). Covered by the new 463-line `test_cow_ops_per_broadcast.ts` (`modules/dexbot_cow_runtime.ts`, `modules/constants.ts`, `modules/dexbot_class.ts`, `modules/runtime_settings.ts`).
|
|
693
749
|
- **Fix(grid)**: exclude gap-band strays from divergence desired-window selection — a fund-driven boundary shift during `applyGridDivergenceCorrections` re-types the working grid, but the SPREAD GUARD keeps live on-chain orders inside the new spread band typed BUY/SELL, so the Phase-2 window selected "closest to market" slots purely by stored type+price and a stray SELL inside the new gap looked like the bottom of the sell rail and was never relocated, collapsing the real spread (boundary 107→110 left sells at 111–113 inside the new gap, real spread 0.5% vs the 2.0% target). New shared `MathUtils.isSlotInRail` (pure geometric rail-membership test) now filters desired-window candidates using the working boundary; the strategy window and virtual-slot selection delegate to the same helper, and gap-band strays become surplus → cancelled and relocated back onto the rail (`modules/order/utils/math.ts`, `modules/order/utils/system.ts`, `modules/order/strategy.ts`, `modules/order/grid_reconcile_internal.ts`, `tests/test_is_slot_in_rail.ts`, `tests/test_cow_divergence_correction.ts`, `tests/test_lp_chart.ts`).
|
|
694
|
-
- **Tune**: lower the AMA slope grid-reset threshold from 10 to 8 — the AMA slope delta trigger resets the grid when the slope swing exceeds (`AMA_SLOPE_DELTA_THRESHOLD_PERCENT`/100) × maxSlopePct. At 10 the
|
|
750
|
+
- **Tune**: lower the AMA slope grid-reset threshold from 10 to 8 — the AMA slope delta trigger resets the grid when the slope swing exceeds (`AMA_SLOPE_DELTA_THRESHOLD_PERCENT`/100) × maxSlopePct. At 10 the <market-pair> trend reversal (DOWN baseline → UP current, delta 0.0074%/bar) stayed below the 0.0085 threshold, leaving the grid scaled for the wrong direction. Lowering to 8 (threshold 0.0068%/bar) reacts to the reversal while still ignoring small slope noise (`modules/constants.ts`).
|
|
695
751
|
- **Feat(ui)**: green/red relative-scaling feedback for price inputs — the bot editor's Price Range displayed min/max as plain white, hiding whether relative scaling (x multipliers) is active. Range values now render green for "1.55x" multipliers and red for fixed prices, and `readInput` gains a colorize option so the typed input switches red → green live the moment the "x" is entered (`modules/account_bots.ts`, `modules/order/utils/system.ts`).
|
|
696
752
|
- **Fix(ui)**: clarify the GridPrice label in the bot editor — the Price section displayed the gridPrice reference as bare "Grid:", which was ambiguous next to "Start:"/"Pool:" and collided with the section "4) Grid". Renamed to "GridPrice:" (one word, matching the `gridPrice` config field name) to reflect the values it accepts (pool/book/ama/number/none) (`modules/account_bots.ts`).
|
|
697
753
|
- **Docs**: add an end-to-end lifecycle walkthrough — new `docs/LIFECYCLE.md` consolidates the startup, fill-driven (reactive), and maintenance/AMA-driven (periodic) flows into one newcomer-facing map with mermaid system-context and sequence diagrams (fill → `_incomingFillQueue` → `processFilledOrders` → Accounting SSOT → WorkingGrid COW → single atomic broadcast → persist; `_performPeriodicGridChecks` → `performPeriodicGridChecks` → `runGridMaintenance` → `executeMaintenanceLogic`), plus a cross-cutting invariants table and file map. Surfaced as the first read from README and the docs index, and added to the npm `files` array (`docs/LIFECYCLE.md`, `docs/developer_guide.md`, `docs/README.md`, `README.md`, `package.json`).
|
|
@@ -785,7 +841,7 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
785
841
|
|
|
786
842
|
### 2026-08-14
|
|
787
843
|
|
|
788
|
-
- **Feat**: add an optional bot filter to `dexbot order` — pass a bot key as a positional argument (e.g. `dexbot order
|
|
844
|
+
- **Feat**: add an optional bot filter to `dexbot order` — pass a bot key as a positional argument (e.g. `dexbot order <botKey>`) to render only that bot's persisted grid, optionally combined with `--export` for a single-bot HTML report; matching accepts the raw key, its sanitized form, or the configured name; a missing key lists available bots and suppresses skipped-candidate noise (`scripts/analyze-orders.ts`, `dexbot.ts`, `README.md`, `docs/WORKFLOW.md`).
|
|
789
845
|
|
|
790
846
|
### 2026-08-13
|
|
791
847
|
|
|
@@ -1341,7 +1397,7 @@ The `fix(version-notice)` work committed after the 1.6.8 tag (real verdict from
|
|
|
1341
1397
|
- **Fix**: process queued price corrections on startup and in maintenance loop — corrections queued by syncFromOpenOrders (via ordersNeedingPriceCorrection) were only processed inside _consumeFillQueue, which only runs when new fills arrive. For an idle market where sync detects a price mismatch during startup, the correction sat in the queue indefinitely, stalling the pipeline. Now processed immediately after startup sync and at the start of every maintenance cycle (`modules/dexbot_class.ts:1339`, `modules/dexbot_maintenance_runtime.ts:1399`).
|
|
1342
1398
|
- **Fix**: protect committed orders from recovery sync virtualization — during UNCERTAIN broadcast and fund-invariant recovery, the full two-pass syncFromOpenOrders could virtualize orders that were correctly placed by prior successful COW commits when the chain snapshot lags behind confirmed transactions. New `_committedOrderIds` set tracked across COW commit boundaries; PASS 1 virtualization guard skips any orderId in the set (`modules/order/manager.ts`, `modules/order/sync_engine.ts`, `modules/dexbot_class.ts`, `modules/order/accounting.ts`).
|
|
1343
1399
|
- **Fix**: cancel residual ghost orders left on chain by other-side rounding — when a fill leaves a tiny residual where opposite-asset value rounds to 0 at blockchain precision, the grid slot was virtualized but the chain order was never cancelled. New `ghostOrderId` return field drains orphan cancellations via a per-session guarded set to avoid repeat attempts (`modules/dexbot_class.ts`, `modules/order/sync_engine.ts`, `tests/test_ghost_order_fix.ts`).
|
|
1344
|
-
- **Fix**: remove hardcoded
|
|
1400
|
+
- **Fix**: remove hardcoded <market-pair> defaults from analysis scripts and docs — all 6 analysis scripts now require `--bot-key` explicitly at runtime; documentation uses `EXAMPLE-BOT` placeholders instead of `<market-pair>` (`analysis/analyze_dynamic_weight.ts`, `analysis/analyze_volatility.ts`, `analysis/analyze_kalman.ts`, `analysis/analyze_regime.ts`, `analysis/analyze_regime_windows.ts`, `analysis/analyze_derivatives.ts`, `docs/*.md`, `market_adapter/README.md`).
|
|
1345
1401
|
- **Feat**: centralize AMA config resolution in bot_key_utils for analysis tools — shared `loadBotMeta`, `resolveAmaConfig` (inline > profile > built-in with preset merge, erSmoothPeriod on all paths, fast/slow swap guard), and `resolveAmaKey` extracted from individual scripts. Dynamic chart legend now shows the resolved AMA label (AMA1/AMA2/AMA3/AMA4) instead of hardcoded AMA3 (`analysis/bot_key_utils.ts`, `analysis/analyze_dynamic_weight.ts`, `analysis/analyze_tradingview.ts`, `analysis/trend_detection/dynamic_weight_chart_generator.ts`).
|
|
1346
1402
|
|
|
1347
1403
|
## [1.1.11] - 2026-07-18 - npm publish, README install options, CLI dist resolution, .npmrc ignore
|
package/README.md
CHANGED
|
@@ -314,14 +314,14 @@ Defaults in [`modules/constants.ts`](modules/constants.ts) are overridable at gl
|
|
|
314
314
|
|
|
315
315
|
## 🎯 Zero-Dependency Process Management
|
|
316
316
|
|
|
317
|
-
`dexbot start` is the recommended production runtime (global install). Repo-root users can run `./unlock` instead. It runs the selected bot set as one monolithic bot process, with the credential daemon and market adapter in separate helper processes. Monolithic start/stop/reload/restart controls apply to the whole runtime, not to individual bots.
|
|
317
|
+
`dexbot start` is the recommended production runtime (global install). Repo-root users can run `./unlock` instead. It runs the selected bot set as one monolithic bot process, with the credential daemon and market adapter in separate helper processes. Monolithic start/stop/reload/restart controls apply to the whole runtime, not to individual bots: a bot argument (e.g. `dexbot reload <bot>`) is validated and then folds into the whole-runtime action with a notice. Per-bot control needs `--isolated` (one supervisor process per bot, then `stop`/`reload`/`restart <bot>` acts on just that bot). `delete` and `status` are whole-runtime only. `dexbot help` detects which runtime is up (monolithic, isolated, or PM2) and lists the controls for that mode.
|
|
318
318
|
|
|
319
319
|
```bash
|
|
320
320
|
dexbot start/stop # Stop/start the monolithic runtime
|
|
321
321
|
dexbot start --dryrun # Dry-run (no transactions broadcast)
|
|
322
|
-
dexbot reload
|
|
323
|
-
dexbot restart
|
|
324
|
-
dexbot delete # Shut down and clean up
|
|
322
|
+
dexbot reload [<bot>] # Reload (monolithic: whole runtime; isolated: one bot)
|
|
323
|
+
dexbot restart [<bot>] # Restart (re-unlocks credential daemon)
|
|
324
|
+
dexbot delete # Shut down and clean up (whole runtime)
|
|
325
325
|
```
|
|
326
326
|
|
|
327
327
|
First-run details and common mistakes are covered in the [BitShares Onboarding Tutorial](docs/BITSHARES_ONBOARDING.md).
|
package/analysis/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Tools that inspect DEXBot trading behavior and the market data it operates on. O
|
|
|
39
39
|
|
|
40
40
|
Common abbreviations used throughout: OHLC, AMA, ER, ATR, Kalman, Hurst, PE, R, LIFO, FIFO, PnL, SMA, VWMA. Full definitions below.
|
|
41
41
|
|
|
42
|
-
<details><summary>Abbreviation glossary (click to expand)</summary>
|
|
42
|
+
<details><summary><mark>Abbreviation glossary (click to expand)</mark></summary>
|
|
43
43
|
|
|
44
44
|
| Term | Full name | Plain English |
|
|
45
45
|
|------|-----------|---------------|
|
|
@@ -163,7 +163,7 @@ node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
|
163
163
|
--hours 168 --match-mode fifo
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
<details><summary>Options (click to expand)</summary>
|
|
166
|
+
<details><summary><mark>Options (click to expand)</mark></summary>
|
|
167
167
|
|
|
168
168
|
| Flag | Default | Description |
|
|
169
169
|
|------|---------|-------------|
|
|
@@ -208,7 +208,7 @@ node dist/analysis/trade_profitability.js 1.2.123456 \
|
|
|
208
208
|
|
|
209
209
|
**Metrics glossary** — `R` = the size of the average losing trade. A +3R trade earned 3× what a typical loser costs you.
|
|
210
210
|
|
|
211
|
-
<details><summary>Per-metric definitions (click to expand)</summary>
|
|
211
|
+
<details><summary><mark>Per-metric definitions (click to expand)</mark></summary>
|
|
212
212
|
|
|
213
213
|
| Output line | Meaning |
|
|
214
214
|
|-------------|---------|
|
|
@@ -278,7 +278,7 @@ npm run analysis:grid-check -- --bot-key <bot-key> --hours 168 --increment 0.5
|
|
|
278
278
|
|
|
279
279
|
Exit code `0` = pass, `2` = violations found, `1` = fatal error. Bot keys resolve via `profiles/bots.json` (`--list-bots` to enumerate); the account defaults to the bot's stored `accountId` when present (no chain lookup — the ID is auto-saved next to `preferredAccount` after the first successful name resolution, re-verified with `--refresh-account`), otherwise `preferredAccount` is resolved on-chain, and can be overridden with `--account <1.2.x|name>`.
|
|
280
280
|
|
|
281
|
-
<details><summary>Options (click to expand)</summary>
|
|
281
|
+
<details><summary><mark>Options (click to expand)</mark></summary>
|
|
282
282
|
|
|
283
283
|
| Flag | Default | Description |
|
|
284
284
|
|------|---------|-------------|
|
|
@@ -319,7 +319,7 @@ node dist/analysis/analyze_trade_heatmap.js \
|
|
|
319
319
|
--slice-months 6
|
|
320
320
|
```
|
|
321
321
|
|
|
322
|
-
<details><summary>Options (click to expand)</summary>
|
|
322
|
+
<details><summary><mark>Options (click to expand)</mark></summary>
|
|
323
323
|
|
|
324
324
|
| Flag | Default | Description |
|
|
325
325
|
|------|---------|-------------|
|
|
@@ -429,7 +429,7 @@ Shared analyzers and chart renderers for the dynamic-weight signal path. Core en
|
|
|
429
429
|
- [README.md](trend_detection/README.md) — directory overview and module index
|
|
430
430
|
- [DYNAMIC_WEIGHT_RESEARCH.md](trend_detection/DYNAMIC_WEIGHT_RESEARCH.md) — AMA+Kalman blend with Hurst/PE regime gating, formula reference, knob guide
|
|
431
431
|
|
|
432
|
-
<details><summary>Modules (click to expand)</summary>
|
|
432
|
+
<details><summary><mark>Modules (click to expand)</mark></summary>
|
|
433
433
|
|
|
434
434
|
| Module | Purpose |
|
|
435
435
|
|--------|---------|
|
|
@@ -34,7 +34,7 @@ The sections below cover manual usage (explicit candle files, direct runner flag
|
|
|
34
34
|
## What It Produces
|
|
35
35
|
|
|
36
36
|
- Log-scale price chart
|
|
37
|
-
- Candle timeframe buttons: `1h`, `4h`, `1d`, `1w`
|
|
37
|
+
- Candle timeframe buttons: `1h`, `4h`, `1d`, `1w`, `1M`
|
|
38
38
|
- Pair-orientation switcher for `A/B` and `B/A`
|
|
39
39
|
- SMA overlay
|
|
40
40
|
- AMA preset buttons `1–4` (one-click AMA1–4, active preset highlighted); numeric inputs kept
|
|
@@ -48,6 +48,7 @@ The sections below cover manual usage (explicit candle files, direct runner flag
|
|
|
48
48
|
- Volume badge (bottom-right of the volume chart, same small type): visible-window max volume, always with the currency suffix (`1.2M BTS`); click the badge, the legend `Vol` value, or the toolbar unit button to switch base/quote units (quote ≈ base × close, persisted per chart like the AMA settings; feed charts show publish counts and disable the switch)
|
|
49
49
|
- Bottom volume panel with `Volume` toggle and per-bar hover tooltip
|
|
50
50
|
- Crosshair legend with current candle values
|
|
51
|
+
- Live data-age badge next to the title: the age of the newest candle is recomputed every minute in the browser (minutes under an hour, hours and minutes under a day, days and hours beyond), so a chart saved or opened later shows its own staleness — green under 24h, amber 1–7 days, red over a week (unknown when the source carries no candle time or `meta.updatedAt`)
|
|
51
52
|
|
|
52
53
|
## Quick Start
|
|
53
54
|
|
package/claw/README.md
CHANGED
|
@@ -43,7 +43,7 @@ npm install
|
|
|
43
43
|
|
|
44
44
|
## Files
|
|
45
45
|
|
|
46
|
-
<details><summary>Module and file map (click to expand)</summary>
|
|
46
|
+
<details><summary><mark>Module and file map (click to expand)</mark></summary>
|
|
47
47
|
|
|
48
48
|
- Core BitShares runtime: `modules/bitshares_client.ts`, `modules/chain_queries.ts`, `modules/chain_broadcast.ts`, `modules/chain_actions.ts`
|
|
49
49
|
- Strategy and state helpers: `modules/short_mpa_strategy.ts`, `modules/position_manager.ts`, `modules/position_manager_watch.ts`
|
|
@@ -188,7 +188,7 @@ Shared boundary notes live in `skills/shared/references/skill-boundaries.md`.
|
|
|
188
188
|
| NullClaw | `SKILL.toml` skill manifest plus MCP server config | Zig-native workspace assistant with manifest loading | Strong fit for local workspace loading, but more dependent on NullClaw-specific config conventions |
|
|
189
189
|
| memU | Subprocess bridge plus MCP server | Proactive memory and intent capture for AI agents | Python-based memory framework with LLM-powered extraction and vector search |
|
|
190
190
|
|
|
191
|
-
<details><summary>Quick selection rule of thumb (click to expand)</summary>
|
|
191
|
+
<details><summary><mark>Quick selection rule of thumb (click to expand)</mark></summary>
|
|
192
192
|
|
|
193
193
|
- Choose **OpenClaw** for the broadest assistant platform.
|
|
194
194
|
- Choose **Hermes** if you want a general-purpose assistant with memory, messaging, cron, and browser tooling that can also trade through Claw.
|
|
@@ -271,7 +271,7 @@ npm run openfang:skill -- --repo-root "$CLAW_ROOT" --profile-root "$DEXBOT_ROOT"
|
|
|
271
271
|
|
|
272
272
|
OpenFang uses the same shared bridge surface through a local CLI wrapper.
|
|
273
273
|
|
|
274
|
-
<details><summary>Compatibility command surface (click to expand)</summary>
|
|
274
|
+
<details><summary><mark>Compatibility command surface (click to expand)</mark></summary>
|
|
275
275
|
|
|
276
276
|
```bash
|
|
277
277
|
npm run openfang:bridge -- manifest
|
|
@@ -338,7 +338,7 @@ npm run nanoclaw:skill -- --repo-root "$CLAW_ROOT" --profile-root "$DEXBOT_ROOT"
|
|
|
338
338
|
|
|
339
339
|
NanoClaw already ships its own `claw` skill, so keep this bridge skill named `bitshares-claw`.
|
|
340
340
|
|
|
341
|
-
<details><summary>Compatibility command surface (click to expand)</summary>
|
|
341
|
+
<details><summary><mark>Compatibility command surface (click to expand)</mark></summary>
|
|
342
342
|
|
|
343
343
|
```bash
|
|
344
344
|
npm run nanoclaw:bridge -- manifest
|
|
@@ -359,7 +359,7 @@ DEXBOT_ROOT="$(cd .. && pwd)"
|
|
|
359
359
|
npm run zeroclaw:skill -- --repo-root "$CLAW_ROOT" --profile-root "$DEXBOT_ROOT" --output ~/.zeroclaw/workspace/skills/ai-bots/SKILL.toml
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
-
<details><summary>Compatibility command surface (click to expand)</summary>
|
|
362
|
+
<details><summary><mark>Compatibility command surface (click to expand)</mark></summary>
|
|
363
363
|
|
|
364
364
|
```bash
|
|
365
365
|
npm run zeroclaw:bridge -- manifest
|
|
@@ -383,7 +383,7 @@ DEXBOT_ROOT="$(cd .. && pwd)"
|
|
|
383
383
|
npm run nullclaw:skill -- --repo-root "$CLAW_ROOT" --profile-root "$DEXBOT_ROOT" --output ~/.nullclaw/workspace/skills/bitshares-claw/SKILL.toml
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
-
<details><summary>Compatibility command surface (click to expand)</summary>
|
|
386
|
+
<details><summary><mark>Compatibility command surface (click to expand)</mark></summary>
|
|
387
387
|
|
|
388
388
|
```bash
|
|
389
389
|
npm run nullclaw:bridge -- manifest
|
|
@@ -435,7 +435,7 @@ mcp_servers:
|
|
|
435
435
|
args: ["/absolute/path/to/DEXBot2/dist/claw/scripts/memu_mcp_server.js", "--memu-dir", "/absolute/path/to/claw/data/memu"]
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
<details><summary>Compatibility command surface (click to expand)</summary>
|
|
438
|
+
<details><summary><mark>Compatibility command surface (click to expand)</mark></summary>
|
|
439
439
|
|
|
440
440
|
```bash
|
|
441
441
|
# Via claw bridge
|
|
@@ -70,7 +70,8 @@ This is the empty gap between the best buy and best sell rails.
|
|
|
70
70
|
|
|
71
71
|
This controls how size is distributed across the ladder.
|
|
72
72
|
|
|
73
|
-
- `0.5` is the neutral baseline
|
|
73
|
+
- `0.5` is the neutral baseline; `1.0` is the shipped default (mountain)
|
|
74
|
+
- the scale runs from `-1` (super-valley) to `2` (super-mountain)
|
|
74
75
|
- values above `0.5` concentrate more size near the market-adjacent orders
|
|
75
76
|
- values below `0.5` flatten the ladder
|
|
76
77
|
|
|
@@ -211,7 +212,7 @@ For a conservative starting point:
|
|
|
211
212
|
- `incrementPercent: 0.5`
|
|
212
213
|
- `targetSpreadPercent: 2.0`
|
|
213
214
|
- `coreOrders: 20 / 20`
|
|
214
|
-
- `weightDistribution: 0.5 / 0.5`
|
|
215
|
+
- `weightDistribution: 1.0 / 1.0` — the shipped default (mountain); flatten toward `0.5 / 0.5` only if you deliberately want a flatter ladder
|
|
215
216
|
- `minPrice` and `maxPrice`: as narrow as the expected drift allows, not blindly `3x`
|
|
216
217
|
|
|
217
218
|
For a more competitive market:
|
|
@@ -41,9 +41,9 @@ async function getDynamicGlobalProperties() {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
async function getAsset(symbolOrId: any) {
|
|
44
|
-
// Symbols arrive from a user-supplied `pair: "BASE/QUOTE"` option;
|
|
45
|
-
//
|
|
46
|
-
//
|
|
44
|
+
// Symbols arrive from a user-supplied `pair: "BASE/QUOTE"` option; the chain
|
|
45
|
+
// lookup is case-sensitive, so canonicalize before the id test and both
|
|
46
|
+
// lookup paths.
|
|
47
47
|
const ref = normalizeAssetRef(symbolOrId);
|
|
48
48
|
if (/^1\.3\.\d+$/.test(ref)) {
|
|
49
49
|
const assets = await dbCall('get_assets', [[ref]]);
|
package/claw/package.json
CHANGED
|
@@ -26,6 +26,7 @@ import { MARKET_ADAPTER } from '../../modules/constants.js';
|
|
|
26
26
|
import { getErrorMessage } from '../../modules/utils/errors.js';
|
|
27
27
|
import { writeJsonAtomic } from '../../market_adapter/utils/atomic_write.js';
|
|
28
28
|
import { loadLpSeriesFromBasePath } from '../../market_adapter/utils/data_discovery.js';
|
|
29
|
+
import { canonicalPair, invertCandleSeries } from '../../market_adapter/utils/pair_orientation.js';
|
|
29
30
|
import { normalizePoolId } from '../../market_adapter/utils/chain.js';
|
|
30
31
|
import { fetchCandlesSequentially, outputPath, } from '../../market_adapter/inputs/fetch_lp_data.js';
|
|
31
32
|
const HOURS_3Y = 3 * 365 * 24; // 26280
|
|
@@ -180,7 +181,13 @@ async function main() {
|
|
|
180
181
|
// snapshot (same meta shape as fetch_lp_data's export). Deriving it from
|
|
181
182
|
// the assembled shards means a narrow re-run can never shrink the file.
|
|
182
183
|
const assembled = loadLpSeriesFromBasePath(outPath);
|
|
183
|
-
|
|
184
|
+
// Shards are canonical; the export is the requested orientation.
|
|
185
|
+
const assembledCandles = assembled && assembled.candles.length > 0
|
|
186
|
+
? (canonicalPair(assetA, assetB).flipped
|
|
187
|
+
? invertCandleSeries(assembled.candles, { volume: 'scale' })
|
|
188
|
+
: assembled.candles)
|
|
189
|
+
: null;
|
|
190
|
+
const exportCandles = (assembledCandles ?? candles);
|
|
184
191
|
const firstTs = new Date(exportCandles[0][0]).toISOString();
|
|
185
192
|
const lastTs = new Date(exportCandles[exportCandles.length - 1][0]).toISOString();
|
|
186
193
|
console.log(` Received: ${exportCandles.length} candles (${firstTs} → ${lastTs})`);
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
interface DataMeta {
|
|
2
|
+
intervalSeconds?: unknown;
|
|
3
|
+
pool?: unknown;
|
|
4
|
+
fetchedAt?: unknown;
|
|
5
|
+
assetA?: {
|
|
6
|
+
symbol?: unknown;
|
|
7
|
+
id?: unknown;
|
|
8
|
+
};
|
|
9
|
+
assetB?: {
|
|
10
|
+
symbol?: unknown;
|
|
11
|
+
id?: unknown;
|
|
12
|
+
};
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
interface AmaArea {
|
|
16
|
+
maxDist: number;
|
|
17
|
+
total: number;
|
|
18
|
+
above: number;
|
|
19
|
+
below: number;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface SearchEntry {
|
|
23
|
+
er: number;
|
|
24
|
+
fast: number;
|
|
25
|
+
slow: number;
|
|
26
|
+
area: AmaArea;
|
|
27
|
+
amaMovementTotal: number;
|
|
28
|
+
distanceTotal: number;
|
|
29
|
+
bandFactorPct: number;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface WeightedEntry extends SearchEntry {
|
|
33
|
+
weightedScore: number;
|
|
34
|
+
normDistance: number | null;
|
|
35
|
+
normMovement: number | null;
|
|
36
|
+
key: string;
|
|
37
|
+
label: string;
|
|
38
|
+
}
|
|
1
39
|
declare function parseArgs(argv?: string[]): {
|
|
2
40
|
dataFile: string | null;
|
|
3
41
|
er: {
|
|
@@ -31,5 +69,16 @@ declare function parseArgs(argv?: string[]): {
|
|
|
31
69
|
ama3Weight: number | null;
|
|
32
70
|
ama4Weight: number | null;
|
|
33
71
|
};
|
|
34
|
-
|
|
72
|
+
declare function updateAmaProfilesFile({ dataFile, meta, winners, sourceResultsFile }: {
|
|
73
|
+
dataFile: string | null;
|
|
74
|
+
meta: DataMeta | null;
|
|
75
|
+
winners: {
|
|
76
|
+
ama1: WeightedEntry;
|
|
77
|
+
ama2: WeightedEntry;
|
|
78
|
+
ama3: WeightedEntry;
|
|
79
|
+
ama4: WeightedEntry;
|
|
80
|
+
};
|
|
81
|
+
sourceResultsFile: string | null;
|
|
82
|
+
}): void;
|
|
83
|
+
export { parseArgs, updateAmaProfilesFile };
|
|
35
84
|
//# sourceMappingURL=optimizer_high_resolution.d.ts.map
|
|
@@ -13,6 +13,7 @@ import { range, geometricRange, percentile } from '../math_utils.js';
|
|
|
13
13
|
import { runModuleWorker, splitIntoShards } from '../worker_pool.js';
|
|
14
14
|
import { getStorage } from '../../modules/storage/index.js';
|
|
15
15
|
import { normalizeAssetSymbol } from '../../modules/utils/asset_symbols.js';
|
|
16
|
+
import { canonicalPair } from '../../market_adapter/utils/pair_orientation.js';
|
|
16
17
|
const { readJSON, writeJSON } = getStorage();
|
|
17
18
|
import { loadLpDataFile, } from '../../market_adapter/lp_chart_runner.js';
|
|
18
19
|
const AMA_PROFILES_FILE = PATHS.PROFILES.MARKET_PROFILES_JSON;
|
|
@@ -290,13 +291,22 @@ function updateAmaProfilesFile({ dataFile, meta, winners, sourceResultsFile }) {
|
|
|
290
291
|
const assetBSymbol = normalizeSymbol(meta?.assetB?.symbol);
|
|
291
292
|
const assetAId = normalizeSymbol(meta?.assetA?.id);
|
|
292
293
|
const assetBId = normalizeSymbol(meta?.assetB?.id);
|
|
293
|
-
|
|
294
|
-
|
|
294
|
+
// Canonical orientation on write, matching the candle cache: a pool fitted
|
|
295
|
+
// from either data orientation produces ONE self-consistent profile entry
|
|
296
|
+
// (`BTS|IOB.XRP|3600`, never also `IOB.XRP|BTS|3600`). The lookup-side
|
|
297
|
+
// tolerance then only has to cover pre-existing/foreign entries.
|
|
298
|
+
const hasIds = Boolean(assetAId && assetBId);
|
|
299
|
+
const order = canonicalPair({ id: hasIds ? assetAId : null, symbol: assetASymbol || assetAId }, { id: hasIds ? assetBId : null, symbol: assetBSymbol || assetBId });
|
|
300
|
+
const assetA = normalizeSymbol(order.assetA.symbol) || normalizeSymbol(order.assetA.id);
|
|
301
|
+
const assetB = normalizeSymbol(order.assetB.symbol) || normalizeSymbol(order.assetB.id);
|
|
302
|
+
const canonAId = normalizeSymbol(order.assetA.id);
|
|
303
|
+
const canonBId = normalizeSymbol(order.assetB.id);
|
|
295
304
|
if (!assetA || !assetB)
|
|
296
305
|
return;
|
|
297
306
|
const intervalSeconds = Number(meta?.intervalSeconds);
|
|
298
307
|
const intervalLabel = inferIntervalLabel(dataFile, meta);
|
|
299
|
-
const
|
|
308
|
+
const intervalKey = Number.isFinite(intervalSeconds) && intervalSeconds > 0 ? intervalSeconds : intervalLabel;
|
|
309
|
+
const key = `${assetA}|${assetB}|${intervalKey}`;
|
|
300
310
|
const payload = {
|
|
301
311
|
version: 1,
|
|
302
312
|
updatedAt: new Date().toISOString(),
|
|
@@ -316,8 +326,8 @@ function updateAmaProfilesFile({ dataFile, meta, winners, sourceResultsFile }) {
|
|
|
316
326
|
key,
|
|
317
327
|
assetA,
|
|
318
328
|
assetB,
|
|
319
|
-
assetAId:
|
|
320
|
-
assetBId:
|
|
329
|
+
assetAId: canonAId || null,
|
|
330
|
+
assetBId: canonBId || null,
|
|
321
331
|
poolId: meta?.pool || null,
|
|
322
332
|
intervalSeconds: Number.isFinite(intervalSeconds) && intervalSeconds > 0 ? intervalSeconds : null,
|
|
323
333
|
intervalLabel,
|
|
@@ -351,7 +361,23 @@ function updateAmaProfilesFile({ dataFile, meta, winners, sourceResultsFile }) {
|
|
|
351
361
|
},
|
|
352
362
|
},
|
|
353
363
|
};
|
|
354
|
-
|
|
364
|
+
// Replace on canonical key, or on the SAME pair in either orientation so a
|
|
365
|
+
// profile written before canonicalization converges to one entry instead of
|
|
366
|
+
// accumulating a duplicate.
|
|
367
|
+
const sameIntervalAs = (entry) => (Number.isFinite(intervalSeconds) && intervalSeconds > 0 && Number(entry.intervalSeconds) === intervalSeconds)
|
|
368
|
+
|| String(entry.intervalLabel || '') === intervalLabel;
|
|
369
|
+
const idx = payload.profiles.findIndex((p) => {
|
|
370
|
+
const entry = p;
|
|
371
|
+
if (!entry)
|
|
372
|
+
return false;
|
|
373
|
+
if (String(entry.key || '') === key)
|
|
374
|
+
return true;
|
|
375
|
+
if (!sameIntervalAs(entry))
|
|
376
|
+
return false;
|
|
377
|
+
const eA = String(entry.assetA || entry.assetAId || '');
|
|
378
|
+
const eB = String(entry.assetB || entry.assetBId || '');
|
|
379
|
+
return (eA === assetA && eB === assetB) || (eA === assetB && eB === assetA);
|
|
380
|
+
});
|
|
355
381
|
if (idx >= 0)
|
|
356
382
|
payload.profiles[idx] = profile;
|
|
357
383
|
else
|
|
@@ -744,5 +770,5 @@ else if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).h
|
|
|
744
770
|
process.exit(1);
|
|
745
771
|
});
|
|
746
772
|
}
|
|
747
|
-
export { parseArgs };
|
|
773
|
+
export { parseArgs, updateAmaProfilesFile };
|
|
748
774
|
//# sourceMappingURL=optimizer_high_resolution.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Spread-gap width in slots — direct port of calculateGapSlots
|
|
3
|
-
* (modules/order/utils/math.ts
|
|
3
|
+
* (modules/order/utils/math.ts). The effective target spread is clamped
|
|
4
4
|
* up to incrementPercent × MIN_SPREAD_FACTOR and the gap never drops below
|
|
5
5
|
* MIN_SPREAD_ORDERS slots. `incrementPercent`/`targetSpreadPercent` in PERCENT
|
|
6
6
|
* units, matching the production signature.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
declare function computeGapSlots(incrementPercent: number, targetSpreadPercent: number): number;
|
|
9
9
|
/**
|
|
10
10
|
* Slope-ratio grid price offset — port of computeGridPriceOffsetPlan
|
|
11
|
-
* (market_adapter/core/market_adapter_service.ts
|
|
11
|
+
* (market_adapter/core/market_adapter_service.ts) combined with the
|
|
12
12
|
* trend/slopeRatio semantics of computeAmaSlopeWeights
|
|
13
13
|
* (market_adapter/core/strategies/ama_slope_model.ts):
|
|
14
14
|
*
|
|
@@ -17,18 +17,20 @@ declare function computeGapSlots(incrementPercent: number, targetSpreadPercent:
|
|
|
17
17
|
* direction = sign(slopePct) (0 inside the neutral zone)
|
|
18
18
|
* offsetPct = direction × slopeRatio × maxGridPriceOffsetPct
|
|
19
19
|
*
|
|
20
|
-
* Production applies this to startPrice (grid.ts
|
|
21
|
-
* offset/100)) only for
|
|
20
|
+
* Production applies this to startPrice (modules/order/grid.ts,
|
|
21
|
+
* initializeGrid: startPrice × (1 + offset/100)) only for
|
|
22
|
+
* asymmetricBounds-whitelisted bots; the sim applies it
|
|
22
23
|
* to the placement center on every grid build when asymmetricBounds is on.
|
|
23
24
|
*/
|
|
24
25
|
declare function computeGridPriceOffsetPct(slopePct: number, targetSpreadPercent: number): number;
|
|
25
26
|
/**
|
|
26
27
|
* Build a persistent grid with FIXED chain prices from a master rail —
|
|
27
|
-
* port of createOrderGrid (modules/order/grid.ts
|
|
28
|
+
* port of createOrderGrid (modules/order/grid.ts):
|
|
28
29
|
*
|
|
29
30
|
* - Master rail: geometric progression starting at √(1±inc) × center and
|
|
30
31
|
* expanding by (1±inc) steps outward, bounded by
|
|
31
|
-
* [center/maxMinRatio, center×maxMinRatio] (
|
|
32
|
+
* [center/maxMinRatio, center×maxMinRatio] (rail expansion:
|
|
33
|
+
* derivePriceLevels in modules/order/utils/math.ts).
|
|
32
34
|
* - Spread gap: gapSlots empty slots centered on the center price
|
|
33
35
|
* (calculateIdealBoundary: boundaryIdx = splitIdx − floor(gap/2) − 1;
|
|
34
36
|
* sells start at boundaryIdx + gapSlots + 1).
|