dexbot 1.6.13 → 1.6.14
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 +32 -0
- package/README.md +2 -2
- package/claw/docs/AI_BOT_LIBRARY_API.md +1 -1
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
- package/claw/modules/claw_catalog.ts +8 -4
- package/claw/modules/dexbot_profiles.ts +59 -15
- package/claw/modules/types.ts +2 -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/skills/margin-trading/SKILL.md +1 -1
- package/claw/skills/margin-trading/references/position-management.md +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +25 -25
- package/dist/modules/account_bots.d.ts +7 -6
- package/dist/modules/account_bots.js +10 -10
- package/dist/modules/account_orders.d.ts +36 -4
- package/dist/modules/account_orders.js +76 -5
- package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
- package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
- package/dist/modules/bot_defaults.d.ts +16 -2
- package/dist/modules/bot_defaults.js +34 -8
- package/dist/modules/bot_settings.d.ts +4 -0
- package/dist/modules/bot_settings.js +55 -21
- package/dist/modules/config.js +6 -1
- package/dist/modules/constants.d.ts +7 -5
- package/dist/modules/constants.js +12 -5
- package/dist/modules/dexbot_class.d.ts +5 -0
- package/dist/modules/dexbot_class.js +8 -3
- package/dist/modules/dexbot_cow_runtime.d.ts +62 -174
- package/dist/modules/dexbot_cow_runtime.js +331 -46
- package/dist/modules/dexbot_credential_client.d.ts +1 -16
- package/dist/modules/dexbot_credential_client.js +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +1 -1
- package/dist/modules/dexbot_fill_runtime.js +12 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +18 -80
- package/dist/modules/dexbot_maintenance_runtime.js +57 -68
- package/dist/modules/dexbot_startup_runtime.js +12 -0
- package/dist/modules/dexbot_state_recovery.js +16 -0
- package/dist/modules/key_store.d.ts +0 -5
- package/dist/modules/key_store.js +1 -1
- package/dist/modules/order/accounting.js +11 -11
- package/dist/modules/order/export.js +2 -2
- package/dist/modules/order/format.d.ts +15 -1
- package/dist/modules/order/format.js +19 -1
- package/dist/modules/order/genesis_policy.d.ts +1 -1
- package/dist/modules/order/genesis_policy.js +1 -1
- package/dist/modules/order/grid.d.ts +23 -11
- package/dist/modules/order/grid.js +383 -51
- package/dist/modules/order/grid_reconcile.d.ts +1 -1
- package/dist/modules/order/grid_reconcile.js +5 -5
- package/dist/modules/order/grid_reconcile_internal.js +48 -40
- package/dist/modules/order/index.d.ts +34 -8
- package/dist/modules/order/logger.js +2 -2
- package/dist/modules/order/manager.d.ts +9 -2
- package/dist/modules/order/manager.js +58 -24
- package/dist/modules/order/strategy.d.ts +2 -2
- package/dist/modules/order/strategy.js +51 -21
- package/dist/modules/order/sync_engine.js +4 -0
- package/dist/modules/order/utils/math.d.ts +3 -3
- package/dist/modules/order/utils/math.js +38 -27
- package/dist/modules/order/utils/order.d.ts +58 -58
- package/dist/modules/order/utils/order.js +119 -102
- package/dist/modules/order/utils/system.d.ts +193 -6
- package/dist/modules/order/utils/system.js +392 -29
- package/dist/modules/order/utils/validate.js +26 -4
- package/dist/modules/runtime_settings.d.ts +1 -1
- package/dist/modules/runtime_settings.js +3 -3
- package/dist/modules/types.d.ts +48 -4
- package/dist/scripts/analyze-orders.d.ts +1 -1
- package/dist/scripts/analyze-orders.js +4 -4
- package/dist/scripts/divergence-calc.js +6 -6
- package/dist/scripts/validate_bots.d.ts +1 -1
- package/dist/scripts/validate_bots.js +3 -3
- package/dist/unlock.js +7 -2
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -2
- package/docs/COW_INVARIANTS.md +6 -6
- package/docs/DEXBOT_COMPARISON.md +5 -5
- package/docs/EVOLUTION.md +8 -7
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
- package/docs/GRID_PRICE_INVARIANT.md +3 -3
- package/docs/GRID_RECALCULATION.md +4 -1
- package/docs/GRID_RECONCILE.md +4 -4
- package/docs/LIFECYCLE.md +11 -11
- package/docs/LOGGING.md +14 -0
- package/docs/MPA_CREDIT_USAGE.md +1 -1
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
- package/docs/README.md +3 -3
- package/docs/architecture.md +6 -6
- package/docs/developer_guide.md +7 -2
- package/package.json +1 -1
- package/tests/README.md +1 -1
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
* - getOrderSize(order) - Extract order size with fallback
|
|
61
61
|
*
|
|
62
62
|
* SECTION 10: STRATEGY CALCULATIONS (7 functions)
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
65
|
-
* -
|
|
66
|
-
* -
|
|
67
|
-
* -
|
|
68
|
-
* -
|
|
69
|
-
* -
|
|
63
|
+
* - resolveEdgeCount(config, side) - Clamped per-side edge count (>=0 int, 0 disables)
|
|
64
|
+
* - resolveEdgeOrders(config) - Total edge orders buy+sell (fee/count totals)
|
|
65
|
+
* - resolveLiveEdgeAnchorPrice(manager, side) - Live-grid edge anchor (genesis ladder extreme; null when no usable ladder)
|
|
66
|
+
* - resolveEdgeAnchorPrice(config, side) - Config-bound anchor fallback (buy→minPrice, sell→maxPrice; null when unresolvable)
|
|
67
|
+
* - compareEdge(a, b, edge, anchorPrice) - Shared anchored edge comparator (single ordering source)
|
|
68
|
+
* - edgeOrderIdSet(allSlots, config, orderType, anchorPrice?, excludeIds?) - Edge order id set (config count; shares the picker ordering; excludeIds carries the window exclusion)
|
|
69
|
+
* - selectEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice?) - Shared position picker (both edges anchor toward their bound)
|
|
70
70
|
*
|
|
71
71
|
* ===============================================================================
|
|
72
72
|
*/
|
|
@@ -1279,6 +1279,11 @@ function geometryTypeForSlotIndex(idx, boundaryIdx, gapSlots) {
|
|
|
1279
1279
|
return null;
|
|
1280
1280
|
if (boundaryIdx === null || boundaryIdx === undefined || boundaryIdx === '')
|
|
1281
1281
|
return null;
|
|
1282
|
+
// Unknown gap width must also fail closed: Number(null)/Number('') === 0
|
|
1283
|
+
// would collapse the gap band and misclassify an in-band slot as a rail
|
|
1284
|
+
// slot (the same trap guarded in detectGapEvacuationCandidates).
|
|
1285
|
+
if (gapSlots === null || gapSlots === undefined || gapSlots === '')
|
|
1286
|
+
return null;
|
|
1282
1287
|
const n = Number(idx);
|
|
1283
1288
|
const b = Number(boundaryIdx);
|
|
1284
1289
|
const g = Number(gapSlots);
|
|
@@ -1306,6 +1311,14 @@ function detectGapEvacuationCandidates(masterGrid, boundaryIdx, gapSlots) {
|
|
|
1306
1311
|
const out = [];
|
|
1307
1312
|
if (!masterGrid || typeof masterGrid.values !== 'function')
|
|
1308
1313
|
return out;
|
|
1314
|
+
// Explicit null/undefined/'' guard BEFORE Number(): Number(null) === 0 and
|
|
1315
|
+
// Number('') === 0 are finite and would read an unknown boundary as slot 0,
|
|
1316
|
+
// selecting a fake gap band around it (same trap guarded in
|
|
1317
|
+
// geometryTypeForSlotIndex / isSlotIndexInGapBand).
|
|
1318
|
+
if (boundaryIdx === null || boundaryIdx === undefined || boundaryIdx === '')
|
|
1319
|
+
return out;
|
|
1320
|
+
if (gapSlots === null || gapSlots === undefined || gapSlots === '')
|
|
1321
|
+
return out;
|
|
1309
1322
|
const b = Number(boundaryIdx);
|
|
1310
1323
|
const g = Number(gapSlots);
|
|
1311
1324
|
if (!Number.isFinite(b) || !Number.isFinite(g) || g < 0)
|
|
@@ -2400,7 +2413,7 @@ function deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, config, gapSl
|
|
|
2400
2413
|
referencePrice = centerPrice;
|
|
2401
2414
|
}
|
|
2402
2415
|
if (referencePrice === null) {
|
|
2403
|
-
const fallbackCap = Math.max(Math.floor((config?.
|
|
2416
|
+
const fallbackCap = Math.max(Math.floor((config?.coreOrders?.sell ?? 1) / 2), Math.floor((config?.coreOrders?.buy ?? 1) / 2), 1);
|
|
2404
2417
|
const effectiveBudget = crossChunkBudget ?? fallbackCap;
|
|
2405
2418
|
return { boundaryIdx: null, remainingBudget: effectiveBudget };
|
|
2406
2419
|
}
|
|
@@ -2409,22 +2422,22 @@ function deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, config, gapSl
|
|
|
2409
2422
|
// Empty slot list with a Tier 1-3 reference: no honest index
|
|
2410
2423
|
// exists (calculateIdealBoundary returns -1). Stay null rather
|
|
2411
2424
|
// than letting the clamp below fabricate a slot-0 boundary.
|
|
2412
|
-
const fallbackCap = Math.max(Math.floor((config?.
|
|
2425
|
+
const fallbackCap = Math.max(Math.floor((config?.coreOrders?.sell ?? 1) / 2), Math.floor((config?.coreOrders?.buy ?? 1) / 2), 1);
|
|
2413
2426
|
return { boundaryIdx: null, remainingBudget: crossChunkBudget ?? fallbackCap };
|
|
2414
2427
|
}
|
|
2415
2428
|
recovered = true;
|
|
2416
2429
|
}
|
|
2417
|
-
// Apply shift from fills with rate-limiting (
|
|
2430
|
+
// Apply shift from fills with rate-limiting (edge fills excluded: static insurance).
|
|
2418
2431
|
let netShift = 0;
|
|
2419
|
-
//
|
|
2432
|
+
// Edge ladder: fills from edge-pinned edge slots never crawl the
|
|
2420
2433
|
// boundary — they are static fat-finger insurance, not market movement.
|
|
2421
|
-
// `edgeAnchors` (
|
|
2434
|
+
// `edgeAnchors` (resolveLiveEdgeAnchorPrice) is the same anchor the
|
|
2422
2435
|
// placement sites use; without it the classification falls back to the
|
|
2423
2436
|
// config-bound anchor, which can disagree with the slots actually placed.
|
|
2424
2437
|
// The window exclusion is the same one every placement picker applies: a
|
|
2425
2438
|
// window that reaches the grid edge (e.g. a keep-low window sitting on
|
|
2426
2439
|
// the floor) must not let the edge pick land on window members — otherwise
|
|
2427
|
-
// a genuine window fill is treated as a static
|
|
2440
|
+
// a genuine window fill is treated as a static edge fill and never
|
|
2428
2441
|
// crawls, and the hole is refilled same-side. Unknown geometry
|
|
2429
2442
|
// (null boundary) fails open to the previous classification.
|
|
2430
2443
|
const windowBoundaryIdx = (currentBoundaryIdx === null || currentBoundaryIdx === undefined)
|
|
@@ -2432,28 +2445,28 @@ function deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, config, gapSl
|
|
|
2432
2445
|
: currentBoundaryIdx;
|
|
2433
2446
|
const windowBuyIds = windowIdSetFromSlots(allSlots, config, ORDER_TYPES.BUY, windowBoundaryIdx, gapSlots);
|
|
2434
2447
|
const windowSellIds = windowIdSetFromSlots(allSlots, config, ORDER_TYPES.SELL, windowBoundaryIdx, gapSlots);
|
|
2435
|
-
const
|
|
2436
|
-
const
|
|
2448
|
+
const edgeBuyIds = edgeOrderIdSet(allSlots, config, ORDER_TYPES.BUY, edgeAnchors?.buy ?? null, windowBuyIds);
|
|
2449
|
+
const edgeSellIds = edgeOrderIdSet(allSlots, config, ORDER_TYPES.SELL, edgeAnchors?.sell ?? null, windowSellIds);
|
|
2437
2450
|
// Pending crawls: fills recorded by earlier batches whose derivation
|
|
2438
2451
|
// never committed (refused broadcast, P4 abort, or pre-restart loss —
|
|
2439
2452
|
// the Sep-10 case: 4 fills consumed under a null boundary, crawl lost,
|
|
2440
2453
|
// restart refilled the holes same-side). Entries for slots in the
|
|
2441
2454
|
// CURRENT batch are excluded — those fills crawl below as usual;
|
|
2442
|
-
// anything older is still owed and shifts here.
|
|
2455
|
+
// anything older is still owed and shifts here. Edge-slot entries
|
|
2443
2456
|
// never crawl (static insurance), same as live fills.
|
|
2444
2457
|
const currentSlotIds = new Set((fills ?? []).map((f) => f?.id).filter((id) => typeof id === 'string' && id.length > 0));
|
|
2445
2458
|
const owedPending = (pendingCrawls ?? []).filter((e) => e
|
|
2446
2459
|
&& typeof e.slotId === 'string' && e.slotId.length > 0
|
|
2447
2460
|
&& !currentSlotIds.has(e.slotId)
|
|
2448
2461
|
&& (e.side === ORDER_TYPES.BUY || e.side === ORDER_TYPES.SELL)
|
|
2449
|
-
&& !(e.side === ORDER_TYPES.BUY &&
|
|
2450
|
-
&& !(e.side === ORDER_TYPES.SELL &&
|
|
2462
|
+
&& !(e.side === ORDER_TYPES.BUY && edgeBuyIds && edgeBuyIds.has(e.slotId))
|
|
2463
|
+
&& !(e.side === ORDER_TYPES.SELL && edgeSellIds && edgeSellIds.has(e.slotId)));
|
|
2451
2464
|
for (const fill of fills ?? []) {
|
|
2452
2465
|
if (!isShiftEligibleFill(fill))
|
|
2453
2466
|
continue;
|
|
2454
|
-
if (fill && fill.type === ORDER_TYPES.BUY &&
|
|
2467
|
+
if (fill && fill.type === ORDER_TYPES.BUY && edgeBuyIds && fill.id != null && edgeBuyIds.has(fill.id))
|
|
2455
2468
|
continue;
|
|
2456
|
-
if (fill && fill.type === ORDER_TYPES.SELL &&
|
|
2469
|
+
if (fill && fill.type === ORDER_TYPES.SELL && edgeSellIds && fill.id != null && edgeSellIds.has(fill.id))
|
|
2457
2470
|
continue;
|
|
2458
2471
|
if (fill.type === ORDER_TYPES.SELL)
|
|
2459
2472
|
netShift++;
|
|
@@ -2477,7 +2490,7 @@ function deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, config, gapSl
|
|
|
2477
2490
|
// consumes from the same pool so the total across all chunks
|
|
2478
2491
|
// never exceeds half the active window.
|
|
2479
2492
|
// Falls back to a per-call cap when no budget is set.
|
|
2480
|
-
const fallbackCap = Math.max(Math.floor((config?.
|
|
2493
|
+
const fallbackCap = Math.max(Math.floor((config?.coreOrders?.sell ?? 1) / 2), Math.floor((config?.coreOrders?.buy ?? 1) / 2), 1);
|
|
2481
2494
|
const effectiveBudget = crossChunkBudget ?? fallbackCap;
|
|
2482
2495
|
const cap = Math.min(Math.abs(effectiveBudget), fallbackCap);
|
|
2483
2496
|
if (recovered && anchoredFromFills) {
|
|
@@ -2559,15 +2572,15 @@ export function consumePendingFillCrawls(manager) {
|
|
|
2559
2572
|
const slots = Array.from(manager?.orders instanceof Map ? manager.orders.values() : []);
|
|
2560
2573
|
// Classify with the SAME live anchors the strategy derivation uses, or the
|
|
2561
2574
|
// two disagree: the config-bound fallback is null for mode-string/relative
|
|
2562
|
-
// bounds, so a restart would rank a stale below-rail slot as
|
|
2575
|
+
// bounds, so a restart would rank a stale below-rail slot as an edge order and
|
|
2563
2576
|
// silently drop a crawl the live run recorded as ordinary market movement.
|
|
2564
2577
|
// The window exclusion must match placement too (same source as the count
|
|
2565
|
-
// fix) — a window over the
|
|
2578
|
+
// fix) — a window over the edge must not be read as an edge order, or
|
|
2566
2579
|
// its owed crawl is dropped instead of applied.
|
|
2567
2580
|
const windowBuyIds = liveWindowIdSet(manager, ORDER_TYPES.BUY);
|
|
2568
2581
|
const windowSellIds = liveWindowIdSet(manager, ORDER_TYPES.SELL);
|
|
2569
|
-
const
|
|
2570
|
-
const
|
|
2582
|
+
const edgeBuyIds = edgeOrderIdSet(slots, config, ORDER_TYPES.BUY, resolveLiveEdgeAnchorPrice(manager, 'buy'), windowBuyIds);
|
|
2583
|
+
const edgeSellIds = edgeOrderIdSet(slots, config, ORDER_TYPES.SELL, resolveLiveEdgeAnchorPrice(manager, 'sell'), windowSellIds);
|
|
2571
2584
|
let netShift = 0;
|
|
2572
2585
|
let count = 0;
|
|
2573
2586
|
for (const e of pending) {
|
|
@@ -2575,9 +2588,9 @@ export function consumePendingFillCrawls(manager) {
|
|
|
2575
2588
|
continue;
|
|
2576
2589
|
if (e.side !== ORDER_TYPES.BUY && e.side !== ORDER_TYPES.SELL)
|
|
2577
2590
|
continue;
|
|
2578
|
-
if (e.side === ORDER_TYPES.BUY &&
|
|
2591
|
+
if (e.side === ORDER_TYPES.BUY && edgeBuyIds && edgeBuyIds.has(e.slotId))
|
|
2579
2592
|
continue;
|
|
2580
|
-
if (e.side === ORDER_TYPES.SELL &&
|
|
2593
|
+
if (e.side === ORDER_TYPES.SELL && edgeSellIds && edgeSellIds.has(e.slotId))
|
|
2581
2594
|
continue;
|
|
2582
2595
|
netShift += e.side === ORDER_TYPES.SELL ? 1 : -1;
|
|
2583
2596
|
count++;
|
|
@@ -2586,12 +2599,15 @@ export function consumePendingFillCrawls(manager) {
|
|
|
2586
2599
|
clear();
|
|
2587
2600
|
return { applied: false, reason: 'nothing-owed' };
|
|
2588
2601
|
}
|
|
2589
|
-
const
|
|
2590
|
-
const
|
|
2591
|
-
const fallbackCap = Math.max(Math.floor(Number(
|
|
2602
|
+
const coreOrdersCfg = config?.coreOrders;
|
|
2603
|
+
const coreOrdersObj = (coreOrdersCfg && typeof coreOrdersCfg === 'object') ? coreOrdersCfg : {};
|
|
2604
|
+
const fallbackCap = Math.max(Math.floor(Number(coreOrdersObj.sell ?? 1) / 2), Math.floor(Number(coreOrdersObj.buy ?? 1) / 2), 1);
|
|
2592
2605
|
if (Math.abs(netShift) > fallbackCap)
|
|
2593
2606
|
netShift = Math.sign(netShift) * fallbackCap;
|
|
2594
|
-
|
|
2607
|
+
// Absent-aware: Number(null) === 0 is finite, so a plain Number() would use
|
|
2608
|
+
// a collapsed (0) gap instead of the config-derived fallback and let the
|
|
2609
|
+
// ceiling + validatePersistedBoundary run on the wrong band.
|
|
2610
|
+
let gapSlots = Format.toKnownNumber(manager?._gapSlots);
|
|
2595
2611
|
if (!Number.isFinite(gapSlots)) {
|
|
2596
2612
|
try {
|
|
2597
2613
|
gapSlots = MathUtils.calculateGapSlots(config?.incrementPercent, config?.targetSpreadPercent, config?.gridLimits);
|
|
@@ -2627,89 +2643,89 @@ export function consumePendingFillCrawls(manager) {
|
|
|
2627
2643
|
return { applied: true, from: boundary, to: candidate, count };
|
|
2628
2644
|
}
|
|
2629
2645
|
/**
|
|
2630
|
-
* Per-side
|
|
2631
|
-
* Buy
|
|
2646
|
+
* Per-side edge count (edge-pinned fat-finger insurance orders).
|
|
2647
|
+
* Buy edges pin at the grid floor, sell edges at the grid ceiling.
|
|
2632
2648
|
* Non-finite/non-integer/negative values disable (0).
|
|
2633
2649
|
*
|
|
2634
|
-
* The legacy numeric form (`
|
|
2650
|
+
* The legacy numeric form (`edgeOrders: n`) is migrated here at read time
|
|
2635
2651
|
* to `{ buy: n, sell: 0 }`: the editor seeder rewrites the persisted JSON, but
|
|
2636
|
-
* a hand-edited bots.json that bypassed the editor must not have its
|
|
2652
|
+
* a hand-edited bots.json that bypassed the editor must not have its edge
|
|
2637
2653
|
* count silently read as 0.
|
|
2638
2654
|
*
|
|
2639
2655
|
* @param {Object} config - Bot configuration
|
|
2640
2656
|
* @param {string} side - 'buy' or 'sell'
|
|
2641
|
-
* @returns {number}
|
|
2657
|
+
* @returns {number} Edge count for the side (>= 0 integer)
|
|
2642
2658
|
*/
|
|
2643
|
-
function
|
|
2659
|
+
function resolveEdgeCount(config, side) {
|
|
2644
2660
|
const key = side === 'sell' ? 'sell' : 'buy';
|
|
2645
|
-
const
|
|
2646
|
-
if (typeof
|
|
2661
|
+
const rawEdge = config?.edgeOrders;
|
|
2662
|
+
if (typeof rawEdge === 'number') {
|
|
2647
2663
|
if (side === 'sell')
|
|
2648
2664
|
return 0;
|
|
2649
|
-
const n = Math.floor(
|
|
2665
|
+
const n = Math.floor(rawEdge);
|
|
2650
2666
|
return Number.isFinite(n) && n >= 0 ? n : 0;
|
|
2651
2667
|
}
|
|
2652
|
-
const raw = Number(
|
|
2668
|
+
const raw = Number(rawEdge?.[key] ?? 0);
|
|
2653
2669
|
if (!Number.isInteger(raw) || raw < 0)
|
|
2654
2670
|
return 0;
|
|
2655
2671
|
return raw;
|
|
2656
2672
|
}
|
|
2657
2673
|
/**
|
|
2658
|
-
* Total
|
|
2674
|
+
* Total edge count across both sides (fee/count totals).
|
|
2659
2675
|
*
|
|
2660
2676
|
* @param {Object} config - Bot configuration
|
|
2661
|
-
* @returns {number} Total
|
|
2677
|
+
* @returns {number} Total edges (buy + sell)
|
|
2662
2678
|
*/
|
|
2663
|
-
function
|
|
2664
|
-
return
|
|
2679
|
+
function resolveEdgeOrders(config) {
|
|
2680
|
+
return resolveEdgeCount(config, 'buy') + resolveEdgeCount(config, 'sell');
|
|
2665
2681
|
}
|
|
2666
2682
|
/**
|
|
2667
|
-
* Edge-pinned
|
|
2683
|
+
* Edge-pinned order id set for one side, or null when disabled.
|
|
2668
2684
|
* Type/price-filtered, then ordered by the SAME edge order the placement
|
|
2669
|
-
* pickers use (
|
|
2685
|
+
* pickers use (compareEdge via selectEdgeSlots) — single source
|
|
2670
2686
|
* of truth, so the no-crawl classification can never drift from placement.
|
|
2671
2687
|
* Anchor: explicit live-grid edge when supplied, otherwise the config-bound
|
|
2672
2688
|
* fallback (unresolved -> plain rank). Shelf/manual ids (non-slot-N, e.g.
|
|
2673
|
-
* fork-kept deep-* orders below the rail) are never
|
|
2689
|
+
* fork-kept deep-* orders below the rail) are never edge orders: they would
|
|
2674
2690
|
* otherwise win the cheapest-first rank and poison the deficit check while
|
|
2675
2691
|
* the shelf is live (issue #27 follow-up). No-op upstream (grids only mint
|
|
2676
2692
|
* slot-N).
|
|
2677
2693
|
*
|
|
2678
2694
|
* @param {Array<Object>} allSlots - All grid slots (need id/price/type)
|
|
2679
|
-
* @param {Object} config - Bot configuration (
|
|
2695
|
+
* @param {Object} config - Bot configuration (edge count source)
|
|
2680
2696
|
* @param {string} orderType - ORDER_TYPES.BUY (floor) or SELL (ceiling)
|
|
2681
2697
|
* @param {number|null} [anchorPrice] - Explicit edge anchor (live grid edge);
|
|
2682
2698
|
* callers that picked slots must pass the SAME anchor so no-crawl
|
|
2683
2699
|
* classification matches placement. NB: null/undefined falls back to the
|
|
2684
2700
|
* config-bound anchor (unresolved -> plain rank) — unlike
|
|
2685
|
-
*
|
|
2701
|
+
* selectEdgeSlots, where null alone means plain rank.
|
|
2686
2702
|
* @param {Set<string>|null} [excludeIds] - Windowed ids to skip (same set the
|
|
2687
2703
|
* placement pickers exclude). Window + edge are additive in every target
|
|
2688
2704
|
* (order counts, fees, hold-back), so a window that reaches the grid edge
|
|
2689
2705
|
* (e.g. a keep-low window sitting on the floor) must not let the edge pick
|
|
2690
2706
|
* land on window members — otherwise counting reads N/N with zero
|
|
2691
|
-
* dedicated
|
|
2707
|
+
* dedicated edge orders and the deficit never fires (issue #27 follow-up).
|
|
2692
2708
|
* @returns {Set<string>|null} Edge slot ids, or null when side disabled
|
|
2693
2709
|
*/
|
|
2694
|
-
function
|
|
2710
|
+
function edgeOrderIdSet(allSlots, config, orderType, anchorPrice = null, excludeIds = null) {
|
|
2695
2711
|
const isSell = orderType === ORDER_TYPES.SELL;
|
|
2696
2712
|
const side = isSell ? 'sell' : 'buy';
|
|
2697
2713
|
// Filter by the canonical side type, not the caller's token: the previous
|
|
2698
2714
|
// per-side resolvers did the same, so a non-canonical token keeps the
|
|
2699
2715
|
// floor behavior instead of silently matching nothing.
|
|
2700
2716
|
const type = isSell ? ORDER_TYPES.SELL : ORDER_TYPES.BUY;
|
|
2701
|
-
const n =
|
|
2717
|
+
const n = resolveEdgeCount(config, side);
|
|
2702
2718
|
if (n <= 0)
|
|
2703
2719
|
return null;
|
|
2704
2720
|
const ids = new Set();
|
|
2705
2721
|
if (!Array.isArray(allSlots))
|
|
2706
2722
|
return ids;
|
|
2707
2723
|
// NB: Number(null) === 0 is finite — null/undefined must mean "no anchor".
|
|
2708
|
-
const anchor = anchorPrice == null ?
|
|
2724
|
+
const anchor = anchorPrice == null ? resolveEdgeAnchorPrice(config, side) : Number(anchorPrice);
|
|
2709
2725
|
const ascending = allSlots
|
|
2710
2726
|
.filter((s) => s && s.id != null && s.price != null && s.type === type && parseSlotIndex(s.id) !== null)
|
|
2711
2727
|
.sort((a, b) => Number(a.price) - Number(b.price));
|
|
2712
|
-
for (const s of
|
|
2728
|
+
for (const s of selectEdgeSlots(ascending, n, excludeIds, isSell ? 'ceiling' : 'floor', anchor)) {
|
|
2713
2729
|
ids.add(String(s.id));
|
|
2714
2730
|
}
|
|
2715
2731
|
return ids;
|
|
@@ -2717,21 +2733,21 @@ function reserveEdgeIdSet(allSlots, config, orderType, anchorPrice = null, exclu
|
|
|
2717
2733
|
/**
|
|
2718
2734
|
* Window member ids for one side from an explicit slot list and geometry.
|
|
2719
2735
|
*
|
|
2720
|
-
* Mirror of the window every placement picker excludes from its
|
|
2736
|
+
* Mirror of the window every placement picker excludes from its edge
|
|
2721
2737
|
* pick: in-rail slots of the side (geometry via isSlotInRail), ordered
|
|
2722
2738
|
* closest to market first (buys: highest price first; sells: lowest first),
|
|
2723
|
-
* sliced to the configured
|
|
2739
|
+
* sliced to the configured coreOrders count. The slice runs over the FULL
|
|
2724
2740
|
* rail, not just live orders — window membership is geometric (a virtual
|
|
2725
|
-
* hole inside the window still blocks the
|
|
2726
|
-
* slices would misclassify live
|
|
2741
|
+
* hole inside the window still blocks the edge pick there), so live-only
|
|
2742
|
+
* slices would misclassify live edge orders as window members whenever the
|
|
2727
2743
|
* window itself is under-filled.
|
|
2728
2744
|
*
|
|
2729
2745
|
* Returns null when the boundary geometry is unknown (null boundary): the
|
|
2730
|
-
* pickers cannot place
|
|
2746
|
+
* pickers cannot place edge orders without it either, so callers fail open
|
|
2731
2747
|
* (no exclusion) and keep their previous classification instead of guessing.
|
|
2732
2748
|
*
|
|
2733
2749
|
* @param {Array<Object>} allSlots - Slots (master grid or clone)
|
|
2734
|
-
* @param {Object} config - Bot configuration (
|
|
2750
|
+
* @param {Object} config - Bot configuration (coreOrders count source)
|
|
2735
2751
|
* @param {string} orderType - ORDER_TYPES.BUY or SELL
|
|
2736
2752
|
* @param {number|null|undefined} boundaryIdx - Boundary the rail is derived from
|
|
2737
2753
|
* @param {number} gapSlots - Gap band size
|
|
@@ -2742,7 +2758,7 @@ function windowIdSetFromSlots(allSlots, config, orderType, boundaryIdx, gapSlots
|
|
|
2742
2758
|
const isSell = orderType === ORDER_TYPES.SELL;
|
|
2743
2759
|
const type = isSell ? ORDER_TYPES.SELL : ORDER_TYPES.BUY;
|
|
2744
2760
|
const side = isSell ? 'sell' : 'buy';
|
|
2745
|
-
const count = Math.max(0, Math.floor(Number(config?.
|
|
2761
|
+
const count = Math.max(0, Math.floor(Number(config?.coreOrders?.[side])) || 0);
|
|
2746
2762
|
if (!(count > 0))
|
|
2747
2763
|
return new Set();
|
|
2748
2764
|
if (!Array.isArray(allSlots))
|
|
@@ -2801,26 +2817,26 @@ function liveWindowIdSet(manager, orderType) {
|
|
|
2801
2817
|
*
|
|
2802
2818
|
* - CREATE ids of the plan (the slots a fold did not convert into an
|
|
2803
2819
|
* UPDATE), minus
|
|
2804
|
-
* -
|
|
2820
|
+
* - edge-ladder ids. Edge orders are static edge insurance; their fills
|
|
2805
2821
|
* never crawl (deriveTargetBoundary filters them), so a guard-skipped
|
|
2806
|
-
*
|
|
2822
|
+
* edge order must not pin geometry either. Without this exclusion an edge order
|
|
2807
2823
|
* CREATE skipped at the wrong moment (e.g. a floor BUY above the last-fill
|
|
2808
2824
|
* pivot while the market dumps below the grid) would hold the boundary for
|
|
2809
2825
|
* a cycle although nothing was stranded.
|
|
2810
2826
|
*
|
|
2811
|
-
* Absent/disabled
|
|
2812
|
-
* so callers that never configured
|
|
2827
|
+
* Absent/disabled edge orders or an empty action list yield the plain CREATE ids,
|
|
2828
|
+
* so callers that never configured edge orders keep the previous behavior.
|
|
2813
2829
|
*
|
|
2814
2830
|
* @param {Array<Object>} actions - Optimized COW actions
|
|
2815
2831
|
* @param {Object} [options]
|
|
2816
|
-
* @param {Object} [options.config] - Bot configuration (
|
|
2817
|
-
* @param {Iterable<Object>} [options.slots] - Master slots (
|
|
2832
|
+
* @param {Object} [options.config] - Bot configuration (edge count source)
|
|
2833
|
+
* @param {Iterable<Object>} [options.slots] - Master slots (edge classification)
|
|
2818
2834
|
* @param {{buy?: number|null, sell?: number|null}} [options.edgeAnchors] - Live
|
|
2819
|
-
* edge anchors (same pair the strategy classifies
|
|
2835
|
+
* edge anchors (same pair the strategy classifies edge fills against)
|
|
2820
2836
|
* @param {unknown} [options.manager] - OrderManager for the window exclusion (same
|
|
2821
2837
|
* set the placement pickers exclude); omit to fall back to the previous
|
|
2822
2838
|
* exclusion-free classification (fail-open)
|
|
2823
|
-
* @returns {string[]} Refill slot ids (CREATE ids minus
|
|
2839
|
+
* @returns {string[]} Refill slot ids (CREATE ids minus edge ids)
|
|
2824
2840
|
*/
|
|
2825
2841
|
function collectRefillSlotIds(actions, options = {}) {
|
|
2826
2842
|
const { config = null, slots = null, edgeAnchors = null, manager = null } = options;
|
|
@@ -2832,12 +2848,12 @@ function collectRefillSlotIds(actions, options = {}) {
|
|
|
2832
2848
|
.map((a) => a.id);
|
|
2833
2849
|
if (createIds.length === 0)
|
|
2834
2850
|
return out;
|
|
2835
|
-
let
|
|
2851
|
+
let edgeIds = null;
|
|
2836
2852
|
if (slots && config) {
|
|
2837
2853
|
try {
|
|
2838
2854
|
// Accept a Map (master grid), an array of slots, or any iterable of
|
|
2839
2855
|
// slot objects. Map entries are [id, slot] pairs, so `.values()` is
|
|
2840
|
-
// required — Array.from(map) would hand
|
|
2856
|
+
// required — Array.from(map) would hand edgeOrderIdSet pairs.
|
|
2841
2857
|
const allSlots = Array.isArray(slots)
|
|
2842
2858
|
? slots
|
|
2843
2859
|
: (slots && typeof slots.values === 'function'
|
|
@@ -2846,30 +2862,30 @@ function collectRefillSlotIds(actions, options = {}) {
|
|
|
2846
2862
|
// Window exclusion keeps classification in agreement with the
|
|
2847
2863
|
// placement pickers: a window reaching the grid edge must not have
|
|
2848
2864
|
// its window hole-CREATEs dropped from the wire as if they were
|
|
2849
|
-
//
|
|
2865
|
+
// edge orders, or a guard-skipped window refill would no longer pin
|
|
2850
2866
|
// the committed boundary (stranding the hole it failed to fill).
|
|
2851
2867
|
const windowBuyIds = manager ? liveWindowIdSet(manager, ORDER_TYPES.BUY) : null;
|
|
2852
2868
|
const windowSellIds = manager ? liveWindowIdSet(manager, ORDER_TYPES.SELL) : null;
|
|
2853
|
-
const buyIds =
|
|
2854
|
-
const sellIds =
|
|
2869
|
+
const buyIds = edgeOrderIdSet(allSlots, config, ORDER_TYPES.BUY, edgeAnchors?.buy ?? null, windowBuyIds);
|
|
2870
|
+
const sellIds = edgeOrderIdSet(allSlots, config, ORDER_TYPES.SELL, edgeAnchors?.sell ?? null, windowSellIds);
|
|
2855
2871
|
if (buyIds || sellIds)
|
|
2856
|
-
|
|
2872
|
+
edgeIds = new Set([...(buyIds ?? []), ...(sellIds ?? [])]);
|
|
2857
2873
|
}
|
|
2858
2874
|
catch {
|
|
2859
|
-
|
|
2875
|
+
edgeIds = null;
|
|
2860
2876
|
}
|
|
2861
2877
|
}
|
|
2862
2878
|
for (const id of createIds) {
|
|
2863
|
-
// Fail-open on classification errors: an id we cannot prove is
|
|
2879
|
+
// Fail-open on classification errors: an id we cannot prove is an edge order
|
|
2864
2880
|
// stays in the wire, so the hold keeps its previous (conservative) reach.
|
|
2865
|
-
if (
|
|
2881
|
+
if (edgeIds && edgeIds.has(id))
|
|
2866
2882
|
continue;
|
|
2867
2883
|
out.push(id);
|
|
2868
2884
|
}
|
|
2869
2885
|
return out;
|
|
2870
2886
|
}
|
|
2871
2887
|
/**
|
|
2872
|
-
* Resolved bound anchor for
|
|
2888
|
+
* Resolved bound anchor for edges from CONFIG alone.
|
|
2873
2889
|
* BUY floor anchors toward minPrice (dip-insurance end), SELL ceiling toward
|
|
2874
2890
|
* maxPrice (spike-insurance end). Resolves numeric and "Nx" relative forms
|
|
2875
2891
|
* via resolveConfiguredPriceBound (startPrice-referenced); falls back to the
|
|
@@ -2877,16 +2893,16 @@ function collectRefillSlotIds(actions, options = {}) {
|
|
|
2877
2893
|
*
|
|
2878
2894
|
* Known limit: this is the statically resolved config bound, not the
|
|
2879
2895
|
* gridPrice/AMA-referenced live rail bound. Placement call sites should use
|
|
2880
|
-
*
|
|
2896
|
+
* resolveLiveEdgeAnchorPrice(manager, side), which prefers the genesis
|
|
2881
2897
|
* ladder extreme and returns null when there is no usable ladder. Callers that
|
|
2882
|
-
* need a fallback (e.g.
|
|
2898
|
+
* need a fallback (e.g. edgeOrderIdSet) still resolve this config bound when
|
|
2883
2899
|
* the live anchor is null; the live resolver itself no longer computes it.
|
|
2884
2900
|
*
|
|
2885
2901
|
* @param {Object} config - Bot configuration
|
|
2886
2902
|
* @param {string} side - 'buy' or 'sell'
|
|
2887
2903
|
* @returns {number|null} Finite anchor price, or null
|
|
2888
2904
|
*/
|
|
2889
|
-
function
|
|
2905
|
+
function resolveEdgeAnchorPrice(config, side) {
|
|
2890
2906
|
const isSell = side === 'sell';
|
|
2891
2907
|
const bound = isSell ? config?.maxPrice : config?.minPrice;
|
|
2892
2908
|
const mode = isSell ? 'max' : 'min';
|
|
@@ -2900,7 +2916,7 @@ function resolveReserveEdgeAnchorPrice(config, side) {
|
|
|
2900
2916
|
return Number.isFinite(raw) ? raw : null;
|
|
2901
2917
|
}
|
|
2902
2918
|
/**
|
|
2903
|
-
* Live-grid
|
|
2919
|
+
* Live-grid edge anchor (single source for edge placement).
|
|
2904
2920
|
*
|
|
2905
2921
|
* The anchor must come from the geometry the bot is actually trading, never
|
|
2906
2922
|
* from a config value that can be a mode string ("pool"/"book"), a relative
|
|
@@ -2918,7 +2934,7 @@ function resolveReserveEdgeAnchorPrice(config, side) {
|
|
|
2918
2934
|
* paper over. The former tiers — the live in-rail slot extreme and the resolved
|
|
2919
2935
|
* config bound — are gone with the legacy matcher they only existed to cover;
|
|
2920
2936
|
* any config-bound fallback is now resolved by the individual consumer that
|
|
2921
|
-
* wants one (see
|
|
2937
|
+
* wants one (see edgeOrderIdSet), not by this live-edge resolver. The fault
|
|
2922
2938
|
* itself is reported
|
|
2923
2939
|
* once per grid generation by the sync-entry gate; this resolver stays silent
|
|
2924
2940
|
* because it is called from per-fill and per-placement paths.
|
|
@@ -2927,7 +2943,7 @@ function resolveReserveEdgeAnchorPrice(config, side) {
|
|
|
2927
2943
|
* @param {string} side - 'buy' or 'sell'
|
|
2928
2944
|
* @returns {number|null} Finite anchor price, or null
|
|
2929
2945
|
*/
|
|
2930
|
-
function
|
|
2946
|
+
function resolveLiveEdgeAnchorPrice(manager, side) {
|
|
2931
2947
|
const isSell = side === 'sell';
|
|
2932
2948
|
const levels = manager?._genesis?.priceLevels;
|
|
2933
2949
|
if (Array.isArray(levels) && levels.length > 0) {
|
|
@@ -2938,7 +2954,7 @@ function resolveLiveReserveEdgeAnchorPrice(manager, side) {
|
|
|
2938
2954
|
return null;
|
|
2939
2955
|
}
|
|
2940
2956
|
/**
|
|
2941
|
-
* Shared anchored edge comparator for
|
|
2957
|
+
* Shared anchored edge comparator for edge selection (single source).
|
|
2942
2958
|
* With a finite anchor: in-bound slots first, nearest the anchor first
|
|
2943
2959
|
* (floor ascending, ceiling descending); stale out-of-bound slots last,
|
|
2944
2960
|
* still nearest the anchor first. Without one: plain rank fallback
|
|
@@ -2950,7 +2966,7 @@ function resolveLiveReserveEdgeAnchorPrice(manager, side) {
|
|
|
2950
2966
|
* @param {number|null} anchorPrice - Resolved bound anchor (null = rank fallback)
|
|
2951
2967
|
* @returns {number} Comparator result for Array.prototype.sort
|
|
2952
2968
|
*/
|
|
2953
|
-
function
|
|
2969
|
+
function compareEdge(a, b, edge, anchorPrice) {
|
|
2954
2970
|
const ceil = edge === 'ceiling';
|
|
2955
2971
|
// NB: Number(null) === 0 is finite — null/undefined must mean "no anchor".
|
|
2956
2972
|
const anchor = anchorPrice == null ? Number.NaN : Number(anchorPrice);
|
|
@@ -2968,25 +2984,25 @@ function compareReserveEdge(a, b, edge, anchorPrice) {
|
|
|
2968
2984
|
return ceil ? pa - pb : pb - pa;
|
|
2969
2985
|
}
|
|
2970
2986
|
/**
|
|
2971
|
-
* Central edge selector: take
|
|
2987
|
+
* Central edge selector: take edge slots from a price-ascending list,
|
|
2972
2988
|
* skipping already-windowed ids. Both edges anchor at the live grid's own
|
|
2973
|
-
* edge (
|
|
2989
|
+
* edge (resolveLiveEdgeAnchorPrice) when finite — floor: nearest
|
|
2974
2990
|
* at/above the live floor first, slots below it rank last; ceiling: nearest
|
|
2975
2991
|
* at/below the live ceiling first, slots above it rank last. Anchoring to the
|
|
2976
|
-
* live edge keeps the
|
|
2992
|
+
* live edge keeps the edge order on genuine live-rail slots when the grid still
|
|
2977
2993
|
* carries leftovers from an older bound or the configured bound disagrees
|
|
2978
2994
|
* with the geometry being traded. Callers pre-filter rail/type and apply
|
|
2979
2995
|
* their own size gates; this only picks positions. A null anchor degrades to
|
|
2980
2996
|
* plain rank (floor: lowest first; ceiling: highest first).
|
|
2981
2997
|
*
|
|
2982
2998
|
* @param {Array<Object>} sortedAsc - Slots sorted by price ascending
|
|
2983
|
-
* @param {number} count -
|
|
2999
|
+
* @param {number} count - Edge count
|
|
2984
3000
|
* @param {Set<string>|null} excludeIds - Windowed ids to skip
|
|
2985
3001
|
* @param {string} edge - 'floor' or 'ceiling'
|
|
2986
3002
|
* @param {number|null} [anchorPrice] - Live edge anchor for the side (null = rank-based)
|
|
2987
|
-
* @returns {Array<Object>}
|
|
3003
|
+
* @returns {Array<Object>} Edge slots (ascending for floor, descending for ceiling)
|
|
2988
3004
|
*/
|
|
2989
|
-
function
|
|
3005
|
+
function selectEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice = null) {
|
|
2990
3006
|
const n = Math.max(0, Math.floor(Number(count) || 0));
|
|
2991
3007
|
if (n <= 0 || !Array.isArray(sortedAsc))
|
|
2992
3008
|
return [];
|
|
@@ -3001,21 +3017,22 @@ function selectReserveEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice
|
|
|
3001
3017
|
// Anchored: shared comparator — in-bound slots nearest the bound first,
|
|
3002
3018
|
// stale out-of-bound slots last.
|
|
3003
3019
|
return avail
|
|
3004
|
-
.sort((x, y) =>
|
|
3020
|
+
.sort((x, y) => compareEdge(x, y, edge, anchor))
|
|
3005
3021
|
.slice(0, n);
|
|
3006
3022
|
}
|
|
3007
3023
|
/**
|
|
3008
3024
|
* Total target order count across both sides (used for BTS fee calculation).
|
|
3009
3025
|
* Single source of truth so every budget derivation sizes identically.
|
|
3010
|
-
* Includes per-side
|
|
3026
|
+
* Includes per-side edge orders: they rest live on-chain and pay creation fees.
|
|
3011
3027
|
*
|
|
3012
3028
|
* @param {Object} config - Bot configuration
|
|
3013
3029
|
* @returns {number} Total target order count
|
|
3014
3030
|
*/
|
|
3015
|
-
function
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3031
|
+
function getCoreOrdersTotal(config) {
|
|
3032
|
+
const coreOrders = config?.coreOrders;
|
|
3033
|
+
return Math.max(0, coreOrders?.buy ?? 1) +
|
|
3034
|
+
Math.max(0, coreOrders?.sell ?? 1) +
|
|
3035
|
+
resolveEdgeOrders(config);
|
|
3019
3036
|
}
|
|
3020
3037
|
/**
|
|
3021
3038
|
* Calculate side budget after BTS fee deduction.
|
|
@@ -3268,6 +3285,6 @@ function collectKnownOnChainOrderIds(mgr, placedResults, placedContexts, extraCr
|
|
|
3268
3285
|
const all = new Set([...masterIds, ...createIds]);
|
|
3269
3286
|
return { masterIds: [...masterIds], createIds: [...createIds], all: [...all] };
|
|
3270
3287
|
}
|
|
3271
|
-
export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill,
|
|
3272
|
-
export {
|
|
3288
|
+
export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill, resolveEdgeCount, resolveEdgeOrders, selectEdgeSlots, getCoreOrdersTotal, getSideBudget, calculateBudgetedSizes, buildCreateOpFingerprint, isOrderGoneErrorMessage, recordDuplicateOrphanDetection, clearDuplicateOrphanDetection, duplicateOrphanLogInfo, chainOrderUnchangedFromCache, detectCrossedBookPlan, collectKnownOnChainOrderIds, edgeOrderIdSet, liveWindowIdSet, checkGridPriceInvariant, reportGridPriceInvariant };
|
|
3289
|
+
export { resolveEdgeAnchorPrice, resolveLiveEdgeAnchorPrice, compareEdge, collectRefillSlotIds, recordOrderPlacement, isFreshlyPlacedOrder, _filterUnmatchedChainOrders };
|
|
3273
3290
|
//# sourceMappingURL=order.js.map
|