dexbot 1.6.17 → 1.7.0
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 +58 -0
- package/README.md +24 -18
- package/analysis/README.md +105 -12
- package/analysis/ama_fitting/README.md +2 -2
- package/analysis/bot_fitting/README.md +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/analyze_args.d.ts +2 -1
- package/dist/analysis/analyze_dynamic_weight.js +2 -1
- package/dist/analysis/analyze_kalman.js +3 -2
- package/dist/analysis/analyze_liquidity.d.ts +17 -0
- package/dist/analysis/analyze_liquidity.js +325 -0
- package/dist/analysis/analyze_regime.js +3 -2
- package/dist/analysis/analyze_regime_windows.js +3 -2
- package/dist/analysis/analyze_volatility.js +3 -2
- package/dist/analysis/fills_source.d.ts +1 -8
- package/dist/analysis/fills_source.js +1 -1
- package/dist/analysis/grid_correction_check.d.ts +9 -6
- package/dist/analysis/grid_correction_check.js +56 -64
- package/dist/analysis/liquidity/liquidity_chain.d.ts +66 -0
- package/dist/analysis/liquidity/liquidity_chain.js +178 -0
- package/dist/analysis/liquidity/liquidity_chart_generator.d.ts +19 -0
- package/dist/analysis/liquidity/liquidity_chart_generator.js +523 -0
- package/dist/analysis/liquidity/liquidity_depth_model.d.ts +141 -0
- package/dist/analysis/liquidity/liquidity_depth_model.js +230 -0
- package/dist/analysis/liquidity/liquidity_view.d.ts +38 -0
- package/dist/analysis/liquidity/liquidity_view.js +55 -0
- package/dist/analysis/math_utils.d.ts +1 -1
- package/dist/analysis/trade_profitability.d.ts +1 -1
- package/dist/analysis/trade_profitability.js +2 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +2 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +3 -3
- package/dist/analysis/trend_detection/huber_scale_variants.d.ts +4 -3
- package/dist/dexbot.js +74 -169
- package/dist/market_adapter/cli_args.d.ts +6 -1
- package/dist/market_adapter/cli_args.js +16 -2
- package/dist/market_adapter/core/kibana_candles.d.ts +5 -1
- package/dist/market_adapter/core/kibana_candles.js +3 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +7 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +3 -1
- package/dist/market_adapter/inputs/cex_candle_parsing.d.ts +7 -2
- package/dist/market_adapter/inputs/cex_candle_parsing.js +3 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts +7 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +3 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -11
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +26 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +62 -52
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts +14 -2
- package/dist/market_adapter/inputs/kibana_feed_source.js +14 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +14 -3
- package/dist/market_adapter/inputs/window_cache.js +14 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +12 -9
- package/dist/market_adapter/lp_chart_runner.js +3 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +5 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +3 -1
- package/dist/market_adapter/market_adapter.d.ts +10 -2
- package/dist/market_adapter/market_adapter.js +10 -11
- package/dist/market_adapter/utils/chain.d.ts +2 -3
- package/dist/market_adapter/utils/file_json_cache.d.ts +5 -1
- package/dist/market_adapter/utils/file_json_cache.js +3 -1
- package/dist/market_adapter/utils/file_lock.js +1 -1
- package/dist/market_adapter/utils/native_history.d.ts +7 -3
- package/dist/market_adapter/utils/native_history.js +3 -1
- package/dist/market_adapter/utils/pair_orientation.d.ts +2 -2
- package/dist/modules/asset_lookup.d.ts +25 -0
- package/dist/modules/asset_lookup.js +75 -0
- package/dist/modules/bots_file_lock.d.ts +2 -2
- package/dist/modules/bots_file_lock.js +2 -2
- package/dist/modules/chain_scan.d.ts +64 -0
- package/dist/modules/chain_scan.js +80 -0
- package/dist/modules/cli_colors.d.ts +5 -0
- package/dist/modules/cli_colors.js +7 -0
- package/dist/modules/cli_progress.d.ts +51 -0
- package/dist/modules/cli_progress.js +113 -0
- package/dist/modules/constants.js +6 -3
- package/dist/modules/dexbot_class.d.ts +8 -0
- package/dist/modules/dexbot_class.js +10 -0
- package/dist/modules/dexbot_cow_runtime.d.ts +62 -1
- package/dist/modules/dexbot_cow_runtime.js +475 -47
- package/dist/modules/dexbot_credential_client.d.ts +5 -0
- package/dist/modules/dexbot_fill_runtime.js +20 -0
- package/dist/modules/dexbot_maintenance_runtime.js +71 -9
- package/dist/modules/dexbot_startup_runtime.js +7 -1
- package/dist/modules/graceful_shutdown.d.ts +2 -2
- package/dist/modules/graceful_shutdown.js +2 -2
- package/dist/modules/launcher/runtime_entry.d.ts +21 -1
- package/dist/modules/launcher/runtime_entry.js +36 -1
- package/dist/modules/launcher/runtime_mode.d.ts +4 -3
- package/dist/modules/liquidity_pool_ref.d.ts +32 -0
- package/dist/modules/liquidity_pool_ref.js +116 -0
- package/dist/modules/node_manager.d.ts +1 -1
- package/dist/modules/node_manager.js +1 -1
- package/dist/modules/order/accounting.js +2 -1
- package/dist/modules/order/export.d.ts +2 -2
- package/dist/modules/order/export.js +2 -2
- package/dist/modules/order/grid.d.ts +19 -14
- package/dist/modules/order/grid.js +269 -61
- package/dist/modules/order/grid_reconcile.js +27 -2
- package/dist/modules/order/grid_reconcile_internal.js +94 -15
- package/dist/modules/order/index.d.ts +24 -4
- package/dist/modules/order/manager.d.ts +12 -0
- package/dist/modules/order/manager.js +44 -11
- package/dist/modules/order/strategy.js +22 -2
- package/dist/modules/order/sync_engine.d.ts +32 -1
- package/dist/modules/order/sync_engine.js +209 -26
- package/dist/modules/order/utils/math.d.ts +26 -10
- package/dist/modules/order/utils/math.js +54 -14
- package/dist/modules/order/utils/order.d.ts +158 -11
- package/dist/modules/order/utils/order.js +434 -21
- package/dist/modules/order/utils/system.d.ts +136 -30
- package/dist/modules/order/utils/system.js +465 -63
- package/dist/modules/order/utils/validate.d.ts +1 -0
- package/dist/modules/order/utils/validate.js +37 -3
- package/dist/modules/storage/index.d.ts +3 -2
- package/dist/modules/storage/index.js +3 -2
- package/dist/modules/types.d.ts +14 -0
- package/dist/modules/utils/asset_symbols.d.ts +13 -2
- package/dist/modules/utils/asset_symbols.js +21 -2
- package/dist/scripts/analysis_runner.d.ts +10 -0
- package/dist/scripts/analysis_runner.js +33 -0
- package/dist/scripts/analyze-orders.js +2 -1
- package/dist/scripts/asset.d.ts +26 -0
- package/dist/scripts/asset.js +165 -0
- package/dist/scripts/bts_distribution.d.ts +1 -0
- package/dist/scripts/bts_distribution.js +194 -142
- package/dist/scripts/chart_command.d.ts +1 -1
- package/dist/scripts/chart_command.js +60 -86
- package/dist/scripts/chart_targets.d.ts +18 -0
- package/dist/scripts/chart_targets.js +52 -0
- package/dist/scripts/dw.js +1 -1
- package/dist/scripts/liquid.d.ts +24 -0
- package/dist/scripts/liquid.js +134 -0
- package/dist/scripts/rich_list.js +12 -16
- package/dist/scripts/token_distribution.d.ts +2 -0
- package/dist/scripts/token_distribution.js +132 -108
- package/dist/scripts/tv.js +1 -1
- package/dist/scripts/verify-browser-bundle.js +18 -0
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -1
- package/docs/COW_INVARIANTS.md +21 -11
- package/docs/DEXBOT_COMPARISON.md +6 -6
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +11 -11
- package/docs/GRID_PRICE_INVARIANT.md +28 -5
- package/docs/GRID_RECONCILE.md +25 -5
- package/docs/LIFECYCLE.md +11 -11
- package/docs/LOGGING.md +37 -2
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +124 -36
- package/docs/README.md +1 -1
- package/docs/WORKFLOW.md +3 -1
- package/docs/architecture.md +115 -13
- package/docs/developer_guide.md +12 -0
- package/market_adapter/README.md +9 -4
- package/modules/README.md +23 -15
- package/package.json +6 -3
- package/scripts/README.md +23 -7
|
@@ -346,7 +346,7 @@ export declare function persistGridSnapshot(manager: OrderManagerLike, accountOr
|
|
|
346
346
|
*/
|
|
347
347
|
export declare function restoreGapEvacStreaks(manager: OrderManagerLike, persisted: unknown): number;
|
|
348
348
|
/** Why spread correction is degraded or refused for a cycle. */
|
|
349
|
-
|
|
349
|
+
type SpreadCorrectionRefusalReason = 'cold-book' | 'stale-snapshot' | 'unmatched-orders';
|
|
350
350
|
export interface SpreadCorrectionReadiness {
|
|
351
351
|
/** False => hard refusal (cold book): the planner must not act this cycle. */
|
|
352
352
|
ok: boolean;
|
|
@@ -366,7 +366,7 @@ export interface SpreadCorrectionReadiness {
|
|
|
366
366
|
unmatched: UnmatchedChainOrderLike[];
|
|
367
367
|
}
|
|
368
368
|
/** Narrowed read-only view of an unmatched chain order used by the readiness gate. */
|
|
369
|
-
|
|
369
|
+
interface UnmatchedChainOrderLike extends Record<string, unknown> {
|
|
370
370
|
price?: number;
|
|
371
371
|
orderId?: string;
|
|
372
372
|
chainOrderId?: string;
|
|
@@ -479,25 +479,6 @@ export declare function evaluateSpreadCorrectionReadiness(manager: OrderManagerL
|
|
|
479
479
|
* @returns {number|null} Reference price or null
|
|
480
480
|
*/
|
|
481
481
|
export declare function resolveSpreadMarketReference(manager: OrderManagerLike): number | null;
|
|
482
|
-
/**
|
|
483
|
-
* Resolve the reference the generic LAST-FILL-GUARD judges against.
|
|
484
|
-
*
|
|
485
|
-
* Prefers the live armed pivot. When that is cold (a grid regeneration
|
|
486
|
-
* cleared it, or a rejected-snapshot reset ran) it falls back to the
|
|
487
|
-
* bot-scoped last-market-fill row — the same market truth spread correction
|
|
488
|
-
* already uses. This is what stops a rebuild from silently un-arming the
|
|
489
|
-
* guard until the next fill: the price the account last traded at is known,
|
|
490
|
-
* so a CREATE/rotation must still not cross it.
|
|
491
|
-
*
|
|
492
|
-
* Read-time fallback only: it does NOT mutate the pivot or persist an
|
|
493
|
-
* old-generation value, so the genesis-bound pivot/persist contract is
|
|
494
|
-
* unchanged. The guard still validates the value onto the CURRENT ladder via
|
|
495
|
-
* resolveOnGridPivot at the call site (off-ladder → raw value + warn), so a
|
|
496
|
-
* regenerated geometry stays the authority on which placements are off-grid.
|
|
497
|
-
*
|
|
498
|
-
* @param {Object} manager - OrderManager instance
|
|
499
|
-
* @returns {{price: number|null, type: string|null}} Effective pivot (both null when cold)
|
|
500
|
-
*/
|
|
501
482
|
/**
|
|
502
483
|
* Re-anchor the boundary so the newest REAL fill sits outside its own window.
|
|
503
484
|
*
|
|
@@ -515,16 +496,33 @@ export declare function resolveSpreadMarketReference(manager: OrderManagerLike):
|
|
|
515
496
|
*
|
|
516
497
|
* Only a genuine on-ladder fill price is accepted (same one-increment drift
|
|
517
498
|
* bound as `resolveOnGridPivot`), and the candidate must pass the same
|
|
518
|
-
* placed-order-aware validation the boundary commit gate uses
|
|
519
|
-
*
|
|
499
|
+
* placed-order-aware validation the boundary commit gate uses
|
|
500
|
+
* (`validatePersistedBoundary` — the SAME gate the restore and commit paths
|
|
501
|
+
* use), so a re-anchor can never strand a live order inside the re-typed band.
|
|
502
|
+
*
|
|
503
|
+
* ELIGIBILITY (same rule as the crawl, see deriveTargetBoundary):
|
|
504
|
+
* - EDGE-pinned insurance fills never anchor. An edge fill is by definition
|
|
505
|
+
* outside the window it would move, and it is a book event (a fat-finger
|
|
506
|
+
* wick), not market movement — the crawl already excludes it, and an
|
|
507
|
+
* absolute anchor from a grid-edge price would teleport the window to that
|
|
508
|
+
* edge. Such fills also never arm the pivot (recordLastFilledPrices skips
|
|
509
|
+
* them), so the reference can only be a window fill.
|
|
510
|
+
* - PARTIAL fills DO anchor: a partial at the far slot is still a real trade
|
|
511
|
+
* at a real price, and the residual it leaves at the anchor slot is
|
|
512
|
+
* explicitly allow-listed below (otherwise the geometry deadlocks).
|
|
520
513
|
*
|
|
521
514
|
* @param {Object} manager - OrderManager (pivot + genesis)
|
|
522
515
|
* @param {number|null} boundaryIdx - Boundary the derivation would commit
|
|
523
516
|
* @param {Array<Object>} slots - Grid slots (current generation)
|
|
524
517
|
* @param {number} gapSlots - Gap band width
|
|
518
|
+
* @param {Array<Object>} [fills] - Current fill batch (extremum resolution)
|
|
525
519
|
* @returns {{boundaryIdx: number|null, reanchored: boolean, from?: number|null, to?: number, side?: string, fillSlot?: number, reason?: string}}
|
|
526
520
|
*/
|
|
527
|
-
export declare function reanchorBoundaryFromLastFill(manager: OrderManagerLike, boundaryIdx: number | null | undefined, slots: ManagedOrder[] | null | undefined, gapSlots: number
|
|
521
|
+
export declare function reanchorBoundaryFromLastFill(manager: OrderManagerLike, boundaryIdx: number | null | undefined, slots: ManagedOrder[] | null | undefined, gapSlots: number, fills?: Array<{
|
|
522
|
+
id?: string;
|
|
523
|
+
type?: string;
|
|
524
|
+
price?: unknown;
|
|
525
|
+
}> | null | undefined): {
|
|
528
526
|
boundaryIdx: number | null;
|
|
529
527
|
reanchored: boolean;
|
|
530
528
|
from?: number | null;
|
|
@@ -533,7 +531,35 @@ export declare function reanchorBoundaryFromLastFill(manager: OrderManagerLike,
|
|
|
533
531
|
fillSlot?: number;
|
|
534
532
|
reason?: string;
|
|
535
533
|
};
|
|
536
|
-
|
|
534
|
+
/**
|
|
535
|
+
* Resolve the reference the generic LAST-FILL-GUARD judges against.
|
|
536
|
+
*
|
|
537
|
+
* Prefers the live armed pivot. When that is cold (a grid regeneration
|
|
538
|
+
* cleared it, or a rejected-snapshot reset ran) it falls back to the
|
|
539
|
+
* bot-scoped last-market-fill row — the same market truth spread correction
|
|
540
|
+
* already uses. This is what stops a rebuild from silently un-arming the
|
|
541
|
+
* guard until the next fill: the price the account last traded at is known,
|
|
542
|
+
* so a CREATE/rotation must still not cross it.
|
|
543
|
+
*
|
|
544
|
+
* Read-time fallback only: it does NOT mutate the pivot or persist an
|
|
545
|
+
* old-generation value, so the genesis-bound pivot/persist contract is
|
|
546
|
+
* unchanged. The guard still validates the value onto the CURRENT ladder via
|
|
547
|
+
* resolveOnGridPivot at the call site (off-ladder → raw value + warn), so a
|
|
548
|
+
* regenerated geometry stays the authority on which placements are off-grid.
|
|
549
|
+
*
|
|
550
|
+
* The rebuild path re-arms the pivot explicitly (rearmLastFillPivotFromMarketFill)
|
|
551
|
+
* so this fallback covers only the window before that write, not the whole
|
|
552
|
+
* post-rebuild lifetime.
|
|
553
|
+
*
|
|
554
|
+
* LIFETIME: a fill reference older than GRID_LIMITS.LAST_FILL_PIVOT_TTL_MS is
|
|
555
|
+
* ignored (read-time expiry, same bound the restore path applies), so a stale
|
|
556
|
+
* pivot cannot veto one side forever in a long-lived process. Unknown ages
|
|
557
|
+
* (missing timestamp) never expire.
|
|
558
|
+
*
|
|
559
|
+
* @param {Object} manager - OrderManager instance
|
|
560
|
+
* @returns {{price: number|null, type: string|null}} Effective pivot (both null when cold)
|
|
561
|
+
*/
|
|
562
|
+
export declare function resolveLastFillGuardReference(manager: OrderManagerLike | null | undefined): {
|
|
537
563
|
price: number | null;
|
|
538
564
|
type: string | null;
|
|
539
565
|
};
|
|
@@ -552,22 +578,72 @@ export declare function resolveLastFillGuardReference(manager: OrderManagerLike)
|
|
|
552
578
|
* we actually did: a BUY below the last sell, a SELL above the last buy. Equal
|
|
553
579
|
* price counts as blocked — that is a re-place at the just-filled level, the
|
|
554
580
|
* immediate re-fill loop this guard exists to prevent. Cold (no numeric pivot,
|
|
555
|
-
* or no fill side recorded — e.g. a book-seeded pivot) => disabled.
|
|
556
|
-
*
|
|
581
|
+
* or no fill side recorded — e.g. a book-seeded pivot) => disabled.
|
|
582
|
+
*
|
|
583
|
+
* Signature note: the old band rule also consumed order size and the grid
|
|
584
|
+
* increment (it judged against `pivot ± increment/2`). Both are gone on
|
|
585
|
+
* purpose — re-adding an increment term re-opens retrospective §9.7 (a BUY
|
|
586
|
+
* below a SELL fill was blocked, a SELL one tick above our cost was blocked,
|
|
587
|
+
* and spread tightening became structurally impossible after any fill).
|
|
557
588
|
*
|
|
558
589
|
* @param {number} price - Target order price
|
|
559
|
-
* @param {number} _size - Order size (unused, kept for compat)
|
|
560
590
|
* @param {string} type - ORDER_TYPES.BUY/SELL
|
|
561
591
|
* @param {number|null} lastPrice - Most recent fill price
|
|
562
592
|
* @param {string|null} lastType - Most recent fill side; null keeps the guard cold
|
|
563
|
-
* @param {number|any} _incrementPercent - Unused (kept for signature compat)
|
|
564
593
|
* @returns {{blocked: boolean, pivot: number|null, threshold?: number|null}}
|
|
565
594
|
*/
|
|
566
|
-
export declare function isLastFillGuardBlocked(price: number,
|
|
595
|
+
export declare function isLastFillGuardBlocked(price: number, type: unknown, lastPrice: number | null, lastType: string | null): {
|
|
567
596
|
blocked: boolean;
|
|
568
597
|
pivot: number | null;
|
|
569
598
|
threshold?: number | null;
|
|
570
599
|
};
|
|
600
|
+
/**
|
|
601
|
+
* LAST-FILL PLACEMENT GUARD — the direction rule applied to a PLACEMENT.
|
|
602
|
+
*
|
|
603
|
+
* Wraps isLastFillGuardBlocked with the same pivot resolution the runtime uses
|
|
604
|
+
* (live fill pivot, then the bot-scoped market-fill row) and adds the
|
|
605
|
+
* SAME-LEVEL refusal: a placement within half a grid step of the pivot is a
|
|
606
|
+
* re-place at the level that just traded, which the raw `>=`/`<=` comparison
|
|
607
|
+
* lets through because a slot price and its execution price differ by
|
|
608
|
+
* rounding (live: slot 1310.046339 filled at 1310.060435).
|
|
609
|
+
*
|
|
610
|
+
* Unlike the COW-path guard this is meant for the reconcile/startup placement
|
|
611
|
+
* paths (create + relocation), which previously had no last-fill check at all:
|
|
612
|
+
* a startup-style top-up could therefore re-create a BUY at the price the bot
|
|
613
|
+
* had just bought at, or place a BUY above it (the "buying later at higher
|
|
614
|
+
* prices" incident). Fail-open on a cold pivot (no fill yet) so a fresh grid
|
|
615
|
+
* still builds.
|
|
616
|
+
*
|
|
617
|
+
* @param {Object} manager - OrderManager instance (pivot + config.incrementPercent)
|
|
618
|
+
* @param {number} price - Target placement price
|
|
619
|
+
* @param {string} type - ORDER_TYPES.BUY / ORDER_TYPES.SELL
|
|
620
|
+
* @returns {{blocked: boolean, pivot: number|null, reason?: 'direction'|'same-level'}}
|
|
621
|
+
*/
|
|
622
|
+
export declare function isLastFillPlacementBlocked(manager: OrderManagerLike | null | undefined, price: unknown, type: unknown): {
|
|
623
|
+
blocked: boolean;
|
|
624
|
+
pivot: number | null;
|
|
625
|
+
reason?: 'direction' | 'same-level';
|
|
626
|
+
};
|
|
627
|
+
/**
|
|
628
|
+
* Are fills still UNSETTLED (arrived but not yet absorbed by the grid)?
|
|
629
|
+
*
|
|
630
|
+
* While this returns true the master grid still holds filled slots as ACTIVE
|
|
631
|
+
* and the boundary has not crawled for them, so any geometry-derived plan
|
|
632
|
+
* (window top-up, startup-style reconcile) is built on the PREVIOUS book. The
|
|
633
|
+
* live incident: a 120s stale broadcast region deferred 12 fills, the
|
|
634
|
+
* post-fill reconcile saw "buy 12/20" on that stale master and re-created 8
|
|
635
|
+
* BUYs at the TOP of the un-crawled rail (1282.78 -> 1310.04), which filled
|
|
636
|
+
* within seconds (9 buy-lower violations, 23.5% of the window's BTS).
|
|
637
|
+
*
|
|
638
|
+
* Accepts a bot (its `manager` is inspected) or a bare manager.
|
|
639
|
+
*
|
|
640
|
+
* @param {Object} source - DEXBot-like or OrderManager-like instance
|
|
641
|
+
* @returns {{unsettled: boolean, reason: string|null}}
|
|
642
|
+
*/
|
|
643
|
+
export declare function hasUnsettledFills(source: unknown): {
|
|
644
|
+
unsettled: boolean;
|
|
645
|
+
reason: string | null;
|
|
646
|
+
};
|
|
571
647
|
/**
|
|
572
648
|
* Restore the persisted bot-scoped last-market-fill reference into the
|
|
573
649
|
* manager. Deliberately independent of the boundary and the genesis: this is
|
|
@@ -585,6 +661,36 @@ export declare function isLastFillGuardBlocked(price: number, _size: number, typ
|
|
|
585
661
|
export declare function restoreLastMarketFill(manager: OrderManagerLike, persisted: unknown, options?: {
|
|
586
662
|
now?: number;
|
|
587
663
|
}): boolean;
|
|
664
|
+
/**
|
|
665
|
+
* Re-arm the LAST-FILL-GUARD pivot from the bot-scoped market-fill row.
|
|
666
|
+
*
|
|
667
|
+
* The grid-rebuild path deliberately clears the armed pivot (a new generation).
|
|
668
|
+
* The guard must NOT stay cold afterwards: the price the account last traded at
|
|
669
|
+
* is still market truth, so the pivot is re-armed on the NEW generation
|
|
670
|
+
* explicitly, through the single shared writer, at the original fill timestamp.
|
|
671
|
+
* That makes the documented contract real ("the guard re-arms against the new
|
|
672
|
+
* ladder") instead of relying on the read-time fallback in
|
|
673
|
+
* `resolveLastFillGuardReference` for the whole post-rebuild lifetime — a
|
|
674
|
+
* fallback that cannot be re-validated, persisted or logged.
|
|
675
|
+
*
|
|
676
|
+
* Provenance stays 'fill' (a book seed never qualifies). The price is not
|
|
677
|
+
* rewritten: an off-new-ladder value is handled by the same one-increment
|
|
678
|
+
* `resolveOnGridPivot` rule every other probe uses.
|
|
679
|
+
*
|
|
680
|
+
* The timestamp comes from the SAME row as the price (see
|
|
681
|
+
* resolveFillProvenancedRow). Reading `_lastFilledAt` unconditionally paired a
|
|
682
|
+
* market-row price with a book-seed clock: a book seed writes `_lastFilledAt`
|
|
683
|
+
* but never the market row, and `setLastFillPivot(..., 'fill')` then re-stamps
|
|
684
|
+
* `_lastMarketFillAt` with that newer time — refreshing the 24h lifetime on
|
|
685
|
+
* every rebuild until the row never expires.
|
|
686
|
+
*
|
|
687
|
+
* EXPIRED ROWS DO NOT RE-ARM (resolveFillProvenancedRow drops them), so the
|
|
688
|
+
* documented pivot lifetime holds with or without a restart.
|
|
689
|
+
*
|
|
690
|
+
* @param {Object} manager - OrderManager instance
|
|
691
|
+
* @returns {boolean} True when a pivot was re-armed
|
|
692
|
+
*/
|
|
693
|
+
export declare function rearmLastFillPivotFromMarketFill(manager: OrderManagerLike): boolean;
|
|
588
694
|
/**
|
|
589
695
|
* Normalize a persisted LAST-FILL-GUARD pivot row (shared by the
|
|
590
696
|
* AccountOrders sanitizer/loader and the payload builder's row contract).
|